From a7f1e89ce9e25fcb61d219ef71b7bb883bfd0bba Mon Sep 17 00:00:00 2001 From: fengxiangdebaozi <10845145+fengxiangdebaozi@user.noreply.gitee.com> Date: Thu, 14 May 2026 10:51:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E7=A4=BA=E8=AF=8D=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/workspace/input-box.tsx | 33 +-- .../workspace/workspace-nav-menu.tsx | 13 +- .../src/core/recommended-questions/hooks.ts | 58 +++++ .../src/core/recommended-questions/index.ts | 57 ++++ .../src/pages/RecommendedQuestionsPage.tsx | 246 ++++++++++++++++++ frontend-web/src/pages/WorkspaceRoutes.tsx | 9 + 6 files changed, 389 insertions(+), 27 deletions(-) create mode 100644 frontend-web/src/core/recommended-questions/hooks.ts create mode 100644 frontend-web/src/core/recommended-questions/index.ts create mode 100644 frontend-web/src/pages/RecommendedQuestionsPage.tsx diff --git a/frontend-web/src/components/workspace/input-box.tsx b/frontend-web/src/components/workspace/input-box.tsx index 7bc633fa..4bc67415 100644 --- a/frontend-web/src/components/workspace/input-box.tsx +++ b/frontend-web/src/components/workspace/input-box.tsx @@ -80,35 +80,14 @@ import { DropdownMenuTrigger, } from "../ui/dropdown-menu"; +import { useRecommendedQuestions } from "@/core/recommended-questions/hooks"; + import { useThread } from "./messages/context"; import { ModeHoverGuide } from "./mode-hover-guide"; import { Tooltip } from "./tooltip"; type InputMode = "flash" | "thinking" | "pro" | "ultra"; -// 推荐问题列表 — 可自由配置 title(卡片标题)和 content(发送给对话的内容) -const RECOMMENDED_QUESTIONS: { title: string; content: string }[] = [ - { - title: "市场分析报告", - content: "请帮我写一份关于当前 AI 市场的详细分析报告,包括市场规模、主要玩家和发展趋势。", - }, - { - title: "制定学习计划", - content: "请帮我制定一个为期 3 个月的 Python 编程学习计划,从基础到进阶,每周安排具体任务。", - }, - { - title: "代码审查建议", - content: "请帮我审查代码,找出潜在的问题、性能瓶颈以及改进建议,并给出修改示例。", - }, - { - title: "数据分析方案", - content: "请帮我设计一个用于分析用户行为数据的方案,包括数据收集、处理和可视化策略。", - }, - { - title: "文章润色优化", - content: "请帮我润色以下文章,使其更加流畅、专业,并保持原意不变。", - }, -]; function getResolvedMode( mode: InputMode | undefined, @@ -185,6 +164,8 @@ export function InputBox({ null, ); + const [recommendedQuestions] = useRecommendedQuestions(); + useEffect(() => { if (models.length === 0) { return; @@ -461,11 +442,11 @@ export function InputBox({ )} - {isNewThread && searchParams.get("mode") !== "skill" && ( + {isNewThread && searchParams.get("mode") !== "skill" && recommendedQuestions.length > 0 && (
- {RECOMMENDED_QUESTIONS.map((q) => ( + {recommendedQuestions.map((q) => ( +
+ + {questions.length === 0 ? ( +
+

暂无推荐问题

+ +
+ ) : ( +
+ {questions.map((q, index) => ( +
handleDragStart(index)} + onDragOver={(e) => handleDragOver(e, index)} + onDrop={() => handleDrop(index)} + onDragEnd={() => { + setDragIndex(null); + setDragOverIndex(null); + }} + className={`flex items-start gap-3 rounded-xl border bg-white px-4 py-3.5 transition-colors ${ + dragOverIndex === index && dragIndex !== index + ? "border-blue-400 bg-blue-50" + : "border-[#e4e4e7]" + }`} + > + +
+
+ {q.title} +
+
+ {q.content} +
+
+
+ + +
+
+ ))} +
+ )} + + {/* 添加 / 编辑弹窗 */} + !o && closeDialog()}> + + + + {dialog?.mode === "add" ? "添加推荐问题" : "编辑推荐问题"} + + +
+
+

卡片标题

+ setFormTitle(e.target.value)} + /> +
+
+

发送内容

+