feat(web): F1/F2/F3 前端——拆书入库为规则 / 续写式链选择 / 模板库
- gen:api 纳入 /templates、chain continue_volume、teardown rules ingest 端点 - F1:GeneratorRunner 识别拆书为单对象入库(整 preview 作一条 teardown), ingestTable(BookTeardownResult)=rules,buildIngestRequest 组装 teardown 体, 按 isSingleObjectIngest 隐藏勾选框、改文案「入库为规则」 - F2:ChainStarter 加链类型单选(draft_volume 从头写 / continue_volume 续写), chain_key 作 path 参传给 run(CHAIN_KINDS 对齐后端 SUPPORTED_CHAINS) - F3:模板库页 app/templates + 全局 nav 入口 + TemplatesManager(列/建/删,乐观更新回滚); GeneratorRunner 加 TemplateFiller「从模板填入」(body 填进 brief/text,纯前端) - vitest 覆盖 templates/ingest teardown/templateFillTarget/CHAIN_KINDS 纯逻辑
This commit is contained in:
32
apps/web/app/templates/page.tsx
Normal file
32
apps/web/app/templates/page.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
import { AppShell } from "@/components/AppShell";
|
||||
import { TemplatesManager } from "@/components/templates/TemplatesManager";
|
||||
import { fetchTemplates } from "@/lib/api/server";
|
||||
import type { TemplateResponse } from "@/lib/api/types";
|
||||
|
||||
// 提示词/模板库(F3,全局单用户本地版)。Server Component 预取列表;CRUD 在客户端组件。
|
||||
export default async function TemplatesPage() {
|
||||
let initial: TemplateResponse[] = [];
|
||||
let loadError = false;
|
||||
try {
|
||||
initial = await fetchTemplates();
|
||||
} catch {
|
||||
loadError = true;
|
||||
}
|
||||
|
||||
return (
|
||||
<AppShell title="提示词 / 模板库">
|
||||
<div className="mx-auto max-w-3xl px-8 py-10">
|
||||
<p className="mb-6 text-xs text-ink-soft">
|
||||
保存常用提示词,复用时一键填入生成器的 brief / 原文输入。仅本地、单用户,不做分享。
|
||||
</p>
|
||||
{loadError ? (
|
||||
<p className="rounded border border-conflict bg-panel p-6 text-conflict">
|
||||
无法连接后端服务,请确认 API 已启动后刷新。
|
||||
</p>
|
||||
) : (
|
||||
<TemplatesManager initial={initial} />
|
||||
)}
|
||||
</div>
|
||||
</AppShell>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user