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