From bf96cf4cb4e76f530f6d820b45d4f691e54d2b89 Mon Sep 17 00:00:00 2001 From: fengxiangdebaozi <10845145+fengxiangdebaozi@user.noreply.gitee.com> Date: Wed, 3 Jun 2026 19:12:30 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend-web/.env.development | 2 +- frontend-web/.env.production | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend-web/.env.development b/frontend-web/.env.development index 1d8b3666..0e89436f 100644 --- a/frontend-web/.env.development +++ b/frontend-web/.env.development @@ -26,7 +26,7 @@ VITE_AIPI_KNOWLEDGE_IFRAME_SKIN=red VITE_AIPI_MOPECHAT_URL=https://ch1.b.uat.4.cn/likun_b1_mope VITE_AIPI_BACKENP_URL=https://knowledgetoolserver.b.uat.4.cn # 我的笔记前端 -VITE_AIPI_FRONTEND_URL= xxx +VITE_AIPI_FRONTEND_URL=https://knowledgetoolserver.b.uat.4.cn VITE_AIPI_CONSUMER_URL=https://ch1.b.uat.4.cn/consumer # MaxKey 鉴权(getTokenByOnlineTicket) VITE_AUTH_BASE_URL=https://auth.y.sit.4.cn diff --git a/frontend-web/.env.production b/frontend-web/.env.production index 67dabce1..6aa2d33d 100644 --- a/frontend-web/.env.production +++ b/frontend-web/.env.production @@ -25,6 +25,7 @@ VITE_AIPI_CONSUMER_URL=https://ch1.b.uat.4.cn/consumer VITE_AUTH_BASE_URL=https://auth.y.uat.4.cn VITE_AIPI_PGLINKTO_URL=https://pg.b.uat.4.cn VITE_AIPI_XKLINKTO_URL=https://kz.b.uat.4.cn +VITE_AIPI_FRONTEND_URL=https://knowledgetoolserver.b.uat.4.cn # 可选:Canvas 独立 LangGraph 地址 # VITE_CANVAS_LANGGRAPH_BASE_URL= From b0b0cf7b9ecfd36152c6585297ed319830633587 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=87=AF?= Date: Wed, 3 Jun 2026 21:07:12 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E5=9C=B0=E5=9D=80=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend-web/.env.network | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend-web/.env.network b/frontend-web/.env.network index 4bcd8f15..be82f968 100644 --- a/frontend-web/.env.network +++ b/frontend-web/.env.network @@ -2,8 +2,8 @@ # 打包前请将 192.168.1.100 改为实际服务器 IP;变量会写入 dist,运行时不可再改 # Gateway / DeerFlow API(与 offline-backend DEPLOY 文档一致) -VITE_BACKEND_BASE_URL=http://47.88.25.99 -VITE_LANGGRAPH_BASE_URL=http://47.88.25.99/api +VITE_BACKEND_BASE_URL=http://47.88.25.99:7001 +VITE_LANGGRAPH_BASE_URL=http://47.88.25.99:7001/api # 轻应用「新建笔记」系列接口 VITE_NOTE_API_BASE_URL=http://192.168.1.100:8000 From d5b0bd4d31231bec3e74511d00693f8d267a44d9 Mon Sep 17 00:00:00 2001 From: fengxiangdebaozi <10845145+fengxiangdebaozi@user.noreply.gitee.com> Date: Wed, 3 Jun 2026 21:44:46 +0800 Subject: [PATCH 3/9] =?UTF-8?q?fix(roundtable):=20=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=8D=A1=E6=88=AA=E6=96=AD=E3=80=81Step3=20=E5=AE=8C=E6=95=B4?= =?UTF-8?q?=20HTML=20=E4=B8=8E=E8=B7=A8=E6=A0=87=E7=AD=BE=E9=A1=B5?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 第二步消息列表长文件名不再溢出卡片;第三步绘制结束后从沙箱回灌完整 HTML(修复 append 续写 stub 被截短),进入第三步时关闭第二步沙箱;HTML 预览与提示词强调 utf-8/中文。跨标签页切换账号改为 toast 提示而非强制刷新;方案总结智能体 SOUL 去掉「AI 自动生成」标签要求。 --- .../artifacts/artifact-file-detail.tsx | 5 +- frontend-web/src/core/auth/sync.tsx | 76 ++++++++++++++++--- .../components/HighFidelityReport.tsx | 8 ++ .../components/Step2Panel.tsx | 10 +-- .../hooks/useStep3Report.ts | 68 +++++++++++++++-- .../roundtable-report/SOUL.md | 3 +- 6 files changed, 143 insertions(+), 27 deletions(-) diff --git a/frontend-web/src/components/workspace/artifacts/artifact-file-detail.tsx b/frontend-web/src/components/workspace/artifacts/artifact-file-detail.tsx index 01800c52..faa635a2 100644 --- a/frontend-web/src/components/workspace/artifacts/artifact-file-detail.tsx +++ b/frontend-web/src/components/workspace/artifacts/artifact-file-detail.tsx @@ -715,7 +715,10 @@ export function ArtifactFilePreview({ return; } - const blob = new Blob([content ?? ""], { type: "text/html" }); + // 必须带 charset=utf-8:blob: URL 的 Content-Type 不含 charset 时,iframe 会按 + // 系统默认编码(中文 Windows 常为 GBK/Latin-1)解码,模型生成的 HTML 若没写 + // 就会中文乱码。与下方下载/新窗口打开的 blobType 保持一致。 + const blob = new Blob([content ?? ""], { type: "text/html;charset=utf-8" }); const url = URL.createObjectURL(blob); setHtmlPreviewUrl(url); diff --git a/frontend-web/src/core/auth/sync.tsx b/frontend-web/src/core/auth/sync.tsx index e9f3b460..8a5fbdb6 100644 --- a/frontend-web/src/core/auth/sync.tsx +++ b/frontend-web/src/core/auth/sync.tsx @@ -1,46 +1,98 @@ "use client"; import { useEffect, useRef } from "react"; +import { toast } from "sonner"; import { getStoredAuth } from "@/core/auth"; const AUTH_STORAGE_KEY = "deerflow.auth"; +// 防抖窗口:跨标签页登录/重写 auth 常常在极短时间内连发多个 storage 事件 +// (例如先写 token、再写用户信息)。等它"落定"再判断,避免抖动期的中间态 +// (短暂 null / 半写状态)误触发动作。 +const SETTLE_DELAY_MS = 1200; + +// 提示 toast 的稳定 id —— 同一次身份变化只保留一条,避免连发事件刷屏。 +const IDENTITY_TOAST_ID = "auth-identity-changed"; + function readUserId(): string | null { return getStoredAuth()?.user_id ?? null; } /** * Mount once at the app root. Watches `localStorage["deerflow.auth"]` for - * cross-tab changes — when another tab logs in as a different user, this tab - * still holds the previous user's cached state (chat list, thread ids, etc.) - * which then collides with the new token and surfaces as a 404 on "新对话". - * Reloading the tab is the simplest way to resync React state with the new - * identity. + * cross-tab changes. + * + * 背景:`deerflow.auth` 在同源所有标签页之间共享。某个标签页登录/重写它时, + * 其它标签页仍持有旧用户的内存态(会话列表、thread id、以及多智能体会商这类 + * 纯内存的页面状态),与新 token 不一致,可能在"新对话"等操作上 404。 + * + * 旧实现:只要检测到 user_id 变化就 `window.location.reload()`。这会把**正在 + * 使用的标签页**(例如正在跑多智能体会商第二步的那个)整页刷新,内存态全丢、 + * 步骤回到第一步 —— 用户复制链接到新标签页打开(新标签页可能以不同/默认用户 + * 重新登录并改写共享 auth)就会触发,体验很差。 + * + * 现实现(方案 1,收敛粗暴刷新): + * - **真·退出登录**(auth 变为 null)→ 仍然跳登录页并刷新(本就该重新登录)。 + * - **出现不同的非空用户**(另一个标签页登录成别的身份)→ **不再自动整页刷新**, + * 改为弹一条常驻提示,把"是否刷新同步"的决定权交给用户,避免冲掉正在进行的工作。 + * - 防抖 + 落定后二次校验,过滤掉同用户重写 / 抖动中间态带来的误触发。 */ export function AuthSyncWatcher() { const lastUserIdRef = useRef(readUserId()); useEffect(() => { - function handleStorage(event: StorageEvent) { - if (event.key !== null && event.key !== AUTH_STORAGE_KEY) { - return; - } + let settleTimer: ReturnType | null = null; + + // storage 事件落定后再判断当前的真实身份并决定动作。 + function evaluateSettledIdentity() { const nextUserId = readUserId(); if (nextUserId === lastUserIdRef.current) { + // 同用户重写,或抖动后又回到原身份 —— 无需任何动作。 return; } - lastUserIdRef.current = nextUserId; + if (nextUserId === null) { + // 另一个标签页退出登录(或清空了 auth)→ 本标签页也该回到登录页。 + lastUserIdRef.current = null; window.location.replace("#/login"); window.location.reload(); return; } - window.location.reload(); + + // 出现了不同的非空用户。共享 auth 已被改成别的身份,继续在本标签页发请求 + // 可能 404 / 鉴权失败,但**不**强制刷新 —— 用户可能正在本标签页干活 + // (如多智能体会商),由用户自己决定何时刷新同步。 + lastUserIdRef.current = nextUserId; + toast.warning("检测到账号在其它标签页发生变化", { + id: IDENTITY_TOAST_ID, + description: "当前标签页仍是原会话。如需与新账号同步,请刷新页面。", + duration: Infinity, + action: { + label: "刷新同步", + onClick: () => window.location.reload(), + }, + }); + } + + function handleStorage(event: StorageEvent) { + // 只关心 auth 键的变化;event.key === null 表示 localStorage 被整体清空。 + if (event.key !== null && event.key !== AUTH_STORAGE_KEY) { + return; + } + if (settleTimer) { + clearTimeout(settleTimer); + } + settleTimer = setTimeout(evaluateSettledIdentity, SETTLE_DELAY_MS); } window.addEventListener("storage", handleStorage); - return () => window.removeEventListener("storage", handleStorage); + return () => { + window.removeEventListener("storage", handleStorage); + if (settleTimer) { + clearTimeout(settleTimer); + } + }; }, []); return null; diff --git a/frontend-web/src/roundtable-planning/components/HighFidelityReport.tsx b/frontend-web/src/roundtable-planning/components/HighFidelityReport.tsx index 8cb7a0d0..cd5e88ea 100644 --- a/frontend-web/src/roundtable-planning/components/HighFidelityReport.tsx +++ b/frontend-web/src/roundtable-planning/components/HighFidelityReport.tsx @@ -14,6 +14,7 @@ import { Sparkles, } from "lucide-react"; +import { useArtifacts } from "@/components/workspace/artifacts"; import { buildArtifactDownloadUrl, listSessionArtifacts, @@ -118,6 +119,13 @@ export const HighFidelityReport: React.FC = ({ }) => { // 「结果绘制」模式:把现有报告内容收起到左栏,右侧由方案可视化智能体绘制图表 HTML。 const [drawMode, setDrawMode] = useState(false); + + // 进入第三步即关闭并清空第二步遗留的沙箱(artifacts 面板全局共享,第二步打开后 + // 不会自动关)。点「结果绘制」后 Step3ReportMode 会按需开自己的沙箱,互不串扰。 + const { deselect: deselectArtifact } = useArtifacts(); + useEffect(() => { + deselectArtifact(); + }, [deselectArtifact]); // Build the per-seat list (excludes the coordinator). useMemo so the file // fetch effect doesn't re-fire on every parent render. const seatThreadEntries = useMemo(() => { diff --git a/frontend-web/src/roundtable-planning/components/Step2Panel.tsx b/frontend-web/src/roundtable-planning/components/Step2Panel.tsx index c3cc6206..fc077524 100644 --- a/frontend-web/src/roundtable-planning/components/Step2Panel.tsx +++ b/frontend-web/src/roundtable-planning/components/Step2Panel.tsx @@ -521,7 +521,7 @@ function PresentFilesRow({ disabled: boolean; }) { return ( -
+
{files.map((path) => ( -
+
{filename}
-
+
{typeLabel} diff --git a/frontend-web/src/roundtable-planning/hooks/useStep3Report.ts b/frontend-web/src/roundtable-planning/hooks/useStep3Report.ts index 6d2bf725..72f05b81 100644 --- a/frontend-web/src/roundtable-planning/hooks/useStep3Report.ts +++ b/frontend-web/src/roundtable-planning/hooks/useStep3Report.ts @@ -17,8 +17,10 @@ import { useCallback, useEffect, useRef, useState } from "react"; import { useArtifacts } from "@/components/workspace/artifacts"; +import { apiFetch } from "@/core/api"; import type { DraftStep3Snapshot } from "@/roundtable-planning/api/drafts"; import { + buildArtifactDownloadUrl, initReportThread, listSessionArtifacts, streamMultiAgent, @@ -139,6 +141,11 @@ function buildReportPrompt(opts: { "文字为主图表点睛(全篇穿插 3–5 个有信息量的图、每图配一两句解读)、浅红主题(主色 #c25555);" + "写完文件后只用一两句话总结,不要把 HTML 源码贴进对话。", ); + // 语言 + 编码硬约束:偶发整篇输出英文 / 中文乱码的两个根因都在这里堵住。 + parts.push( + "硬性要求:① 全程使用简体中文输出——HTML 正文、标题、图表标签与图例、按钮、结论摘要等一切文字都必须是中文,禁止输出英文(专有名词可中英并列);" + + '② HTML 必须是完整文档,并在 最前面声明 ,确保中文不乱码。', + ); return parts.join("\n"); } @@ -543,6 +550,51 @@ export function useStep3Report( [setArtifacts, selectArtifact, setArtifactsOpen], ); + // 收尾对账:以沙箱真实文件为准回灌 stub,拿到完整 HTML。 + // 智能体可能分多次写文件 —— 尤其是 write_file 带 `append=true` 续写后半段(截图里 + // 「Append remaining HTML content…」那一步)。后端 append 会把后半段拼到磁盘文件已有 + // 内容后面,磁盘文件是完整的;但前端 stub 按 (name,path) 去重,第二次 write_file 会用 + // 「只含后半段」的 content 覆盖掉前半段(防抹空守卫只挡空内容、挡不住非空的后半段)。 + // 这里流式结束后从 outputs 读真实文件回灌 stub,让预览与存档都拿到完整 HTML。 + // 返回最终用于存草稿的 HTML(拉取失败 / 真实文件更短时退回 stub 内容,不打断收尾)。 + const reconcileStubFromRealFile = useCallback( + async (threadId: string, signal?: AbortSignal): Promise => { + const writeTc = stubRef.current[threadId]?.[0]?.tool_calls.find( + (tc) => tc.name === "write_file", + ); + const stubPath = + typeof (writeTc?.args as { path?: unknown })?.path === "string" + ? ((writeTc!.args as { path?: string }).path as string) + : ""; + const stubContent = + typeof (writeTc?.args as { content?: unknown })?.content === "string" + ? ((writeTc!.args as { content?: string }).content as string) + : ""; + if (!stubPath) return stubContent; + try { + const list = await listSessionArtifacts(threadId, { signal }); + const htmlFile = + list.files.find((f) => /\.html?$/i.test(f.name)) ?? null; + if (!htmlFile) return stubContent; + const res = await apiFetch( + buildArtifactDownloadUrl(threadId, htmlFile.path), + { signal }, + ); + if (!res.ok) return stubContent; + const real = await res.text(); + // 只在真实文件更长(说明 stub 被后半段截短了)时替换,避免偶发空/短响应回退。 + if (real.trim() && real.length > stubContent.length) { + upsertStub(threadId, "write_file", { path: stubPath, content: real }); + return real; + } + } catch { + /* 拉取真实文件失败就退回 stub 内容,不打断主流程 */ + } + return stubContent; + }, + [upsertStub], + ); + const abort = useCallback(() => { aborterRef.current?.abort(); aborterRef.current = null; @@ -604,17 +656,16 @@ export function useStep3Report( const hasStubFile = (stubRef.current[threadId]?.[0]?.tool_calls.length ?? 0) > 0; if (!hasStubFile) await openRealArtifactFallback(threadId); + // 以沙箱真实文件回灌 stub(修复 append 续写只剩后半段的问题),并拿到完整 HTML。 + const html = hasStubFile + ? await reconcileStubFromRealFile(threadId, aborter.signal) + : ""; + if (aborter.signal.aborted) return; + finalizeDialogue(bubbleId, res.content, "绘制完成"); setPhase("done"); - // 绘制成功 → 把完整 HTML 等抛给上层存进草稿(step3)。从 stub 取最新 write_file 内容。 - const writeTc = stubRef.current[threadId]?.[0]?.tool_calls.find( - (tc) => tc.name === "write_file", - ); - const html = - typeof (writeTc?.args as { content?: unknown })?.content === "string" - ? ((writeTc!.args as { content?: string }).content as string) - : ""; + // 绘制成功 → 把完整 HTML 等抛给上层存进草稿(step3)。 if (html.trim()) { onReportSavedRef.current?.({ html, @@ -645,6 +696,7 @@ export function useStep3Report( handleArtifactToolPhase, handleUpstreamFrame, openRealArtifactFallback, + reconcileStubFromRealFile, ]); const start = useCallback(() => { diff --git a/offline-backend-20260512/backend/app/gateway/routers/_roundtable_seed_assets/roundtable-report/SOUL.md b/offline-backend-20260512/backend/app/gateway/routers/_roundtable_seed_assets/roundtable-report/SOUL.md index 933bc760..30756662 100644 --- a/offline-backend-20260512/backend/app/gateway/routers/_roundtable_seed_assets/roundtable-report/SOUL.md +++ b/offline-backend-20260512/backend/app/gateway/routers/_roundtable_seed_assets/roundtable-report/SOUL.md @@ -30,7 +30,7 @@ | # | 章节 | 内容(文字) | 配图建议 | |---|------|------|----------| -| ① | 报告头 | 标题 + 生成时间占位 + 「AI 自动生成」标签 | — | +| ① | 报告头 | 标题 + 生成时间占位 | — | | ② | 一句话结论 + 关键指标卡 | 用一句话点明最终方案/结论 | 4–6 个 KPI 数字卡(共识度、参与席位数、识别风险数、里程碑数、预估周期、预算规模等) | | ③ | 任务背景与目标 | 2–4 句交代要解决什么、目标与关键约束 | 可选:目标/约束要点列表 | | ④ | 各席位观点与交付 | **每个席位一段提炼文字**(这位专家关注什么、给出了什么关键结论/建议),用小标题+正文,让读者读懂每方的贡献 | 关键席位视情况配小图(如情报席位的对比、环境席位的承载评估) | @@ -73,4 +73,5 @@ - ❌ 写 Python / shell / 任何脚本去生成 HTML,或用 bash 跑脚本产出文件(必须自己把 HTML 文本直接写进 `write_file`) - ❌ 把 HTML 拆成多文件或分多次拼接、或写完后再去读取/校验文件 - ❌ 用 `str_replace` 局部修改 HTML(返工请整文件 `write_file` 重写) +- ❌ 在报告头或任何位置添加「AI 自动生成」「AI generated」之类的标签、徽章或水印 - ❌ 编造与原料明显矛盾的数据 From 062f9842621836dfe8d55051d49dc429eb898a5e Mon Sep 17 00:00:00 2001 From: fengxiangdebaozi <10845145+fengxiangdebaozi@user.noreply.gitee.com> Date: Thu, 4 Jun 2026 10:40:16 +0800 Subject: [PATCH 4/9] =?UTF-8?q?ai=E5=86=99=E4=BD=9C=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/open-canvas/pages/AIWritingPage.tsx | 124 ++++++++++++------ 1 file changed, 87 insertions(+), 37 deletions(-) diff --git a/frontend-web/src/open-canvas/pages/AIWritingPage.tsx b/frontend-web/src/open-canvas/pages/AIWritingPage.tsx index cd96dc1a..d4ab02b9 100644 --- a/frontend-web/src/open-canvas/pages/AIWritingPage.tsx +++ b/frontend-web/src/open-canvas/pages/AIWritingPage.tsx @@ -102,17 +102,99 @@ import { // Panel IDs used as keys in the v4 Layout map const WRITING_ID = 'aw-writing'; const DRAFT_ID = 'aw-draft'; +// 初始问答阶段(idle)专用的两栏 ID:左=问答助手,右=写作配置表单 +const SETUP_CHAT_ID = 'aw-setup-chat'; +const SETUP_FORM_ID = 'aw-setup-form'; // Match the original canvas page proportions (chat=35, artifact=65) const DEFAULT_LAYOUT = { [WRITING_ID]: 35, [DRAFT_ID]: 65 }; +// idle 阶段镜像原比例:问答框在左占大头(65),配置表单在右占小头(35) +const SETUP_LAYOUT = { [SETUP_CHAT_ID]: 65, [SETUP_FORM_ID]: 35 }; /** - * 右侧面板:未开始写作(idle)时显示「写作助手 Q&A」,帮用户聊清并回填左侧表单; - * 一旦开始写作(status !== idle)就切回草稿预览。 + * 写作配置表单面板(写作助手回填的目标),抽出复用:idle 时在右栏,开始写作后在左栏。 */ -function AIWritingRightPanel() { +function WritingFormPanel({ hideAdvancedFields }: { hideAdvancedFields: boolean }) { + return ( + // 与原布局保持相同的 flex-1 min-h-0 包裹,确保内部 h-full 正确解析 +
+ +
+ ); +} + +/** + * 根据写作状态切换两套左右布局: + * - idle(初始问答阶段):左=「写作助手 Q&A」,右=「写作配置选项」表单; + * - 开始写作后:回到原布局——左=写作配置/时间线面板,右=草稿预览。 + */ +function AIWritingLayout({ hideAdvancedFields }: { hideAdvancedFields: boolean }) { + const layoutRef = useRef(null); const { state } = useAIWriting(); - return state.status === 'idle' ? : ; + + if (state.status === 'idle') { + return ( + + {/* 左侧:写作助手 Q&A */} + + + + + + + {/* 右侧:写作配置选项表单 */} + + + + + ); + } + + return ( + + {/* 左侧:AI 写作面板,与原画布页左侧等宽 */} + + + + + + + {/* 右侧:草稿预览面板 */} + + + + + ); } export default function AIWritingPage({ @@ -120,8 +202,6 @@ export default function AIWritingPage({ }: { hideAdvancedFields?: boolean; } = {}) { - const layoutRef = useRef(null); - return ( @@ -131,37 +211,7 @@ export default function AIWritingPage({
- - {/* 左侧:AI 写作面板,与原画布页左侧等宽 */} - - {/* 与原布局保持相同的 flex-1 min-h-0 包裹,确保内部 h-full 正确解析 */} -
- -
-
- - - - {/* 右侧:草稿预览面板 */} - - - -
+
From 9423d7e8924cf552f95278d0b2af158651c89ccf Mon Sep 17 00:00:00 2001 From: zjy <2642113241@qq.com> Date: Thu, 4 Jun 2026 10:44:55 +0800 Subject: [PATCH 5/9] =?UTF-8?q?'feat:=E6=8A=80=E8=83=BD=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E6=94=B9=E6=88=90=E5=8D=A1=E7=89=87=E5=BC=8F'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend-web/package.json | 1 + .../settings/skill-settings-page.tsx | 223 +++++++++++++++++- .../components/workspace/tags/tag-chip.tsx | 10 +- 3 files changed, 228 insertions(+), 6 deletions(-) diff --git a/frontend-web/package.json b/frontend-web/package.json index 368e9fa6..aedd761c 100644 --- a/frontend-web/package.json +++ b/frontend-web/package.json @@ -59,6 +59,7 @@ "cmdk": "^1.1.1", "codemirror": "^6.0.2", "date-fns": "^4.1.0", + "dayjs": "^1.11.20", "docx": "^9.5.1", "dotenv": "^17.2.3", "embla-carousel-react": "^8.6.0", diff --git a/frontend-web/src/components/workspace/settings/skill-settings-page.tsx b/frontend-web/src/components/workspace/settings/skill-settings-page.tsx index 2e20e074..19a12de2 100644 --- a/frontend-web/src/components/workspace/settings/skill-settings-page.tsx +++ b/frontend-web/src/components/workspace/settings/skill-settings-page.tsx @@ -27,6 +27,13 @@ import { toast } from "sonner"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; +import { + Card, + CardDescription, + CardFooter, + CardHeader, + CardTitle, +} from "@/components/ui/card"; import { Dialog, DialogContent, @@ -43,6 +50,7 @@ import { EmptyMedia, EmptyTitle, } from "@/components/ui/empty"; + import { Item, ItemActions, @@ -50,6 +58,7 @@ import { ItemContent, ItemDescription, } from "@/components/ui/item"; + import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { SkillDetailDialog } from "@/components/workspace/skills/skill-detail-dialog"; import { TagChipList } from "@/components/workspace/tags/tag-chip"; @@ -319,6 +328,8 @@ function SkillSettingsList({ onClose }: { onClose?: () => void }) { {!isLoading && !error && filteredSkills.length === 0 && ( )} + + {/* —— 原纵向列表布局(保留备查)—— {!isLoading && !error && filteredSkills.length > 0 && pagedSkills.map((skill) => ( @@ -328,7 +339,21 @@ function SkillSettingsList({ onClose }: { onClose?: () => void }) { currentUserId={currentUserId} isAdmin={isAdmin} /> - ))} + ))} */} + {/* card */} + {!isLoading && !error && filteredSkills.length > 0 && ( +
+ {pagedSkills.map((skill) => ( + + ))} +
+ )} {!isLoading && !error && totalPages > 1 && (
+ )} + {canManage && ( + + )} + {canTogglePublish && ( + + )} + {canManage && ( + + )} +
+ + )} + diff --git a/frontend-web/src/components/workspace/tags/tag-chip.tsx b/frontend-web/src/components/workspace/tags/tag-chip.tsx index 17edf948..635e46a6 100644 --- a/frontend-web/src/components/workspace/tags/tag-chip.tsx +++ b/frontend-web/src/components/workspace/tags/tag-chip.tsx @@ -17,20 +17,22 @@ export function TagChip({ className?: string; }) { const color = resolveTagColor(tag.color); + const label = desensitize(tag.name); return ( - {desensitize(tag.name)} + {label} {onRemove && ( + + + + ); +} + +// ── 单张链条行卡片 ───────────────────────────────────────────────────────── + +function ChainRow({ + chain, + onSettings, +}: { + chain: BusinessChain; + onSettings: () => void; +}) { + return ( +
+ {/* 标题行 + 设置按钮 */} +
+
{chain.title || "未命名链条"}
+ + {chain.seats.length} 席 + + +
+ + {chain.description && ( +
{chain.description}
+ )} + + {/* 席位名 tag(按顺序,→ 箭头连接发言次序) */} +
+ {chain.seats.map((seat, i) => ( + + {i > 0 && } + + {seat.name || seat.agent_id} + + + ))} +
+
+ ); +} diff --git a/frontend-web/src/roundtable-planning/pages/BusinessChainEditorPage.tsx b/frontend-web/src/roundtable-planning/pages/BusinessChainEditorPage.tsx index 94354ac9..2ed3f44f 100644 --- a/frontend-web/src/roundtable-planning/pages/BusinessChainEditorPage.tsx +++ b/frontend-web/src/roundtable-planning/pages/BusinessChainEditorPage.tsx @@ -21,8 +21,8 @@ * * 详见 `docs/multi-agent-business-chain-dev.md` §7 阶段 1。 */ -import { useCallback, useEffect, useMemo, useState } from "react"; -import { useNavigate } from "react-router-dom"; +import { useCallback, useEffect, useMemo, useRef, useState } from "react"; +import { useNavigate, useSearchParams } from "react-router-dom"; import { toast } from "sonner"; import { nanoid } from "nanoid"; import { @@ -101,6 +101,7 @@ type ActiveDrag = export default function BusinessChainEditorPage() { const navigate = useNavigate(); + const [searchParams] = useSearchParams(); // ─── 数据 ──────────────────────────────────────────────────────────── const [pool, setPool] = useState([]); @@ -184,6 +185,19 @@ export default function BusinessChainEditorPage() { setSeats([]); }, []); + // ─── URL 参数 chainId:从「业务链条」弹窗点「设置」进来时自动切到该链条 ────── + // 只在链条列表加载完后应用一次(用 ref 闸门避免覆盖用户后续的手动切换)。 + const appliedChainParamRef = useRef(false); + useEffect(() => { + if (appliedChainParamRef.current) return; + const chainId = searchParams.get("chainId"); + if (!chainId) return; + if (chains.length === 0) return; // 等 refreshChains 拉回列表 + const chain = chains.find((c) => c.id === chainId); + if (chain) loadChain(chain); + appliedChainParamRef.current = true; // 命中或链条已不存在,都不再重试 + }, [chains, searchParams, loadChain]); + // ─── 席位增删改 ─────────────────────────────────────────────────────── const addAgentToSeats = useCallback( (agentId: string, atIndex?: number) => { diff --git a/frontend-web/src/roundtable-planning/pages/RoundtablePlanningPage.tsx b/frontend-web/src/roundtable-planning/pages/RoundtablePlanningPage.tsx index ac457087..2910c69e 100644 --- a/frontend-web/src/roundtable-planning/pages/RoundtablePlanningPage.tsx +++ b/frontend-web/src/roundtable-planning/pages/RoundtablePlanningPage.tsx @@ -55,6 +55,7 @@ import { useModels } from "@/core/models/hooks"; import { getAvatar, Man1Avatar, RobotAvatar } from "@/roundtable-planning/components/Avatars"; import { RecommendAgentsDialog } from "@/roundtable-planning/components/RecommendAgentsDialog"; +import { BusinessChainListDialog } from "@/roundtable-planning/components/BusinessChainListDialog"; import { Step1Panel } from "@/roundtable-planning/components/Step1Panel"; import { Step2Panel } from "@/roundtable-planning/components/Step2Panel"; import { Step3Panel } from "@/roundtable-planning/components/Step3Panel"; @@ -85,6 +86,8 @@ export default function RoundtablePlanningPage() { const [currentStep, setCurrentStep] = useState(1); const [showToast, setShowToast] = useState(null); const [isRecommendDialogOpen, setIsRecommendDialogOpen] = useState(false); + // 「业务链条」按钮 → 打开链条列表弹窗(弹窗里再决定进配置页 / 切到某条链条)。 + const [isChainListOpen, setIsChainListOpen] = useState(false); const [selectedModel, setSelectedModel] = useState(""); // Step 2 编排模式:recommend = 总控自由派活;chain = 总控按业务链条顺序派活。 // 由推荐弹窗确认时的 SeatSelectionResult.mode 决定(见 handleConfirmAgents)。 @@ -374,6 +377,19 @@ export default function RoundtablePlanningPage() { onConfirm={handleConfirmAgents} /> + { + setIsChainListOpen(false); + navigate( + chainId + ? `/page/workspace/roundtable/chains?chainId=${encodeURIComponent(chainId)}` + : "/page/workspace/roundtable/chains", + ); + }} + /> + {showToast && (
@@ -394,8 +410,8 @@ export default function RoundtablePlanningPage() {