Merge branch 'ji' into master

This commit is contained in:
吉鑫升 committed 2026-06-18 17:17:11 +08:00
commit 3aa629f0df
5 files changed
+23 -9

No files matched your search

+8 -2
View File
@@ -130,7 +130,7 @@ export default function AgentChatPage({
}, [isNewThread, threadId, agent_id]);
const { showNotification } = useNotification();
const [thread, sendMessage] = useThreadStream({
const [thread, sendMessage, , streamThreadId] = useThreadStream({
threadId: isNewThread ? undefined : threadId,
assistantId: agent_id,
context: { ...settings.context, agent_id },
@@ -229,13 +229,19 @@ export default function AgentChatPage({
// 纯绑定任务深链(3qfx/xdfx,无闸门):进入新建对话即自动发出任务开场信息。
// 每次新建对话都带(与 rwfx 闸门「开始问答」发出等价);ref 防止同一会话内重复发出。
//
// 必须等 `streamThreadId == null`(底层 stream 已切到全新线程)才发:从已有会话点「新建对话」时,
// `isNewThread` 先翻 true,但 useThreadStream 的 onStreamThreadId 要慢一帧才重置为 null。
// 若在那一帧就 submit,hook 仍绑定上一个会话,submit 的 threadId 选项被忽略 → 开场信息发进
// 上一个对话(表现为「一直在同一个聊天框里发消息」)。等它归零再发即落到新建线程。
useEffect(() => {
if (!taskAutoSendText) return;
if (!isNewThread) return;
if (streamThreadId != null) return;
if (taskAutoSentRef.current) return;
taskAutoSentRef.current = true;
handleSubmit({ text: taskAutoSendText, files: [] });
}, [taskAutoSendText, isNewThread, handleSubmit]);
}, [taskAutoSendText, isNewThread, streamThreadId, handleSubmit]);
const handleClarificationSubmit = useCallback(
(answer: string) => {