fix: improve agent handoff and leaderboard scheduling

This commit is contained in:
吉鑫升 committed 2026-06-05 21:46:04 +08:00
1 parent cbbde887d4
commit a41b5a6d4c
4 files changed
+75 -26

No files matched your search

+8 -3
View File
@@ -131,8 +131,8 @@ export default function AgentChatPage() {
const pendingMessageHandled = useRef(false);
useEffect(() => {
if (pendingMessageHandled.current) return;
if (!agent_id || !isNewThread) return;
let pending: { agentId?: string; text?: string } | null = null;
if (!agent_id) return;
let pending: { agentId?: string; threadId?: string; text?: string } | null = null;
try {
const raw = sessionStorage.getItem("pendingAgentMessage");
if (raw) pending = JSON.parse(raw);
@@ -140,10 +140,15 @@ export default function AgentChatPage() {
pending = null;
}
if (!pending || pending.agentId !== agent_id || !pending.text) return;
if (pending.threadId) {
if (pending.threadId !== threadId) return;
} else if (!isNewThread) {
return;
}
pendingMessageHandled.current = true;
sessionStorage.removeItem("pendingAgentMessage");
handleSubmit({ text: pending.text, files: [] });
}, [agent_id, isNewThread, handleSubmit]);
}, [agent_id, threadId, isNewThread, handleSubmit]);
const handleClarificationSubmit = useCallback(
(answer: string) => {