diff --git a/frontend-web/src/components/workspace/agents/agent-manage-dialog.tsx b/frontend-web/src/components/workspace/agents/agent-manage-dialog.tsx index 03231c51..5cebb4e5 100644 --- a/frontend-web/src/components/workspace/agents/agent-manage-dialog.tsx +++ b/frontend-web/src/components/workspace/agents/agent-manage-dialog.tsx @@ -222,6 +222,7 @@ export function AgentManageDialog({ key={agent.id} value={`${agent.name} ${agent.description ?? ""}`} onSelect={() => void add(agent)} + className="flex min-w-0 items-center overflow-hidden" >
diff --git a/frontend-web/src/components/workspace/agents/agent-selector.tsx b/frontend-web/src/components/workspace/agents/agent-selector.tsx index 1a196922..dc1d43f8 100644 --- a/frontend-web/src/components/workspace/agents/agent-selector.tsx +++ b/frontend-web/src/components/workspace/agents/agent-selector.tsx @@ -120,7 +120,7 @@ export function AgentSelector({ value={`${agent.name} ${agent.description ?? ""}`} onSelect={() => handleSelect(agent)} className={cn( - "flex items-center gap-2", + "flex min-w-0 items-center gap-2 overflow-hidden", agent.id === selectedAgentId && "bg-accent", )} > diff --git a/frontend-web/src/components/workspace/custom-prompt-menu.tsx b/frontend-web/src/components/workspace/custom-prompt-menu.tsx index ccce3b77..1f9b0a3b 100644 --- a/frontend-web/src/components/workspace/custom-prompt-menu.tsx +++ b/frontend-web/src/components/workspace/custom-prompt-menu.tsx @@ -29,6 +29,7 @@ import { import { Switch } from "@/components/ui/switch"; import { Textarea } from "@/components/ui/textarea"; import { useAgents } from "@/core/agents/hooks"; +import { getStoredAuth } from "@/core/auth"; import { useCreateCustomPrompt, useCustomPrompts, @@ -42,16 +43,6 @@ import { import { desensitize } from "@/lib/desensitize"; import { cn } from "@/lib/utils"; -/** Sentinel select value for "no agent association" (global prompt). */ -const NO_AGENT = "__global__"; - -/** - * Bar above the chat input showing the user's saved prompts as centered, - * clickable chips. When there are too many to fit, they become a horizontal - * carousel (arrows appear). A gear pinned to the far right opens the manage - * dialog. Prompts are bound to the account (server-backed), and this coexists - * with the admin-configured global prompt prefix. - */ export function CustomPromptBar({ onInsert, className, @@ -59,19 +50,13 @@ export function CustomPromptBar({ }: { onInsert: (content: string) => void; className?: string; - /** - * The agent currently selected for this chat (or null on the general - * new-chat page). Agent-associated prompts only show when their ``agent_id`` - * matches; un-associated (global) prompts always show. - */ currentAgentId?: string | null; }) { const allPrompts = useCustomPrompts(); const prompts = allPrompts.filter( - (p) => !p.agent_id || p.agent_id === currentAgentId, + (prompt) => !prompt.agent_id || prompt.agent_id === currentAgentId, ); const [manageOpen, setManageOpen] = useState(false); - const scrollRef = useRef(null); const [canLeft, setCanLeft] = useState(false); const [canRight, setCanRight] = useState(false); @@ -87,7 +72,7 @@ export function CustomPromptBar({ updateArrows(); window.addEventListener("resize", updateArrows); return () => window.removeEventListener("resize", updateArrows); - }, [updateArrows, prompts]); + }, [prompts, updateArrows]); const scrollByDir = (dir: 1 | -1) => { scrollRef.current?.scrollBy({ left: dir * 220, behavior: "smooth" }); @@ -97,7 +82,7 @@ export function CustomPromptBar({ return ( <> -
+
{prompts.length > 0 && ( <> {overflowing && ( @@ -116,7 +101,7 @@ export function CustomPromptBar({
{prompts.map((prompt) => ( @@ -150,7 +135,7 @@ export function CustomPromptBar({ )} )} - {prompts.length === 0 &&
} + {prompts.length === 0 &&
}
setTitle(e.target.value)} + onChange={(event) => setTitle(event.target.value)} placeholder="名称(可选,例如:周报总结)" />