feat: 会话详情

This commit is contained in:
rd
2025-08-27 18:07:36 +08:00
parent 0406dea56f
commit 892704c592
4 changed files with 36 additions and 15 deletions

View File

@ -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',

View File

@ -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 () => (
<div class="chat-view-wrap w-full h-full flex">
<section class="flex-1 flex flex-col pt-20px justify-center relative px-16px">

View File

@ -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 (
<div class="flex items-center">