diff --git a/src/api/all/chat.ts b/src/api/all/chat.ts index cea1188..907ee0f 100644 --- a/src/api/all/chat.ts +++ b/src/api/all/chat.ts @@ -23,6 +23,10 @@ export const deleteHistoryItem = (id: string) => { return Http.delete(`/v1/multi-agent/del-session/${id}`); }; +// 历史记录-列表 +export const getConversationList = (params: {}) => { + return Http.get(`/v1/conversation/message/list`, params); +}; export const baseUrl = 'http://192.168.40.41:8001'; export const getHeaders = () => { diff --git a/src/components/xt-chat/chat-view/constants.ts b/src/components/xt-chat/chat-view/constants.ts index e715a2d..2948730 100644 --- a/src/components/xt-chat/chat-view/constants.ts +++ b/src/components/xt-chat/chat-view/constants.ts @@ -4,10 +4,10 @@ import type { BubbleListProps } from '@/components/xt-chat/xt-bubble/types'; // 定义角色常量 export const LOADING_ROLE = 'loading'; // 加载中 export const INTELLECTUAL_THINKING_ROLE = 'intellectual_thinking'; // 智能思考标题 -export const QUESTION_ROLE = 'question'; -export const ANSWER_ROLE = 'text'; -export const FILE_ROLE = 'file'; -export const THOUGHT_ROLE = 'thought'; +export const QUESTION_ROLE = 'question'; // 问题 +export const ANSWER_ROLE = 'answer'; // 回答 +export const REMOTE_USER_ROLE = 'user'; // 接口返回用户 +export const REMOTE_ASSISTANT_ROLE = 'assistant'; // 接口返回智能体 export const ROLE_STYLE = { width: '600px', diff --git a/src/components/xt-chat/chat-view/index.vue b/src/components/xt-chat/chat-view/index.vue index 8cd0eaa..fa51b77 100644 --- a/src/components/xt-chat/chat-view/index.vue +++ b/src/components/xt-chat/chat-view/index.vue @@ -6,10 +6,10 @@ import RightView from './components/right-view/index.vue'; import { useRoute } from 'vue-router'; import { useChatStore } from '@/stores/modules/chat'; +import { getConversationList } from '@/api/all/chat'; import querySSE from '@/utils/querySSE'; - import useChatHandler from './useChatHandler'; -import { QUESTION_ROLE, LOADING_ROLE } from './constants'; +import { QUESTION_ROLE, LOADING_ROLE, REMOTE_ROLE } from './constants'; export default { props: { @@ -47,7 +47,7 @@ export default { const handleCancel = () => { // 中止当前正在输出的回答 - console.log('handleCancel', currentTaskId.value) + console.log('handleCancel', currentTaskId.value); if (generateLoading.value) { bubbleListRef.value?.abortTypingByKey(currentTaskId.value); sseController.value?.abort?.(); @@ -115,6 +115,18 @@ export default { { deep: true }, ); + onMounted(async () => { + if (conversationId.value) { + const { data, code } = await getConversationList({ + session_id: conversationId.value, + agent_id: chatStore.agentInfo.agent_id, + }); + if (code === 200) { + conversationList.value = data.list?.flat(1) ?? [] + } + } + }); + return () => (
diff --git a/src/components/xt-chat/chat-view/useChatHandler.tsx b/src/components/xt-chat/chat-view/useChatHandler.tsx index 5c3d1c4..fe98bea 100644 --- a/src/components/xt-chat/chat-view/useChatHandler.tsx +++ b/src/components/xt-chat/chat-view/useChatHandler.tsx @@ -24,11 +24,11 @@ import { QUESTION_ROLE, ANSWER_ROLE, INTELLECTUAL_THINKING_ROLE, - FILE_ROLE, LOADING_ROLE, - THOUGHT_ROLE, ROLE_STYLE, EnumTeamRunStatus, + REMOTE_USER_ROLE, + REMOTE_ASSISTANT_ROLE, FILE_TYPE_MAP, } from './constants'; import type { UseChatHandlerReturn } from './constants'; @@ -79,16 +79,21 @@ export default function useChatHandler({ initSse }): UseChatHandlerReturn { }, style: ROLE_STYLE, }, - [THOUGHT_ROLE]: { - placement: 'start', - variant: 'borderless', - style: ROLE_STYLE, - }, [QUESTION_ROLE]: { placement: 'end', shape: 'round', style: ROLE_STYLE, }, + [REMOTE_USER_ROLE]: { + placement: 'end', + shape: 'round', + style: ROLE_STYLE, + }, + [REMOTE_ASSISTANT_ROLE]: { + placement: 'start', + variant: 'borderless', + style: ROLE_STYLE, + }, }; // 下载处理 @@ -298,7 +303,7 @@ export default function useChatHandler({ initSse }): UseChatHandlerReturn { ); } - + _targetTask.footer = () => { return (