From 941bac2332cf1cf1ed42f6410edfc902800d86e2 Mon Sep 17 00:00:00 2001 From: LC Date: Mon, 18 May 2026 14:50:57 +0800 Subject: [PATCH] feat(web): add chat detail visibility selector (#2886) --- .../src/components/chat/chat-page.tsx | 61 ++++- .../src/features/chat/detail-visibility.ts | 255 ++++++++++++++++++ web/frontend/src/i18n/locales/en.json | 8 +- web/frontend/src/i18n/locales/pt-br.json | 8 +- web/frontend/src/i18n/locales/zh.json | 8 +- web/frontend/src/store/chat.ts | 25 +- 6 files changed, 344 insertions(+), 21 deletions(-) create mode 100644 web/frontend/src/features/chat/detail-visibility.ts diff --git a/web/frontend/src/components/chat/chat-page.tsx b/web/frontend/src/components/chat/chat-page.tsx index 3ad811da..be30ff03 100644 --- a/web/frontend/src/components/chat/chat-page.tsx +++ b/web/frontend/src/components/chat/chat-page.tsx @@ -16,14 +16,24 @@ import { TypingIndicator } from "@/components/chat/typing-indicator" import { UserMessage } from "@/components/chat/user-message" import { PageHeader } from "@/components/page-header" import { Button } from "@/components/ui/button" -import { Switch } from "@/components/ui/switch" +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/components/ui/select" import { useChatModels } from "@/hooks/use-chat-models" import { useGateway } from "@/hooks/use-gateway" import { usePicoChat } from "@/hooks/use-pico-chat" import { useSessionHistory } from "@/hooks/use-session-history" +import type { AssistantDetailVisibility } from "@/store/chat" import type { ConnectionState } from "@/store/chat" import type { ChatAttachment } from "@/store/chat" -import { showAssistantDetailsAtom } from "@/store/chat" +import { + assistantDetailVisibilityAtom, + shouldShowAssistantMessage, +} from "@/store/chat" import type { GatewayState } from "@/store/gateway" const MAX_IMAGE_SIZE_BYTES = 7 * 1024 * 1024 @@ -112,10 +122,23 @@ export function ChatPage() { const [hasScrolled, setHasScrolled] = useState(false) const [input, setInput] = useState("") const [attachments, setAttachments] = useState([]) - const [showAssistantDetails, setShowAssistantDetails] = useAtom( - showAssistantDetailsAtom, + const [assistantDetailVisibility, setAssistantDetailVisibility] = useAtom( + assistantDetailVisibilityAtom, ) + const assistantDetailVisibilityOptions: Array<{ + value: AssistantDetailVisibility + label: string + }> = [ + { value: "none", label: t("chat.assistantDetailVisibility.none") }, + { value: "thought", label: t("chat.assistantDetailVisibility.thought") }, + { + value: "tool_calls", + label: t("chat.assistantDetailVisibility.toolCalls"), + }, + { value: "all", label: t("chat.assistantDetailVisibility.all") }, + ] + const { messages, connectionState, @@ -275,12 +298,27 @@ export function ChatPage() { {t("chat.showAssistantDetails")} - +