feat: 会话详情
This commit is contained in:
@ -23,6 +23,10 @@ export const deleteHistoryItem = (id: string) => {
|
|||||||
return Http.delete(`/v1/multi-agent/del-session/${id}`);
|
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 baseUrl = 'http://192.168.40.41:8001';
|
||||||
export const getHeaders = () => {
|
export const getHeaders = () => {
|
||||||
|
|||||||
@ -4,10 +4,10 @@ import type { BubbleListProps } from '@/components/xt-chat/xt-bubble/types';
|
|||||||
// 定义角色常量
|
// 定义角色常量
|
||||||
export const LOADING_ROLE = 'loading'; // 加载中
|
export const LOADING_ROLE = 'loading'; // 加载中
|
||||||
export const INTELLECTUAL_THINKING_ROLE = 'intellectual_thinking'; // 智能思考标题
|
export const INTELLECTUAL_THINKING_ROLE = 'intellectual_thinking'; // 智能思考标题
|
||||||
export const QUESTION_ROLE = 'question';
|
export const QUESTION_ROLE = 'question'; // 问题
|
||||||
export const ANSWER_ROLE = 'text';
|
export const ANSWER_ROLE = 'answer'; // 回答
|
||||||
export const FILE_ROLE = 'file';
|
export const REMOTE_USER_ROLE = 'user'; // 接口返回用户
|
||||||
export const THOUGHT_ROLE = 'thought';
|
export const REMOTE_ASSISTANT_ROLE = 'assistant'; // 接口返回智能体
|
||||||
|
|
||||||
export const ROLE_STYLE = {
|
export const ROLE_STYLE = {
|
||||||
width: '600px',
|
width: '600px',
|
||||||
|
|||||||
@ -6,10 +6,10 @@ import RightView from './components/right-view/index.vue';
|
|||||||
|
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useChatStore } from '@/stores/modules/chat';
|
import { useChatStore } from '@/stores/modules/chat';
|
||||||
|
import { getConversationList } from '@/api/all/chat';
|
||||||
import querySSE from '@/utils/querySSE';
|
import querySSE from '@/utils/querySSE';
|
||||||
|
|
||||||
import useChatHandler from './useChatHandler';
|
import useChatHandler from './useChatHandler';
|
||||||
import { QUESTION_ROLE, LOADING_ROLE } from './constants';
|
import { QUESTION_ROLE, LOADING_ROLE, REMOTE_ROLE } from './constants';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
@ -47,7 +47,7 @@ export default {
|
|||||||
|
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
// 中止当前正在输出的回答
|
// 中止当前正在输出的回答
|
||||||
console.log('handleCancel', currentTaskId.value)
|
console.log('handleCancel', currentTaskId.value);
|
||||||
if (generateLoading.value) {
|
if (generateLoading.value) {
|
||||||
bubbleListRef.value?.abortTypingByKey(currentTaskId.value);
|
bubbleListRef.value?.abortTypingByKey(currentTaskId.value);
|
||||||
sseController.value?.abort?.();
|
sseController.value?.abort?.();
|
||||||
@ -115,6 +115,18 @@ export default {
|
|||||||
{ deep: true },
|
{ 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 () => (
|
return () => (
|
||||||
<div class="chat-view-wrap w-full h-full flex">
|
<div class="chat-view-wrap w-full h-full flex">
|
||||||
<section class="flex-1 flex flex-col pt-20px justify-center relative px-16px">
|
<section class="flex-1 flex flex-col pt-20px justify-center relative px-16px">
|
||||||
|
|||||||
@ -24,11 +24,11 @@ import {
|
|||||||
QUESTION_ROLE,
|
QUESTION_ROLE,
|
||||||
ANSWER_ROLE,
|
ANSWER_ROLE,
|
||||||
INTELLECTUAL_THINKING_ROLE,
|
INTELLECTUAL_THINKING_ROLE,
|
||||||
FILE_ROLE,
|
|
||||||
LOADING_ROLE,
|
LOADING_ROLE,
|
||||||
THOUGHT_ROLE,
|
|
||||||
ROLE_STYLE,
|
ROLE_STYLE,
|
||||||
EnumTeamRunStatus,
|
EnumTeamRunStatus,
|
||||||
|
REMOTE_USER_ROLE,
|
||||||
|
REMOTE_ASSISTANT_ROLE,
|
||||||
FILE_TYPE_MAP,
|
FILE_TYPE_MAP,
|
||||||
} from './constants';
|
} from './constants';
|
||||||
import type { UseChatHandlerReturn } from './constants';
|
import type { UseChatHandlerReturn } from './constants';
|
||||||
@ -79,16 +79,21 @@ export default function useChatHandler({ initSse }): UseChatHandlerReturn {
|
|||||||
},
|
},
|
||||||
style: ROLE_STYLE,
|
style: ROLE_STYLE,
|
||||||
},
|
},
|
||||||
[THOUGHT_ROLE]: {
|
|
||||||
placement: 'start',
|
|
||||||
variant: 'borderless',
|
|
||||||
style: ROLE_STYLE,
|
|
||||||
},
|
|
||||||
[QUESTION_ROLE]: {
|
[QUESTION_ROLE]: {
|
||||||
placement: 'end',
|
placement: 'end',
|
||||||
shape: 'round',
|
shape: 'round',
|
||||||
style: ROLE_STYLE,
|
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 = () => {
|
_targetTask.footer = () => {
|
||||||
return (
|
return (
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
|
|||||||
Reference in New Issue
Block a user