From 4988b1c5fb50affae8e66b73b96b81bfe993b80b Mon Sep 17 00:00:00 2001 From: Xin Wang Date: Sun, 7 Jun 2026 22:05:18 +0800 Subject: [PATCH] Enhance AssistantPage layout with new popover component and improved button accessibility Updated the AssistantPage to include a new Popover component for better user interaction. Enhanced button accessibility by adding keyboard navigation support and improved visual elements for runtime mode selection. Refined the layout for clearer presentation of assistant configuration options, including updated icons and descriptions. --- src/components/pages/AssistantPage.tsx | 308 +++++++++++++++---------- src/components/ui/popover.tsx | 42 ++++ 2 files changed, 229 insertions(+), 121 deletions(-) create mode 100644 src/components/ui/popover.tsx diff --git a/src/components/pages/AssistantPage.tsx b/src/components/pages/AssistantPage.tsx index a7fe3fa..b362ed1 100644 --- a/src/components/pages/AssistantPage.tsx +++ b/src/components/pages/AssistantPage.tsx @@ -19,9 +19,11 @@ import { ChevronRight, Save, Mic, - Volume2, Send, MessageCircle, + HelpCircle, + Waypoints, + AudioLines, } from "lucide-react"; import { Button } from "@/components/ui/button"; @@ -42,14 +44,18 @@ import { SelectTrigger, SelectValue, } from "@/components/ui/select"; +import { + Popover, + PopoverContent, + PopoverTrigger, +} from "@/components/ui/popover"; import { Card, CardContent, - CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; -import { useState } from "react"; +import { useEffect, useRef, useState } from "react"; type RuntimeMode = "pipeline" | "realtime"; @@ -675,11 +681,11 @@ export function AssistantPage() { return (
-
-

创建助手

-

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

+
+ updateForm("name", value)} + />
@@ -703,22 +709,32 @@ export function AssistantPage() {
- +
- +
} - title="基础信息" - description="定义助手名称、开场白和提示词" + icon={} + title="提示词" + description="描述助手的角色、能力和回答要求" > - updateForm("name", value)} - placeholder="请输入助手名称" - /> - - updateForm("greeting", value)} - placeholder="请输入助手开场白" - /> - - {form.runtimeMode === "realtime" && ( + {form.runtimeMode === "pipeline" ? ( } - title="Realtime 配置" + title="模型配置" + description="配置语音管线的大语言模型、语音识别与播报音色" + > + updateForm("model", value)} + options={["DeepSeek-V3", "Qwen-Max", "Kimi-K2", "Doubao-Pro", "GPT-4o"]} + /> + updateForm("asr", value)} + options={["SenseVoice", "Paraformer", "Whisper", "FunASR"]} + /> + updateForm("voice", value)} + options={["晓宁", "晓美", "晓宇", "晓晨"]} + /> + + ) : ( + } + title="模型配置" description="当前模式下 ASR 与 TTS 由 Realtime 模型内置完成" > )} - {form.runtimeMode === "pipeline" && ( - <> - } - title="LLM 配置" - description="选择驱动对话理解与生成的大语言模型" - > - updateForm("model", value)} - options={["DeepSeek-V3", "Qwen-Max", "Kimi-K2", "Doubao-Pro", "GPT-4o"]} - /> - - - } - title="ASR 配置" - description="选择将用户语音转为文本的识别引擎" - > - updateForm("asr", value)} - options={["SenseVoice", "Paraformer", "Whisper", "FunASR"]} - /> - - - } - title="TTS 配置" - description="选择助手播报回复时使用的合成音色" - > - updateForm("voice", value)} - options={["晓宁", "晓美", "晓宇", "晓晨"]} - /> - - - )} + } + title="开场白" + description="助手与用户首次对话时的开场语" + > + updateForm("greeting", value)} + placeholder="请输入助手开场白" + /> + } @@ -895,7 +896,7 @@ function DebugDrawer({ return (