perf: 中断打字

This commit is contained in:
rd
2025-08-28 14:46:57 +08:00
parent 6074f716ef
commit cdda8ffba7
4 changed files with 121 additions and 82 deletions

View File

@ -1,6 +1,29 @@
import type { Ref } from 'vue';
import type { BubbleListProps } from '@/components/xt-chat/xt-bubble/types';
export interface UseChatHandlerReturn {
roles?: BubbleListProps['roles'];
generateTeamRunTaskId?: Ref<string | null>;
handleMessage?: (parsedData: { event: string; data: MESSAGE.Answer }) => void;
handleOpen?: (data: Response) => void;
generateLoading?: Ref<boolean>;
conversationList?: Ref<any[]>;
showRightView?: Ref<boolean>;
rightViewData?: Ref<any>;
senderRef?: Ref<null>
}
export enum EnumTeamRunStatus {
TeamRunStarted = 'TeamRunStarted', // 对话开始
TeamRunResponseContent = 'TeamRunResponseContent', // 对话执行中
TeamRunCompleted = 'TeamRunCompleted', // 对话完成
RunStarted = 'RunStarted', // l2开始运行
RunResponseContent = 'RunResponseContent', // l2执行中
RunCompleted = 'RunCompleted', // l2完成
}
export interface UseChatHandlerOptions {
initSse: (inputInfo: CHAT.TInputInfo) => Promise<void>; // 明确 initSse 带参
}
// 定义角色常量
export const LOADING_ROLE = 'loading'; // 加载中
export const INTELLECTUAL_THINKING_ROLE = 'intellectual_thinking'; // 智能思考标题
@ -22,26 +45,6 @@ export const ANSWER_STYLE = {
left: '6px',
};
export interface UseChatHandlerReturn {
roles?: BubbleListProps['roles'];
generateTeamRunTaskId?: Ref<string | null>;
handleMessage?: (parsedData: { event: string; data: MESSAGE.Answer }) => void;
handleOpen?: (data: Response) => void;
generateLoading?: Ref<boolean>;
conversationList?: Ref<any[]>;
showRightView?: Ref<boolean>;
rightViewData?: Ref<any>;
senderRef?: Ref<null>
}
export enum EnumTeamRunStatus {
TeamRunStarted = 'TeamRunStarted', // 对话开始
TeamRunResponseContent = 'TeamRunResponseContent', // 对话执行中
TeamRunCompleted = 'TeamRunCompleted', // 对话完成
RunStarted = 'RunStarted', // l2开始运行
RunResponseContent = 'RunResponseContent', // l2执行中
RunCompleted = 'RunCompleted', // l2完成
}
export const FILE_TYPE = {
topic_only: 'topic_only', // 排期&选题
topic_with_content: 'topic_with_content', // 选题&内容稿件