feat(agent-chat): 修复智能体会话归属与历史路由恢复:侧边栏按当前agent过滤会话并携带agent上下文跳转,补充旧线程路径回溯到智能体工作区,防止误入通用问答,并完善输入框记忆按钮显隐与侧边栏展开入口,提升体验一致性。

This commit is contained in:
董宏凯 committed 2026-09-01 13:47:31 +08:00
1 parent 051e66f7d8
commit aeb9a55497
5 files changed
+140 -30

No files matched your search

+13 -1
View File
@@ -27,6 +27,18 @@ function pickAgentRef(
return undefined;
}
/**
* Return the agent that owns a thread when that ownership was persisted on
* either its run context or its metadata. Keeping this in one place ensures
* sidebars and route recovery make the same decision for older deep links.
*/
export function agentRefOfThread(thread: {
context?: ThreadAgentRef | null;
metadata?: Record<string, unknown> | null;
}): string | undefined {
return pickAgentRef(thread.context, thread.metadata);
}
export function pathOfThread(
thread: ThreadRouteTarget,
context?: ThreadAgentRef | null,
@@ -36,7 +48,7 @@ export function pathOfThread(
const agentRef =
typeof thread === "string"
? pickAgentRef(context, null)
: pickAgentRef(thread.context, thread.metadata);
: agentRefOfThread(thread) ?? pickAgentRef(context, null);
return agentRef
? `${base}/agents/${encodeURIComponent(agentRef)}/chats/${threadId}`