fix(agent): 输入草稿按会话保留,切换会话、关抽屉不丢
会话面板与新对话输入框的草稿原来是组件内状态,切到别的会话或 Esc 关抽屉就没了。 改为按会话(以及列表页 / 抽屉两处新对话)分键记在模块里,发送成功后清掉。 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Cxwgnn2pbzQ7rXv3rq7fei
This commit is contained in:
1 parent
164a27fd80
commit
9f499ac7c2
5 files changed
+86
-6
No files matched your search
@@ -2,7 +2,13 @@ import { FlaskConical } from "lucide-react";
|
||||
import { useNavigate } from "react-router";
|
||||
import { toast } from "sonner";
|
||||
import { agentMockEnabled, useCreateAgentRun } from "~/api/agent.ts";
|
||||
import { agentRunHref, pageListMemory, usePageListGroup } from "~/components/agent/agent-nav.ts";
|
||||
import {
|
||||
agentRunHref,
|
||||
DRAFT_PAGE_GOAL,
|
||||
pageListMemory,
|
||||
usePageListGroup,
|
||||
writeDraft,
|
||||
} from "~/components/agent/agent-nav.ts";
|
||||
import { GoalComposer } from "~/components/agent/agent-run-panel.tsx";
|
||||
import { AgentSessionList } from "~/components/agent/agent-session-list.tsx";
|
||||
import { quickGoalsFor } from "~/components/agent/quick-goals.ts";
|
||||
@@ -43,11 +49,15 @@ export default function AgentPage() {
|
||||
<GoalComposer
|
||||
pending={create.isPending}
|
||||
suggestions={quickGoalsFor("/console/agent")}
|
||||
draftKey={DRAFT_PAGE_GOAL}
|
||||
onSubmit={(goal, opts) =>
|
||||
create.mutate(
|
||||
{ goal, ...opts },
|
||||
{
|
||||
onSuccess: (run) => navigate(agentRunHref(run.id, mock)),
|
||||
onSuccess: (run) => {
|
||||
writeDraft(DRAFT_PAGE_GOAL, "");
|
||||
navigate(agentRunHref(run.id, mock));
|
||||
},
|
||||
onError: (e) => toast.error(errorMessage(e)),
|
||||
},
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user