Skip to content

World's first open-source enterprise world model.

Library, Review and Settings on one scale (#364)

WaylandYang55f552ea8b44
diff --git a/web/src/i18n/en.ts b/web/src/i18n/en.ts
index c2759d37..d44a126d 100644
--- a/web/src/i18n/en.ts
+++ b/web/src/i18n/en.ts
@@ -1590,6 +1590,7 @@ export const en = {
},
/** 通用组件文案(SearchSelect 等) */
ui: {
+ close: "Close",
noMatches: "No matches",
keepTyping: (n: number) => `${n} more — keep typing to narrow down`,
},
diff --git a/web/src/i18n/zh.ts b/web/src/i18n/zh.ts
index b5735165..59923094 100644
--- a/web/src/i18n/zh.ts
+++ b/web/src/i18n/zh.ts
@@ -1399,6 +1399,7 @@ export const zh: Strings = {
closeFactAt: (d: string) => `在 ${d} 闭合`,
},
ui: {
+ close: "关闭",
noMatches: "没有匹配",
keepTyping: (n: number) => `还有 ${n} 项——继续输入以缩小范围`,
},
diff --git a/web/src/pages/Library.tsx b/web/src/pages/Library.tsx
index 10316324..db51e96b 100644
--- a/web/src/pages/Library.tsx
+++ b/web/src/pages/Library.tsx
@@ -20,7 +20,22 @@ import {
} from "../sourceKinds";
import { useKb, useKbId } from "../kb";
import { toast } from "../toast";
-import { Chip, type ChipTone, DangerConfirm, Loading, Pager } from "../ui";
+import {
+ Button,
+ Checkbox,
+ Chip,
+ type ChipTone,
+ cn,
+ DangerConfirm,
+ IconButton,
+ Input,
+ LinkButton,
+ Loading,
+ NativeSelect,
+ Pager,
+ Segmented,
+ Textarea,
+} from "../ui";
import {
KIND_ICON,
SOURCE_ICONS,
@@ -177,32 +192,24 @@ function SchedulePicker({
return (
<div>
- <div className="flex rounded-lg overflow-hidden border border-white/10 mb-2">
- {modes.map(({ key, label }) => (
- <button
- key={key}
- onClick={() => {
- setMode(key);
- emit(key, {});
- }}
- className={`flex-1 px-2 py-1.5 text-[11px] transition-colors ${
- mode === key
- ? "bg-white/10 text-neutral-100"
- : "text-neutral-500 hover:bg-white/[0.05] hover:text-neutral-300"
- }`}
- >
- {label}
- </button>
- ))}
- </div>
+ <Segmented
+ fill
+ size="sm"
+ className="mb-2"
+ value={mode}
+ onChange={(k) => {
+ setMode(k);
+ emit(k, {});
+ }}
+ options={modes.map(({ key, label }) => ({ value: key, label }))}
+ />
{mode === "interval" && (
- <div className="flex items-center gap-2 text-sm text-neutral-400">
+ <div className="flex items-center gap-2 text-body text-ink-2">
{S.library.schedule.every}
- <input
+ <Input size="sm" className="u-input-plain w-16 u-num text-center"
type="number"
min={1}
- className="input-dark u-input-plain w-16 px-2 py-1.5 text-sm u-num text-center"
value={every}
onChange={(e) => {
const n = Number(e.target.value) || 1;
@@ -211,24 +218,18 @@ function SchedulePicker({
}}
/>
{/* 两个选项不配下拉:分段切换,与上方模式条同配方 */}
- <div className="flex rounded-lg overflow-hidden border border-white/10">
- {(["minutes", "hours"] as const).map((u) => (
- <button
- key={u}
- onClick={() => {
- setUnit(u);
- emit("interval", { unit: u });
- }}
- className={`px-3 py-1.5 text-xs transition-colors ${
- unit === u
- ? "bg-white/10 text-neutral-100"
- : "text-neutral-500 hover:bg-white/[0.05] hover:text-neutral-300"
- }`}
- >
- {S.library.schedule[u]}
- </button>
- ))}
- </div>
+ <Segmented
+ size="sm"
+ value={unit}
+ onChange={(u) => {
+ setUnit(u);
+ emit("interval", { unit: u });
+ }}
+ options={(["minutes", "hours"] as const).map((u) => ({
+ value: u,
+ label: S.library.schedule[u],
+ }))}
+ />
</div>
)}
@@ -237,8 +238,11 @@ function SchedulePicker({
{mode === "weekly" && (
<div className="flex gap-1">
{S.library.schedule.daysShort.map((d, i) => (
- <button
+ <Button
+ variant={days.has(i) ? "primary" : "secondary"}
+ size="sm"
key={d}
+ className="flex-1"
onClick={() => {
const next = new Set(days);
if (next.has(i)) next.delete(i);
@@ -246,24 +250,21 @@ function SchedulePicker({
setDays(next);
emit("weekly", { days: next });
}}
- className={`flex-1 rounded-lg px-1 py-1.5 text-[11px] transition-colors ${
- days.has(i)
- ? "bg-white text-black font-medium"
- : "bg-white/[0.05] text-neutral-500 hover:text-neutral-300"
- }`}
>
{d}
- </button>
+ </Button>
))}
</div>
)}
- <div className="flex items-center gap-2 text-sm text-neutral-400">
+ <div className="flex items-center gap-2 text-body text-ink-2">
{S.library.schedule.at}
{/* 24h 纯文本输入:原生 time 控件块头大且跟随系统语言("上午 09:00") */}
- <input
- className={`input-dark u-input-plain w-[4.2rem] px-2 py-1.5 text-sm u-num text-center ${
- /^([01]?\d|2[0-3]):[0-5]\d$/.test(time) ? "" : "!border-[var(--u-danger)]"
- }`}
+ <Input
+ size="sm"
+ className={cn(
+ "u-input-plain u-num w-20 text-center",
+ !/^([01]?\d|2[0-3]):[0-5]\d$/.test(time) && "!border-danger",
+ )}
placeholder="09:00"
value={time}
onChange={(e) => {
@@ -279,8 +280,7 @@ function SchedulePicker({
{mode === "advanced" && (
<div>
{/* 表达式用 mono,placeholder 回默认字体(u-placeholder-sans) */}
- <input
- className="input-dark w-full px-3 py-2 text-sm font-mono u-placeholder-sans"
+ <Input className="w-full font-mono u-placeholder-sans"
placeholder={S.library.schedule.cronPlaceholder}
value={cron}
onChange={(e) => {
@@ -292,7 +292,7 @@ function SchedulePicker({
href={S.library.schedule.cronDocsUrl}
target="_blank"
rel="noreferrer"
- className="mt-1.5 inline-block text-[10.5px] text-neutral-500 underline decoration-white/20 underline-offset-2 hover:text-neutral-300 transition-colors"
+ className="u-link mt-2 inline-block text-fine"
>
{S.library.schedule.whatIsCron}
</a>
@@ -566,7 +566,7 @@ export function Library() {
{/* 工作页居左:与 Review/Ontology 同规——左缘随栏起步,切页不跳 */}
<div className="max-w-4xl">
<div className="flex items-center justify-between mb-4">
- <h1 className="u-title text-lg">
+ <h1 className="u-title text-title">
{selectedSource?.name ??
(selection === "uploads"
? S.library.uploads
@@ -579,30 +579,27 @@ export function Library() {
<div className={`relative ${showHistory ? "invisible" : ""}`}>
<Search
size={13}
- className="absolute left-2.5 top-1/2 -translate-y-1/2 text-neutral-500 pointer-events-none"
+ className="absolute left-2.5 top-1/2 -translate-y-1/2 text-ink-3 pointer-events-none"
/>
- <input
- className="input-dark w-52 pl-8 pr-7 py-1.5 text-[13px]"
+ <Input size="sm" className="w-52 pl-8 pr-8"
placeholder={S.library.filterPlaceholder}
value={filter}
onChange={(e) => setFilter(e.target.value)}
onKeyDown={(e) => e.key === "Escape" && setFilter("")}
/>
{filter && (
- <button
+ <IconButton size="sm" label={S.library.close} className="absolute right-2 top-1/2 -translate-y-1/2"
onClick={() => setFilter("")}
- className="absolute right-2 top-1/2 -translate-y-1/2 text-neutral-500 hover:text-neutral-200"
>
<X size={12} />
- </button>
+ </IconButton>
)}
</div>
{/* 按抽取状态筛。**选项写死成那五个**,不按库里实际有的填——
它是一组固定的管道状态,而「这个库现在没有失败的」正是用户
想通过筛一下确认的事 */}
{selection !== "deleted" && (
- <select
- className="input-dark px-2 py-1.5 text-[13px] shrink-0"
+ <NativeSelect size="sm" className="shrink-0"
value={graphFilter}
onChange={(e) => {
setGraphFilter(e.target.value);
@@ -615,38 +612,35 @@ export function Library() {
<option value="queued">{S.library.statusQueued}</option>
<option value="extracting">{S.library.statusExtracting}</option>
<option value="none">{S.library.statusNone}</option>
- </select>
+ </NativeSelect>
)}
{/* 一键重试。**只在真有失败时出现**——没有失败的库不该看到一个
点了什么都不会发生的按钮。数字写在按钮上,点之前就知道会动几篇 */}
{(docs.data?.failed ?? 0) > 0 && canUpload && (
- <button
+ <Button variant="secondary" size="sm" className="flex items-center gap-2 shrink-0"
onClick={() => retryFailed.mutate()}
disabled={retryFailed.isPending}
- className="u-btn u-btn-ghost px-3 py-1.5 text-xs flex items-center gap-1.5 shrink-0"
>
<RefreshCw size={12} />
{S.library.retryFailed(docs.data!.failed)}
- </button>
+ </Button>
)}
{/* 全库重建:清算语义,仅 KB admin;放在 All documents 视图 */}
{selection === "all" && canRebuild && (
- <button
+ <Button variant="danger" size="sm" className="flex items-center gap-2 shrink-0"
onClick={() => setRebuilding(true)}
- className="u-btn u-btn-ghost px-3 py-1.5 text-xs flex items-center gap-1.5 shrink-0 !text-[var(--u-danger)]"
>
<RefreshCw size={12} />
{S.library.rebuild}
- </button>
+ </Button>
)}
{canUpload && (
- <button
+ <Button variant="secondary" size="sm" className="flex items-center gap-2 shrink-0"
onClick={() => fileInput.current?.click()}
- className="u-btn u-btn-ghost px-3 py-1.5 text-xs flex items-center gap-1.5 shrink-0"
>
<Upload size={12} />
{S.library.upload}
- </button>
+ </Button>
)}
</div>
<input
@@ -682,16 +676,16 @@ export function Library() {
const total = (docs.data?.ready ?? 0) + pending;
const done = total - pending;
return (
- <div className="mb-3 glass rounded-xl px-4 py-2.5">
- <div className="flex items-center justify-between text-xs text-neutral-400 mb-1.5">
+ <div className="mb-3 glass rounded-xl px-4 py-3">
+ <div className="flex items-center justify-between text-small text-ink-2 mb-2">
<span>{S.library.extractProgress(done, total)}</span>
- <span className="u-num text-neutral-600">
+ <span className="u-num text-ink-3">
{Math.round((done / Math.max(total, 1)) * 100)}%
</span>
</div>
- <div className="h-1 rounded-full bg-white/[0.06] overflow-hidden">
+ <div className="h-1 rounded-full bg-surface-2 overflow-hidden">
<div
- className="h-full bg-[var(--u-warn)] transition-[width] duration-500"
+ className="u-progress-fill h-full bg-warn"
style={{ width: `${(done / Math.max(total, 1)) * 100}%` }}
/>
</div>
@@ -700,10 +694,10 @@ export function Library() {
})()}
{upload.isPending && (
- <div className="mb-3 text-sm text-[var(--u-warn)]">{S.library.uploading}</div>
+ <div className="mb-3 text-body text-warn">{S.library.uploading}</div>
)}
{upload.isError && (
- <div className="mb-3 text-sm text-rose-400">
+ <div className="mb-3 text-body text-danger">
{S.library.uploadFailed}: {String((upload.error as Error).message)}
</div>
)}
@@ -712,7 +706,7 @@ export function Library() {
<RunsPanel kbId={kb.id} sourceId={selectedSource.id} />
) : (
<>
- <div className={`glass rounded-2xl glass-hover ${dragging ? "u-highlight" : ""}`}>
+ <div className={`glass rounded-xl glass-hover ${dragging ? "u-highlight" : ""}`}>
{selection === "deleted" ? (
<DeletedTable
docs={pagedDocs}
@@ -722,18 +716,18 @@ export function Library() {
onPurge={setPurging}
/>
) : pagedDocs.length ? (
- <table className="w-full text-sm">
+ <table className="w-full text-body">
<thead>
- <tr className="text-left text-xs text-neutral-500 border-b border-white/10">
- <th className="px-4 py-2.5 font-medium">{S.library.colFile}</th>
+ <tr className="text-left text-small text-ink-3 border-b border-line">
+ <th className="px-4 py-3 font-medium">{S.library.colFile}</th>
{selection === "all" && (
- <th className="px-4 py-2.5 font-medium">{S.library.colSource}</th>
+ <th className="px-4 py-3 font-medium">{S.library.colSource}</th>
)}
- <th className="px-4 py-2.5 font-medium">{S.library.colStatus}</th>
- <th className="px-4 py-2.5 font-medium">{S.library.colGraph}</th>
- <th className="px-4 py-2.5 font-medium">{S.library.colChunks}</th>
- <th className="px-4 py-2.5 font-medium">{S.library.colSize}</th>
- <th className="px-4 py-2.5"></th>
+ <th className="px-4 py-3 font-medium">{S.library.colStatus}</th>
+ <th className="px-4 py-3 font-medium">{S.library.colGraph}</th>
+ <th className="px-4 py-3 font-medium">{S.library.colChunks}</th>
+ <th className="px-4 py-3 font-medium">{S.library.colSize}</th>
+ <th className="px-4 py-3"></th>
</tr>
</thead>
<tbody>
@@ -759,15 +753,15 @@ export function Library() {
</tbody>
</table>
) : query || graphFilter ? (
- <div className="py-20 text-center text-sm text-neutral-500">
+ <div className="py-20 text-center text-body text-ink-3">
{S.library.filterNoMatch}
</div>
) : (
- <div className="py-20 text-center text-sm text-neutral-500">
+ <div className="py-20 text-center text-body text-ink-3">
{canUpload ? (
<>
{S.library.dropHint}
- <div className="mt-2 text-xs text-neutral-600">{S.library.formats}</div>
+ <div className="mt-2 text-small text-ink-3">{S.library.formats}</div>
</>
) : (
S.library.emptyPull
@@ -932,7 +926,7 @@ function SourceBar({
return (
<div className="glass rounded-xl mb-3">
- <div className="px-4 py-2.5 flex items-center gap-3 text-xs">
+ <div className="px-4 py-3 flex items-center gap-3 text-small">
{/* api 与拉取型同一状态语汇:点 + 状态 + 时刻 + 产出/错误;
端点是一次性集成信息,放 Token 弹窗,不占常驻条 */}
{(isPull || isApi) && (
@@ -940,36 +934,36 @@ function SourceBar({
<span
className={`h-1.5 w-1.5 rounded-full shrink-0 ${SYNC_DOT[source.last_sync_status]}`}
/>
- <span className="text-neutral-300 whitespace-nowrap shrink-0">
+ <span className="text-ink-2 whitespace-nowrap shrink-0">
{isApi
? S.library.pushStatus[source.last_sync_status]
: S.library.syncStatus[source.last_sync_status]}
</span>
{source.last_sync_at && (
- <span className="text-neutral-600 u-num whitespace-nowrap shrink-0">
+ <span className="text-ink-3 u-num whitespace-nowrap shrink-0">
{source.last_sync_at.slice(0, 16).replace("T", " ")}
</span>
)}
{source.last_sync_status === "ok" && source.last_sync_added > 0 && (
- <span className="text-[var(--u-ok)]">
+ <span className="text-ok">
{S.library.lastSyncAdded(source.last_sync_added)}
</span>
)}
{source.last_sync_error && (
- <span className="text-rose-400 truncate min-w-0" title={source.last_sync_error}>
+ <span className="text-danger truncate min-w-0" title={source.last_sync_error}>
{source.last_sync_error}
</span>
)}
{isPull && (
<>
- <span className="text-neutral-600 truncate min-w-0">{configSummary}</span>
- <span className="text-neutral-600 shrink-0 u-num">{scheduleLabel(source)}</span>
+ <span className="text-ink-3 truncate min-w-0">{configSummary}</span>
+ <span className="text-ink-3 shrink-0 u-num">{scheduleLabel(source)}</span>
</>
)}
</>
)}
{!isPull && !isApi && (
- <span className="text-neutral-600 truncate min-w-0">
+ <span className="text-ink-3 truncate min-w-0">
{S.library.sourceKindHints[source.kind as "folder"] ?? ""}
</span>
)}
@@ -987,62 +981,57 @@ function SourceBar({
</Link>
)}
{source.missing_count > 0 && (
- <button
+ <Button variant="secondary" size="sm"
onClick={onCleanup}
- className="u-btn u-btn-ghost px-2.5 py-1 text-xs !text-[var(--u-warn)]"
>
{S.library.cleanupMissing(source.missing_count)}
- </button>
+ </Button>
)}
{/* History 对拉取型与 api 推送型都开放:推送失败(格式错等)也记 run */}
{(isPull || source.kind === "api") && (
/* 激活态用反色(与弹窗类型 tab、图标选中同一语汇),一眼可辨 */
- <button
+ <Button variant="secondary" size="sm"
onClick={onToggleHistory}
- className={`u-btn px-2.5 py-1 text-xs flex items-center gap-1.5 ${
+ className={`u-btn px-3 py-1 text-small flex items-center gap-2 ${
historyOpen ? "u-btn-primary" : "u-btn-ghost"
}`}
>
<HistoryIcon size={11} />
{S.library.syncHistory}
- </button>
+ </Button>
)}
{isPull && (
- <button
+ <Button variant="secondary" size="sm" className="flex items-center gap-2"
onClick={onSync}
disabled={busy || syncing}
- className="u-btn u-btn-ghost px-2.5 py-1 text-xs flex items-center gap-1.5"
>
<RefreshCw size={11} className={busy ? "animate-spin" : ""} />
{S.library.syncNow}
- </button>
+ </Button>
)}
{source.kind === "api" && (
- <button
+ <Button variant="secondary" size="sm" className="flex items-center gap-2"
onClick={onToken}
- className="u-btn u-btn-ghost px-2.5 py-1 text-xs flex items-center gap-1.5"
>
<KeyRound size={11} />
{S.library.viewToken}
- </button>
+ </Button>
)}
{/* 全量重抽本来源:所有类型都给(有文档就能重抽) */}
{onReExtract && source.doc_count > 0 && (
- <button
+ <Button variant="secondary" size="sm" className="flex items-center gap-2"
onClick={onReExtract}
- className="u-btn u-btn-ghost px-2.5 py-1 text-xs flex items-center gap-1.5"
>
<Waypoints size={11} />
{S.library.reExtractSource}
- </button>
+ </Button>
)}
- <button
+ <Button variant="secondary" size="sm"
onClick={onEdit}
title={S.library.sourceSettings}
- className="u-btn u-btn-ghost px-2 py-1"
>
<SettingsIcon size={12} />
- </button>
+ </Button>
</div>
</div>
</div>
@@ -1068,41 +1057,41 @@ function DropsModal({
return (
<div
- className="fixed inset-0 z-50 grid place-items-center bg-black/60 backdrop-blur-sm"
+ className="u-modal-scrim fixed inset-0 z-50 grid place-items-center"
onMouseDown={(e) => {
if (e.target === e.currentTarget) onClose();
}}
>
- <div className="glass-strong w-[36rem] max-w-[calc(100vw-2rem)] rounded-2xl shadow-2xl">
- <div className="px-5 pt-4 pb-3 border-b border-white/10">
+ <div className="glass-strong w-[36rem] max-w-[calc(100vw-2rem)] rounded-xl shadow-2xl">
+ <div className="px-6 pt-4 pb-3 border-b border-line">
<div className="flex items-center justify-between">
- <h2 className="u-title text-[15px]">{S.library.dropsTitle}</h2>
- <button onClick={onClose} className="text-neutral-500 hover:text-neutral-200">
+ <h2 className="u-title text-title">{S.library.dropsTitle}</h2>
+ <IconButton size="sm" label={S.library.close} onClick={onClose}>
<X size={15} />
- </button>
+ </IconButton>
</div>
- <p className="mt-1 text-xs text-neutral-500 truncate" title={file}>
+ <p className="mt-1 text-small text-ink-3 truncate" title={file}>
{file}
</p>
- <p className="mt-1.5 text-xs text-neutral-500">{S.library.dropsNote}</p>
+ <p className="mt-2 text-small text-ink-3">{S.library.dropsNote}</p>
</div>
- <div className="u-scroll max-h-80 overflow-y-auto px-5 py-3">
+ <div className="u-scroll max-h-80 overflow-y-auto px-6 py-3">
{rows.map((r) => (
<div
key={`${r.reason}:${r.detail}`}
- className="border-b border-white/5 py-2.5 last:border-0"
+ className="border-b border-line py-3 last:border-0"
>
<div className="flex items-baseline gap-2">
- <span className="text-sm text-neutral-200">
+ <span className="text-body text-ink">
{S.library.dropReason[r.reason] ?? r.reason}
</span>
- <span className="u-num ml-auto text-xs text-neutral-500">×{r.count}</span>
+ <span className="u-num ml-auto text-small text-ink-3">×{r.count}</span>
</div>
- <div className="mt-0.5 font-mono text-[11px] text-neutral-400 break-all">
+ <div className="mt-1 font-mono text-fine text-ink-2 break-all">
{r.detail}
</div>
{r.example && (
- <div className="mt-0.5 text-[11px] text-neutral-600 break-all">
+ <div className="mt-1 text-fine text-ink-3 break-all">
{S.library.dropsExample} {r.example}
</div>
)}
@@ -1133,31 +1122,30 @@ function ErrorModal({
return (
<div
- className="fixed inset-0 z-50 grid place-items-center bg-black/60 backdrop-blur-sm"
+ className="u-modal-scrim fixed inset-0 z-50 grid place-items-center"
onMouseDown={(e) => {
if (e.target === e.currentTarget) onClose();
}}
>
- <div className="glass-strong w-[36rem] max-w-[calc(100vw-2rem)] rounded-2xl shadow-2xl">
- <div className="px-5 pt-4 pb-3 border-b border-white/10">
+ <div className="glass-strong w-[36rem] max-w-[calc(100vw-2rem)] rounded-xl shadow-2xl">
+ <div className="px-6 pt-4 pb-3 border-b border-line">
<div className="flex items-center justify-between">
- <h2 className="u-title text-[15px]">{S.library.errorTitle}</h2>
- <button onClick={onClose} className="text-neutral-500 hover:text-neutral-200">
+ <h2 className="u-title text-title">{S.library.errorTitle}</h2>
+ <IconButton size="sm" label={S.library.close} onClick={onClose}>
<X size={15} />
- </button>
+ </IconButton>
</div>
- <p className="mt-1 text-xs text-neutral-500 truncate" title={file}>
+ <p className="mt-1 text-small text-ink-3 truncate" title={file}>
{file} · {kind}
</p>
</div>
- <div className="px-5 py-4">
- <pre className="u-scroll max-h-72 overflow-auto rounded-lg border border-white/10 bg-white/[0.03] p-3 text-[12px] leading-relaxed text-neutral-300 whitespace-pre-wrap break-words">
+ <div className="px-6 py-4">
+ <pre className="u-scroll max-h-72 overflow-auto rounded-lg border border-line bg-surface p-3 text-small leading-relaxed text-ink-2 whitespace-pre-wrap break-words">
{text}
</pre>
</div>
- <div className="flex justify-end gap-2 px-5 py-3 border-t border-white/10">
- <button
- className="u-btn u-btn-ghost px-3.5 py-1.5 text-xs"
+ <div className="flex justify-end gap-2 px-6 py-3 border-t border-line">
+ <Button variant="secondary" size="sm"
onClick={() =>
navigator.clipboard
.writeText(text)
@@ -1166,10 +1154,10 @@ function ErrorModal({
}
>
{S.library.copyError}
- </button>
- <button className="u-btn u-btn-primary px-3.5 py-1.5 text-xs" onClick={onClose}>
+ </Button>
+ <Button variant="primary" size="sm" onClick={onClose}>
{S.library.close}
- </button>
+ </Button>
</div>
</div>
</div>
@@ -1212,64 +1200,65 @@ function TokenModal({
return (
<div
- className="fixed inset-0 z-50 grid place-items-center bg-black/60 backdrop-blur-sm"
+ className="u-modal-scrim fixed inset-0 z-50 grid place-items-center"
onMouseDown={(e) => {
if (e.target === e.currentTarget) onClose();
}}
>
- <div className="glass-strong w-[32rem] max-w-[calc(100vw-2rem)] rounded-2xl shadow-2xl">
- <div className="flex items-center justify-between px-5 pt-4 pb-3 border-b border-white/10">
- <h2 className="u-title text-[15px] flex items-center gap-2">
- <KeyRound size={14} className="text-neutral-400" />
+ <div className="glass-strong w-[32rem] max-w-[calc(100vw-2rem)] rounded-xl shadow-2xl">
+ <div className="flex items-center justify-between px-6 pt-4 pb-3 border-b border-line">
+ <h2 className="u-title text-title flex items-center gap-2">
+ <KeyRound size={14} className="text-ink-2" />
{S.library.tokenTitle}
</h2>
- <button onClick={onClose} className="text-neutral-500 hover:text-neutral-200">
+ <IconButton size="sm" label={S.library.close} onClick={onClose}>
<X size={15} />
- </button>
+ </IconButton>
</div>
- <div className="px-5 py-4 space-y-3">
+ <div className="px-6 py-4 space-y-3">
{tokenQuery.isPending ? (
- <p className="text-sm text-neutral-500">{S.nav.loading}</p>
+ <p className="text-body text-ink-3">{S.nav.loading}</p>
) : token ? (
<>
- <button
- onClick={() => copy(token, S.library.tokenCopied)}
+ <Button
+ variant="secondary"
+ className="h-auto w-full justify-start whitespace-normal break-all py-3 text-left font-mono"
title={S.library.copyEndpoint}
- className="w-full text-left font-mono text-[12.5px] text-neutral-200 bg-white/[0.05] border border-white/10 hover:border-white/25 rounded-lg px-3 py-2.5 break-all transition-colors"
+ onClick={() => copy(token, S.library.tokenCopied)}
>
{token}
- </button>
- <p className="text-[11px] leading-relaxed text-neutral-500">
+ </Button>
+ <p className="text-fine leading-relaxed text-ink-3">
{S.library.tokenWarning}
</p>
<div>
- <p className="mb-1 text-[11px] text-neutral-500">{S.library.tokenUsage}</p>
- <button
- onClick={() => copy(endpoint, S.library.endpointCopied)}
+ <p className="mb-1 text-fine text-ink-3">{S.library.tokenUsage}</p>
+ <Button
+ variant="secondary"
+ className="h-auto w-full justify-start whitespace-pre-wrap break-all py-2 text-left font-mono text-ink-2"
title={S.library.copyEndpoint}
- className="w-full text-left font-mono text-[11.5px] text-neutral-400 hover:text-neutral-200 bg-white/[0.03] border border-white/10 rounded-lg px-3 py-2 break-all transition-colors"
+ onClick={() => copy(endpoint, S.library.endpointCopied)}
>
POST {endpoint}
{"\n"}Authorization: Bearer &lt;token&gt;
- </button>
+ </Button>
</div>
</>
) : (
- <p className="text-sm text-neutral-500">{S.library.noToken}</p>
+ <p className="text-body text-ink-3">{S.library.noToken}</p>
)}
</div>
- <div className="flex justify-end gap-2 px-5 py-3 border-t border-white/10">
- <button
- className="u-btn u-btn-ghost px-3.5 py-1.5 text-xs flex items-center gap-1.5"
+ <div className="flex justify-end gap-2 px-6 py-3 border-t border-line">
+ <Button variant="secondary" size="sm" className="flex items-center gap-2"
disabled={rotate.isPending || tokenQuery.isPending}
onClick={() => rotate.mutate()}
>
<RefreshCw size={11} className={rotate.isPending ? "animate-spin" : ""} />
{token ? S.library.rotateToken : S.library.generateToken}
- </button>
- <button className="u-btn u-btn-primary px-3.5 py-1.5 text-xs" onClick={onClose}>
+ </Button>
+ <Button variant="primary" size="sm" onClick={onClose}>
{S.library.close}
- </button>
+ </Button>
</div>
</div>
</div>
@@ -1285,40 +1274,40 @@ function RunsPanel({ kbId, sourceId }: { kbId: string; sourceId: string }) {
const list = runs.data?.runs ?? [];
return (
- <div className="glass rounded-2xl">
+ <div className="glass rounded-xl">
{runs.isLoading ? (
- <div className="py-20 text-center text-sm text-neutral-500">{S.nav.loading}</div>
+ <div className="py-20 text-center text-body text-ink-3">{S.nav.loading}</div>
) : list.length === 0 ? (
- <div className="py-20 text-center text-sm text-neutral-500">{S.library.noRuns}</div>
+ <div className="py-20 text-center text-body text-ink-3">{S.library.noRuns}</div>
) : (
<div className="px-4 py-2">
{list.map((r) => (
<div
key={r.id}
- className="flex items-center gap-3 py-2 text-xs border-b border-white/5 last:border-0"
+ className="flex items-center gap-3 py-2 text-small border-b border-line last:border-0"
>
<span
className={`h-1.5 w-1.5 rounded-full shrink-0 ${
r.status === "ok"
- ? "bg-[var(--u-ok)]"
+ ? "bg-ok"
: r.status === "failed"
- ? "bg-[var(--u-danger)]"
- : "bg-[var(--u-warn)] animate-pulse"
+ ? "bg-danger"
+ : "bg-warn animate-pulse"
}`}
/>
- <span className="u-num text-neutral-400 whitespace-nowrap shrink-0">
+ <span className="u-num text-ink-2 whitespace-nowrap shrink-0">
{r.started_at.slice(0, 16).replace("T", " ")}
</span>
- <span className="text-neutral-500 whitespace-nowrap shrink-0">
+ <span className="text-ink-3 whitespace-nowrap shrink-0">
{r.created_docs > 0 && S.library.runNew(r.created_docs)}
{r.created_docs > 0 && r.updated_docs > 0 && " · "}
{r.updated_docs > 0 && S.library.runUpdated(r.updated_docs)}
{r.status === "ok" && r.created_docs === 0 && r.updated_docs === 0 && (
- <span className="text-neutral-600">{S.library.runNothing}</span>
+ <span className="text-ink-3">{S.library.runNothing}</span>
)}
</span>
{r.error && (
- <span className="text-rose-400 truncate min-w-0" title={r.error}>
+ <span className="text-danger truncate min-w-0" title={r.error}>
{r.error}
</span>
)}
@@ -1483,47 +1472,47 @@ function SourceModal({
//(button 也算),导致图标网格/日程选择器悬停时第一个按钮常亮
const field = (label: string, node: React.ReactNode) => (
<div className="mb-3">
- <div className="mb-1 text-[11px] font-medium text-neutral-500">{label}</div>
+ <div className="mb-1 text-fine font-medium text-ink-3">{label}</div>
{node}
</div>
);
return (
<div
- className="fixed inset-0 z-50 grid place-items-center bg-black/60 backdrop-blur-sm"
+ className="u-modal-scrim fixed inset-0 z-50 grid place-items-center"
onMouseDown={(e) => {
if (e.target === e.currentTarget) onDone();
}}
>
- <div className="glass-strong w-[30rem] max-w-[calc(100vw-2rem)] max-h-[calc(100vh-4rem)] overflow-y-auto u-scroll rounded-2xl shadow-2xl">
- <div className="flex items-center justify-between px-5 pt-4 pb-3 border-b border-white/10">
- <h2 className="u-title text-[15px]">{S.library.newSourceTitle}</h2>
- <button onClick={() => onDone()} className="text-neutral-500 hover:text-neutral-200">
+ <div className="glass-strong w-[30rem] max-w-[calc(100vw-2rem)] max-h-[calc(100vh-4rem)] overflow-y-auto u-scroll rounded-xl shadow-2xl">
+ <div className="flex items-center justify-between px-6 pt-4 pb-3 border-b border-line">
+ <h2 className="u-title text-title">{S.library.newSourceTitle}</h2>
+ <IconButton size="sm" label={S.library.close} onClick={() => onDone()}>
<X size={15} />
- </button>
+ </IconButton>
</div>
- <div className="px-5 py-4">
+ <div className="px-6 py-4">
{/* 类型 */}
<div className="flex gap-2 mb-2">
{CREATABLE_SOURCE_KINDS.map((k) => {
const Icon = KIND_ICON[k];
return (
- <button
+ <Button variant="secondary" size="sm"
key={k}
onClick={() => setKind(k)}
- className={`u-btn flex-1 px-3 py-2 text-xs flex items-center justify-center gap-1.5 ${
+ className={`u-btn flex-1 px-3 py-2 text-small flex items-center justify-center gap-2 ${
kind === k ? "u-btn-primary" : "u-btn-ghost"
}`}
>
<Icon size={12} />
{S.library.sourceKinds[k]}
- </button>
+ </Button>
);
})}
</div>
{/* 类型自解释:一行说明;接口细节移入内置文档,弹窗只留链接 */}
- <p className="mb-4 text-[11px] leading-relaxed text-neutral-500">
+ <p className="mb-4 text-fine leading-relaxed text-ink-3">
{S.library.sourceKindHints[kind]}
{kind === "custom" && (
<>
@@ -1542,8 +1531,7 @@ function SourceModal({
{field(
S.library.sourceName,
- <input
- className="input-dark w-full px-3 py-2 text-sm"
+ <Input className="w-full"
value={name}
onChange={(e) => setName(e.target.value)}
autoFocus
@@ -1556,18 +1544,14 @@ function SourceModal({
S.library.iconLabel,
<div className="grid grid-cols-10 gap-1">
{Object.entries(SOURCE_ICONS).map(([key, Icon]) => (
- <button
+ <IconButton
key={key}
+ variant={icon === key ? "primary" : "ghost"}
+ label={key}
onClick={() => setIcon(icon === key ? null : key)}
- title={key}
- className={`h-8 grid place-items-center rounded-lg transition-colors ${
- icon === key
- ? "bg-white text-black"
- : "text-neutral-400 hover:bg-white/[0.07] hover:text-neutral-200"
- }`}
>
<Icon size={14} />
- </button>
+ </IconButton>
))}
</div>,
)}
@@ -1576,8 +1560,7 @@ function SourceModal({
<>
{field(
S.library.endpointField,
- <input
- className="input-dark w-full px-3 py-2 text-sm font-mono"
+ <Input className="w-full font-mono"
placeholder="https://your-service/utopia-feed"
value={endpoint}
onChange={(e) => setEndpoint(e.target.value)}
@@ -1585,8 +1568,7 @@ function SourceModal({
)}
{field(
S.library.authHeaderField,
- <input
- className="input-dark w-full px-3 py-2 text-sm font-mono"
+ <Input className="w-full font-mono"
type="password"
placeholder="Bearer sk-…"
value={authHeader}
@@ -1599,8 +1581,7 @@ function SourceModal({
{kind === "url" &&
field(
S.library.urlsField,
- <textarea
- className="input-dark w-full px-3 py-2 text-sm font-mono h-20 resize-y"
+ <Textarea className="w-full font-mono resize-y"
value={urls}
onChange={(e) => setUrls(e.target.value)}
/>,
@@ -1608,8 +1589,7 @@ function SourceModal({
{kind === "rss" &&
field(
S.library.feedUrl,
- <input
- className="input-dark w-full px-3 py-2 text-sm font-mono"
+ <Input className="w-full font-mono"
value={feedUrl}
onChange={(e) => setFeedUrl(e.target.value)}
/>,
@@ -1618,8 +1598,7 @@ function SourceModal({
<>
{field(
S.library.jiraUrlField,
- <input
- className="input-dark w-full px-3 py-2 text-sm font-mono"
+ <Input className="w-full font-mono"
placeholder="https://jira.example.com"
value={jiraUrl}
onChange={(e) => setJiraUrl(e.target.value)}
@@ -1627,8 +1606,7 @@ function SourceModal({
)}
{field(
S.library.jiraProjectField,
- <input
- className="input-dark w-full px-3 py-2 text-sm font-mono"
+ <Input className="w-full font-mono"
placeholder="KAFKA"
value={jiraProject}
onChange={(e) => setJiraProject(e.target.value)}
@@ -1636,8 +1614,7 @@ function SourceModal({
)}
{field(
S.library.tokenField,
- <input
- className="input-dark w-full px-3 py-2 text-sm font-mono"
+ <Input className="w-full font-mono"
type="password"
placeholder="Basic dXNlcjp0b2tlbg=="
value={authHeader}
@@ -1650,8 +1627,7 @@ function SourceModal({
<>
{field(
S.library.s3BucketField,
- <input
- className="input-dark w-full px-3 py-2 text-sm font-mono"
+ <Input className="w-full font-mono"
placeholder="documents"
value={s3Bucket}
onChange={(e) => setS3Bucket(e.target.value)}
@@ -1659,8 +1635,7 @@ function SourceModal({
)}
{field(
S.library.s3PrefixField,
- <input
- className="input-dark w-full px-3 py-2 text-sm font-mono"
+ <Input className="w-full font-mono"
placeholder="reports/2026/"
value={s3Prefix}
onChange={(e) => setS3Prefix(e.target.value)}
@@ -1668,8 +1643,7 @@ function SourceModal({
)}
{field(
S.library.s3EndpointField,
- <input
- className="input-dark w-full px-3 py-2 text-sm font-mono"
+ <Input className="w-full font-mono"
placeholder="http://minio.internal:9000"
value={s3Endpoint}
onChange={(e) => setS3Endpoint(e.target.value)}
@@ -1677,8 +1651,7 @@ function SourceModal({
)}
{field(
S.library.s3RegionField,
- <input
- className="input-dark w-full px-3 py-2 text-sm font-mono"
+ <Input className="w-full font-mono"
placeholder="us-east-1"
value={s3Region}
onChange={(e) => setS3Region(e.target.value)}
@@ -1688,16 +1661,14 @@ function SourceModal({
<>
{field(
S.library.s3KeyField,
- <input
- className="input-dark w-full px-3 py-2 text-sm font-mono"
+ <Input className="w-full font-mono"
value={s3Key}
onChange={(e) => setS3Key(e.target.value)}
/>,
)}
{field(
S.library.s3SecretField,
- <input
- className="input-dark w-full px-3 py-2 text-sm font-mono"
+ <Input className="w-full font-mono"
type="password"
value={s3Secret}
onChange={(e) => setS3Secret(e.target.value)}
@@ -1709,16 +1680,14 @@ function SourceModal({
<>
{field(
S.library.azAccountField,
- <input
- className="input-dark w-full px-3 py-2 text-sm font-mono"
+ <Input className="w-full font-mono"
value={azAccount}
onChange={(e) => setAzAccount(e.target.value)}
/>,
)}
{field(
S.library.azKeyField,
- <input
- className="input-dark w-full px-3 py-2 text-sm font-mono"
+ <Input className="w-full font-mono"
type="password"
value={azKey}
onChange={(e) => setAzKey(e.target.value)}
@@ -1729,8 +1698,7 @@ function SourceModal({
{kind === "gcs" &&
field(
S.library.gcsKeyField,
- <textarea
- className="input-dark w-full px-3 py-2 text-sm font-mono h-24"
+ <Textarea className="w-full font-mono"
placeholder='{"type":"service_account",...}'
value={gcsKey}
onChange={(e) => setGcsKey(e.target.value)}
@@ -1742,8 +1710,7 @@ function SourceModal({
<>
{field(
S.library.davUrlField,
- <input
- className="input-dark w-full px-3 py-2 text-sm font-mono"
+ <Input className="w-full font-mono"
placeholder="https://cloud.example.com/remote.php/dav/files/alice"
value={davUrl}
onChange={(e) => setDavUrl(e.target.value)}
@@ -1751,8 +1718,7 @@ function SourceModal({
)}
{field(
S.library.davPathField,
- <input
- className="input-dark w-full px-3 py-2 text-sm font-mono"
+ <Input className="w-full font-mono"
placeholder="/Documents"
value={davPath}
onChange={(e) => setDavPath(e.target.value)}
@@ -1760,16 +1726,14 @@ function SourceModal({
)}
{field(
S.library.davUserField,
- <input
- className="input-dark w-full px-3 py-2 text-sm font-mono"
+ <Input className="w-full font-mono"
value={davUser}
onChange={(e) => setDavUser(e.target.value)}
/>,
)}
{field(
S.library.davPassField,
- <input
- className="input-dark w-full px-3 py-2 text-sm font-mono"
+ <Input className="w-full font-mono"
type="password"
value={davPass}
onChange={(e) => setDavPass(e.target.value)}
@@ -1781,8 +1745,7 @@ function SourceModal({
<>
{field(
S.library.notionTokenField,
- <input
- className="input-dark w-full px-3 py-2 text-sm font-mono"
+ <Input className="w-full font-mono"
type="password"
placeholder="ntn_..."
value={notionToken}
@@ -1791,8 +1754,7 @@ function SourceModal({
)}
{field(
S.library.notionQueryField,
- <input
- className="input-dark w-full px-3 py-2 text-sm font-mono"
+ <Input className="w-full font-mono"
value={notionQuery}
onChange={(e) => setNotionQuery(e.target.value)}
/>,
@@ -1803,8 +1765,7 @@ function SourceModal({
<>
{field(
S.library.repoField,
- <input
- className="input-dark w-full px-3 py-2 text-sm font-mono"
+ <Input className="w-full font-mono"
placeholder="owner/name"
value={repo}
onChange={(e) => setRepo(e.target.value)}
@@ -1812,43 +1773,39 @@ function SourceModal({
)}
{field(
S.library.tokenField,
- <input
- className="input-dark w-full px-3 py-2 text-sm font-mono"
+ <Input className="w-full font-mono"
type="password"
placeholder="Bearer ghp_…"
value={authHeader}
onChange={(e) => setAuthHeader(e.target.value)}
/>,
)}
- <label className="mb-4 flex items-center gap-2 text-[11px] text-neutral-400">
- <input
- type="checkbox"
- checked={includePrs}
- onChange={(e) => setIncludePrs(e.target.checked)}
- />
- {S.library.includePullRequests}
- </label>
+ <Checkbox
+ className="mb-4"
+ checked={includePrs}
+ onChange={(e) => setIncludePrs(e.target.checked)}
+ label={S.library.includePullRequests}
+ />
</>
)}
{syncing && field(S.library.interval, <SchedulePicker onChange={setSchedule} />)}
{create.isError && (
- <p className="text-xs text-rose-400 mb-2">{(create.error as Error).message}</p>
+ <p className="text-small text-danger mb-2">{(create.error as Error).message}</p>
)}
</div>
- <div className="flex justify-end gap-2 px-5 py-3 border-t border-white/10">
- <button className="u-btn u-btn-ghost px-3.5 py-1.5 text-xs" onClick={() => onDone()}>
+ <div className="flex justify-end gap-2 px-6 py-3 border-t border-line">
+ <Button variant="secondary" size="sm" onClick={() => onDone()}>
{S.library.cancel}
- </button>
- <button
- className="u-btn u-btn-primary px-3.5 py-1.5 text-xs"
+ </Button>
+ <Button variant="primary" size="sm"
disabled={!valid || create.isPending}
onClick={() => create.mutate()}
>
{S.library.createSource}
- </button>
+ </Button>
</div>
</div>
</div>
@@ -1939,37 +1896,36 @@ function SourceEditModal({
// div 而非 label:label 会把 :hover/click 转发给第一个可标记控件
const field = (label: string, node: React.ReactNode) => (
<div className="mb-3">
- <div className="mb-1 text-[11px] font-medium text-neutral-500">{label}</div>
+ <div className="mb-1 text-fine font-medium text-ink-3">{label}</div>
{node}
</div>
);
return (
<div
- className="fixed inset-0 z-50 grid place-items-center bg-black/60 backdrop-blur-sm"
+ className="u-modal-scrim fixed inset-0 z-50 grid place-items-center"
onMouseDown={(e) => {
if (e.target === e.currentTarget) onDone();
}}
>
- <div className="glass-strong w-[30rem] max-w-[calc(100vw-2rem)] max-h-[calc(100vh-4rem)] overflow-y-auto u-scroll rounded-2xl shadow-2xl">
- <div className="flex items-center justify-between px-5 pt-4 pb-3 border-b border-white/10">
- <h2 className="u-title text-[15px]">{S.library.editSourceTitle}</h2>
- <button onClick={onDone} className="text-neutral-500 hover:text-neutral-200">
+ <div className="glass-strong w-[30rem] max-w-[calc(100vw-2rem)] max-h-[calc(100vh-4rem)] overflow-y-auto u-scroll rounded-xl shadow-2xl">
+ <div className="flex items-center justify-between px-6 pt-4 pb-3 border-b border-line">
+ <h2 className="u-title text-title">{S.library.editSourceTitle}</h2>
+ <IconButton size="sm" label={S.library.close} onClick={onDone}>
<X size={15} />
- </button>
+ </IconButton>
</div>
- <div className="px-5 py-4">
+ <div className="px-6 py-4">
{/* 类型只读:换类型 = 换身份,应新建来源 */}
- <div className="mb-4 flex items-center gap-2 text-xs text-neutral-400">
- <KindIcon size={13} className="text-neutral-500" />
+ <div className="mb-4 flex items-center gap-2 text-small text-ink-2">
+ <KindIcon size={13} className="text-ink-3" />
{S.library.sourceKinds[kind as keyof typeof S.library.sourceKinds] ?? kind}
</div>
{field(
S.library.sourceName,
- <input
- className="input-dark w-full px-3 py-2 text-sm"
+ <Input className="w-full"
value={name}
onChange={(e) => setName(e.target.value)}
/>,
@@ -1980,18 +1936,14 @@ function SourceEditModal({
S.library.iconLabel,
<div className="grid grid-cols-10 gap-1">
{Object.entries(SOURCE_ICONS).map(([key, Icon]) => (
- <button
+ <IconButton
key={key}
+ variant={icon === key ? "primary" : "ghost"}
+ label={key}
onClick={() => setIcon(icon === key ? null : key)}
- title={key}
- className={`h-8 grid place-items-center rounded-lg transition-colors ${
- icon === key
- ? "bg-white text-black"
- : "text-neutral-400 hover:bg-white/[0.07] hover:text-neutral-200"
- }`}
>
<Icon size={14} />
- </button>
+ </IconButton>
))}
</div>,
)}
@@ -1999,8 +1951,7 @@ function SourceEditModal({
{kind === "url" &&
field(
S.library.urlsField,
- <textarea
- className="input-dark w-full px-3 py-2 text-sm font-mono h-20 resize-y"
+ <Textarea className="w-full font-mono resize-y"
value={urls}
onChange={(e) => setUrls(e.target.value)}
/>,
@@ -2008,8 +1959,7 @@ function SourceEditModal({
{kind === "rss" &&
field(
S.library.feedUrl,
- <input
- className="input-dark w-full px-3 py-2 text-sm font-mono"
+ <Input className="w-full font-mono"
value={feedUrl}
onChange={(e) => setFeedUrl(e.target.value)}
/>,
@@ -2018,8 +1968,7 @@ function SourceEditModal({
<>
{field(
S.library.repoField,
- <input
- className="input-dark w-full px-3 py-2 text-sm font-mono"
+ <Input className="w-full font-mono"
placeholder="owner/name"
value={repo}
onChange={(e) => setRepo(e.target.value)}
@@ -2027,38 +1976,33 @@ function SourceEditModal({
)}
{field(
S.library.tokenField,
- <input
- className="input-dark w-full px-3 py-2 text-sm font-mono"
+ <Input className="w-full font-mono"
type="password"
placeholder="Bearer ghp_…"
value={authHeader}
onChange={(e) => setAuthHeader(e.target.value)}
/>,
)}
- <label className="mb-4 flex items-center gap-2 text-[11px] text-neutral-400">
- <input
- type="checkbox"
- checked={includePrs}
- onChange={(e) => setIncludePrs(e.target.checked)}
- />
- {S.library.includePullRequests}
- </label>
+ <Checkbox
+ className="mb-4"
+ checked={includePrs}
+ onChange={(e) => setIncludePrs(e.target.checked)}
+ label={S.library.includePullRequests}
+ />
</>
)}
{kind === "custom" && (
<>
{field(
S.library.endpointField,
- <input
- className="input-dark w-full px-3 py-2 text-sm font-mono"
+ <Input className="w-full font-mono"
value={endpoint}
onChange={(e) => setEndpoint(e.target.value)}
/>,
)}
{field(
S.library.authHeaderEditField,
- <input
- className="input-dark w-full px-3 py-2 text-sm font-mono"
+ <Input className="w-full font-mono"
type="password"
placeholder={S.library.authKeepHint}
value={authHeader}
@@ -2069,7 +2013,7 @@ function SourceEditModal({
)}
{ingestChanged && (
- <p className="mb-3 text-[11px] leading-relaxed text-neutral-500">
+ <p className="mb-3 text-fine leading-relaxed text-ink-3">
{S.library.editKeepNote}
</p>
)}
@@ -2087,38 +2031,36 @@ function SourceEditModal({
)}
{save.isError && (
- <p className="text-xs text-rose-400 mb-2">{(save.error as Error).message}</p>
+ <p className="text-small text-danger mb-2">{(save.error as Error).message}</p>
)}
{/* Danger zone:删除来源(文档保留,落回 Uploads) */}
- <div className="mt-4 pt-3 border-t border-white/10">
- <div className="mb-1 text-[11px] font-medium text-neutral-500">
+ <div className="mt-4 pt-3 border-t border-line">
+ <div className="mb-1 text-fine font-medium text-ink-3">
{S.library.dangerZone}
</div>
<div className="flex items-center justify-between gap-3">
- <span className="text-[11px] text-neutral-600">{S.library.deleteSourceHint}</span>
- <button
+ <span className="text-fine text-ink-3">{S.library.deleteSourceHint}</span>
+ <Button variant="secondary" size="sm" className="shrink-0"
onClick={() => setConfirmingDelete(true)}
- className="u-btn px-3.5 py-1.5 text-xs font-semibold shrink-0"
style={{ background: "var(--u-danger-solid)", color: "#ffffff" }}
>
{S.library.deleteSource}
- </button>
+ </Button>
</div>
</div>
</div>
- <div className="flex justify-end gap-2 px-5 py-3 border-t border-white/10">
- <button className="u-btn u-btn-ghost px-3.5 py-1.5 text-xs" onClick={onDone}>
+ <div className="flex justify-end gap-2 px-6 py-3 border-t border-line">
+ <Button variant="secondary" size="sm" onClick={onDone}>
{S.library.cancel}
- </button>
- <button
- className="u-btn u-btn-primary px-3.5 py-1.5 text-xs"
+ </Button>
+ <Button variant="primary" size="sm"
disabled={!valid || save.isPending}
onClick={() => save.mutate()}
>
{S.library.saveChanges}
- </button>
+ </Button>
</div>
</div>
@@ -2153,43 +2095,37 @@ function DeletedTable({
}) {
if (!docs.length) {
return (
- <div className="py-20 text-center text-sm text-neutral-500">{S.library.deletedEmpty}</div>
+ <div className="py-20 text-center text-body text-ink-3">{S.library.deletedEmpty}</div>
);
}
return (
- <table className="w-full text-sm">
+ <table className="w-full text-body">
<thead>
- <tr className="text-left text-xs text-neutral-500 border-b border-white/10">
- <th className="px-4 py-2.5 font-medium">{S.library.colFile}</th>
- <th className="px-4 py-2.5 font-medium">{S.library.colSource}</th>
- <th className="px-4 py-2.5 font-medium">{S.library.colDeleted}</th>
- <th className="px-4 py-2.5"></th>
+ <tr className="text-left text-small text-ink-3 border-b border-line">
+ <th className="px-4 py-3 font-medium">{S.library.colFile}</th>
+ <th className="px-4 py-3 font-medium">{S.library.colSource}</th>
+ <th className="px-4 py-3 font-medium">{S.library.colDeleted}</th>
+ <th className="px-4 py-3"></th>
</tr>
</thead>
<tbody>
{docs.map((d) => {
const src = sources.find((s) => s.id === d.source_id);
return (
- <tr key={d.id} className="border-b border-white/[0.06] last:border-0">
- <td className="px-4 py-2.5 text-neutral-300">{d.filename}</td>
- <td className="px-4 py-2.5 text-neutral-500">{src?.name ?? S.library.uploads}</td>
- <td className="px-4 py-2.5 u-num text-neutral-500">
+ <tr key={d.id} className="border-b border-line last:border-0">
+ <td className="px-4 py-3 text-ink-2">{d.filename}</td>
+ <td className="px-4 py-3 text-ink-3">{src?.name ?? S.library.uploads}</td>
+ <td className="px-4 py-3 u-num text-ink-3">
{d.deleted_at ? new Date(d.deleted_at).toLocaleString() : ""}
</td>
- <td className="px-4 py-2.5 text-right whitespace-nowrap">
- <button
- onClick={() => onRestore(d.id)}
- className="text-xs text-neutral-400 hover:text-neutral-100"
- >
+ <td className="px-4 py-3 text-right whitespace-nowrap">
+ <LinkButton onClick={() => onRestore(d.id)}>
{S.library.restore}
- </button>
+ </LinkButton>
{canPurge && (
- <button
- onClick={() => onPurge(d)}
- className="ml-4 text-xs text-neutral-500 hover:text-rose-400"
- >
+ <LinkButton tone="danger" className="ml-4" onClick={() => onPurge(d)}>
{S.library.purge}
- </button>
+ </LinkButton>
)}
</td>
</tr>
@@ -2230,82 +2166,82 @@ function DocRow({
doc.graph_status;
const SrcIcon = source ? sourceIcon(source) : Upload;
return (
- <tr className="border-b border-white/5 hover:bg-white/[0.03]">
- <td className="px-4 py-2.5 max-w-xs truncate" title={doc.filename}>
+ <tr className="border-b border-line">
+ <td className="px-4 py-3 max-w-xs truncate" title={doc.filename}>
<Link
to="/kb/$kbId/doc/$docId"
params={{ kbId, docId: doc.id }}
search={{}}
- className="text-neutral-200 hover:text-[var(--u-accent)]"
+ className="u-inline-link text-ink"
>
{doc.filename}
</Link>
</td>
{source !== undefined && (
- <td className="px-4 py-2.5">
- <span className="flex items-center gap-1.5 text-xs text-neutral-400">
- <SrcIcon size={12} className="shrink-0 text-neutral-500" />
+ <td className="px-4 py-3">
+ <span className="flex items-center gap-2 text-small text-ink-2">
+ <SrcIcon size={12} className="shrink-0 text-ink-3" />
<span className="truncate max-w-28">{source?.name ?? S.library.uploads}</span>
</span>
</td>
)}
- <td className="px-4 py-2.5">
+ <td className="px-4 py-3">
{/* 失败可点开看原文:tooltip 会截断、也没法复制 */}
{doc.status === "failed" && doc.error ? (
- <button
+ <Chip
+ tone="danger"
onClick={() => onShowError(S.library.errorParse, doc.error!)}
- className="align-middle"
>
- <Chip tone="danger">{statusText}</Chip>
- </button>
+ {statusText}
+ </Chip>
) : (
<Chip tone={STATUS_TONE[doc.status] ?? "neutral"}>{statusText}</Chip>
)}
{/* 解析管道失败:重跑 解析→索引→嵌入(解析器升级/瞬时故障重试) */}
{doc.status === "failed" && (
- <button onClick={onReprocess} className="u-link ml-1.5 text-xs">
+ <LinkButton underline className="ml-2" onClick={onReprocess}>
{S.library.reprocess}
- </button>
+ </LinkButton>
)}
{doc.missing_since && (
- <span className="ml-1.5 inline-block" title={doc.missing_since.slice(0, 16).replace("T", " ")}>
+ <span className="ml-2 inline-block" title={doc.missing_since.slice(0, 16).replace("T", " ")}>
<Chip tone="neutral">{S.library.notInSource}</Chip>
</span>
)}
</td>
- <td className="px-4 py-2.5">
+ <td className="px-4 py-3">
{doc.graph_status === "none" ? (
- <span className="text-xs text-neutral-600">{graphText}</span>
+ <span className="text-small text-ink-3">{graphText}</span>
) : doc.graph_status === "failed" && doc.graph_error ? (
- <button
+ <Chip
+ tone="danger"
onClick={() => onShowError(S.library.errorGraph, doc.graph_error!)}
- className="align-middle"
>
- <Chip tone="danger">{graphText}</Chip>
- </button>
+ {graphText}
+ </Chip>
) : (
<Chip tone={GRAPH_TONE[doc.graph_status] ?? "neutral"}>{graphText}</Chip>
)}
{/* 抽出来却没落地的事实。抽取成功不代表全须全尾,所以这个 chip 与
graph_status 并列而不是替代它——"done" 和 "3 dropped" 同时为真 */}
{dropTotal > 0 && drops && (
- <button onClick={() => onShowDrops(drops)} className="ml-1.5 align-middle">
- <Chip tone="warn">{S.library.dropsChip(dropTotal)}</Chip>
- </button>
+ <Chip tone="warn" className="ml-2" onClick={() => onShowDrops(drops)}>
+ {S.library.dropsChip(dropTotal)}
+ </Chip>
)}
{/* done 也可重抽:本体(描述/新类)调整后强制全量重抽正是常规操作 */}
{doc.status === "ready" && ["none", "failed", "done"].includes(doc.graph_status) && (
- <button onClick={onExtract} className="u-link ml-1.5 text-xs">
+ <LinkButton underline className="ml-2" onClick={onExtract}>
{doc.graph_status === "done" ? S.library.reExtract : S.library.extract}
- </button>
+ </LinkButton>
)}
</td>
- <td className="px-4 py-2.5 text-neutral-400">{doc.chunk_count || "—"}</td>
- <td className="px-4 py-2.5 text-neutral-400">{formatSize(doc.size_bytes)}</td>
- <td className="px-4 py-2.5 text-right">
- <button onClick={onDelete} className="text-xs text-neutral-500 hover:text-rose-400">
+ <td className="px-4 py-3 text-ink-2">{doc.chunk_count || "—"}</td>
+ <td className="px-4 py-3 text-ink-2">{formatSize(doc.size_bytes)}</td>
+ <td className="px-4 py-3 text-right">
+ <LinkButton tone="danger" onClick={onDelete}>
{S.library.delete}
- </button>
+ </LinkButton>
</td>
</tr>
);
diff --git a/web/src/pages/Review.tsx b/web/src/pages/Review.tsx
index bd1bd095..adde282e 100644
--- a/web/src/pages/Review.tsx
+++ b/web/src/pages/Review.tsx
@@ -19,7 +19,16 @@ import {
import { PendingFactRow, useCanDecide } from "./PendingFacts";
import { S } from "../i18n";
import { useKb, useKbId } from "../kb";
-import { Chip, type ChipTone, Pager, RAIL_CLS, cn } from "../ui";
+import {
+ Button,
+ Chip,
+ type ChipTone,
+ cn,
+ Input,
+ Pager,
+ RAIL_CLS,
+ Row,
+} from "../ui";
const DUP_PAGE = 6;
const FACT_PAGE = 10;
@@ -49,29 +58,29 @@ function SideCard({ side }: { side: ReviewSide }) {
className="h-2.5 w-2.5 rounded-full shrink-0"
style={{ backgroundColor: side.color }}
/>
- <span className="text-sm font-medium text-white truncate">
+ <span className="text-body font-medium text-ink truncate">
{side.name}
</span>
{side.disambiguator && (
- <span className="text-xs text-neutral-500 truncate">
+ <span className="text-small text-ink-3 truncate">
· {side.disambiguator}
</span>
)}
</div>
- <div className="text-xs text-neutral-500 mb-2">
+ <div className="text-small text-ink-3 mb-2">
{side.type_label ?? S.graph.untyped} ·{" "}
{S.review.factsCount(side.degree)}
</div>
{side.top_facts.length > 0 ? (
<ul className="space-y-1">
{side.top_facts.map((f, i) => (
- <li key={i} className="text-xs text-neutral-400 truncate">
+ <li key={i} className="text-small text-ink-2 truncate">
{f}
</li>
))}
</ul>
) : (
- <p className="text-xs text-neutral-600">{S.review.noFacts}</p>
+ <p className="text-small text-ink-3">{S.review.noFacts}</p>
)}
</div>
);
@@ -92,10 +101,10 @@ function DuplicateCard({
<div className="glass rounded-xl p-4">
<div className="flex gap-4">
<SideCard side={item.left} />
- <div className="self-center text-neutral-600 text-sm shrink-0">≟</div>
+ <div className="self-center text-ink-3 text-body shrink-0">≟</div>
<SideCard side={item.right} />
</div>
- <div className="mt-3 pt-3 flex items-center gap-3 border-t border-[var(--u-line)]">
+ <div className="mt-3 pt-3 flex items-center gap-3 border-t border-line">
<span
className={`u-chip ${item.stage === "human" ? "u-chip-warn" : "u-chip-neutral"}`}
>
@@ -104,30 +113,28 @@ function DuplicateCard({
: S.review.stageAdjudicating}
</span>
{reasonCode !== "namesake" && (
- <span className="text-xs text-neutral-500">
+ <span className="text-small text-ink-3">
{S.review.similarity(Math.round(item.score * 100))}
</span>
)}
{item.reason && (
- <span className="text-xs text-neutral-600 truncate min-w-0">
+ <span className="text-small text-ink-3 truncate min-w-0">
{escalationText(item.reason)}
</span>
)}
<div className="ml-auto flex gap-2 shrink-0">
- <button
- className="u-btn u-btn-ghost px-3 py-1.5 text-xs"
+ <Button variant="secondary" size="sm"
disabled={busy}
onClick={() => onDecide("keep")}
>
{S.review.keep}
- </button>
- <button
- className="u-btn u-btn-primary px-3 py-1.5 text-xs"
+ </Button>
+ <Button variant="primary" size="sm"
disabled={busy}
onClick={() => onDecide("merge")}
>
{S.review.merge}
- </button>
+ </Button>
</div>
</div>
</div>
@@ -149,15 +156,15 @@ function FactRow({
return (
<div className="glass rounded-xl p-4">
<div className="flex items-center gap-2 flex-wrap">
- <span className="text-sm font-medium text-white">
+ <span className="text-body font-medium text-ink">
{fact.subject_name}
</span>
- <span className="text-xs text-neutral-500">
+ <span className="text-small text-ink-3">
—{" "}
<span
className={
fact.predicate_label === null
- ? "italic text-neutral-600"
+ ? "italic text-ink-3"
: undefined
}
>
@@ -165,34 +172,32 @@ function FactRow({
</span>{" "}
→
</span>
- <span className="text-sm font-medium text-white">
+ <span className="text-body font-medium text-ink">
{fact.object_name ?? "?"}
</span>
- {range && <span className="text-xs text-neutral-500">({range})</span>}
+ {range && <span className="text-small text-ink-3">({range})</span>}
<span className="u-chip u-chip-warn ml-auto">
{S.review.confidence(Math.round(fact.confidence * 100))}
</span>
</div>
{fact.quote && (
- <p className="mt-2 text-xs text-neutral-500 italic line-clamp-2">
+ <p className="mt-2 text-small text-ink-3 italic line-clamp-2">
“{fact.quote}”
</p>
)}
<div className="mt-3 flex gap-2 justify-end">
- <button
- className="u-btn u-btn-ghost px-3 py-1.5 text-xs text-[var(--u-danger)]"
+ <Button variant="danger" size="sm"
disabled={busy}
onClick={onReject}
>
{S.review.reject}
- </button>
- <button
- className="u-btn u-btn-ghost px-3 py-1.5 text-xs"
+ </Button>
+ <Button variant="secondary" size="sm"
disabled={busy}
onClick={onConfirm}
>
{S.review.confirm}
- </button>
+ </Button>
</div>
</div>
);
@@ -222,28 +227,28 @@ function ConflictRow({
return (
<div className="glass rounded-xl p-4">
<div className="flex items-center gap-2 flex-wrap">
- <span className="text-sm font-medium text-white">{c.old_subject}</span>
- <span className="text-xs text-neutral-500">
+ <span className="text-body font-medium text-ink">{c.old_subject}</span>
+ <span className="text-small text-ink-3">
— {c.predicate_label} →
</span>
- <span className="text-sm font-medium text-white">
+ <span className="text-body font-medium text-ink">
{c.old_object ?? "?"}
</span>
{c.old_valid_from && (
- <span className="u-num text-xs text-neutral-500">
+ <span className="u-num text-small text-ink-3">
({S.review.conflictSince(c.old_valid_from.slice(0, 10))})
</span>
)}
- <span className="text-xs text-neutral-600">{S.review.conflictVs}</span>
- <span className="text-sm font-medium text-white">{c.new_subject}</span>
- <span className="text-xs text-neutral-500">
+ <span className="text-small text-ink-3">{S.review.conflictVs}</span>
+ <span className="text-body font-medium text-ink">{c.new_subject}</span>
+ <span className="text-small text-ink-3">
— {c.predicate_label} →
</span>
- <span className="text-sm font-medium text-white">
+ <span className="text-body font-medium text-ink">
{c.new_object ?? "?"}
</span>
{c.new_valid_from && (
- <span className="u-num text-xs text-neutral-500">
+ <span className="u-num text-small text-ink-3">
({S.review.conflictSince(c.new_valid_from.slice(0, 10))})
</span>
)}
@@ -252,37 +257,33 @@ function ConflictRow({
</span>
</div>
<div className="mt-3 flex items-center gap-2 justify-end">
- <button
- className="u-btn u-btn-ghost px-3 py-1.5 text-xs text-[var(--u-danger)]"
+ <Button variant="danger" size="sm"
disabled={busy}
onClick={() => onResolve("reject_new")}
>
{S.review.rejectNew}
- </button>
- <button
- className="u-btn u-btn-ghost px-3 py-1.5 text-xs"
+ </Button>
+ <Button variant="secondary" size="sm"
disabled={busy}
onClick={() => onResolve("keep")}
>
{S.review.keepBoth}
- </button>
+ </Button>
{needsDate && (
- <input
- className="input-dark u-num w-28 px-2 py-1.5 text-xs text-center"
+ <Input size="sm" className="u-num w-28 text-center"
placeholder={S.review.closeAtPlaceholder}
value={closeAt}
onChange={(e) => setCloseAt(e.target.value)}
/>
)}
- <button
- className="u-btn u-btn-ghost px-3 py-1.5 text-xs"
+ <Button variant="secondary" size="sm"
disabled={busy || (needsDate && !closeAtIso)}
onClick={() => onResolve("close", closeAtIso)}
>
{c.new_valid_from
? S.review.closeOldAt(c.new_valid_from.slice(0, 10))
: S.review.closeOld}
- </button>
+ </Button>
</div>
</div>
);
@@ -309,15 +310,15 @@ function UnconfirmedRow({
return (
<div className="glass rounded-xl p-4">
<div className="flex items-center gap-2 flex-wrap">
- <span className="text-sm font-medium text-white">
+ <span className="text-body font-medium text-ink">
{fact.subject_name}
</span>
- <span className="text-xs text-neutral-500">
+ <span className="text-small text-ink-3">
—{" "}
<span
className={
fact.predicate_label === null
- ? "italic text-neutral-600"
+ ? "italic text-ink-3"
: undefined
}
>
@@ -325,41 +326,38 @@ function UnconfirmedRow({
</span>{" "}
→
</span>
- <span className="text-sm font-medium text-white">
+ <span className="text-body font-medium text-ink">
{fact.object_name ?? "?"}
</span>
{range && (
- <span className="u-num text-xs text-neutral-500">({range})</span>
+ <span className="u-num text-small text-ink-3">({range})</span>
)}
</div>
{fact.quote && (
- <p className="mt-2 text-xs text-neutral-500 italic line-clamp-2">
+ <p className="mt-2 text-small text-ink-3 italic line-clamp-2">
“{fact.quote}”
</p>
)}
<div className="mt-3 flex items-center gap-2 justify-end">
- <button
- className="u-btn u-btn-ghost px-3 py-1.5 text-xs text-[var(--u-danger)]"
+ <Button variant="danger" size="sm"
disabled={busy}
onClick={onReject}
>
{S.review.reject}
- </button>
- <input
- className="input-dark u-num w-28 px-2 py-1.5 text-xs text-center"
+ </Button>
+ <Input size="sm" className="u-num w-28 text-center"
placeholder={S.review.closeAtPlaceholder}
value={closeAt}
onChange={(e) => setCloseAt(e.target.value)}
/>
- <button
- className="u-btn u-btn-ghost px-3 py-1.5 text-xs"
+ <Button variant="secondary" size="sm"
disabled={busy || !closeAtIso}
onClick={() => closeAtIso && onClose(closeAtIso)}
>
{closeAt.trim()
? S.review.closeFactAt(closeAt.trim())
: S.review.closeFact}
- </button>
+ </Button>
</div>
</div>
);
@@ -377,12 +375,12 @@ function MergeRow({
return (
<div className="glass rounded-xl px-4 py-3 flex items-center gap-3">
<div className="min-w-0 flex-1">
- <div className="text-sm text-neutral-300 truncate">
- <span className="text-neutral-500">{merge.source_name}</span>
- <span className="text-neutral-600"> → </span>
- <span className="text-white">{merge.target_name}</span>
+ <div className="text-body text-ink-2 truncate">
+ <span className="text-ink-3">{merge.source_name}</span>
+ <span className="text-ink-3"> → </span>
+ <span className="text-ink">{merge.target_name}</span>
</div>
- <div className="text-xs text-neutral-500 truncate">
+ <div className="text-small text-ink-3 truncate">
{merge.merged_by_name
? S.review.mergedBy(merge.merged_by_name)
: S.review.mergedByAi}
@@ -396,13 +394,12 @@ function MergeRow({
{S.review.reverted}
</span>
) : (
- <button
- className="u-btn u-btn-ghost px-3 py-1.5 text-xs shrink-0"
+ <Button variant="secondary" size="sm" className="shrink-0"
disabled={busy}
onClick={onRevert}
>
{S.review.revert}
- </button>
+ </Button>
)}
</div>
);
@@ -442,18 +439,18 @@ function DecisionRow({ e }: { e: ReviewHistoryEvent }) {
<Chip tone={DECISION_TONE[e.action] ?? "neutral"}>
{S.review.decisionActions[e.action] ?? e.action}
</Chip>
- <span className="text-sm text-neutral-300 truncate min-w-0">{text}</span>
+ <span className="text-body text-ink-2 truncate min-w-0">{text}</span>
{typeof d.confidence === "number" && (
- <span className="u-num text-xs text-neutral-600 shrink-0">
+ <span className="u-num text-small text-ink-3 shrink-0">
{Math.round(d.confidence * 100)}%
</span>
)}
{typeof d.valid_to === "string" && (
- <span className="u-num text-xs text-neutral-600 shrink-0">
+ <span className="u-num text-small text-ink-3 shrink-0">
→ {d.valid_to.slice(0, 10)}
</span>
)}
- <span className="ml-auto shrink-0 text-xs text-neutral-500">
+ <span className="ml-auto shrink-0 text-small text-ink-3">
{e.actor_name ?? S.review.aiActor}
{" · "}
<span className="u-num">{e.created_at.slice(0, 10)}</span>
@@ -495,56 +492,54 @@ function DefectRow({
return (
<div className="glass rounded-xl p-3">
<div className="flex items-baseline gap-2 flex-wrap">
- <span className="text-sm text-[var(--u-danger)]">{what}</span>
+ <span className="text-body text-danger">{what}</span>
{d.subject_label && (
- <span className="text-xs text-neutral-300">{d.subject_label}</span>
+ <span className="text-small text-ink-2">{d.subject_label}</span>
)}
{d.other_label && (
- <span className="text-xs text-neutral-500">↔ {d.other_label}</span>
+ <span className="text-small text-ink-3">↔ {d.other_label}</span>
)}
</div>
{d.path_labels.length > 0 && (
- <div className="mt-1 text-xs text-neutral-400">
+ <div className="mt-1 text-small text-ink-2">
{d.path_labels.join(" → ")} → {d.path_labels[0]}
</div>
)}
{unsatisfiable && (
- <p className="mt-1 text-xs text-neutral-500">
+ <p className="mt-1 text-small text-ink-3">
{S.review.defectNeverInstantiable}
</p>
)}
{rules.length > 0 && (
- <div className="mt-1 space-y-1 text-xs text-neutral-400">
+ <div className="mt-1 space-y-1 text-small text-ink-2">
<div>{S.review.rulesDisagreeCount(d.detail.count ?? 0)}</div>
{rules.map((r, i) => (
<div key={i}>
- <div className="text-neutral-500">
+ <div className="text-ink-3">
{S.review.rulesDisagreeRule(r.rule_a, r.via_a, r.rule_b, r.via_b, r.axiom)}
</div>
{r.examples.map(([x, y], j) => (
- <div key={j} className="pl-3 text-neutral-400">
- {x} <span className="text-neutral-600">·</span> {y}
+ <div key={j} className="pl-3 text-ink-2">
+ {x} <span className="text-ink-3">·</span> {y}
</div>
))}
</div>
))}
</div>
)}
- <div className="mt-2 flex gap-1.5">
- <button
- className="u-btn u-btn-ghost px-3 py-1.5 text-xs"
+ <div className="mt-2 flex gap-2">
+ <Button variant="secondary" size="sm"
disabled={busy}
onClick={() => onDecide("accepted")}
>
{S.review.defectAccepted}
- </button>
- <button
- className="u-btn u-btn-primary px-3 py-1.5 text-xs"
+ </Button>
+ <Button variant="primary" size="sm"
disabled={busy}
onClick={() => onDecide("fixed")}
>
{S.review.defectFixed}
- </button>
+ </Button>
</div>
</div>
);
@@ -595,58 +590,54 @@ function ViolationRow({
return (
<div className="glass rounded-xl p-3">
<div className="flex items-baseline gap-2 flex-wrap">
- <span className="text-sm text-[var(--u-warn)]">{what}</span>
+ <span className="text-body text-warn">{what}</span>
{v.predicate && (
- <span className="text-[11px] text-neutral-500">
+ <span className="text-fine text-ink-3">
{S.review.violationVia(v.predicate)}
</span>
)}
{v.path_len > 0 && (
- <span className="text-[11px] text-neutral-500">
+ <span className="text-fine text-ink-3">
{S.review.violationPath(v.path_len)}
</span>
)}
</div>
- <div className="mt-1.5 space-y-1">
+ <div className="mt-2 space-y-1">
{facts.map((f) => (
<div key={f.id} className="flex items-center gap-2">
- <span className="text-xs text-neutral-300 min-w-0 flex-1">{f.text}</span>
+ <span className="text-small text-ink-2 min-w-0 flex-1">{f.text}</span>
{!single && (
- <button
- className="u-btn u-btn-ghost shrink-0 px-2 py-1 text-[11px]"
+ <Button variant="secondary" size="sm" className="shrink-0"
disabled={busy}
title={S.review.retractThisHint}
onClick={() => onDecide("fact_retracted", { factId: f.id })}
>
{S.review.retractThis}
- </button>
+ </Button>
)}
</div>
))}
</div>
- <div className="mt-2 flex gap-1.5 flex-wrap">
- <button
- className="u-btn u-btn-ghost px-3 py-1.5 text-xs"
+ <div className="mt-2 flex gap-2 flex-wrap">
+ <Button variant="secondary" size="sm"
disabled={busy}
onClick={() => onDecide("accepted")}
>
{S.review.acceptBoth}
- </button>
- <button
- className="u-btn u-btn-ghost px-3 py-1.5 text-xs"
+ </Button>
+ <Button variant="secondary" size="sm"
disabled={busy}
onClick={() => onDecide("axiom_relaxed")}
>
{S.review.relaxAxiom}
- </button>
+ </Button>
{single && (
- <button
- className="u-btn u-btn-primary px-3 py-1.5 text-xs"
+ <Button variant="primary" size="sm"
disabled={busy}
onClick={() => onDecide("fact_retracted", { factId: v.left_fact })}
>
{S.review.retractFact}
- </button>
+ </Button>
)}
</div>
</div>
@@ -685,72 +676,66 @@ function ContradictionRow({
return (
<div className="glass rounded-xl p-3 border border-[color-mix(in_srgb,var(--u-contest)_35%,transparent)]">
<div className="flex items-baseline gap-2 flex-wrap">
- <span className="text-sm text-[var(--u-contest)]">{what}</span>
+ <span className="text-body text-contest">{what}</span>
{v.predicate && (
- <span className="text-[11px] text-neutral-500">
+ <span className="text-fine text-ink-3">
{S.review.violationVia(v.predicate)}
</span>
)}
</div>
- <div className="mt-1.5 space-y-1">
- <div className="text-xs text-neutral-300">
+ <div className="mt-2 space-y-1">
+ <div className="text-small text-ink-2">
{S.review.derivedLine(d.subject ?? "?", d.predicate ?? "?", d.object ?? "?")}
{d.rule && d.via_label && (
- <span className="ml-1.5 text-neutral-500">
+ <span className="ml-2 text-ink-3">
{S.review.derivedBy(d.rule, d.via_label)}
</span>
)}
</div>
- <div className="text-xs text-neutral-300">
+ <div className="text-small text-ink-2">
{S.review.assertedLine(v.left_text)}
</div>
</div>
- <p className="mt-1.5 text-xs text-neutral-500">{hint}</p>
- <div className="mt-2 flex gap-1.5 flex-wrap items-center">
- <input
+ <p className="mt-2 text-small text-ink-3">{hint}</p>
+ <div className="mt-2 flex gap-2 flex-wrap items-center">
+ <Input size="sm" className="u-num"
type="date"
- className="input-dark px-2 py-1 text-xs u-num"
value={closeAt}
title={S.review.closeAssertion}
onChange={(e) => setCloseAt(e.target.value)}
/>
- <button
- className="u-btn u-btn-primary px-3 py-1.5 text-xs"
+ <Button variant="primary" size="sm"
disabled={busy || !closeAt}
onClick={() =>
onDecide("fact_closed", { closeAt: new Date(closeAt).toISOString() })
}
>
{S.review.closeAssertion}
- </button>
- <button
- className="u-btn u-btn-ghost px-3 py-1.5 text-xs"
+ </Button>
+ <Button variant="secondary" size="sm"
disabled={busy}
onClick={() => onDecide("fact_retracted")}
>
{S.review.retractAssertion}
- </button>
- <button
- className="u-btn u-btn-ghost px-3 py-1.5 text-xs"
+ </Button>
+ <Button variant="secondary" size="sm"
disabled={busy}
onClick={onDuplicates}
>
{S.review.seeDuplicates}
- </button>
- <button
- className="u-btn u-btn-ghost px-3 py-1.5 text-xs"
+ </Button>
+ <Button variant="secondary" size="sm"
disabled={busy}
onClick={onOntology}
>
{S.review.openOntology}
- </button>
- <button
- className="u-btn u-btn-ghost px-3 py-1.5 text-xs"
+ </Button>
+ <Button variant="secondary" size="sm"
disabled={busy}
onClick={() => onDecide("accepted")}
>
{S.review.letBothStand}
- </button>
+ </Button>
</div>
</div>
);
@@ -809,7 +794,7 @@ const PAGE_SIZE: Record<Sel, number> = {
function RailHeader({ label }: { label: string }) {
return (
- <div className="px-4 pt-4 pb-1.5 text-[10px] font-medium uppercase tracking-[0.08em] text-neutral-500">
+ <div className="px-4 pt-4 pb-2 text-fine font-medium uppercase tracking-[0.08em] text-ink-3">
{label}
</div>
);
@@ -830,28 +815,23 @@ function RailItem({
external?: boolean;
}) {
return (
- <button
+ <Row
+ density="nav"
+ active={active}
onClick={onClick}
- className={cn(
- "w-full flex items-center gap-2 rounded-lg px-2.5 py-1.5 text-[13px] transition-colors",
- active
- ? "u-nav-active"
- : "text-neutral-400 hover:bg-white/[0.05] hover:text-neutral-200",
- )}
+ trailing={
+ count !== null ? (
+ <span className={cn("u-num", count > 0 ? "text-ink-2" : "text-ink-3")}>
+ {count}
+ </span>
+ ) : undefined
+ }
>
- <span className="truncate">{label}</span>
- {external && <ArrowUpRight size={11} className="shrink-0 opacity-50" />}
- {count !== null && (
- <span
- className={cn(
- "ml-auto shrink-0 u-num text-[10.5px]",
- count > 0 ? "text-neutral-400" : "text-neutral-700",
- )}
- >
- {count}
- </span>
- )}
- </button>
+ <span className="flex items-center gap-2">
+ <span className="truncate">{label}</span>
+ {external && <ArrowUpRight size={11} className="shrink-0 opacity-50" />}
+ </span>
+ </Row>
);
}
@@ -1061,7 +1041,7 @@ export function Review() {
压到底,两者要一起给 */}
<aside className={`${RAIL_CLS} flex flex-col overflow-y-auto u-scroll`}>
<RailHeader label={S.review.tabQueue} />
- <div className="px-2 space-y-0.5">
+ <div className="px-2 space-y-1">
<RailItem
active={active === "pending"}
label={S.review.railPending}
@@ -1106,7 +1086,7 @@ export function Review() {
/>
</div>
<RailHeader label={S.review.tabHistory} />
- <div className="px-2 space-y-0.5">
+ <div className="px-2 space-y-1">
<RailItem
active={active === "decisions"}
label={S.review.railDecisions}
@@ -1127,7 +1107,7 @@ export function Review() {
而口径的决定从来不进 `review_history`(它只捞 review./fact./
conflict./merge.,口径记的是 mapping.decided)。
**计数留着**——收件箱该说「有几条等你」,但活在有上下文的那一页干 */}
- <div className="mt-auto border-t border-white/5 px-2 py-2">
+ <div className="mt-auto border-t border-line px-2 py-2">
<RailItem
active={false}
label={S.review.railMappings}
@@ -1144,20 +1124,20 @@ export function Review() {
<div className="flex-1 min-w-0 overflow-y-auto u-scroll px-8 py-6">
<div className="max-w-4xl">
{review.isPending && (
- <p className="text-sm text-neutral-500">{S.nav.loading}</p>
+ <p className="text-body text-ink-3">{S.nav.loading}</p>
)}
{review.isError && (
- <p className="text-sm text-rose-400">
+ <p className="text-body text-danger">
{(review.error as Error).message}
</p>
)}
{review.data && (
<section>
- {/* 页级标题:与 Library/KB Settings 同级(text-lg),不是卡片头 */}
- <h2 className="u-title text-lg mb-1">{SECTION[active].title}</h2>
+ {/* 页级标题:与 Library/KB Settings 同级(text-title),不是卡片头 */}
+ <h2 className="u-title text-title mb-1">{SECTION[active].title}</h2>
{SECTION[active].hint && (
- <p className="text-xs text-neutral-500 mb-3">
+ <p className="text-small text-ink-3 mb-3">
{SECTION[active].hint}
</p>
)}
@@ -1168,7 +1148,7 @@ export function Review() {
active !== "violations" &&
active !== "defects" &&
counts[active] === 0 && (
- <div className="glass rounded-xl p-10 text-center text-sm text-neutral-500">
+ <div className="glass rounded-xl p-8 text-center text-body text-ink-3">
{queueEmpty ? S.review.empty : S.review.categoryEmpty}
</div>
)}
@@ -1277,7 +1257,7 @@ export function Review() {
{active === "defects" && (
<div className="space-y-3">
{counts.defects === 0 && (
- <div className="glass rounded-xl p-10 text-center text-sm text-neutral-500">
+ <div className="glass rounded-xl p-8 text-center text-body text-ink-3">
{S.review.categoryEmpty}
</div>
)}
@@ -1305,17 +1285,16 @@ export function Review() {
{/* ghost 而不是实心白:这和「探查映射」是同一种东西——
手动触发一次分析,不是这一页的主操作。留一个实心白给
真正的决定(确认 / 合并) */}
- <button
- className="u-btn u-btn-ghost px-3 py-1.5 text-xs"
+ <Button variant="secondary" size="sm"
disabled={runCheck.isPending}
onClick={() => runCheck.mutate()}
>
{runCheck.isPending
? S.review.checking
: S.review.runCheck}
- </button>
+ </Button>
{runCheck.data && (
- <span className="text-xs text-neutral-500">
+ <span className="text-small text-ink-3">
{/* 三种结果说三句话。**`found` 不是要报的数**:
重跑会把已裁决的那些重新算出来,说「3 处矛盾」而
列表只剩一条,看起来像界面漏了东西 */}
@@ -1330,7 +1309,7 @@ export function Review() {
)}
</div>
{counts.violations === 0 && !runCheck.data && (
- <div className="glass rounded-xl p-10 text-center text-sm text-neutral-500">
+ <div className="glass rounded-xl p-8 text-center text-body text-ink-3">
{S.review.checkNeverRun}
</div>
)}
@@ -1339,7 +1318,7 @@ export function Review() {
key={v.id}
className={
v.id === search.item
- ? "rounded-xl ring-1 ring-[var(--u-contest)]"
+ ? "rounded-xl ring-1 ring-contest"
: undefined
}
>
@@ -1362,7 +1341,7 @@ export function Review() {
{active === "merges" &&
(counts.merges === 0 ? (
- <div className="glass rounded-xl p-10 text-center text-sm text-neutral-500">
+ <div className="glass rounded-xl p-8 text-center text-body text-ink-3">
{S.review.historyEmpty}
</div>
) : (
@@ -1380,9 +1359,9 @@ export function Review() {
{active === "decisions" &&
(history.isPending ? (
- <p className="text-sm text-neutral-500">{S.nav.loading}</p>
+ <p className="text-body text-ink-3">{S.nav.loading}</p>
) : (history.data?.total ?? 0) === 0 ? (
- <div className="glass rounded-xl p-10 text-center text-sm text-neutral-500">
+ <div className="glass rounded-xl p-8 text-center text-body text-ink-3">
{S.review.decisionsEmpty}
</div>
) : (
diff --git a/web/src/pages/Settings.tsx b/web/src/pages/Settings.tsx
index d9f4abb4..624e2e74 100644
--- a/web/src/pages/Settings.tsx
+++ b/web/src/pages/Settings.tsx
@@ -6,7 +6,17 @@ import { api, DEFAULT_ONTOLOGY_PACKS } from "../api";
import { LANG_NAMES, S } from "../i18n";
import { useKb } from "../kb";
import { toast } from "../toast";
-import { SearchSelect } from "../ui";
+import {
+ Button,
+ Checkbox,
+ ChoiceCard,
+ IconButton,
+ Input,
+ LinkButton,
+ Pill,
+ SearchSelect,
+ Segmented,
+} from "../ui";
import { Members } from "./Members";
/** 一个源授权给了哪些工作区(0014)。
@@ -59,31 +69,29 @@ function SourceGrants({ sourceId }: { sourceId: string }) {
);
return (
- <div className="border-t border-white/5 pt-3 space-y-2">
+ <div className="border-t border-line pt-3 space-y-2">
<div className="flex items-baseline gap-2">
- <span className="text-[11px] text-neutral-500">
+ <span className="text-fine text-ink-3">
{S.settings.datasources.grants}
</span>
{granted.length === 0 ? (
- <span className="text-[11px] text-neutral-600">
+ <span className="text-fine text-ink-3">
{S.settings.datasources.grantsNone}
</span>
) : (
- <div className="flex flex-wrap gap-1.5">
+ <div className="flex flex-wrap gap-2">
{granted.map((w) => (
<span
key={w.id}
- className="u-chip u-chip-neutral text-[11px] flex items-center gap-1"
+ className="u-chip u-chip-neutral text-fine flex items-center gap-1"
>
{w.name}
- <button
- className="text-neutral-500 hover:text-[var(--u-danger)]"
- title={S.settings.datasources.grantRevoke}
+ <IconButton size="sm" label={S.settings.datasources.grantRevoke}
disabled={revoke.isPending}
onClick={() => revoke.mutate(w.id)}
>
<X size={10} />
- </button>
+ </IconButton>
</span>
))}
</div>
@@ -103,7 +111,7 @@ function SourceGrants({ sourceId }: { sourceId: string }) {
/>
</div>
)}
- {notice && <p className="text-[11px] text-neutral-500">{notice}</p>}
+ {notice && <p className="text-fine text-ink-3">{notice}</p>}
</div>
);
}
@@ -150,76 +158,59 @@ function DeploymentAdmin() {
return (
<div className="glass rounded-xl p-4 space-y-4">
- <label className="flex items-start gap-3 cursor-pointer">
- <input
- type="checkbox"
- className="mt-0.5"
- checked={open}
- disabled={dep.isPending || save.isPending}
- onChange={(e) => save.mutate({ open: e.target.checked })}
- />
- <span>
- <span className="block text-sm text-neutral-200">
- {S.settings.deployment.openReg}
- </span>
- <span className="block text-xs text-neutral-500 mt-0.5">
- {S.settings.deployment.openRegHint}
- </span>
- </span>
- </label>
+ <Checkbox
+ checked={open}
+ disabled={dep.isPending || save.isPending}
+ onChange={(e) => save.mutate({ open: e.target.checked })}
+ label={S.settings.deployment.openReg}
+ hint={S.settings.deployment.openRegHint}
+ />
{/* 新建库的本体语言。**不是界面语言**——界面语言是每个人自己在账户菜单里选的,
根本不经过后端(docs/decisions/0004)。说明里必须把这句讲出来 */}
- <div className="flex items-start justify-between gap-4 border-t border-white/10 pt-4">
+ <div className="flex items-start justify-between gap-4 border-t border-line pt-4">
<div className="min-w-0">
- <span className="block text-sm text-neutral-200">
+ <span className="block text-body text-ink">
{S.settings.deployment.ontologyLang}
</span>
- <span className="block text-xs text-neutral-500 mt-0.5">
+ <span className="block text-small text-ink-3 mt-1">
{S.settings.deployment.ontologyLangHint}
</span>
</div>
- <div className="flex gap-1 rounded-lg bg-white/5 p-1 h-fit shrink-0">
- {(["en", "zh"] as const).map((l) => (
- <button
- key={l}
- disabled={dep.isPending || save.isPending}
- onClick={() => save.mutate({ open, ontologyLang: l })}
- className={`rounded-md px-3 py-1 text-[12px] font-medium transition-colors ${
- (dep.data?.default_ontology_lang ?? "en") === l
- ? "bg-white/10 text-neutral-100"
- : "text-neutral-500 hover:text-neutral-300"
- }`}
- >
- {LANG_NAMES[l]}
- </button>
- ))}
- </div>
+ <Segmented
+ size="sm"
+ className="h-fit shrink-0"
+ disabled={dep.isPending || save.isPending}
+ value={dep.data?.default_ontology_lang ?? "en"}
+ onChange={(l) => save.mutate({ open, ontologyLang: l })}
+ options={(["en", "zh"] as const).map((l) => ({
+ value: l,
+ label: LANG_NAMES[l],
+ }))}
+ />
</div>
- <div className="flex items-start justify-between gap-4 border-t border-white/10 pt-4">
+ <div className="flex items-start justify-between gap-4 border-t border-line pt-4">
<div className="min-w-0">
- <span className="block text-sm text-neutral-200">
+ <span className="block text-body text-ink">
{S.settings.deployment.workers}
</span>
- <span className="block text-xs text-neutral-500 mt-0.5">
+ <span className="block text-small text-ink-3 mt-1">
{S.settings.deployment.workersHint}
</span>
</div>
<div className="flex items-center gap-2 shrink-0">
- <input
+ <Input size="sm" className="u-input-plain w-16 u-num text-center"
type="number"
min={1}
max={32}
- className="input-dark u-input-plain w-16 px-2 py-1.5 text-sm u-num text-center"
value={shown}
disabled={dep.isPending}
onChange={(e) =>
setWorkers(Math.max(1, Math.min(32, Number(e.target.value) || 1)))
}
/>
- <button
- className="u-btn u-btn-ghost px-3 py-1.5 text-xs"
+ <Button variant="secondary" size="sm"
disabled={
save.isPending ||
workers === null ||
@@ -228,30 +219,29 @@ function DeploymentAdmin() {
onClick={() => save.mutate({ open, workers: shown })}
>
{S.settings.deployment.workersApply}
- </button>
+ </Button>
</div>
</div>
{/* 按模型的并发才是真正的节流:约束来自供应商的速率限制,而那是按模型算的。
上面那个 worker 并发只是外层兜底,防任务无限堆积 */}
- <div className="border-t border-white/10 pt-4">
+ <div className="border-t border-line pt-4">
<div className="flex items-start justify-between gap-4">
<div className="min-w-0">
- <span className="block text-sm text-neutral-200">
+ <span className="block text-body text-ink">
{S.settings.deployment.modelConcurrency}
</span>
- <span className="block text-xs text-neutral-500 mt-0.5">
+ <span className="block text-small text-ink-3 mt-1">
{S.settings.deployment.modelConcurrencyHint}
</span>
</div>
<div className="flex items-center gap-2 shrink-0">
- <span className="text-xs text-neutral-500">
+ <span className="text-small text-ink-3">
{S.settings.deployment.modelDefault}
</span>
- <input
+ <Input size="sm" className="u-input-plain w-16 u-num text-center"
type="number"
min={1}
max={256}
- className="input-dark u-input-plain w-16 px-2 py-1.5 text-sm u-num text-center"
value={shownDefault}
disabled={dep.isPending}
onChange={(e) =>
@@ -260,8 +250,7 @@ function DeploymentAdmin() {
)
}
/>
- <button
- className="u-btn u-btn-ghost px-3 py-1.5 text-xs"
+ <Button variant="secondary" size="sm"
disabled={
save.isPending ||
modelDefault === null ||
@@ -270,12 +259,12 @@ function DeploymentAdmin() {
onClick={() => save.mutate({ open, defaultModel: shownDefault })}
>
{S.settings.deployment.workersApply}
- </button>
+ </Button>
</div>
</div>
{!!dep.data?.models_in_use?.length && (
- <div className="mt-3 space-y-1.5">
+ <div className="mt-3 space-y-2">
{dep.data.models_in_use.map((m) => {
const cur =
dep.data?.model_limits?.find(
@@ -284,21 +273,20 @@ function DeploymentAdmin() {
const key = `${m.base_url}|${m.model}`;
const val = perModel[key] ?? cur ?? shownDefault;
return (
- <div key={key} className="flex items-center gap-2 text-xs">
- <span className="u-chip u-chip-neutral !text-[10px] !px-1.5 shrink-0">
+ <div key={key} className="flex items-center gap-2 text-small">
+ <span className="u-chip u-chip-neutral !text-fine !px-2 shrink-0">
{m.kind}
</span>
- <span className="font-mono text-neutral-300 truncate">
+ <span className="font-mono text-ink-2 truncate">
{m.model}
</span>
- <span className="text-neutral-600 truncate hidden sm:inline">
+ <span className="text-ink-3 truncate hidden sm:inline">
{m.base_url}
</span>
- <input
+ <Input size="sm" className="u-input-plain ml-auto w-14 u-num text-center shrink-0"
type="number"
min={1}
max={256}
- className="input-dark u-input-plain ml-auto w-14 px-1.5 py-1 text-xs u-num text-center shrink-0"
value={val}
onChange={(e) =>
setPerModel({
@@ -310,8 +298,7 @@ function DeploymentAdmin() {
})
}
/>
- <button
- className="u-btn u-btn-ghost px-2 py-1 text-[11px] shrink-0"
+ <Button variant="secondary" size="sm" className="shrink-0"
disabled={save.isPending || perModel[key] === undefined}
onClick={() =>
save.mutate({
@@ -325,10 +312,9 @@ function DeploymentAdmin() {
}
>
{S.settings.deployment.workersApply}
- </button>
+ </Button>
{cur !== null && (
- <button
- className="u-btn u-btn-ghost px-2 py-1 text-[11px] shrink-0 text-neutral-500"
+ <Button variant="secondary" size="sm" className="shrink-0"
disabled={save.isPending}
title={S.settings.deployment.modelResetHint}
onClick={() =>
@@ -343,7 +329,7 @@ function DeploymentAdmin() {
}
>
{S.settings.deployment.modelReset}
- </button>
+ </Button>
)}
</div>
);
@@ -353,7 +339,7 @@ function DeploymentAdmin() {
</div>
{save.isError && (
- <p className="text-xs text-rose-400">{(save.error as Error).message}</p>
+ <p className="text-small text-danger">{(save.error as Error).message}</p>
)}
</div>
);
@@ -374,57 +360,55 @@ function KbsAdmin() {
return (
<div className="space-y-4">
- <p className="text-xs text-neutral-500">{S.settings.kbs.hint}</p>
+ <p className="text-small text-ink-3">{S.settings.kbs.hint}</p>
- <div className="glass rounded-xl divide-y divide-white/5">
+ <div className="glass rounded-xl divide-y divide-line">
{rows.map(({ kb, doc_count, member_count }) => (
<div key={kb.id} className="px-4 py-3 flex items-center gap-3">
<div className="min-w-0 flex-1">
<div className="flex items-center gap-2">
- <span className="text-sm text-neutral-200 truncate">
+ <span className="text-body text-ink truncate">
{kb.name}
</span>
{kb.is_default && (
- <span className="u-chip u-chip-neutral !text-[10px]">
+ <span className="u-chip u-chip-neutral !text-fine">
{S.settings.kbs.defaultChip}
</span>
)}
{kb.visibility === "restricted" && (
- <span className="flex items-center gap-1 text-[10.5px] text-neutral-500">
+ <span className="flex items-center gap-1 text-fine text-ink-3">
<Lock size={10} />
{S.settings.kbs.visRestricted}
</span>
)}
</div>
- <div className="mt-0.5 text-xs text-neutral-500">
+ <div className="mt-1 text-small text-ink-3">
<span className="u-num">
{S.account.kbStats(doc_count, member_count)}
</span>
</div>
</div>
- <button
- className="u-btn u-btn-ghost px-2.5 py-1 text-xs shrink-0"
+ <Button variant="secondary" size="sm" className="shrink-0"
onClick={() => {
setKb(kb.id);
navigate({ to: "/kb/$kbId/settings", params: { kbId: kb.id } });
}}
>
{S.settings.kbs.openSettings}
- </button>
+ </Button>
</div>
))}
{!list.isPending && rows.length === 0 && (
- <p className="px-4 py-6 text-sm text-neutral-500">{S.settings.kbs.empty}</p>
+ <p className="px-4 py-6 text-body text-ink-3">{S.settings.kbs.empty}</p>
)}
</div>
- <button
+ <Button variant="primary" size="sm" className="flex items-center gap-2"
onClick={() => setCreating(true)}
- className="u-btn u-btn-primary px-3.5 py-1.5 text-xs flex items-center gap-1.5"
>
<Plus size={12} />
{S.settings.kbs.newKb}
- </button>
+ </Button>
{creating && workspace && (
<NewKbModal
@@ -488,110 +472,91 @@ function NewKbModal({
return (
<div
- className="fixed inset-0 z-50 grid place-items-center bg-black/60 backdrop-blur-sm"
+ className="u-modal-scrim fixed inset-0 z-50 grid place-items-center"
onMouseDown={(e) => {
if (e.target === e.currentTarget) onDone();
}}
>
- <div className="glass-strong w-[24rem] max-w-[calc(100vw-2rem)] rounded-2xl shadow-2xl p-5">
+ <div className="glass-strong w-[24rem] max-w-[calc(100vw-2rem)] rounded-xl shadow-2xl p-6">
<div className="flex items-center justify-between mb-4">
- <h2 className="u-title text-[15px]">{S.settings.kbs.newKb}</h2>
- <button
+ <h2 className="u-title text-title">{S.settings.kbs.newKb}</h2>
+ <IconButton size="sm" label={S.ui.close}
onClick={() => onDone()}
- className="text-neutral-500 hover:text-neutral-200"
>
<X size={15} />
- </button>
+ </IconButton>
</div>
- <input
+ <Input className="w-full mb-2"
autoFocus
- className="input-dark w-full px-3 py-2 text-sm mb-2"
placeholder={S.settings.kbs.name}
value={name}
onChange={(e) => setName(e.target.value)}
/>
- <input
- className="input-dark w-full px-3 py-2 text-sm mb-3"
+ <Input className="w-full mb-3"
placeholder={S.settings.kbs.description}
value={desc}
onChange={(e) => setDesc(e.target.value)}
/>
- <label className="flex items-center gap-2 text-xs text-neutral-400 mb-4">
- <input
- type="checkbox"
- checked={restricted}
- onChange={(e) => setRestricted(e.target.checked)}
- />
- {S.settings.kbs.visRestricted}
- </label>
+ <Checkbox
+ className="mb-4"
+ checked={restricted}
+ onChange={(e) => setRestricted(e.target.checked)}
+ label={S.settings.kbs.visRestricted}
+ />
<div className="mb-4">
- <div className="text-xs text-neutral-300 mb-1">
+ <div className="text-small text-ink-2 mb-1">
{S.settings.kbs.packsLabel}
</div>
- <p className="text-[11px] leading-relaxed text-neutral-500 mb-2">
+ <p className="text-fine leading-relaxed text-ink-3 mb-2">
{S.settings.kbs.packsHint}
</p>
- <div className="grid grid-cols-2 gap-1.5">
+ <div className="grid grid-cols-2 gap-2">
{available.data?.packs.map((p) => {
const on = packs.includes(p.id);
return (
- <label
+ <ChoiceCard
key={p.id}
- // 选中态靠边框与底色,勾选框藏起来:五个并排时
- // 一排勾选框比内容本身还抢眼
- className={
- "cursor-pointer rounded-lg border px-2.5 py-2 transition-colors " +
- (on
- ? "border-white/60 bg-white/[0.12] ring-1 ring-white/30"
- : "border-white/10 hover:bg-white/5")
- }
+ checked={on}
+ onChange={() => toggle(p.id)}
+ label={p.name}
>
- <input
- type="checkbox"
- className="sr-only"
- aria-label={p.name}
- checked={on}
- onChange={() => toggle(p.id)}
- />
- <span className="block text-xs text-neutral-200">
+ <span className="block text-small text-ink">
{p.name}
</span>
- <span className="block text-[11px] leading-snug text-neutral-500">
+ <span className="block text-fine leading-snug text-ink-3">
{p.summary}
</span>
- <span className="mt-0.5 block text-[10px] text-neutral-600">
+ <span className="mt-1 block text-fine text-ink-3">
{S.settings.kbs.packsCount(p.classes, p.properties)}
</span>
- </label>
+ </ChoiceCard>
);
})}
</div>
{packs.length === 0 && (
- <p className="text-[11px] text-neutral-500 mt-1.5">
+ <p className="text-fine text-ink-3 mt-2">
{S.settings.kbs.packsNone}
</p>
)}
</div>
{create.isError && (
- <p className="text-xs text-rose-400 mb-2">
+ <p className="text-small text-danger mb-2">
{(create.error as Error).message}
</p>
)}
<div className="flex justify-end gap-2">
- <button
- className="u-btn u-btn-ghost px-3.5 py-1.5 text-xs"
+ <Button variant="secondary" size="sm"
onClick={() => onDone()}
>
{S.library.cancel}
- </button>
- <button
- className="u-btn u-btn-primary px-3.5 py-1.5 text-xs"
+ </Button>
+ <Button variant="primary" size="sm"
disabled={!name.trim() || create.isPending}
onClick={() => create.mutate()}
>
{S.settings.kbs.create}
- </button>
+ </Button>
</div>
</div>
</div>
@@ -633,20 +598,20 @@ function DataSourcesAdmin() {
return (
<div className="space-y-4">
- <p className="text-xs text-neutral-500">{S.settings.datasources.hint}</p>
+ <p className="text-small text-ink-3">{S.settings.datasources.hint}</p>
- <div className="glass rounded-xl divide-y divide-white/5">
+ <div className="glass rounded-xl divide-y divide-line">
{(list.data?.data_sources ?? []).map((d) => (
<div key={d.id} className="px-4 py-3 space-y-3">
<div className="flex items-center gap-3">
<div className="min-w-0 flex-1">
- <div className="text-sm text-neutral-200">
+ <div className="text-body text-ink">
{d.name}
- <span className="ml-2 text-[11px] uppercase tracking-wide text-neutral-500">
+ <span className="ml-2 text-fine uppercase tracking-wide text-ink-3">
{d.engine}
</span>
</div>
- <div className="text-xs text-neutral-500 font-mono truncate">
+ <div className="text-small text-ink-3 font-mono truncate">
{d.summary}
</div>
</div>
@@ -665,57 +630,54 @@ function DataSourcesAdmin() {
? S.settings.datasources.testFail
: S.settings.datasources.neverTested}
</span>
- <button
- className="u-btn u-btn-ghost px-2.5 py-1 text-xs shrink-0"
+ <Button variant="secondary" size="sm" className="shrink-0"
disabled={test.isPending}
onClick={() => test.mutate(d.id)}
>
{S.settings.datasources.test}
- </button>
- <button
- className="text-xs text-neutral-500 hover:text-[var(--u-danger)] shrink-0"
+ </Button>
+ <LinkButton
+ tone="danger"
+ className="shrink-0"
disabled={remove.isPending}
onClick={() => remove.mutate(d.id)}
>
{S.settings.datasources.remove}
- </button>
+ </LinkButton>
</div>
<SourceGrants sourceId={d.id} />
</div>
))}
{list.data?.data_sources.length === 0 && (
- <p className="px-4 py-6 text-sm text-neutral-500">
+ <p className="px-4 py-6 text-body text-ink-3">
{S.settings.datasources.empty}
</p>
)}
</div>
<div className="glass rounded-xl p-4 space-y-2">
- <input
- className="input-dark w-full px-3 py-2 text-sm"
+ <Input className="w-full"
placeholder={S.settings.datasources.name}
value={name}
onChange={(e) => setName(e.target.value)}
/>
- <input
- className="input-dark w-full px-3 py-2 text-sm font-mono u-placeholder-sans"
+ <Input className="w-full font-mono u-placeholder-sans"
placeholder={S.settings.datasources.connString}
value={conn}
onChange={(e) => setConn(e.target.value)}
/>
- <p className="text-[11px] leading-5 text-neutral-500 font-mono whitespace-pre-line">
+ <p className="text-fine leading-5 text-ink-3 font-mono whitespace-pre-line">
{S.settings.datasources.connSchemes}
</p>
<div className="flex items-center gap-3">
- <button
- className="u-btn u-btn-primary px-3.5 py-1.5 text-xs"
+ <Button variant="primary" size="sm"
disabled={!name.trim() || !conn.trim() || create.isPending}
onClick={() => create.mutate()}
>
{S.settings.datasources.add}
- </button>
+ </Button>
{create.isError && (
- <span className="text-xs text-rose-400">
+ <span className="text-small text-danger">
{(create.error as Error).message}
</span>
)}
@@ -806,23 +768,25 @@ export function Settings() {
});
if (!workspace)
- return <div className="p-8 text-sm text-neutral-500">{S.nav.loading}</div>;
+ return <div className="p-8 text-body text-ink-3">{S.nav.loading}</div>;
const set =
(k: keyof typeof form) => (e: React.ChangeEvent<HTMLInputElement>) =>
setForm({ ...form, [k]: e.target.value });
- const input = "input-dark w-full px-3 py-2 text-sm";
- const label = "block text-xs font-medium text-neutral-400 mb-1";
+ const label = "block text-small font-medium text-ink-2 mb-1";
return (
<div className="h-full overflow-y-auto p-6">
<div className="max-w-xl">
- <h2 className="text-lg font-bold text-neutral-100 mb-3">
+ <h2 className="text-title font-semibold text-ink mb-3">
{S.settings.title}
</h2>
- <div className="flex gap-1 mb-5 bg-white/5 rounded-lg p-1 w-fit">
- {(
+ <Segmented
+ className="mb-6 w-fit"
+ value={tab}
+ onChange={setTab}
+ options={(
[
["models", S.settings.tabModels],
["members", S.settings.tabMembers],
@@ -830,20 +794,8 @@ export function Settings() {
["datasources", S.settings.datasources.tab],
["deployment", S.settings.tabDeployment],
] as const
- ).map(([key, tabLabel]) => (
- <button
- key={key}
- onClick={() => setTab(key)}
- className={`rounded-md px-4 py-1.5 text-sm font-medium transition-colors ${
- tab === key
- ? "bg-white/10 text-neutral-100"
- : "text-neutral-500 hover:text-neutral-300"
- }`}
- >
- {tabLabel}
- </button>
- ))}
- </div>
+ ).map(([key, tabLabel]) => ({ value: key, label: tabLabel }))}
+ />
{tab === "members" && <Members workspaceId={workspace.id} />}
{tab === "kbs" && <KbsAdmin />}
@@ -852,13 +804,13 @@ export function Settings() {
{tab === "models" && (
<>
- <p className="text-sm text-neutral-400 mb-4">
+ <p className="text-body text-ink-2 mb-4">
{S.settings.modelsIntro}
</p>
- <div className="mb-5 flex flex-wrap gap-2">
+ <div className="mb-6 flex flex-wrap gap-2">
{Object.entries(PRESETS).map(([name, p]) => (
- <button
+ <Pill
key={name}
onClick={() =>
setForm({
@@ -869,21 +821,20 @@ export function Settings() {
embed_model: p.embedModel,
})
}
- className="rounded-full border border-white/15 bg-white/5 px-3 py-1 text-xs text-neutral-300 hover:border-[rgba(var(--u-accent-deep),0.5)] hover:text-[var(--u-accent)]"
>
{name}
- </button>
+ </Pill>
))}
</div>
- <div className="glass rounded-xl p-5 space-y-4">
- <h3 className="text-sm font-bold text-neutral-200">
+ <div className="glass rounded-xl p-6 space-y-4">
+ <h3 className="text-body font-semibold text-ink">
{S.settings.chatModel}
</h3>
<div>
<label className={label}>{S.settings.baseUrl}</label>
- <input
- className={input}
+ <Input
+ className="w-full"
placeholder="https://api.deepseek.com/v1"
value={form.chat_base_url}
onChange={set("chat_base_url")}
@@ -892,8 +843,8 @@ export function Settings() {
<div className="grid grid-cols-2 gap-3">
<div>
<label className={label}>{S.settings.model}</label>
- <input
- className={input}
+ <Input
+ className="w-full"
placeholder="deepseek-chat"
value={form.chat_model}
onChange={set("chat_model")}
@@ -903,13 +854,13 @@ export function Settings() {
<label className={label}>
{S.settings.apiKey}{" "}
{settings.data?.has_chat_key && (
- <span className="text-[var(--u-accent)]">
+ <span className="text-accent">
{S.settings.keyConfigured}
</span>
)}
</label>
- <input
- className={input}
+ <Input
+ className="w-full"
type="password"
placeholder="sk-…"
value={form.chat_api_key}
@@ -918,13 +869,13 @@ export function Settings() {
</div>
</div>
- <h3 className="text-sm font-bold text-neutral-200 pt-2">
+ <h3 className="text-body font-semibold text-ink pt-2">
{S.settings.embedModel}
</h3>
<div>
<label className={label}>{S.settings.baseUrl}</label>
- <input
- className={input}
+ <Input
+ className="w-full"
placeholder="http://localhost:11434/v1"
value={form.embed_base_url}
onChange={set("embed_base_url")}
@@ -933,8 +884,8 @@ export function Settings() {
<div className="grid grid-cols-2 gap-3">
<div>
<label className={label}>{S.settings.model}</label>
- <input
- className={input}
+ <Input
+ className="w-full"
placeholder="bge-m3"
value={form.embed_model}
onChange={set("embed_model")}
@@ -944,13 +895,13 @@ export function Settings() {
<label className={label}>
{S.settings.apiKey}{" "}
{settings.data?.has_embed_key && (
- <span className="text-[var(--u-accent)]">
+ <span className="text-accent">
{S.settings.keyConfigured}
</span>
)}
</label>
- <input
- className={input}
+ <Input
+ className="w-full"
type="password"
value={form.embed_api_key}
onChange={set("embed_api_key")}
@@ -959,39 +910,37 @@ export function Settings() {
</div>
<div className="flex gap-2 pt-2">
- <button
+ <Button variant="primary" size="md"
onClick={() => save.mutate()}
disabled={save.isPending}
- className="u-btn u-btn-primary px-4 py-2 text-sm"
>
{save.isPending ? S.settings.saving : S.settings.save}
- </button>
- <button
+ </Button>
+ <Button variant="secondary" size="md"
onClick={() => test.mutate()}
disabled={test.isPending}
- className="u-btn u-btn-ghost px-4 py-2 text-sm"
>
{test.isPending ? S.settings.testing : S.settings.test}
- </button>
+ </Button>
</div>
{save.isSuccess && (
- <p className="text-sm text-[var(--u-accent)]">
+ <p className="text-body text-accent">
{S.settings.saved}
</p>
)}
{save.isError && (
- <p className="text-sm text-rose-400">
+ <p className="text-body text-danger">
{(save.error as Error).message}
</p>
)}
{test.data && (
- <div className="text-sm space-y-1 pt-1">
+ <div className="text-body space-y-1 pt-1">
<p
className={
test.data.chat.ok
- ? "text-[var(--u-accent)]"
- : "text-rose-400"
+ ? "text-accent"
+ : "text-danger"
}
>
{S.settings.chatLabel}:{" "}
@@ -1002,8 +951,8 @@ export function Settings() {
<p
className={
test.data.embed.ok
- ? "text-[var(--u-accent)]"
- : "text-neutral-400"
+ ? "text-accent"
+ : "text-ink-2"
}
>
{S.settings.embedLabel}:{" "}
diff --git a/web/src/styles.css b/web/src/styles.css
index de03f261..fb6aa7c7 100644
--- a/web/src/styles.css
+++ b/web/src/styles.css
@@ -645,6 +645,61 @@ select.input-dark option {
transition: background-color var(--u-fast);
}
+/* 像一句话的动作 */
+.u-linkbtn {
+ font-size: var(--text-small);
+ line-height: var(--text-small--line-height);
+ color: var(--u-text-2);
+ transition: color var(--u-fast);
+}
+.u-linkbtn:hover:not(:disabled) {
+ color: var(--u-text);
+}
+.u-linkbtn.is-danger {
+ color: var(--u-text-3);
+}
+.u-linkbtn.is-danger:hover:not(:disabled) {
+ color: var(--u-danger);
+}
+.u-linkbtn:disabled {
+ opacity: 0.4;
+ cursor: not-allowed;
+}
+.u-linkbtn:focus-visible {
+ outline: 2px solid var(--u-ring);
+ outline-offset: 2px;
+ border-radius: 0.25rem;
+}
+
+/* 勾选框藏起来的可选卡片 */
+.u-choice {
+ display: block;
+ cursor: pointer;
+ border-radius: 0.5rem;
+ border: 1px solid var(--u-line);
+ padding: 0.5rem 0.75rem;
+ transition:
+ background-color var(--u-fast),
+ border-color var(--u-fast);
+}
+.u-choice:hover {
+ background: var(--u-surface-2);
+}
+.u-choice.is-on {
+ border-color: rgba(255, 255, 255, 0.6);
+ background: var(--u-surface-3);
+ box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3);
+}
+.u-choice:focus-within {
+ outline: 2px solid var(--u-ring);
+ outline-offset: 2px;
+}
+
+/* 进度条的填充:宽度过渡 */
+.u-progress-fill {
+ transition: width 500ms ease;
+}
+
/* ---- chips ---- */
.u-chip {
display: inline-block;
@@ -683,6 +738,15 @@ select.input-dark option {
background: rgba(196, 165, 255, 0.12);
color: var(--u-violet);
}
+/* 可点的 chip:指针停上提亮一点 */
+.u-chip-click {
+ cursor: pointer;
+ vertical-align: middle;
+ transition: filter var(--u-fast);
+}
+.u-chip-click:hover {
+ filter: brightness(1.25);
+}
}
/* 浏览态里的程度标注:同一个警示色,但没有填充、没有药丸形状。
diff --git a/web/src/ui/index.tsx b/web/src/ui/index.tsx
index d34bc491..5574d1e6 100644
--- a/web/src/ui/index.tsx
+++ b/web/src/ui/index.tsx
@@ -863,13 +863,28 @@ export function Chip({
tone = "neutral",
className,
title,
+ onClick,
children,
}: {
tone?: ChipTone;
className?: string;
title?: string;
+ /** 给了就是一个按钮(点开看失败原文那种) */
+ onClick?: () => void;
children: ReactNode;
}) {
+ if (onClick) {
+ return (
+ <button
+ type="button"
+ onClick={onClick}
+ title={title}
+ className={cn("u-chip u-chip-click", `u-chip-${tone}`, className)}
+ >
+ {children}
+ </button>
+ );
+ }
return (
<span className={cn("u-chip", `u-chip-${tone}`, className)} title={title}>
{children}
@@ -877,6 +892,61 @@ export function Chip({
);
}
+/* ---------- LinkButton(长得像一句话的动作:表格行末的"重抽""删除") ---------- */
+export function LinkButton({
+ tone = "default",
+ underline,
+ className,
+ type = "button",
+ ...props
+}: ButtonHTMLAttributes<HTMLButtonElement> & {
+ tone?: "default" | "danger";
+ /** 带下划线(u-link 那种) */
+ underline?: boolean;
+}) {
+ return (
+ <button
+ type={type}
+ className={cn(
+ "u-linkbtn",
+ tone === "danger" && "is-danger",
+ underline && "u-link",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+/* ---------- ChoiceCard(勾选框藏起来的可选卡片:本体包那种并排的几张) ---------- */
+export function ChoiceCard({
+ checked,
+ onChange,
+ label,
+ className,
+ children,
+}: {
+ checked: boolean;
+ onChange: () => void;
+ /** 读屏器念的名字 */
+ label: string;
+ className?: string;
+ children: ReactNode;
+}) {
+ return (
+ <label className={cn("u-choice", checked && "is-on", className)}>
+ <input
+ type="checkbox"
+ className="sr-only"
+ aria-label={label}
+ checked={checked}
+ onChange={onChange}
+ />
+ {children}
+ </label>
+ );
+}
+
/* ---------- PageTitle ---------- */
export function PageTitle({
className,
@@ -1065,6 +1135,7 @@ export function Segmented<T extends string>({
onChange,
size = "md",
fill,
+ disabled,
className,
}: {
value: T;
@@ -1072,6 +1143,7 @@ export function Segmented<T extends string>({
onChange: (v: T) => void;
size?: "sm" | "md";
fill?: boolean;
+ disabled?: boolean;
className?: string;
}) {
return (
@@ -1080,6 +1152,7 @@ export function Segmented<T extends string>({
className={cn(
"flex gap-1 rounded-lg bg-surface p-1",
fill && "w-full",
+ disabled && "opacity-40",
className,
)}
>
@@ -1092,6 +1165,7 @@ export function Segmented<T extends string>({
role="tab"
aria-selected={active}
title={o.title}
+ disabled={disabled}
onClick={() => onChange(o.value)}
className={cn(
"flex items-center justify-center gap-1 rounded-lg font-medium transition-colors duration-fast",
diff --git a/web/style-guard.baseline.json b/web/style-guard.baseline.json
index e5a6ac83..7722c625 100644
--- a/web/style-guard.baseline.json
+++ b/web/style-guard.baseline.json
@@ -9,7 +9,6 @@
"src/pages/KbScope.tsx",
"src/pages/KbSettings.tsx",
"src/pages/Legal.tsx",
- "src/pages/Library.tsx",
"src/pages/Login.tsx",
"src/pages/Mappings.tsx",
"src/pages/Members.tsx",
@@ -17,10 +16,8 @@
"src/pages/NextStep.tsx",
"src/pages/OntologySchemaGraph.tsx",
"src/pages/PendingFacts.tsx",
- "src/pages/Review.tsx",
"src/pages/Search.tsx",
"src/pages/ServerDown.tsx",
- "src/pages/Settings.tsx",
"src/pages/Shell.tsx",
"src/pages/SourcesRail.tsx",
"src/pages/Tokens.tsx",