From 6449c3103af1509aba7bce843bad1e417720f463 Mon Sep 17 00:00:00 2001 From: Yaojia Wang Date: Sat, 20 Jun 2026 12:01:09 +0200 Subject: [PATCH] =?UTF-8?q?feat(ux):=20F1=20=E6=B3=A8=E5=85=A5=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E5=8F=AF=E6=8E=A7=E7=89=88=20=E2=80=94=20=F0=9F=93=8C?= =?UTF-8?q?=E7=BD=AE=E9=A1=B6/=E2=9C=95=E6=8E=92=E9=99=A4/=E8=BF=91N?= =?UTF-8?q?=E7=AB=A0=E6=AD=A5=E8=BF=9B=E5=99=A8=20+=20=E5=B7=B2=E6=8E=92?= =?UTF-8?q?=E9=99=A4=E6=81=A2=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - injection.ts 加 override 纯函数(currentOverride/withPinToggled/withExcluded/withRestored/withRecentN/isPinned,钳 1..20)+ author_pin 徽标 - useInjection 加 saving 态 + togglePin/exclude/restore/setRecentN,PUT 后以服务端确定结果为准(不变量 #6);写失败可读文案、不改本地态(天然回滚) - ChapterAssistant:每实体置顶/排除按钮 + 「近 N 章」步进器 + 「已排除」恢复区 - 13 新 vitest(override 纯函数);前端门禁绿(lint/tsc/vitest 183/build) Co-Authored-By: Claude Opus 4.8 (1M context) --- .../components/workbench/ChapterAssistant.tsx | 172 ++++++++++++++++-- apps/web/lib/workbench/injection.test.ts | 78 +++++++- apps/web/lib/workbench/injection.ts | 88 ++++++++- apps/web/lib/workbench/useInjection.ts | 85 +++++++-- apps/web/tsconfig.tsbuildinfo | 2 +- 5 files changed, 391 insertions(+), 34 deletions(-) diff --git a/apps/web/components/workbench/ChapterAssistant.tsx b/apps/web/components/workbench/ChapterAssistant.tsx index c8d2669..1935ad6 100644 --- a/apps/web/components/workbench/ChapterAssistant.tsx +++ b/apps/web/components/workbench/ChapterAssistant.tsx @@ -3,9 +3,13 @@ import Link from "next/link"; import { + isPinned, kindLabel, reasonLabel, + RECENT_N_MAX, + RECENT_N_MIN, type InjectionEntity, + type InjectionEntityRef, } from "@/lib/workbench/injection"; import { useInjection } from "@/lib/workbench/useInjection"; @@ -15,13 +19,10 @@ interface ChapterAssistantProps { } // 右栏「本章助手」(UX §6.3)。 -// 「本章注入(透明)」读 B0 端点,列出确定性选中的设定/角色 + 入选理由徽标—— -// 这是「看到的=写章用的」的信任牌(不变量 #6)。「四审」指向审稿页入口。 +// 「本章注入(透明)」读 B0 端点,列出确定性选中的设定/角色 + 入选理由徽标, +// 并让作者 📌置顶 / ✕排除 / 调近 N 章(可控版)——「看到的=写章用的」信任牌(不变量 #6)。 // 桌面 aside 包裹;移动端经 Workbench 抽屉复用 AssistantContent。 -export function ChapterAssistant({ - projectId, - chapterNo, -}: ChapterAssistantProps) { +export function ChapterAssistant({ projectId, chapterNo }: ChapterAssistantProps) { return (