parent
fe1d16629d
commit
4d158e7717
@ -83,6 +83,8 @@ definitions:
|
||||
type: object
|
||||
entity.ChatMessage:
|
||||
properties:
|
||||
assistant:
|
||||
$ref: '#/definitions/entity.Assistant'
|
||||
assistant_id:
|
||||
description: AssistantId 可以让同一个对话中,使用不同的助手来处理消息
|
||||
type: integer
|
||||
@ -119,6 +121,46 @@ definitions:
|
||||
user_file_id:
|
||||
type: integer
|
||||
type: object
|
||||
entity.ChatMessageList:
|
||||
properties:
|
||||
assistant:
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
name:
|
||||
type: string
|
||||
type: object
|
||||
assistant_id:
|
||||
type: integer
|
||||
chat_id:
|
||||
type: integer
|
||||
completion_tokens:
|
||||
type: integer
|
||||
content:
|
||||
type: string
|
||||
created_at:
|
||||
type: string
|
||||
file:
|
||||
$ref: '#/definitions/entity.File'
|
||||
file_id:
|
||||
type: integer
|
||||
hidden:
|
||||
type: boolean
|
||||
id:
|
||||
type: integer
|
||||
prompt_tokens:
|
||||
type: integer
|
||||
role:
|
||||
type: string
|
||||
total_tokens:
|
||||
type: integer
|
||||
updated_at:
|
||||
type: string
|
||||
user_file:
|
||||
$ref: '#/definitions/entity.UserFile'
|
||||
user_file_id:
|
||||
type: integer
|
||||
type: object
|
||||
entity.Document:
|
||||
properties:
|
||||
chunked:
|
||||
@ -1619,7 +1661,7 @@ paths:
|
||||
- properties:
|
||||
data:
|
||||
items:
|
||||
$ref: '#/definitions/entity.ChatMessage'
|
||||
$ref: '#/definitions/entity.ChatMessageList'
|
||||
type: array
|
||||
type: object
|
||||
"400":
|
||||
|
163
src/api/api.ts
163
src/api/api.ts
@ -383,6 +383,37 @@ export interface ApiV1ChatsIdFilesPostRequest {
|
||||
*/
|
||||
'file'?: File;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @interface ApiV1ChatsIdMessagesGet200Response
|
||||
*/
|
||||
export interface ApiV1ChatsIdMessagesGet200Response {
|
||||
/**
|
||||
*
|
||||
* @type {Array<EntityChatMessageList>}
|
||||
* @memberof ApiV1ChatsIdMessagesGet200Response
|
||||
*/
|
||||
'data'?: Array<EntityChatMessageList>;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof ApiV1ChatsIdMessagesGet200Response
|
||||
*/
|
||||
'error'?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof ApiV1ChatsIdMessagesGet200Response
|
||||
*/
|
||||
'message'?: string;
|
||||
/**
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberof ApiV1ChatsIdMessagesGet200Response
|
||||
*/
|
||||
'success'?: boolean;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@ -832,6 +863,12 @@ export interface EntityChat {
|
||||
* @interface EntityChatMessage
|
||||
*/
|
||||
export interface EntityChatMessage {
|
||||
/**
|
||||
*
|
||||
* @type {EntityAssistant}
|
||||
* @memberof EntityChatMessage
|
||||
*/
|
||||
'assistant'?: EntityAssistant;
|
||||
/**
|
||||
* AssistantId 可以让同一个对话中,使用不同的助手来处理消息
|
||||
* @type {number}
|
||||
@ -923,6 +960,128 @@ export interface EntityChatMessage {
|
||||
*/
|
||||
'user_file_id'?: number;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @interface EntityChatMessageList
|
||||
*/
|
||||
export interface EntityChatMessageList {
|
||||
/**
|
||||
*
|
||||
* @type {EntityChatMessageListAssistant}
|
||||
* @memberof EntityChatMessageList
|
||||
*/
|
||||
'assistant'?: EntityChatMessageListAssistant;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof EntityChatMessageList
|
||||
*/
|
||||
'assistant_id'?: number;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof EntityChatMessageList
|
||||
*/
|
||||
'chat_id'?: number;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof EntityChatMessageList
|
||||
*/
|
||||
'completion_tokens'?: number;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof EntityChatMessageList
|
||||
*/
|
||||
'content'?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof EntityChatMessageList
|
||||
*/
|
||||
'created_at'?: string;
|
||||
/**
|
||||
*
|
||||
* @type {EntityFile}
|
||||
* @memberof EntityChatMessageList
|
||||
*/
|
||||
'file'?: EntityFile;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof EntityChatMessageList
|
||||
*/
|
||||
'file_id'?: number;
|
||||
/**
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberof EntityChatMessageList
|
||||
*/
|
||||
'hidden'?: boolean;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof EntityChatMessageList
|
||||
*/
|
||||
'id'?: number;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof EntityChatMessageList
|
||||
*/
|
||||
'prompt_tokens'?: number;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof EntityChatMessageList
|
||||
*/
|
||||
'role'?: string;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof EntityChatMessageList
|
||||
*/
|
||||
'total_tokens'?: number;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof EntityChatMessageList
|
||||
*/
|
||||
'updated_at'?: string;
|
||||
/**
|
||||
*
|
||||
* @type {EntityUserFile}
|
||||
* @memberof EntityChatMessageList
|
||||
*/
|
||||
'user_file'?: EntityUserFile;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof EntityChatMessageList
|
||||
*/
|
||||
'user_file_id'?: number;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @interface EntityChatMessageListAssistant
|
||||
*/
|
||||
export interface EntityChatMessageListAssistant {
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof EntityChatMessageListAssistant
|
||||
*/
|
||||
'id'?: number;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof EntityChatMessageListAssistant
|
||||
*/
|
||||
'name'?: string;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@ -3814,7 +3973,7 @@ export const ChatMessageApiFp = function(configuration?: Configuration) {
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async apiV1ChatsIdMessagesGet(id: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApiV1ChatPublicChatIdMessagesGet200Response>> {
|
||||
async apiV1ChatsIdMessagesGet(id: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApiV1ChatsIdMessagesGet200Response>> {
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1ChatsIdMessagesGet(id, options);
|
||||
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
||||
const localVarOperationServerBasePath = operationServerMap['ChatMessageApi.apiV1ChatsIdMessagesGet']?.[localVarOperationServerIndex]?.url;
|
||||
@ -3886,7 +4045,7 @@ export const ChatMessageApiFactory = function (configuration?: Configuration, ba
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
apiV1ChatsIdMessagesGet(id: number, options?: RawAxiosRequestConfig): AxiosPromise<ApiV1ChatPublicChatIdMessagesGet200Response> {
|
||||
apiV1ChatsIdMessagesGet(id: number, options?: RawAxiosRequestConfig): AxiosPromise<ApiV1ChatsIdMessagesGet200Response> {
|
||||
return localVarFp.apiV1ChatsIdMessagesGet(id, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
|
@ -3,7 +3,7 @@
|
||||
<n-list hoverable clickable v-show="loaded" class="select-none">
|
||||
<template #header>
|
||||
<div>
|
||||
<span class="text-xl">切换助理</span>
|
||||
<span class="text-xl">下条消息的助理</span>
|
||||
</div>
|
||||
</template>
|
||||
<n-list-item
|
||||
@ -11,9 +11,16 @@
|
||||
:key="a.id"
|
||||
@click="changeAssistant(a.id)"
|
||||
>
|
||||
<n-thing>
|
||||
<div class="flex justify-between items-center">
|
||||
<div>
|
||||
{{ a.name }}
|
||||
</n-thing>
|
||||
</div>
|
||||
<div v-show="a.id === chatStore.currentAssistantId" class="text-green">
|
||||
<n-text type="success">
|
||||
<n-icon><CheckmarkOutline /></n-icon>
|
||||
</n-text>
|
||||
</div>
|
||||
</div>
|
||||
</n-list-item>
|
||||
</n-list>
|
||||
</template>
|
||||
@ -23,6 +30,7 @@ import { useUserStore } from "../stores/user";
|
||||
import { updateAll } from "../plugins/update/update";
|
||||
import { useAssistantStore } from "../stores/assistants";
|
||||
import { useChatStore } from "@/stores/chat";
|
||||
import { CheckmarkOutline } from "@vicons/ionicons5";
|
||||
|
||||
const loaded = ref(false);
|
||||
const userStore = useUserStore();
|
||||
|
@ -20,19 +20,10 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { NMenu } from "naive-ui";
|
||||
import { useRoute } from "vue-router";
|
||||
import { leftMenuOptions } from "../plugins/menus/left";
|
||||
import { ChatboxOutline } from "@vicons/ionicons5";
|
||||
import getApi from "../plugins/api";
|
||||
import { useChatStore } from "../stores/chat";
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
const currentRoute: any = computed(() => route.name);
|
||||
|
||||
const collapsed = ref(false);
|
||||
|
||||
const chatStore = useChatStore();
|
||||
|
||||
async function getChats() {
|
||||
|
@ -32,11 +32,19 @@
|
||||
:plugins="markdownPlugins"
|
||||
/> -->
|
||||
<!-- <v-md-preview :text="message.content" height="500px"></v-md-preview> -->
|
||||
<div class="flex items-end flex-col">
|
||||
<div>
|
||||
<n-divider class="!p-0 !m-0" title-placement="right">
|
||||
{{ userStore.user.name }}
|
||||
</n-divider>
|
||||
</div>
|
||||
<div
|
||||
v-if="mdInited"
|
||||
class="markdown-body"
|
||||
v-html="mdIt.render(message.content)"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<div class="relative h-full">
|
||||
<n-avatar
|
||||
round
|
||||
@ -70,11 +78,20 @@
|
||||
<!-- <div v-html="mdIt.render('# Math Rulez! \n $\\sqrt{3x-1}+(1+x)^2$')"></div> -->
|
||||
|
||||
<!-- 当 message.content 变化时,重新渲染 -->
|
||||
<div>
|
||||
<div
|
||||
v-if="message.assistant_id !== 0 && message.assistant !== null"
|
||||
>
|
||||
<n-divider class="!p-0 !m-0" title-placement="left">
|
||||
{{ message.assistant?.name }}
|
||||
</n-divider>
|
||||
</div>
|
||||
<div
|
||||
v-if="mdInited"
|
||||
class="break-all break-words markdown-body"
|
||||
v-html="mdIt.render(message.content)"
|
||||
></div>
|
||||
</div>
|
||||
<!-- <div v-html="mdIt.render(message.content)"></div> -->
|
||||
|
||||
<!-- <v-md-preview :text="message.content" height="500px"></v-md-preview> -->
|
||||
|
Loading…
Reference in New Issue
Block a user