feat(desktop): 深色 AI 控制台视觉改造 + 工作台仪表盘
桌面端从扁平 dev 工具风改为深色高端 AI 控制台:分层表面 + 紫青强调 + 微光 + 首页仪表盘,提升第一印象与吸引力。 - 设计 tokens: tailwind ink 分层调色板 + glow/card 阴影; index.css 深色基底 + 品牌渐变 + 深色滚动条 - shell: TopBar(品牌渐变+毛玻璃+发光健康灯) / LeftNav(激活态紫色高亮+左光条) / BottomDrawer(深色+状态色) - 新 views/Home 工作台仪表盘: 渐变 hero + 4 状态卡 + 3 能力卡 + 快速开始(默认首页) - 画布: TypedNode 深色节点卡; StudioView ReactFlow colorMode=dark + 深色工具栏/面板/ MiniMap; Inspector 深色表单 - KbView/MemoryView/MemoryPanel/Placeholder 全深色化; 进度条改紫青渐变 - 纯前端改造, npm build✓; 浏览器验证: 仪表盘 + 编排画布深色呈现 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
import { useHealth } from "../lib/health";
|
||||
import type { ViewKey } from "../shell/LeftNav";
|
||||
|
||||
function Stat({ label, value, sub, accent }: { label: string; value: string; sub: string; accent: string }) {
|
||||
return (
|
||||
<div className="rounded-xl border border-line bg-ink-850 p-4">
|
||||
<div className="text-xs text-slate-500">{label}</div>
|
||||
<div className={`mt-1 text-2xl font-semibold ${accent}`}>{value}</div>
|
||||
<div className="mt-0.5 text-[11px] text-slate-500">{sub}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const CAPS = [
|
||||
{ icon: "◆", title: "Agent 编排", desc: "React Flow 画布 → Eino 动态图 → 流式执行", to: "studio" as ViewKey, color: "text-violet-400" },
|
||||
{ icon: "▣", title: "RAG 知识库", desc: "多文件入库 + 向量/全文/图谱 三路混合检索", to: "kb" as ViewKey, color: "text-cyan-400" },
|
||||
{ icon: "◇", title: "偏好记忆", desc: "画像 + 多轮历史,让模型“知道是你”", to: "memory" as ViewKey, color: "text-emerald-400" },
|
||||
];
|
||||
|
||||
// 工作台:平台概览 + 快捷入口(深色 AI 控制台首页)。
|
||||
export function Home({ onSelect }: { onSelect: (v: ViewKey) => void }) {
|
||||
const h = useHealth();
|
||||
return (
|
||||
<div className="h-full overflow-auto p-8">
|
||||
<div className="mx-auto max-w-5xl">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="flex h-11 w-11 items-center justify-center rounded-xl bg-gradient-to-br from-violet-500 to-cyan-500 text-lg font-bold text-white shadow-glow">
|
||||
S
|
||||
</div>
|
||||
<div>
|
||||
<h1 className="brand-gradient text-2xl font-bold leading-tight">sundynix-agentix</h1>
|
||||
<p className="text-sm text-slate-500">分层式 AI Agent 平台 · 编排 / 知识库 / 记忆</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mt-6 grid grid-cols-2 gap-3 md:grid-cols-4">
|
||||
<Stat label="对话模型" value="DeepSeek" sub="chat · 控制面" accent="text-violet-300" />
|
||||
<Stat label="向量模型" value="百炼 v3" sub="embedding · 1024维" accent="text-cyan-300" />
|
||||
<Stat label="混合检索" value="3 路" sub="向量+全文+图谱" accent="text-emerald-300" />
|
||||
<Stat label="网关" value={h.gateway ? "在线" : "离线"} sub={h.persisted ? "持久化就绪" : "降级"} accent={h.gateway ? "text-emerald-300" : "text-rose-300"} />
|
||||
</div>
|
||||
|
||||
<div className="mt-8 grid grid-cols-1 gap-4 md:grid-cols-3">
|
||||
{CAPS.map((c) => (
|
||||
<button
|
||||
key={c.to}
|
||||
onClick={() => onSelect(c.to)}
|
||||
className="group rounded-xl border border-line bg-ink-850 p-5 text-left transition hover:border-violet-500/50 hover:bg-ink-800"
|
||||
>
|
||||
<div className={`text-2xl ${c.color}`}>{c.icon}</div>
|
||||
<div className="mt-3 font-medium text-slate-100">{c.title}</div>
|
||||
<div className="mt-1 text-xs leading-relaxed text-slate-500">{c.desc}</div>
|
||||
<div className="mt-3 text-xs text-violet-400 opacity-0 transition group-hover:opacity-100">进入 →</div>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="mt-8 rounded-xl border border-line bg-ink-900 p-5">
|
||||
<div className="mb-3 text-sm font-medium text-slate-300">快速开始</div>
|
||||
<div className="flex flex-wrap gap-2">
|
||||
<button onClick={() => onSelect("studio")} className="rounded-lg bg-violet-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-violet-500">
|
||||
+ 新建 Agent 编排
|
||||
</button>
|
||||
<button onClick={() => onSelect("kb")} className="rounded-lg border border-line px-3 py-1.5 text-sm text-slate-300 hover:bg-ink-800">
|
||||
⬆ 入库知识
|
||||
</button>
|
||||
<button onClick={() => onSelect("memory")} className="rounded-lg border border-line px-3 py-1.5 text-sm text-slate-300 hover:bg-ink-800">
|
||||
◇ 管理记忆
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -110,24 +110,24 @@ export function KbView() {
|
||||
|
||||
return (
|
||||
<div className="flex h-full flex-col">
|
||||
<div className="flex items-center gap-2 border-b bg-white px-4 py-2">
|
||||
<span className="text-sm font-semibold text-gray-700">知识库</span>
|
||||
<div className="flex items-center gap-2 border-b border-line bg-ink-900 px-4 py-2">
|
||||
<span className="text-sm font-semibold text-slate-300">知识库</span>
|
||||
<input
|
||||
className="w-40 rounded border px-2 py-1 text-sm"
|
||||
className="w-40 rounded-md border border-line bg-ink-800 px-2 py-1 text-sm text-slate-200 focus:border-violet-500/60 focus:outline-none"
|
||||
value={kb}
|
||||
onChange={(e) => setKb(e.target.value)}
|
||||
placeholder="知识库名"
|
||||
title="知识库(Milvus kb 字段分区)"
|
||||
/>
|
||||
<span className="text-[11px] text-gray-400">入库 → 解析 / 切块 / 向量化 / 写入;检索 → 混合召回</span>
|
||||
<span className="text-[11px] text-slate-500">入库 → 解析 / 切块 / 向量化 / 写入;检索 → 混合召回</span>
|
||||
</div>
|
||||
|
||||
<div className="flex min-h-0 flex-1">
|
||||
{/* 左:入库 + 实时监控 */}
|
||||
<section className="flex w-1/2 flex-col border-r p-4">
|
||||
<h3 className="mb-2 text-xs font-semibold text-gray-600">入库</h3>
|
||||
<section className="flex w-1/2 flex-col border-r border-line p-4">
|
||||
<h3 className="mb-2 text-xs font-semibold text-slate-400">入库</h3>
|
||||
<textarea
|
||||
className="h-24 w-full resize-none rounded border p-2 text-sm"
|
||||
className="h-24 w-full resize-none rounded-md border border-line bg-ink-800 p-2 text-sm text-slate-200 focus:border-violet-500/60 focus:outline-none"
|
||||
value={text}
|
||||
onChange={(e) => setText(e.target.value)}
|
||||
placeholder={"每行一条知识,或上传文件"}
|
||||
@@ -136,26 +136,26 @@ export function KbView() {
|
||||
<button
|
||||
onClick={onIngest}
|
||||
disabled={ingesting || !text.trim()}
|
||||
className="rounded bg-emerald-600 px-3 py-1 text-sm text-white disabled:opacity-40"
|
||||
className="rounded-md bg-emerald-600 px-3 py-1 text-sm text-white hover:bg-emerald-500 disabled:opacity-40"
|
||||
>
|
||||
{ingesting ? "入库中…" : "⬆ 入库文本"}
|
||||
</button>
|
||||
<span className="text-[11px] text-gray-400">或</span>
|
||||
<span className="text-[11px] text-slate-500">或</span>
|
||||
<input
|
||||
ref={fileRef}
|
||||
type="file"
|
||||
accept=".txt,.md,.csv,.docx,.xlsx,.pdf"
|
||||
onChange={(e) => onFile(e.target.files?.[0])}
|
||||
disabled={ingesting}
|
||||
className="text-xs file:mr-2 file:rounded file:border file:bg-gray-50 file:px-2 file:py-1 file:text-xs"
|
||||
className="text-xs text-slate-400 file:mr-2 file:rounded file:border-0 file:bg-ink-700 file:px-2 file:py-1 file:text-xs file:text-slate-300"
|
||||
/>
|
||||
</div>
|
||||
<span className="mt-1 text-[10px] text-gray-400">支持 txt/md/csv/docx/xlsx/pdf(docx/xlsx/pdf 经 mcp-py 解析)</span>
|
||||
<span className="mt-1 text-[10px] text-slate-500">支持 txt/md/csv/docx/xlsx/pdf(docx/xlsx/pdf 经 mcp-py 解析)</span>
|
||||
|
||||
{/* 实时流水线进度 */}
|
||||
{prog && (
|
||||
<div className="mt-3 rounded border bg-gray-50 p-2">
|
||||
<div className="flex items-center gap-2 text-xs">
|
||||
<div className="mt-3 rounded-lg border border-line bg-ink-850 p-2.5">
|
||||
<div className="flex flex-wrap items-center gap-1.5 text-xs">
|
||||
{["解析", "切块", "向量化", "写Milvus", "写Bleve", "完成"].map((s) => {
|
||||
const active = prog.stage.startsWith(s) || (s === "完成" && prog.stage === "完成");
|
||||
const passed = stageOrder(prog.stage) > stageOrder(s);
|
||||
@@ -164,12 +164,12 @@ export function KbView() {
|
||||
key={s}
|
||||
className={`rounded px-1.5 py-0.5 text-[10px] ${
|
||||
prog.stage === "失败"
|
||||
? "bg-gray-100 text-gray-400"
|
||||
? "bg-ink-800 text-slate-600"
|
||||
: active
|
||||
? "bg-violet-600 text-white"
|
||||
? "bg-violet-600 text-white shadow-glow"
|
||||
: passed
|
||||
? "bg-emerald-100 text-emerald-700"
|
||||
: "bg-gray-100 text-gray-400"
|
||||
? "bg-emerald-500/15 text-emerald-400"
|
||||
: "bg-ink-800 text-slate-600"
|
||||
}`}
|
||||
>
|
||||
{s}
|
||||
@@ -177,24 +177,22 @@ export function KbView() {
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
{prog.error && <p className="mt-1 text-[11px] text-rose-600">✗ {prog.error}</p>}
|
||||
{prog.error && <p className="mt-1 text-[11px] text-rose-400">✗ {prog.error}</p>}
|
||||
{prog.total ? (
|
||||
<div className="mt-2">
|
||||
<div className="h-1.5 w-full overflow-hidden rounded bg-gray-200">
|
||||
<div className="h-full bg-violet-500 transition-all" style={{ width: `${pct}%` }} />
|
||||
</div>
|
||||
<div className="mt-0.5 text-[10px] text-gray-500">
|
||||
向量化 {prog.done ?? 0}/{prog.total} 块({pct}%)
|
||||
<div className="h-1.5 w-full overflow-hidden rounded-full bg-ink-700">
|
||||
<div className="h-full rounded-full bg-gradient-to-r from-violet-500 to-cyan-400 transition-all" style={{ width: `${pct}%` }} />
|
||||
</div>
|
||||
<div className="mt-1 text-[10px] text-slate-500">向量化 {prog.done ?? 0}/{prog.total} 块({pct}%)</div>
|
||||
</div>
|
||||
) : null}
|
||||
{prog.chunks.length > 0 && (
|
||||
<div className="mt-2">
|
||||
<div className="text-[10px] font-medium text-gray-500">拆分 {prog.chunks.length} 块:</div>
|
||||
<div className="text-[10px] font-medium text-slate-500">拆分 {prog.chunks.length} 块:</div>
|
||||
<ul className="mt-1 max-h-24 space-y-0.5 overflow-auto">
|
||||
{prog.chunks.map((c, i) => (
|
||||
<li key={i} className="truncate rounded bg-white px-1.5 py-0.5 text-[10px] text-gray-600">
|
||||
<span className="text-gray-400">#{i + 1}</span> {c}
|
||||
<li key={i} className="truncate rounded bg-ink-800 px-1.5 py-0.5 text-[10px] text-slate-400">
|
||||
<span className="text-slate-600">#{i + 1}</span> {c}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
@@ -203,12 +201,12 @@ export function KbView() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
<h3 className="mb-1 mt-4 text-xs font-semibold text-gray-600">入库历史</h3>
|
||||
<h3 className="mb-1 mt-4 text-xs font-semibold text-slate-400">入库历史</h3>
|
||||
<ul className="flex-1 space-y-1 overflow-auto">
|
||||
{logs.length === 0 && <li className="text-xs text-gray-400">尚无入库记录。</li>}
|
||||
{logs.length === 0 && <li className="text-xs text-slate-600">尚无入库记录。</li>}
|
||||
{logs.map((l, i) => (
|
||||
<li key={i} className={`text-xs ${l.ok ? "text-emerald-700" : "text-rose-600"}`}>
|
||||
<span className="text-gray-400">{l.t}</span> {l.ok ? "✓" : "✗"} {l.msg}
|
||||
<li key={i} className={`text-xs ${l.ok ? "text-emerald-400" : "text-rose-400"}`}>
|
||||
<span className="text-slate-600">{l.t}</span> {l.ok ? "✓" : "✗"} {l.msg}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
@@ -216,10 +214,10 @@ export function KbView() {
|
||||
|
||||
{/* 右:检索调试台 */}
|
||||
<section className="flex w-1/2 flex-col p-4">
|
||||
<h3 className="mb-2 text-xs font-semibold text-gray-600">检索调试台(混合召回 + rerank)</h3>
|
||||
<h3 className="mb-2 text-xs font-semibold text-slate-400">检索调试台(混合召回 + rerank)</h3>
|
||||
<div className="flex gap-2">
|
||||
<input
|
||||
className="flex-1 rounded border px-2 py-1 text-sm"
|
||||
className="flex-1 rounded-md border border-line bg-ink-800 px-2 py-1 text-sm text-slate-200 focus:border-violet-500/60 focus:outline-none"
|
||||
value={q}
|
||||
onChange={(e) => setQ(e.target.value)}
|
||||
onKeyDown={(e) => e.key === "Enter" && onSearch()}
|
||||
@@ -227,7 +225,7 @@ export function KbView() {
|
||||
/>
|
||||
<input
|
||||
type="number"
|
||||
className="w-16 rounded border px-2 py-1 text-sm"
|
||||
className="w-16 rounded-md border border-line bg-ink-800 px-2 py-1 text-sm text-slate-200 focus:border-violet-500/60 focus:outline-none"
|
||||
value={topK}
|
||||
min={1}
|
||||
max={20}
|
||||
@@ -237,46 +235,46 @@ export function KbView() {
|
||||
<button
|
||||
onClick={onSearch}
|
||||
disabled={searching || !q.trim()}
|
||||
className="rounded bg-violet-600 px-3 py-1 text-sm text-white disabled:opacity-40"
|
||||
className="rounded-md bg-violet-600 px-3 py-1 text-sm text-white hover:bg-violet-500 disabled:opacity-40"
|
||||
>
|
||||
{searching ? "检索中…" : "检索"}
|
||||
</button>
|
||||
</div>
|
||||
{err && <p className="mt-2 text-xs text-rose-600">✗ {err}</p>}
|
||||
{err && <p className="mt-2 text-xs text-rose-400">✗ {err}</p>}
|
||||
<ul className="mt-3 max-h-[40%] space-y-2 overflow-auto">
|
||||
{hits === null && <li className="text-xs text-gray-400">输入查询后展示命中片段与分数。</li>}
|
||||
{hits === null && <li className="text-xs text-slate-600">输入查询后展示命中片段与分数。</li>}
|
||||
{hits !== null && hits.length === 0 && (
|
||||
<li className="text-xs text-gray-400">无命中(知识库为空或 RAG 未配置)。</li>
|
||||
<li className="text-xs text-slate-600">无命中(知识库为空或 RAG 未配置)。</li>
|
||||
)}
|
||||
{hits?.map((h, i) => (
|
||||
<li key={i} className="rounded border bg-gray-50 p-2">
|
||||
<li key={i} className="rounded-lg border border-line bg-ink-850 p-2">
|
||||
<div className="mb-1 flex items-center gap-2 text-[10px]">
|
||||
<span className="rounded bg-sky-100 px-1.5 py-0.5 text-sky-700">混合检索</span>
|
||||
<span className="text-gray-400">#{i + 1}</span>
|
||||
<span className="ml-auto font-mono text-violet-600">{h.score.toFixed(3)}</span>
|
||||
<span className="rounded bg-sky-500/15 px-1.5 py-0.5 text-sky-400">混合检索</span>
|
||||
<span className="text-slate-600">#{i + 1}</span>
|
||||
<span className="ml-auto font-mono text-violet-400">{h.score.toFixed(3)}</span>
|
||||
</div>
|
||||
<div className="text-xs text-gray-800">{h.text}</div>
|
||||
<div className="text-xs text-slate-300">{h.text}</div>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
{/* 知识图谱(Neo4j / GraphRAG) */}
|
||||
<div className="mt-3 flex items-center justify-between border-t pt-2">
|
||||
<h3 className="text-xs font-semibold text-gray-600">知识图谱(Neo4j)</h3>
|
||||
<button onClick={onGraph} className="rounded border px-2 py-0.5 text-xs hover:bg-gray-50">
|
||||
<div className="mt-3 flex items-center justify-between border-t border-line pt-2">
|
||||
<h3 className="text-xs font-semibold text-slate-400">知识图谱(Neo4j)</h3>
|
||||
<button onClick={onGraph} className="rounded-md border border-line px-2 py-0.5 text-xs text-slate-300 hover:bg-ink-800">
|
||||
查看图谱
|
||||
</button>
|
||||
</div>
|
||||
<ul className="mt-2 flex-1 space-y-1 overflow-auto">
|
||||
{graph === null && <li className="text-[11px] text-gray-400">点「查看图谱」展示入库抽取的实体关系。</li>}
|
||||
{graph === null && <li className="text-[11px] text-slate-600">点「查看图谱」展示入库抽取的实体关系。</li>}
|
||||
{graph !== null && graph.length === 0 && (
|
||||
<li className="text-[11px] text-gray-400">该库暂无图谱(需配置 chat 模型 + 入库触发抽取)。</li>
|
||||
<li className="text-[11px] text-slate-600">该库暂无图谱(需配置 chat 模型 + 入库触发抽取)。</li>
|
||||
)}
|
||||
{graph?.map((t, i) => (
|
||||
<li key={i} className="flex items-center gap-1 text-[11px]">
|
||||
<span className="rounded bg-amber-100 px-1.5 py-0.5 text-amber-700">{t.s}</span>
|
||||
<span className="text-gray-400">—{t.p}→</span>
|
||||
<span className="rounded bg-emerald-100 px-1.5 py-0.5 text-emerald-700">{t.o}</span>
|
||||
<span className="rounded bg-amber-500/15 px-1.5 py-0.5 text-amber-300">{t.s}</span>
|
||||
<span className="text-slate-500">—{t.p}→</span>
|
||||
<span className="rounded bg-emerald-500/15 px-1.5 py-0.5 text-emerald-300">{t.o}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
@@ -5,11 +5,11 @@ import type { Identity } from "../lib/api";
|
||||
export function MemoryView({ identity }: { identity: Identity }) {
|
||||
return (
|
||||
<div className="flex h-full">
|
||||
<div className="w-96 border-r">
|
||||
<div className="w-96 border-r border-line bg-ink-900">
|
||||
<MemoryPanel identity={identity} />
|
||||
</div>
|
||||
<div className="flex-1 p-6 text-xs leading-relaxed text-gray-400">
|
||||
<div className="mb-1 text-sm font-semibold text-gray-600">模型记得我什么 / 会话历史</div>
|
||||
<div className="flex-1 p-6 text-xs leading-relaxed text-slate-500">
|
||||
<div className="mb-1 text-sm font-semibold text-slate-300">模型记得我什么 / 会话历史</div>
|
||||
规划:长期画像逐条列出可改/删(含来源),会话列表 + 多轮历史浏览与清空,注入开关。
|
||||
<br />
|
||||
当前左侧可登记偏好(→ memory_upsert → sundynix_user_profile)。
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
// 规划中模块占位 —— 让信息架构可见,同时说明该模块的定位与依赖。
|
||||
// 规划中模块占位 —— 深色,露出信息架构与定位。
|
||||
export function Placeholder({ title, desc }: { title: string; desc: string }) {
|
||||
return (
|
||||
<div className="flex h-full items-center justify-center">
|
||||
<div className="max-w-md rounded-lg border border-dashed bg-gray-50 p-6 text-center">
|
||||
<div className="mb-1 text-sm font-semibold text-gray-600">{title}</div>
|
||||
<p className="text-xs leading-relaxed text-gray-400">{desc}</p>
|
||||
<span className="mt-3 inline-block rounded bg-gray-200 px-2 py-0.5 text-[10px] text-gray-500">
|
||||
规划中
|
||||
</span>
|
||||
<div className="flex h-full items-center justify-center p-8">
|
||||
<div className="max-w-md rounded-xl border border-dashed border-line bg-ink-900 p-8 text-center">
|
||||
<div className="mb-2 text-base font-medium text-slate-200">{title}</div>
|
||||
<p className="text-sm leading-relaxed text-slate-500">{desc}</p>
|
||||
<span className="mt-4 inline-block rounded-md bg-ink-800 px-2.5 py-1 text-[11px] text-slate-400">规划中</span>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user