fix: adapt frontend for legacy Chrome and runtime config
This commit is contained in:
1 parent
db2f21191c
commit
388a9133fc
84 files changed
+1186
-528
No files matched your search
@@ -46,6 +46,8 @@ const WRITING_STATUS_PILL: Record<string, { label: string; className: string; sp
|
||||
error: { label: "出错", className: "text-rose-500" },
|
||||
};
|
||||
|
||||
const SHOW_NOTEBOOK_SPACE_ENTRIES = false;
|
||||
|
||||
/** 单条历史记录项 —— 样式参考多智能体会商的 HistoryDropdown 列表项(圆角卡片 + 状态药丸 + 操作按钮)。 */
|
||||
function WritingHistoryItem({
|
||||
session,
|
||||
@@ -83,8 +85,11 @@ function WritingHistoryItem({
|
||||
|
||||
return (
|
||||
<li
|
||||
className="px-3 py-2.5 transition-colors hover:bg-slate-50"
|
||||
style={isCurrent ? { backgroundColor: "#ecfdf5" } : undefined}
|
||||
className={cn(
|
||||
"px-3 py-2.5 transition-colors hover:bg-slate-50 dark:hover:bg-white/10",
|
||||
isCurrent &&
|
||||
"bg-emerald-50 dark:border-l-2 dark:border-[#00e5ff] dark:bg-[#0b3a71]/80 dark:shadow-[inset_0_0_0_1px_rgba(64,150,255,0.24),0_0_18px_rgba(0,180,255,0.14)]",
|
||||
)}
|
||||
>
|
||||
<div className="flex items-start gap-2">
|
||||
<div className="min-w-0 flex-1">
|
||||
@@ -101,7 +106,7 @@ function WritingHistoryItem({
|
||||
}
|
||||
}}
|
||||
onBlur={commit}
|
||||
className="w-full rounded border border-slate-300 px-2 py-1 text-[11.5px] font-semibold text-slate-800 outline-none focus:border-primary"
|
||||
className="w-full rounded border border-slate-300 px-2 py-1 text-[11.5px] font-semibold text-slate-800 outline-none focus:border-primary dark:border-[#1b477e] dark:bg-[#022248] dark:text-[#e8edf5]"
|
||||
/>
|
||||
) : (
|
||||
<button
|
||||
@@ -132,7 +137,7 @@ function WritingHistoryItem({
|
||||
type="button"
|
||||
onClick={isBackground && onShowProgress ? onShowProgress : onSelect}
|
||||
title={isBackground ? "查看进度" : "只读查看"}
|
||||
className="rounded p-1 text-slate-500 transition hover:bg-slate-100 hover:text-primary"
|
||||
className="rounded p-1 text-slate-500 transition hover:bg-slate-100 hover:text-primary dark:text-[#8aa0c4] dark:hover:bg-white/10 dark:hover:text-[#8fd3ff]"
|
||||
>
|
||||
<Eye className="size-3.5" />
|
||||
</button>
|
||||
@@ -143,7 +148,7 @@ function WritingHistoryItem({
|
||||
setRenaming(true);
|
||||
}}
|
||||
title="重命名"
|
||||
className="rounded p-1 text-slate-500 transition hover:bg-slate-100 hover:text-primary"
|
||||
className="rounded p-1 text-slate-500 transition hover:bg-slate-100 hover:text-primary dark:text-[#8aa0c4] dark:hover:bg-white/10 dark:hover:text-[#8fd3ff]"
|
||||
>
|
||||
<Pencil className="size-3.5" />
|
||||
</button>
|
||||
@@ -151,7 +156,7 @@ function WritingHistoryItem({
|
||||
type="button"
|
||||
onClick={onDelete}
|
||||
title="删除"
|
||||
className="rounded p-1 text-slate-500 transition hover:bg-rose-50 hover:text-rose-600"
|
||||
className="rounded p-1 text-slate-500 transition hover:bg-rose-50 hover:text-rose-600 dark:text-[#8aa0c4] dark:hover:bg-rose-500/15 dark:hover:text-rose-300"
|
||||
>
|
||||
<Trash2 className="size-3.5" />
|
||||
</button>
|
||||
@@ -248,103 +253,105 @@ export function ResearchSidebar({
|
||||
</div>
|
||||
)}
|
||||
<div className="flex min-h-0 flex-1 flex-col overflow-y-auto overflow-x-hidden px-3 py-4">
|
||||
<section className="flex flex-col">
|
||||
<div className="mb-3 flex items-center justify-between px-2">
|
||||
<h2 className="text-[15px] font-bold tracking-wide text-slate-400">
|
||||
笔记本
|
||||
</h2>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
setName("");
|
||||
setCreateError("");
|
||||
setCreateOpen(true);
|
||||
}}
|
||||
title="新建写作空间"
|
||||
aria-label="新建写作空间"
|
||||
className="rounded-md p-1 text-slate-400 transition-colors hover:bg-rose-50 hover:text-rose-600"
|
||||
>
|
||||
<Plus className="size-4 stroke-[2.5]" />
|
||||
</button>
|
||||
</div>
|
||||
{SHOW_NOTEBOOK_SPACE_ENTRIES && (
|
||||
<section className="flex flex-col">
|
||||
<div className="mb-3 flex items-center justify-between px-2">
|
||||
<h2 className="text-[15px] font-bold tracking-wide text-slate-400">
|
||||
笔记本
|
||||
</h2>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
setName("");
|
||||
setCreateError("");
|
||||
setCreateOpen(true);
|
||||
}}
|
||||
title="新建写作空间"
|
||||
aria-label="新建写作空间"
|
||||
className="rounded-md p-1 text-slate-400 transition-colors hover:bg-rose-50 hover:text-rose-600"
|
||||
>
|
||||
<Plus className="size-4 stroke-[2.5]" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="min-h-0 flex-1 space-y-2 overflow-y-auto px-1 pb-3">
|
||||
{notebooksLoading ? (
|
||||
<p className="px-3 py-2 text-xs text-slate-400">加载中...</p>
|
||||
) : notebooksError ? (
|
||||
<p className="rounded-xl bg-amber-50 px-3 py-2 text-xs leading-5 text-amber-700">
|
||||
笔记本服务暂不可用,请检查空间服务地址或账号
|
||||
</p>
|
||||
) : notebooks.length === 0 ? (
|
||||
<p className="px-3 py-2 text-xs text-slate-400">暂无笔记本</p>
|
||||
) : (
|
||||
notebooks.map((nb) => {
|
||||
const active = viewingNotebookId === nb.id;
|
||||
const sourceCount = Math.max(0, nb.source_count ?? 0);
|
||||
return (
|
||||
<button
|
||||
key={nb.id}
|
||||
type="button"
|
||||
onClick={() => onOpenNotebook(nb.id)}
|
||||
title={nb.description || nb.name}
|
||||
className={cn(
|
||||
"group relative flex min-h-14 w-full items-center gap-3 rounded-xl border bg-white px-3 py-2 text-left transition-all",
|
||||
active
|
||||
? "border-rose-100 bg-rose-50/35 text-slate-900 shadow-[0_6px_18px_rgba(244,63,94,0.06)]"
|
||||
: "border-slate-100/80 text-slate-600 hover:border-slate-200 hover:bg-slate-50/70",
|
||||
)}
|
||||
>
|
||||
{active && (
|
||||
<span className="absolute bottom-4 left-0 top-4 w-1 rounded-r-full bg-rose-500" />
|
||||
)}
|
||||
<span
|
||||
<div className="min-h-0 flex-1 space-y-2 overflow-y-auto px-1 pb-3">
|
||||
{notebooksLoading ? (
|
||||
<p className="px-3 py-2 text-xs text-slate-400">加载中...</p>
|
||||
) : notebooksError ? (
|
||||
<p className="rounded-xl bg-amber-50 px-3 py-2 text-xs leading-5 text-amber-700">
|
||||
笔记本服务暂不可用,请检查空间服务地址或账号
|
||||
</p>
|
||||
) : notebooks.length === 0 ? (
|
||||
<p className="px-3 py-2 text-xs text-slate-400">暂无笔记本</p>
|
||||
) : (
|
||||
notebooks.map((nb) => {
|
||||
const active = viewingNotebookId === nb.id;
|
||||
const sourceCount = Math.max(0, nb.source_count ?? 0);
|
||||
return (
|
||||
<button
|
||||
key={nb.id}
|
||||
type="button"
|
||||
onClick={() => onOpenNotebook(nb.id)}
|
||||
title={nb.description || nb.name}
|
||||
className={cn(
|
||||
"flex size-8 shrink-0 items-center justify-center rounded-lg",
|
||||
active ? "bg-rose-50 text-rose-600" : "bg-slate-100 text-slate-500",
|
||||
"group relative flex min-h-14 w-full items-center gap-3 rounded-xl border bg-white px-3 py-2 text-left transition-all",
|
||||
active
|
||||
? "border-rose-100 bg-rose-50/35 text-slate-900 shadow-[0_6px_18px_rgba(244,63,94,0.06)]"
|
||||
: "border-slate-100/80 text-slate-600 hover:border-slate-200 hover:bg-slate-50/70",
|
||||
)}
|
||||
>
|
||||
<BookOpen className="size-4 stroke-[2.2]" />
|
||||
</span>
|
||||
<span className="min-w-0 flex-1">
|
||||
<span className="block truncate text-[15px] font-medium leading-5">
|
||||
{nb.name}
|
||||
</span>
|
||||
{sourceCount > 0 && (
|
||||
<span className="mt-1 flex items-center gap-1 text-[11px] text-slate-400">
|
||||
<FileText className="size-3" />
|
||||
已有 {sourceCount} 篇排版
|
||||
</span>
|
||||
{active && (
|
||||
<span className="absolute bottom-4 left-0 top-4 w-1 rounded-r-full bg-rose-500" />
|
||||
)}
|
||||
</span>
|
||||
{sourceCount > 0 && (
|
||||
<span
|
||||
className={cn(
|
||||
"flex size-7 shrink-0 items-center justify-center rounded-full border text-[12px] font-semibold",
|
||||
active
|
||||
? "border-rose-100 bg-rose-50 text-rose-600"
|
||||
: "border-slate-100 bg-slate-50 text-slate-400",
|
||||
"flex size-8 shrink-0 items-center justify-center rounded-lg",
|
||||
active ? "bg-rose-50 text-rose-600" : "bg-slate-100 text-slate-500",
|
||||
)}
|
||||
>
|
||||
{sourceCount}
|
||||
<BookOpen className="size-4 stroke-[2.2]" />
|
||||
</span>
|
||||
)}
|
||||
</button>
|
||||
);
|
||||
})
|
||||
)}
|
||||
</div>
|
||||
<span className="min-w-0 flex-1">
|
||||
<span className="block truncate text-[15px] font-medium leading-5">
|
||||
{nb.name}
|
||||
</span>
|
||||
{sourceCount > 0 && (
|
||||
<span className="mt-1 flex items-center gap-1 text-[11px] text-slate-400">
|
||||
<FileText className="size-3" />
|
||||
已有 {sourceCount} 篇排版
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
{sourceCount > 0 && (
|
||||
<span
|
||||
className={cn(
|
||||
"flex size-7 shrink-0 items-center justify-center rounded-full border text-[12px] font-semibold",
|
||||
active
|
||||
? "border-rose-100 bg-rose-50 text-rose-600"
|
||||
: "border-slate-100 bg-slate-50 text-slate-400",
|
||||
)}
|
||||
>
|
||||
{sourceCount}
|
||||
</span>
|
||||
)}
|
||||
</button>
|
||||
);
|
||||
})
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="border-t border-slate-100 px-1 pt-3">
|
||||
<button
|
||||
type="button"
|
||||
onClick={onOpenAllSpaces}
|
||||
className="flex w-full items-center gap-3 rounded-xl px-3 py-3 text-left text-[14px] font-bold text-slate-700 transition-colors hover:bg-slate-50 hover:text-slate-950"
|
||||
>
|
||||
<LayoutGrid className="size-4 text-rose-500 stroke-[2.3]" />
|
||||
<span>所有空间</span>
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
<div className="border-t border-slate-100 px-1 pt-3">
|
||||
<button
|
||||
type="button"
|
||||
onClick={onOpenAllSpaces}
|
||||
className="flex w-full items-center gap-3 rounded-xl px-3 py-3 text-left text-[14px] font-bold text-slate-700 transition-colors hover:bg-slate-50 hover:text-slate-950"
|
||||
>
|
||||
<LayoutGrid className="size-4 text-rose-500 stroke-[2.3]" />
|
||||
<span>所有空间</span>
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
|
||||
{/* 「历史记录」列表(样式参考多智能体会商):跟随侧栏自然向下滚动、不固定在底部。
|
||||
点击打开历史回看(显示到右侧区域),✏️/双击改名,🗑删除,「挂起中」点击看进度。 */}
|
||||
|
||||
Reference in new issue
Block a user