perf: 主agent对话交互调整
This commit is contained in:
@ -17,20 +17,20 @@ export default {
|
||||
type: Object as () => CHAT.TInputInfo,
|
||||
default: null,
|
||||
},
|
||||
conversationId: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
setup(props, { emit, expose }) {
|
||||
const chatStore = useChatStore();
|
||||
|
||||
const route = useRoute();
|
||||
// const route = useRoute();
|
||||
|
||||
const rightViewRef = ref(null);
|
||||
const bubbleListRef = ref<any>(null);
|
||||
const sseController = ref<any>(null);
|
||||
|
||||
const conversationId = computed(() => {
|
||||
return route.params.conversationId;
|
||||
});
|
||||
|
||||
const handleSubmit = (message: string) => {
|
||||
if (generateLoading.value) {
|
||||
antdMessage.warning('停止生成后可发送');
|
||||
@ -76,7 +76,7 @@ export default {
|
||||
handleMessage,
|
||||
body: JSON.stringify({
|
||||
content: message,
|
||||
session_id: conversationId.value,
|
||||
session_id: props.conversationId,
|
||||
agent_id: chatStore.agentInfo.agent_id,
|
||||
}),
|
||||
});
|
||||
@ -87,10 +87,26 @@ export default {
|
||||
}
|
||||
};
|
||||
|
||||
const getConversationInfo = async () => {
|
||||
const { data, code } = await getConversationList({
|
||||
session_id: props.conversationId,
|
||||
agent_id: chatStore.agentInfo.agent_id,
|
||||
});
|
||||
if (code === 200) {
|
||||
conversationList.value = [
|
||||
...conversationList.value,
|
||||
...(data.list?.flat(1) ?? []).map((v) => ({
|
||||
...v,
|
||||
teamRunTaskId: v.step_run_id,
|
||||
})),
|
||||
];
|
||||
}
|
||||
};
|
||||
|
||||
const {
|
||||
roles,
|
||||
showRightView,
|
||||
rightViewInfo,
|
||||
rightViewData,
|
||||
currentTaskId,
|
||||
handleMessage,
|
||||
conversationList,
|
||||
@ -102,7 +118,7 @@ export default {
|
||||
|
||||
watch(
|
||||
() => props.inputInfo,
|
||||
(newVal) => {
|
||||
async (newVal) => {
|
||||
if (newVal) {
|
||||
const { message } = newVal;
|
||||
conversationList.value.push({
|
||||
@ -114,18 +130,15 @@ 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) ?? []
|
||||
watch(
|
||||
() => props.conversationId,
|
||||
(newVal) => {
|
||||
if (newVal) {
|
||||
getConversationInfo();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
return () => (
|
||||
<div class="chat-view-wrap w-full h-full flex">
|
||||
@ -157,7 +170,7 @@ export default {
|
||||
{showRightView.value && (
|
||||
<RightView
|
||||
ref={rightViewRef}
|
||||
rightViewInfo={rightViewInfo.value}
|
||||
rightViewData={rightViewData.value}
|
||||
showRightView={showRightView.value}
|
||||
onClose={() => (showRightView.value = false)}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user