From 21aef75fb55878aab2af040cdf045c1299c1ea76 Mon Sep 17 00:00:00 2001 From: Xin Wang Date: Sun, 7 Jun 2026 21:05:52 +0800 Subject: [PATCH] Add debug mode functionality to AssistantPage with text and voice testing options Introduced a DebugDrawer component to allow users to switch between text and voice testing modes. Enhanced the AssistantPage layout for better organization and added a debug interface for testing AI responses. This update improves usability by providing clear options for debugging and testing the assistant's capabilities. --- src/components/pages/AssistantPage.tsx | 139 +++++++++++++++++++++++-- 1 file changed, 128 insertions(+), 11 deletions(-) diff --git a/src/components/pages/AssistantPage.tsx b/src/components/pages/AssistantPage.tsx index 36327dd..a7fe3fa 100644 --- a/src/components/pages/AssistantPage.tsx +++ b/src/components/pages/AssistantPage.tsx @@ -20,6 +20,8 @@ import { Save, Mic, Volume2, + Send, + MessageCircle, } from "lucide-react"; import { Button } from "@/components/ui/button"; @@ -190,6 +192,8 @@ const mockAssistants: AssistantListItem[] = [ }, ]; +type DebugMode = "text" | "voice"; + type TypeFilter = "全部" | AssistantType; const typeFilters: TypeFilter[] = ["全部", ...assistantTypes]; @@ -214,6 +218,8 @@ export function AssistantPage() { const [searchQuery, setSearchQuery] = useState(""); const [typeFilter, setTypeFilter] = useState("全部"); const [currentPage, setCurrentPage] = useState(1); + // 右侧调试 drawer 的当前模式 + const [debugMode, setDebugMode] = useState("text"); // choose 步骤的草稿:名称与已选类型,确认后才决定进入哪个构建页 const [draftName, setDraftName] = useState(""); const [draftType, setDraftType] = useState(null); @@ -667,21 +673,18 @@ export function AssistantPage() { } return ( -
-
-
-

- 创建助手 -

-

+

+
+
+

创建助手

+

通过提示词、模型、语音和知识库快速创建 AI 视频助手

-
+
-
-
+
+
+ + +
+
+ ); +} + +function DebugDrawer({ + mode, + onModeChange, +}: { + mode: DebugMode; + onModeChange: (mode: DebugMode) => void; +}) { + const modeTabs: { key: DebugMode; label: string; icon: React.ReactNode }[] = [ + { key: "text", label: "文字测试", icon: }, + { key: "voice", label: "语音测试", icon: }, + ]; + + return ( + + ); +} + +function DebugTextPanel() { + return ( +
+
+
+
+ 您好,我是 AI 视频助手,请问有什么可以帮您? +
+ 助手 +
+ +
+
+ 我想咨询一下社保卡的办理流程。 +
+ +
+ +
+
+ 社保卡可通过线上或线下渠道办理。线上可在政务服务 App + 提交申请,线下可前往社保经办网点…… +
+ 助手 +
+
+ +
+
+