修改
This commit is contained in:
@@ -425,17 +425,16 @@ async function cancelLatestRun(sessionId: string, runId?: string | null) {
|
||||
const ChatTopActions: FC = () => {
|
||||
const { openFiles } = useActivityPanel();
|
||||
const [workspaceOpen, setWorkspaceOpen] = useState(false);
|
||||
const actionSessionId = useCurrentThreadSessionId({
|
||||
includePending: true,
|
||||
// 工作区切换必须绑定当前可见会话;空白新会话不能回退到上一个
|
||||
// activeSessionId,否则会把 Jupyter 工作区切到旧会话上。
|
||||
includeActive: false,
|
||||
});
|
||||
const displaySessionId = useCurrentThreadSessionId({
|
||||
// "切换工作区" dialog 与 indicator 必须用同一个 sessionId,否则会出现
|
||||
// "绑给 A、查的是 B" 的错位(agent 的 bash 路由也是用 active session id,
|
||||
// 错位时表面 indicator 显示已连接,实际 agent 跑在本地)。
|
||||
// 新建空会话场景由 thread-list.tsx 的 clearActiveSessionId() 兜底,
|
||||
// 此处不再需要刻意排除 activeSessionId。
|
||||
const sessionId = useCurrentThreadSessionId({
|
||||
includePending: true,
|
||||
includeActive: true,
|
||||
});
|
||||
const workspaceStatus = useJupyterWorkspaceStatus(displaySessionId);
|
||||
const workspaceStatus = useJupyterWorkspaceStatus(sessionId);
|
||||
|
||||
return (
|
||||
<div className="pointer-events-none sticky top-3 z-20 mr-4 flex justify-end">
|
||||
@@ -462,7 +461,7 @@ const ChatTopActions: FC = () => {
|
||||
type="button"
|
||||
className="flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-sm transition-colors hover:bg-muted"
|
||||
onClick={() => {
|
||||
openFiles(displaySessionId);
|
||||
openFiles(sessionId);
|
||||
}}
|
||||
>
|
||||
<FileTextIcon className="size-4 text-muted-foreground" />
|
||||
@@ -482,7 +481,7 @@ const ChatTopActions: FC = () => {
|
||||
<WorkspaceSwitchDialog
|
||||
open={workspaceOpen}
|
||||
onOpenChange={setWorkspaceOpen}
|
||||
sessionId={actionSessionId}
|
||||
sessionId={sessionId}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user