Spaces:
Running
Running
root commited on
Commit ·
4030d60
1
Parent(s): 25b6182
写新章干净资料包、修稿/写新章分离、采纳协作 AI 意见需原文依据、发布台
Browse files- fanqie/agent.js +34 -18
- fanqie/dist/index.html +2 -2
- fanqie/mount.js +10 -0
- fanqie/projects.js +118 -1
- public/assets/{index-C3EsJA9A.js → index-CBrxhsfk.js} +0 -0
- public/assets/{index-uerEeeeu.css → index-bViJF6Aj.css} +0 -0
- public/index.html +2 -2
- ui-src/src/api.ts +9 -1
- ui-src/src/rooms/Book.tsx +10 -1
- ui-src/src/rooms/Peer.tsx +1 -0
- ui-src/src/rooms/Publish.tsx +270 -0
- ui-src/src/styles.css +58 -0
fanqie/agent.js
CHANGED
|
@@ -548,7 +548,9 @@ module.exports = function buildAgent(express, projects) {
|
|
| 548 |
'本次任务:审查。你是严格、坦率的网络小说责任编辑,熟悉番茄小说的内容规范、签约标准和读者口味。',
|
| 549 |
'提意见之前,先把附带的大纲、章节目录和后文读完。后文已经交代、大纲已经安排的事,不算问题,单独列为「后文已安排」并注明在第几章;只有资料里确实没有着落的,才算问题。',
|
| 550 |
'每条意见标一个等级:【硬伤】逻辑断裂、前后矛盾、人物动机说不通、违反平台规定;【建议】可以更好但现在也成立;【后文已安排】。按 硬伤 → 建议 → 后文已安排 的顺序写。',
|
| 551 |
-
'每条硬伤
|
|
|
|
|
|
|
| 552 |
'现在成立的写法不要为了“更好”去推翻;不要重写整段正文,必要时只给一两句示范。没问题就直接说「无硬伤」。',
|
| 553 |
].join('\n'),
|
| 554 |
research: '本次任务:调研。请查证并整理写作 AI 问到的信息(平台规则、题材趋势、时代背景、专业知识等),注明信息来源和时间,区分「确定」和「推测」。',
|
|
@@ -833,11 +835,12 @@ module.exports = function buildAgent(express, projects) {
|
|
| 833 |
'- 不批量开新书、不一次生成多本;不替作者做签约、发布等账号操作。', '')
|
| 834 |
L.push('## 3. 可以读、应该读的内容', '',
|
| 835 |
'| 内容 | 怎么读 | 用途 |', '|---|---|---|',
|
|
|
|
| 836 |
'| 作品全部资料 | `GET /fanqie/api/projects/{作品ID}` | 概览、圣经、大纲、章节目录 |',
|
| 837 |
'| 某章正文 | `GET /fanqie/api/projects/{作品ID}/chapters/{章节ID}` 取 `current_version_id`,再读 `.../versions/{版本ID}` | 续写、修改前先读 |',
|
| 838 |
'| 写作上下文 | `GET /fanqie/api/projects/{作品ID}/context?chapter_id=` | 圣经 + 大纲 + 上一章摘要 |',
|
| 839 |
-
'| 作者批注 | `GET /fanqie/api/projects/{作品ID}/notes?status=open` |
|
| 840 |
-
'| 修改记录 | `GET /fanqie/api/projects/{作品ID}/changes?by=author` | 作者亲手改正文的记录 + 未存版本的草稿
|
| 841 |
'| 作者留言 | `GET /fanqie/api/projects/{作品ID}/requests` | 作者说「处理留言」时读 |',
|
| 842 |
'| 写作规则 | `GET /fanqie/api/agent/rules` | 自查清单、番茄平台规定、AI 写作规范 |',
|
| 843 |
'| 素材馆 · 母题列表 | `GET /fanqie/api/materials/motifs` | 先看有哪些母题和数量 |',
|
|
@@ -848,21 +851,34 @@ module.exports = function buildAgent(express, projects) {
|
|
| 848 |
'| 母题库 v2 · 检索 | `GET /fanqie/api/motif2/cards?q=关键词&role=人物&m=母题&emo=情绪`、`/fanqie/api/motif2/role?r=爷爷`、`/fanqie/api/motif2/card?uid=` | 按人物、关系、事件找卡片 |',
|
| 849 |
'| 母题库 v2 · 组稿 | `POST /fanqie/api/motif2/compose`,字段 `idea`、`cast:[{role}]`、`mot:[]`、`emo:[]` | 自动串成提纲 |',
|
| 850 |
'| 番茄热榜 | `GET /fanqie/feed/rank.md`(带访问密码)、`GET /fanqie/api/rank/feed?scope=all&brief=1` | 读趋势、写解读和总纲 |',
|
| 851 |
-
'| 分歧待办 | `GET /fanqie/api/projects/{作品ID}/peer?todo=1` | 作者已表态、你还没处理的分歧
|
| 852 |
'| 阅读进度 | `GET /fanqie/api/projects/{作品ID}/progress` | 作者读到哪一章哪一段(只读,不要改) |', '')
|
| 853 |
L.push('**用素材的规矩:** 素材只借结构、情绪和细节的“类型”,写进小说时人名、地名、职业、具体情节都必须换成自己的;不整段搬用卡片里的句子;一章最多借 1–2 条素材。', '')
|
| 854 |
-
L.push('## 4. 工作流程', '',
|
| 855 |
-
'
|
| 856 |
-
'
|
| 857 |
-
'
|
| 858 |
-
'
|
| 859 |
-
'
|
| 860 |
-
'
|
| 861 |
-
'4.
|
| 862 |
-
'
|
| 863 |
-
'
|
| 864 |
-
'
|
| 865 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 866 |
L.push('## 5. 检查记录:自查清单与平台规定', '',
|
| 867 |
'- 规则来源:`GET /fanqie/api/agent/rules` → `checklist`(发布前自查,三组)和 `platform`(番茄内容红线 + 低质规则)。',
|
| 868 |
'- 检查由你(AI)逐条阅读正文后判断,**不能用关键词匹配代替阅读**。',
|
|
@@ -875,8 +891,8 @@ module.exports = function buildAgent(express, projects) {
|
|
| 875 |
'- 它能做的活:`review` 审查(默认)、`research` 调研、`idea` 出主意、`draft` 起草、`other` 其他。例如:问它概览、圣经、大纲是否合乎逻辑;查某个年代的生活细节;给第 X 章出三种冲突方案。',
|
| 876 |
'- 提问:`POST /fanqie/api/agent/reviewer/ask`,字段:`project_id`、`task`、`topic`(如「圣经逻辑」)、`question`、`attach`(可选:作品资料 `overview`、`bible`、`outline`、`toc`、`chapters:1-5`、`chapter:{章节ID或章号}`、`review:{章号}`(**审单章用这个**:本章 + 前两章 + 已写好的全部后文 + 概览/圣经/大纲/目录)、`refs`(本书参考素材摘要)、`changes`(作者近期亲手改过的段落,`review:` 包里已自动带上本章的);共享资料 `rank`(热榜总览)、`rank:{分类,如 1_1141}`、`motif:{母题卡片uid}`、`motif_role:{人物,如 亲兄弟}`、`material:{素材馆uid}`(只给摘要和改写卡)、`rules`(番茄平台规定))、`wait`(最多等几秒,默认 50)、`queue`(默认开:令牌过期时先排队,作者粘贴新令牌或服务器续期成功后自动发出,状态为 `queued`)、`continue`(填上一次的 `ask_id` 或 `"last"`,就在同一个对话里接着问,对方记得上下文)。',
|
| 877 |
'- 回复要几分钟时,接口先返回 `state: "running"`;之后用 `GET /fanqie/api/agent/reviewer/log/{ask_id}?project_id=&wait=120` 取结果(`state` 变成 `done` 或 `error`)。不要重复提问同一件事。',
|
| 878 |
-
'- 读回复后
|
| 879 |
-
'- **你和协作 AI 是同级的**:它的每条意见你都要自己重新想一遍,不能照单全收。两边意见不一致时,**按你的判断执行**,并把分歧逐条记到对应章节的旁栏(作者在章节编辑页的「分歧」栏里看,**绝不写进正文**):`POST /fanqie/api/projects/{project_id}/peer`,body `{"items":[{"chapter_number":11,"ask_id":"…","topic":"一句话主题","reviewer_said":"协作 AI 的意见","my_view":"我的判断和理由","decision":"最后怎么做","verdict":"disagree"}]}`。`verdict` 取 `disagree`(不一致,按我的)/ `partial`(部分采纳)/ `agree`(一致)。不属于某一章的意见不填章节号,算全书层面。查看:`GET /fanqie/api/projects/{project_id}/peer?chapter_id=`;修改或删除:`PATCH` / `DELETE /fanqie/api/projects/{project_id}/peer/{item_id}`。',
|
| 880 |
'- 不把「素材采集」的任何内容发给它(你本来也读不到);只发作品资料、热榜、母题库、素材馆的摘要和改写卡,以及你自己写的问题。服务器打包时会再剔除一次原文字段。',
|
| 881 |
'- 令牌由服务器自己用续期令牌滚动续期,作者只需在「AI 协作 → 协作 AI」粘贴一次。返回令牌过期(401/403)、续期失败或积分用完:停下来告诉作者,请作者重新粘贴一次,不要自己找令牌、也不要读令牌。', '')
|
| 882 |
L.push('## 7. 番茄热榜怎么更新', '',
|
|
|
|
| 548 |
'本次任务:审查。你是严格、坦率的网络小说责任编辑,熟悉番茄小说的内容规范、签约标准和读者口味。',
|
| 549 |
'提意见之前,先把附带的大纲、章节目录和后文读完。后文已经交代、大纲已经安排的事,不算问题,单独列为「后文已安排」并注明在第几章;只有资料里确实没有着落的,才算问题。',
|
| 550 |
'每条意见标一个等级:【硬伤】逻辑断裂、前后矛盾、人物动机说不通、违反平台规定;【建议】可以更好但现在也成立;【后文已安排】。按 硬伤 → 建议 → 后文已安排 的顺序写。',
|
| 551 |
+
'每条硬伤必须同时给出两处原文:①本章出问题的原句(一字不改地引用);②与它冲突的另一句,注明出自第几章、圣经或大纲。给不出第二处原文的,只能算【建议】,不能算【硬伤】。',
|
| 552 |
+
'然后说清为什么不成立、给出可执行的修改方向(最小改动),并写明「改了会牵连哪几章」。',
|
| 553 |
+
'你只看到了附带的资料,拿不准的地方直接写「拿不准」,不要把猜测写成硬伤。',
|
| 554 |
'现在成立的写法不要为了“更好”去推翻;不要重写整段正文,必要时只给一两句示范。没问题就直接说「无硬伤」。',
|
| 555 |
].join('\n'),
|
| 556 |
research: '本次任务:调研。请查证并整理写作 AI 问到的信息(平台规则、题材趋势、时代背景、专业知识等),注明信息来源和时间,区分「确定」和「推测」。',
|
|
|
|
| 835 |
'- 不批量开新书、不一次生成多本;不替作者做签约、发布等账号操作。', '')
|
| 836 |
L.push('## 3. 可以读、应该读的内容', '',
|
| 837 |
'| 内容 | 怎么读 | 用途 |', '|---|---|---|',
|
| 838 |
+
'| **写新章资料包** | `GET /fanqie/api/projects/{作品ID}/writing-pack?chapter=章号&format=md` | **写新章只读这一份**:概览、圣经、大纲、目录、前三章当前正文、本章计划 |',
|
| 839 |
'| 作品全部资料 | `GET /fanqie/api/projects/{作品ID}` | 概览、圣经、大纲、章节目录 |',
|
| 840 |
'| 某章正文 | `GET /fanqie/api/projects/{作品ID}/chapters/{章节ID}` 取 `current_version_id`,再读 `.../versions/{版本ID}` | 续写、修改前先读 |',
|
| 841 |
'| 写作上下文 | `GET /fanqie/api/projects/{作品ID}/context?chapter_id=` | 圣经 + 大纲 + 上一章摘要 |',
|
| 842 |
+
'| 作者批注 | `GET /fanqie/api/projects/{作品ID}/notes?status=open` | **仅修稿模式** |',
|
| 843 |
+
'| 修改记录 | `GET /fanqie/api/projects/{作品ID}/changes?by=author` | **仅修稿模式**:作者亲手改正文的记录 + 未存版本的草稿 |',
|
| 844 |
'| 作者留言 | `GET /fanqie/api/projects/{作品ID}/requests` | 作者说「处理留言」时读 |',
|
| 845 |
'| 写作规则 | `GET /fanqie/api/agent/rules` | 自查清单、番茄平台规定、AI 写作规范 |',
|
| 846 |
'| 素材馆 · 母题列表 | `GET /fanqie/api/materials/motifs` | 先看有哪些母题和数量 |',
|
|
|
|
| 851 |
'| 母题库 v2 · 检索 | `GET /fanqie/api/motif2/cards?q=关键词&role=人物&m=母题&emo=情绪`、`/fanqie/api/motif2/role?r=爷爷`、`/fanqie/api/motif2/card?uid=` | 按人物、关系、事件找卡片 |',
|
| 852 |
'| 母题库 v2 · 组稿 | `POST /fanqie/api/motif2/compose`,字段 `idea`、`cast:[{role}]`、`mot:[]`、`emo:[]` | 自动串成提纲 |',
|
| 853 |
'| 番茄热榜 | `GET /fanqie/feed/rank.md`(带访问密码)、`GET /fanqie/api/rank/feed?scope=all&brief=1` | 读趋势、写解读和总纲 |',
|
| 854 |
+
'| 分歧待办 | `GET /fanqie/api/projects/{作品ID}/peer?todo=1` | **仅修稿模式**:作者已表态、你还没处理的分歧 |',
|
| 855 |
'| 阅读进度 | `GET /fanqie/api/projects/{作品ID}/progress` | 作者读到哪一章哪一段(只读,不要改) |', '')
|
| 856 |
L.push('**用素材的规矩:** 素材只借结构、情绪和细节的“类型”,写进小说时人名、地名、职业、具体情节都必须换成自己的;不整段搬用卡片里的句子;一章最多借 1–2 条素材。', '')
|
| 857 |
+
L.push('## 4. 工作流程:修稿和写新章是两种模式,严格分开', '',
|
| 858 |
+
'> 批注、分歧、修改记录、协作 AI 的回复、旧版本,都是「修稿用的过程材料」,里面有被否掉的想法、改之前的旧句子、对方没读懂全书时的误判。它们和「素材采集」一样,**写新章时一律不读**,免得旧说法、错误判断混进新正文。改完之后,只有**当前正文 + 圣经 + 大纲**算数。', '',
|
| 859 |
+
'**先判断这一轮是哪种模式:** 作者说「写第 N 章 / 往下写 / 续写」→ 写新章模式;说「按批注改 / 处理分歧 / 修第 N 章 / 审一下」→ 修稿模式。两件事都要做时,**先修稿、全部存成版本、这一轮结束**,再另起一轮写新章,从资料包重新读起,不带着修稿时的印象下笔。', '',
|
| 860 |
+
'### 4A. 写新章模式(只读干净资料包)', '',
|
| 861 |
+
'1. **取资料包**:`GET /fanqie/api/projects/{作品ID}/writing-pack?chapter=章号&format=md`。返回里有「先停一下」时(作者有没存版本的改动),停下来提醒作者,不要动笔。',
|
| 862 |
+
'2. **只用这些**:资料包 + 本守则第 1 节(作者状态)+ `/fanqie/api/agent/rules` + 需要时素材馆的摘要和改写卡。**不读** `notes`、`peer`、`changes`、`reviewer/log`、旧版本(`versions` 列表);不凭记忆沿用协作 AI 说过的句子或方案。',
|
| 863 |
+
'3. **写作**:按本章计划和大纲写,前文以资料包里的当前正文为准。写完存为新版本(`POST .../chapters/{章节ID}/versions`,`created_by` 填 `AI`),不覆盖作者的版本。',
|
| 864 |
+
'4. **自查**:读平台规定,逐条检查本章,写入检查记录(见第 5 节)。作者在「检查」栏看结果,检查只由你做。',
|
| 865 |
+
'5. **送审**:需要时请协作 AI 审本章(`attach: ["review:章号"]`),它的回复留到修稿模式里按 4C 处理,不在写新章这一轮里顺手改。', '',
|
| 866 |
+
'### 4B. 修稿模式(只处理作者点名的章节)', '',
|
| 867 |
+
'1. **作者对分歧的裁决**:`GET /fanqie/api/projects/{作品ID}/peer?todo=1`。`author_decision`:`adopt` = 按协作 AI 的意见改;`keep` = 维持现在的写法(不用改正文);`own` = 按 `author_note` 里作者自己的想法改。改完存新版本,再 `PATCH /fanqie/api/projects/{作品ID}/peer/{item_id}`,body `{"resolved":true,"resolution":"怎么处理的"}`。作者没表态的不用管。',
|
| 868 |
+
'2. **作者批注**:`GET /fanqie/api/projects/{作品ID}/notes?status=open`,不用等作者说「按批注修改」。逐条回原文核对,是问题就改正文、存新版本,在批注上写 `reply`(为什么是/不是问题、改了什么、牵连检查查了哪几章)并把 `status` 改成 `fixed`;不是问题也要写 `reply` 说明理由。',
|
| 869 |
+
'3. **作者亲手改过哪里**:`GET /fanqie/api/projects/{作品ID}/changes?by=author&unread=1`(`hunks`:第几段、原文 → 改为;`unsaved_author_drafts` 是作者还没存版本的改动)。作者的改动就是作者的决定,**不要改回去**;和前后文、圣经、大纲冲突时按牵连检查改其他章节,或提醒作者。读完 `PATCH /fanqie/api/projects/{作品ID}/changes/{change_id}`,body `{"by":"写作 AI","note":"看到了什么、做了什么"}`。**有未存版本的草稿时,别给那一章存新版本**,先提醒作者存版本。',
|
| 870 |
+
'4. **协作 AI 的审查意见**:按 4C 逐条判断,再动手。',
|
| 871 |
+
'5. **改完做牵连检查(必做)**:① 把改动所在的**整场戏**从头读到尾,核对在场的人、谁先走谁后走、动作先后、时间、道具;② 在全书已写章节里搜索这次改动涉及的人名、物件、数字、时间词,看前文铺垫和后文回收是否还成立;③ 牵连到的章节在**同一轮**一起改、一起存版本;④ 在处理记录(`resolution` / `reply` / `response`)里写明「牵连检查:查了第几章到第几章,改了哪几章」。',
|
| 872 |
+
'6. **自查不能只看改的那一句**:以整场戏和前后章为单位重读,不以“这句话本身通顺”为准。',
|
| 873 |
+
'7. **已发布的章节**:`GET /fanqie/api/projects/{作品ID}/publish` 里 `published` 不为空的章节已经发到番茄。改这些章要格外克制,只改硬伤;改完在交付说明里提醒作者「第 N 章已发布,需要到番茄后台同步修改」。',
|
| 874 |
+
'8. **收尾**:这一轮的改动全部存成版本后,修稿就结束了。之后写新章回到 4A,不再翻看这一轮的批注和分歧。', '',
|
| 875 |
+
'### 4C. 协作 AI 的意见怎么采纳(防止「顺着改、越改越乱」)', '',
|
| 876 |
+
'> 协作 AI 每次只看到一部分资料,常把后文已经交代的事、圣经里早有的设定当成漏洞。你写的东西本来没毛病,却因为顺着它改,把前后逻辑改出洞来——这是最要杜绝的情况。',
|
| 877 |
+
'1. **没有原文依据的不算**:一条「硬伤」必须引出本章原句,并引出与它冲突的另一句(注明出自第几章、圣经还是大纲)。没引原文、引文在当前正文里找不到、或只是“感觉不合理”的,一律不改,记成分歧(`verdict: "disagree"`,`evidence` 写「对方未给出原文依据」)。',
|
| 878 |
+
'2. **自己验一遍**:回正文找到它引的那句,前后各读一场;再查圣经、大纲、后文。只有你能用**两句原文**把矛盾说清楚,才算真问题。后文或圣经已经交代的,不算问题。',
|
| 879 |
+
'3. **默认保留原文**:「建议」类、文风类、“可以更好”类意见,默认不改;作者裁决过 `keep` 的、你之前已判 `disagree` 的地方,对方再提也不改。',
|
| 880 |
+
'4. **要改就最小改动**:只改出问题的那几句,用本书自己的语气重写,**不照搬协作 AI 的句子**;改完必做 4B 第 5 步牵连检查。',
|
| 881 |
+
'5. **每条都留记录**:采纳、部分采纳、不采纳都记到分歧栏,`evidence` 填你核对过的原文依据(「第 12 章:……」对「第 3 章:……」),作者据此裁决。', '')
|
| 882 |
L.push('## 5. 检查记录:自查清单与平台规定', '',
|
| 883 |
'- 规则来源:`GET /fanqie/api/agent/rules` → `checklist`(发布前自查,三组)和 `platform`(番茄内容红线 + 低质规则)。',
|
| 884 |
'- 检查由你(AI)逐条阅读正文后判断,**不能用关键词匹配代替阅读**。',
|
|
|
|
| 891 |
'- 它能做的活:`review` 审查(默认)、`research` 调研、`idea` 出主意、`draft` 起草、`other` 其他。例如:问它概览、圣经、大纲是否合乎逻辑;查某个年代的生活细节;给第 X 章出三种冲突方案。',
|
| 892 |
'- 提问:`POST /fanqie/api/agent/reviewer/ask`,字段:`project_id`、`task`、`topic`(如「圣经逻辑」)、`question`、`attach`(可选:作品资料 `overview`、`bible`、`outline`、`toc`、`chapters:1-5`、`chapter:{章节ID或章号}`、`review:{章号}`(**审单章用这个**:本章 + 前两章 + 已写好的全部后文 + 概览/圣经/大纲/目录)、`refs`(本书参考素材摘要)、`changes`(作者近期亲手改过的段落,`review:` 包里已自动带上本章的);共享资料 `rank`(热榜总览)、`rank:{分类,如 1_1141}`、`motif:{母题卡片uid}`、`motif_role:{人物,如 亲兄弟}`、`material:{素材馆uid}`(只给摘要和改写卡)、`rules`(番茄平台规定))、`wait`(最多等几秒,默认 50)、`queue`(默认开:令牌过期时先排队,作者粘贴新令牌或服务器续期成功后自动发出,状态为 `queued`)、`continue`(填上一次的 `ask_id` 或 `"last"`,就在同一个对话里接着问,对方记得上下文)。',
|
| 893 |
'- 回复要几分钟时,接口先返回 `state: "running"`;之后用 `GET /fanqie/api/agent/reviewer/log/{ask_id}?project_id=&wait=120` 取结果(`state` 变成 `done` 或 `error`)。不要重复提问同一件事。',
|
| 894 |
+
'- 读回复后按第 4C 节逐条判断——它的意见只是参考,没有原文依据的不改,与守则或作者要求冲突时以守则和作者为准。改完用 `PATCH /fanqie/api/agent/reviewer/log/{ask_id}` 回写 `status`(adopted / partial / rejected)和 `response`(怎么处理的)。',
|
| 895 |
+
'- **你和协作 AI 是同级的**:它的每条意见你都要自己重新想一遍,不能照单全收。两边意见不一致时,**按你的判断执行**,并把分歧逐条记到对应章节的旁栏(作者在章节编辑页的「分歧」栏里看,**绝不写进正文**):`POST /fanqie/api/projects/{project_id}/peer`,body `{"items":[{"chapter_number":11,"ask_id":"…","topic":"一句话主题","reviewer_said":"协作 AI 的意见","my_view":"我的判断和理由","decision":"最后怎么做","verdict":"disagree","evidence":"核对过的原文依据,如:第12章「……」对第3章「……」;对方没给依据就写「对方未给出原文依据」"}]}`。`verdict` 取 `disagree`(不一致,按我的)/ `partial`(部分采纳)/ `agree`(一致)。不属于某一章的意见不填章节号,算全书层面。查看:`GET /fanqie/api/projects/{project_id}/peer?chapter_id=`;修改或删除:`PATCH` / `DELETE /fanqie/api/projects/{project_id}/peer/{item_id}`。',
|
| 896 |
'- 不把「素材采集」的任何内容发给它(你本来也读不到);只发作品资料、热榜、母题库、素材馆的摘要和改写卡,以及你自己写的问题。服务器打包时会再剔除一次原文字段。',
|
| 897 |
'- 令牌由服务器自己用续期令牌滚动续期,作者只需在「AI 协作 → 协作 AI」粘贴一次。返回令牌过期(401/403)、续期失败或积分用完:停下来告诉作者,请作者重新粘贴一次,不要自己找令牌、也不要读令牌。', '')
|
| 898 |
L.push('## 7. 番茄热榜怎么更新', '',
|
fanqie/dist/index.html
CHANGED
|
@@ -8,8 +8,8 @@
|
|
| 8 |
<title>小说写作台</title>
|
| 9 |
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' rx='12' fill='%23b8432f'/%3E%3Ctext x='32' y='44' font-size='34' text-anchor='middle' fill='%23fff' font-family='serif'%3E%E6%96%87%3C/text%3E%3C/svg%3E" />
|
| 10 |
<script>try{var t=localStorage.getItem('xs_theme');if(t==='night')document.documentElement.dataset.theme='night'}catch(e){}</script>
|
| 11 |
-
<script type="module" crossorigin src="/assets/index-
|
| 12 |
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
| 13 |
</head>
|
| 14 |
<body>
|
| 15 |
<div id="root"></div>
|
|
|
|
| 8 |
<title>小说写作台</title>
|
| 9 |
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' rx='12' fill='%23b8432f'/%3E%3Ctext x='32' y='44' font-size='34' text-anchor='middle' fill='%23fff' font-family='serif'%3E%E6%96%87%3C/text%3E%3C/svg%3E" />
|
| 10 |
<script>try{var t=localStorage.getItem('xs_theme');if(t==='night')document.documentElement.dataset.theme='night'}catch(e){}</script>
|
| 11 |
+
<script type="module" crossorigin src="/assets/index-CBrxhsfk.js"></script>
|
| 12 |
+
<link rel="stylesheet" crossorigin href="/assets/index-bViJF6Aj.css">
|
| 13 |
</head>
|
| 14 |
<body>
|
| 15 |
<div id="root"></div>
|
fanqie/mount.js
CHANGED
|
@@ -57,6 +57,16 @@ module.exports = function mountFanqie(app, passwordOk, express) {
|
|
| 57 |
app.post('/fanqie/api/projects/:projectId/chapters/:chapterId/check', projectRoute(req => projects.basicCheck(req.params.projectId, req.params.chapterId)))
|
| 58 |
app.get('/fanqie/api/projects/:projectId/checks/:versionId', projectRoute(req => projects.getCheck(req.params.projectId, req.params.versionId)))
|
| 59 |
app.put('/fanqie/api/projects/:projectId/checks/:versionId', projectRoute(req => projects.saveCheck(req.params.projectId, req.params.versionId, req.body || {})))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
app.get('/fanqie/api/projects/:projectId/context', projectRoute(req => projects.getContext(req.params.projectId, req.query.chapter_id)))
|
| 61 |
// 协作 AI 意见裁决(逐章旁栏,不进正文)
|
| 62 |
app.get('/fanqie/api/projects/:projectId/peer', projectRoute(req => projects.listPeer(req.params.projectId, req.query.chapter_id ? String(req.query.chapter_id) : '', { todo: req.query.todo === '1' })))
|
|
|
|
| 57 |
app.post('/fanqie/api/projects/:projectId/chapters/:chapterId/check', projectRoute(req => projects.basicCheck(req.params.projectId, req.params.chapterId)))
|
| 58 |
app.get('/fanqie/api/projects/:projectId/checks/:versionId', projectRoute(req => projects.getCheck(req.params.projectId, req.params.versionId)))
|
| 59 |
app.put('/fanqie/api/projects/:projectId/checks/:versionId', projectRoute(req => projects.saveCheck(req.params.projectId, req.params.versionId, req.body || {})))
|
| 60 |
+
app.get('/fanqie/api/projects/:projectId/publish', projectRoute(req => projects.getPublish(req.params.projectId)))
|
| 61 |
+
app.put('/fanqie/api/projects/:projectId/publish/:chapterId', projectRoute(req => projects.setPublish(req.params.projectId, req.params.chapterId, req.body || {})))
|
| 62 |
+
app.get('/fanqie/api/projects/:projectId/writing-pack', async (req, res) => {
|
| 63 |
+
try {
|
| 64 |
+
const r = await projects.writingPack(req.params.projectId, req.query.chapter ? String(req.query.chapter) : '', { prev: req.query.prev, format: req.query.format === 'md' ? 'md' : 'json' })
|
| 65 |
+
res.setHeader('Cache-Control', 'no-store')
|
| 66 |
+
if (req.query.format === 'md') return res.type('text/markdown; charset=utf-8').send(r.text)
|
| 67 |
+
res.json(r)
|
| 68 |
+
} catch (e) { res.status(e.status || 400).json({ error: e.message || String(e) }) }
|
| 69 |
+
})
|
| 70 |
app.get('/fanqie/api/projects/:projectId/context', projectRoute(req => projects.getContext(req.params.projectId, req.query.chapter_id)))
|
| 71 |
// 协作 AI 意见裁决(逐章旁栏,不进正文)
|
| 72 |
app.get('/fanqie/api/projects/:projectId/peer', projectRoute(req => projects.listPeer(req.params.projectId, req.query.chapter_id ? String(req.query.chapter_id) : '', { todo: req.query.todo === '1' })))
|
fanqie/projects.js
CHANGED
|
@@ -503,6 +503,121 @@ async function getContext(projectId, chapterId) {
|
|
| 503 |
return { project, bible, outline, current_chapter: current || null, previous_summary: previous?.previous_summary || '', selected_materials: materials.items || [], chapters }
|
| 504 |
}
|
| 505 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 506 |
async function createRequest(projectId, body) {
|
| 507 |
await getProjectOrThrow(projectId)
|
| 508 |
const request = { request_id: id('request'), project_id: projectId, type: String(body?.type || 'writing'), instruction: String(body?.instruction || '').slice(0, 120000), chapter_id: body?.chapter_id || null, status: 'pending', created_at: now(), updated_at: now() }
|
|
@@ -646,6 +761,8 @@ function cleanPeer(b, prev, chapters) {
|
|
| 646 |
verdict,
|
| 647 |
// 正文里对应的那段话(只用于在编辑页、通读页加底色标注,复制和发布的正文里不会带上)
|
| 648 |
quote: b.quote !== undefined ? s(b.quote, 600) : (prev ? prev.quote || '' : ''),
|
|
|
|
|
|
|
| 649 |
// 作者裁决:adopt 采纳协作 AI 的意见 / keep 维持现在的写法 / own 按作者自己的想法;空 = 作者还没处理(写作 AI 不用管)
|
| 650 |
author_decision: prev ? prev.author_decision || '' : '',
|
| 651 |
author_note: prev ? prev.author_note || '' : '',
|
|
@@ -874,7 +991,7 @@ module.exports = {
|
|
| 874 |
getProgress, saveProgress, decidePeer, listChanges, ackChange, saveAuthorDraft, paraDiff,
|
| 875 |
listProjects, createProject, getProject, updateProject, deleteProject, saveBible, saveOutline, saveMaterials,
|
| 876 |
listChapters, createChapter, getChapter: getChapterOrThrow, updateChapter,
|
| 877 |
-
listVersions, getVersion, saveVersion, rollback, saveCheck, getCheck, basicCheck, getContext,
|
| 878 |
createRequest, listRequests, updateRequest, HttpError,
|
| 879 |
getNotes, createNote, updateNote, deleteNote, saveReview, deleteReview, listProjectNotes,
|
| 880 |
listPeer, addPeer, updatePeer, deletePeer,
|
|
|
|
| 503 |
return { project, bible, outline, current_chapter: current || null, previous_summary: previous?.previous_summary || '', selected_materials: materials.items || [], chapters }
|
| 504 |
}
|
| 505 |
|
| 506 |
+
/* ---------- 写新章的「干净资料包」 ----------
|
| 507 |
+
* 只放定稿内容:概览、圣经、大纲、目录(每章目标)、前几章当前正文、本章计划。
|
| 508 |
+
* 刻意不放:批注、分歧、修改记录、旧版本、协作 AI 的任何意见——这些是修稿用的,写新章时读了会被带偏。 */
|
| 509 |
+
const PACK_RULES = [
|
| 510 |
+
'本资料包只含定稿内容(概览、圣经、大纲、目录、前文当前正文、本章计划),是写新章的唯一依据。',
|
| 511 |
+
'写新章时不读批注、分歧、修改记录、旧版本、协作 AI 的回复;也不要凭记忆沿用其中的说法和句子。',
|
| 512 |
+
'前文正文以这里给出的当前版本为准;和你记忆中的旧写法不同时,以这里为准。',
|
| 513 |
+
'设定、人名、时间、物件以圣经和前文为准;大纲和本章目标决定这一章要走到哪里。',
|
| 514 |
+
]
|
| 515 |
+
async function writingPack(projectId, chapterRef, opt = {}) {
|
| 516 |
+
const project = await getProjectOrThrow(projectId)
|
| 517 |
+
const [bible, outline, chapters, dr] = await Promise.all([
|
| 518 |
+
readJson(projectKey(projectId, 'bible.json'), emptyBible()),
|
| 519 |
+
readJson(projectKey(projectId, 'outline.json'), emptyOutline()),
|
| 520 |
+
listChapters(projectId),
|
| 521 |
+
readJson(draftsKey(projectId), { drafts: {} })
|
| 522 |
+
])
|
| 523 |
+
const sorted = [...chapters].sort((a, b) => Number(a.number) - Number(b.number))
|
| 524 |
+
let target = chapterRef ? sorted.find(c => c.chapter_id === chapterRef || String(c.number) === String(chapterRef)) : null
|
| 525 |
+
const n = target ? Number(target.number) : (Number(chapterRef) > 0 ? Number(chapterRef) : (sorted.filter(c => c.current_version_id).reduce((m, c) => Math.max(m, Number(c.number)), 0) + 1))
|
| 526 |
+
if (!target) target = sorted.find(c => Number(c.number) === n) || null
|
| 527 |
+
const prevN = Math.max(1, Math.min(5, Number(opt.prev) || 3))
|
| 528 |
+
const prev = sorted.filter(c => Number(c.number) < n && c.current_version_id).slice(-prevN)
|
| 529 |
+
const textOf = async c => { try { return (await getVersion(projectId, c.chapter_id, c.current_version_id)).text || '' } catch { return '' } }
|
| 530 |
+
const prevTexts = []
|
| 531 |
+
for (const c of prev) prevTexts.push({ number: c.number, title: c.title || '', text: await textOf(c) })
|
| 532 |
+
const pick = (o, ks) => Object.fromEntries(ks.filter(k => o && o[k] !== undefined && o[k] !== '' && !(Array.isArray(o[k]) && !o[k].length)).map(k => [k, o[k]]))
|
| 533 |
+
const { updated_at: _b, source_material_uids: _s, ...bibleClean } = bible || {}
|
| 534 |
+
const { updated_at: _o, ...outlineClean } = outline || {}
|
| 535 |
+
const pendingDrafts = Object.keys(dr.drafts || {}).map(cid => sorted.find(c => c.chapter_id === cid)).filter(Boolean).map(c => c.number)
|
| 536 |
+
const toc = sorted.map(c => ({ number: c.number, title: c.title || '', goal: c.goal || '', written: !!c.current_version_id, words: c.word_count || 0 }))
|
| 537 |
+
const targetPlan = target ? pick(target, ['number', 'title', 'volume', 'goal', 'outline', 'scenes', 'status']) : { number: n, note: '这一章还没有建立,写之前先按大纲建章(标题 + 目标)。' }
|
| 538 |
+
const pack = {
|
| 539 |
+
kind: 'writing-pack', project_id: projectId, chapter_number: n, chapter_id: target?.chapter_id || null,
|
| 540 |
+
rules: PACK_RULES,
|
| 541 |
+
stop_if: pendingDrafts.length ? `作者在第 ${pendingDrafts.join('、')} 章有还没存为版本的改动。先提醒作者存版本,不要碰这几章。` : '',
|
| 542 |
+
overview: pick(project, ['title', 'genre', 'target_platform', 'target_words', 'pov', 'style', 'premise', 'status']),
|
| 543 |
+
bible: bibleClean, outline: outlineClean, toc,
|
| 544 |
+
previous_chapters: prevTexts,
|
| 545 |
+
target: targetPlan,
|
| 546 |
+
has_current_text: !!target?.current_version_id,
|
| 547 |
+
}
|
| 548 |
+
if (opt.format !== 'md') return pack
|
| 549 |
+
const L = [`# 写作资料包 · 第${n}章`, '', ...PACK_RULES.map(x => `> ${x}`), '']
|
| 550 |
+
if (pack.stop_if) L.push(`**先停一下:${pack.stop_if}**`, '')
|
| 551 |
+
L.push('## 作品概览', '```json', JSON.stringify(pack.overview, null, 1), '```', '')
|
| 552 |
+
L.push('## 作品圣经', '```json', JSON.stringify(bibleClean, null, 1), '```', '')
|
| 553 |
+
L.push('## 全书大纲', '```json', JSON.stringify(outlineClean, null, 1), '```', '')
|
| 554 |
+
L.push('## 章节目录', ...toc.map(c => `- 第${c.number}章 ${c.title}${c.goal ? `|目标:${c.goal}` : ''}${c.written ? `|已写 ${c.words} 字` : '|未写'}`), '')
|
| 555 |
+
for (const c of prevTexts) L.push(`## 前文 · 第${c.number}章 ${c.title}`, '', c.text, '')
|
| 556 |
+
L.push(`## 本章计划 · 第${n}章`, '```json', JSON.stringify(targetPlan, null, 1), '```', '')
|
| 557 |
+
if (pack.has_current_text) L.push('(本章已有正文。写新章模式只在作者要求重写时覆盖;修稿请走修稿模式。)')
|
| 558 |
+
return { ...pack, text: L.join('\n') }
|
| 559 |
+
}
|
| 560 |
+
|
| 561 |
+
/* ---------- 发布台:每章能不能发、发没发 ---------- */
|
| 562 |
+
function publishKey(projectId) { return projectKey(projectId, 'publish.json') }
|
| 563 |
+
async function getPublish(projectId) {
|
| 564 |
+
await getProjectOrThrow(projectId)
|
| 565 |
+
const [chapters, pub, audits, peer, dr] = await Promise.all([
|
| 566 |
+
listChapters(projectId),
|
| 567 |
+
readJson(publishKey(projectId), { chapters: {} }),
|
| 568 |
+
readJson(projectKey(projectId, 'audits/index.json'), { items: [] }),
|
| 569 |
+
readJson(peerKey(projectId), { items: [] }),
|
| 570 |
+
readJson(draftsKey(projectId), { drafts: {} })
|
| 571 |
+
])
|
| 572 |
+
const sorted = [...chapters].sort((a, b) => Number(a.number) - Number(b.number))
|
| 573 |
+
const notes = await Promise.all(sorted.map(c => readJson(notesKey(projectId, c.chapter_id), { notes: [] }).catch(() => ({ notes: [] }))))
|
| 574 |
+
const rows = sorted.map((c, i) => {
|
| 575 |
+
const au = (audits.items || []).filter(a => a.scope === 'chapter' && a.chapter_id === c.chapter_id)
|
| 576 |
+
const kinds = {}
|
| 577 |
+
for (const a of au) if (!kinds[a.kind]) kinds[a.kind] = a // 最新的在前
|
| 578 |
+
const latest = Object.values(kinds)
|
| 579 |
+
const status = !latest.length ? 'none' : latest.some(a => a.status === 'fail') ? 'fail' : latest.some(a => a.status === 'warn') ? 'warn' : 'pass'
|
| 580 |
+
const stale = latest.some(a => a.version_id && c.current_version_id && a.version_id !== c.current_version_id)
|
| 581 |
+
const p = (pub.chapters || {})[c.chapter_id] || null
|
| 582 |
+
return {
|
| 583 |
+
chapter_id: c.chapter_id, number: c.number, title: c.title || '', volume: c.volume || '', status: c.status,
|
| 584 |
+
words: c.word_count || 0, current_version_id: c.current_version_id || null, updated_at: c.updated_at,
|
| 585 |
+
check: { status, stale, kinds: latest.map(a => ({ kind: a.kind, status: a.status, at: a.created_at, version_id: a.version_id })) },
|
| 586 |
+
open_notes: (notes[i].notes || []).filter(n => n.status === 'open').length,
|
| 587 |
+
peer_todo: (peer.items || []).filter(x => x.chapter_id === c.chapter_id && !x.resolved && !x.author_decision).length,
|
| 588 |
+
unsaved_draft: !!(dr.drafts || {})[c.chapter_id],
|
| 589 |
+
published: p ? { at: p.at, version_id: p.version_id, words: p.words, changed: !!(p.version_id && c.current_version_id && p.version_id !== c.current_version_id) } : null,
|
| 590 |
+
}
|
| 591 |
+
})
|
| 592 |
+
return { chapters: rows, updated_at: pub.updated_at || null }
|
| 593 |
+
}
|
| 594 |
+
async function setPublish(projectId, chapterId, body) {
|
| 595 |
+
await getProjectOrThrow(projectId)
|
| 596 |
+
const chapters = await listChapters(projectId)
|
| 597 |
+
const c = chapters.find(x => x.chapter_id === chapterId)
|
| 598 |
+
if (!c) throw new HttpError(404, '章节不存在')
|
| 599 |
+
const out = await withLock(`publish:${projectId}`, async () => {
|
| 600 |
+
const d = await readJson(publishKey(projectId), { chapters: {} })
|
| 601 |
+
d.chapters = d.chapters || {}
|
| 602 |
+
if (body && body.published === false) delete d.chapters[chapterId]
|
| 603 |
+
else {
|
| 604 |
+
if (!c.current_version_id) throw new HttpError(400, '这一章还没有正文')
|
| 605 |
+
d.chapters[chapterId] = { at: body?.at || now(), version_id: c.current_version_id, words: c.word_count || 0, number: c.number }
|
| 606 |
+
}
|
| 607 |
+
await writeJson(publishKey(projectId), { chapters: d.chapters, updated_at: now() })
|
| 608 |
+
return d.chapters[chapterId] || null
|
| 609 |
+
})
|
| 610 |
+
// 作者状态里的「已发布章节数」跟着更新(所有作品合计),写作 AI 读守则时就知道了
|
| 611 |
+
try {
|
| 612 |
+
const list = await listProjects()
|
| 613 |
+
let total = 0
|
| 614 |
+
for (const p of list.projects || []) total += Object.keys((await readJson(publishKey(p.project_id), { chapters: {} })).chapters || {}).length
|
| 615 |
+
const prof = await readJson('agent/profile.json', null)
|
| 616 |
+
await writeJson('agent/profile.json', { ...(prof || {}), published_chapters: total, updated_at: now() })
|
| 617 |
+
} catch (e) { console.error('publish profile sync failed', e.message) }
|
| 618 |
+
return { chapter_id: chapterId, published: out }
|
| 619 |
+
}
|
| 620 |
+
|
| 621 |
async function createRequest(projectId, body) {
|
| 622 |
await getProjectOrThrow(projectId)
|
| 623 |
const request = { request_id: id('request'), project_id: projectId, type: String(body?.type || 'writing'), instruction: String(body?.instruction || '').slice(0, 120000), chapter_id: body?.chapter_id || null, status: 'pending', created_at: now(), updated_at: now() }
|
|
|
|
| 761 |
verdict,
|
| 762 |
// 正文里对应的那段话(只用于在编辑页、通读页加底色标注,复制和发布的正文里不会带上)
|
| 763 |
quote: b.quote !== undefined ? s(b.quote, 600) : (prev ? prev.quote || '' : ''),
|
| 764 |
+
// 原文依据:写作 AI 核对过的两处原文(本章原句 vs 冲突的另一句),没有依据的意见不改
|
| 765 |
+
evidence: b.evidence !== undefined ? s(b.evidence, 2000) : (prev ? prev.evidence || '' : ''),
|
| 766 |
// 作者裁决:adopt 采纳协作 AI 的意见 / keep 维持现在的写法 / own 按作者自己的想法;空 = 作者还没处理(写作 AI 不用管)
|
| 767 |
author_decision: prev ? prev.author_decision || '' : '',
|
| 768 |
author_note: prev ? prev.author_note || '' : '',
|
|
|
|
| 991 |
getProgress, saveProgress, decidePeer, listChanges, ackChange, saveAuthorDraft, paraDiff,
|
| 992 |
listProjects, createProject, getProject, updateProject, deleteProject, saveBible, saveOutline, saveMaterials,
|
| 993 |
listChapters, createChapter, getChapter: getChapterOrThrow, updateChapter,
|
| 994 |
+
listVersions, getVersion, saveVersion, rollback, saveCheck, getCheck, basicCheck, getContext, writingPack, getPublish, setPublish,
|
| 995 |
createRequest, listRequests, updateRequest, HttpError,
|
| 996 |
getNotes, createNote, updateNote, deleteNote, saveReview, deleteReview, listProjectNotes,
|
| 997 |
listPeer, addPeer, updatePeer, deletePeer,
|
public/assets/{index-C3EsJA9A.js → index-CBrxhsfk.js}
RENAMED
|
The diff for this file is too large to render.
See raw diff
|
|
|
public/assets/{index-uerEeeeu.css → index-bViJF6Aj.css}
RENAMED
|
The diff for this file is too large to render.
See raw diff
|
|
|
public/index.html
CHANGED
|
@@ -8,8 +8,8 @@
|
|
| 8 |
<title>小说写作台</title>
|
| 9 |
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' rx='12' fill='%23b8432f'/%3E%3Ctext x='32' y='44' font-size='34' text-anchor='middle' fill='%23fff' font-family='serif'%3E%E6%96%87%3C/text%3E%3C/svg%3E" />
|
| 10 |
<script>try{var t=localStorage.getItem('xs_theme');if(t==='night')document.documentElement.dataset.theme='night'}catch(e){}</script>
|
| 11 |
-
<script type="module" crossorigin src="/assets/index-
|
| 12 |
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
| 13 |
</head>
|
| 14 |
<body>
|
| 15 |
<div id="root"></div>
|
|
|
|
| 8 |
<title>小说写作台</title>
|
| 9 |
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' rx='12' fill='%23b8432f'/%3E%3Ctext x='32' y='44' font-size='34' text-anchor='middle' fill='%23fff' font-family='serif'%3E%E6%96%87%3C/text%3E%3C/svg%3E" />
|
| 10 |
<script>try{var t=localStorage.getItem('xs_theme');if(t==='night')document.documentElement.dataset.theme='night'}catch(e){}</script>
|
| 11 |
+
<script type="module" crossorigin src="/assets/index-CBrxhsfk.js"></script>
|
| 12 |
+
<link rel="stylesheet" crossorigin href="/assets/index-bViJF6Aj.css">
|
| 13 |
</head>
|
| 14 |
<body>
|
| 15 |
<div id="root"></div>
|
ui-src/src/api.ts
CHANGED
|
@@ -203,6 +203,8 @@ export const projectsApi = {
|
|
| 203 |
saveProgress: (id: string, body: { reader?: { chapter_id: string; para: number; ratio?: number }; chapter?: { chapter_id: string; read_para?: number; read_ratio?: number; edit_ratio?: number } }) => put<ReadProgress>(`${P}/${id}/progress`, body),
|
| 204 |
allNotes: (id: string, status?: string) => get<{ chapters: { chapter_id: string; number: number; title: string; current_version_id: string | null; notes: Note[] }[] }>(`${P}/${id}/notes${qs({ status })}`),
|
| 205 |
changes: (id: string, p: { by?: string; chapter_id?: string; limit?: number } = {}) => get<ChangeList>(`${P}/${id}/changes${qs(p)}`),
|
|
|
|
|
|
|
| 206 |
saveDraft: (id: string, cid: string, body: { text: string; base: string | null }) => put<{ ok: boolean }>(`${P}/${id}/chapters/${cid}/draft`, body),
|
| 207 |
createNote: (id: string, cid: string, body: Partial<Note>) => post<Note>(`${P}/${id}/chapters/${cid}/notes`, body),
|
| 208 |
updateNote: (id: string, cid: string, nid: string, body: Partial<Note>) => patch<Note>(`${P}/${id}/chapters/${cid}/notes/${nid}`, body),
|
|
@@ -221,6 +223,12 @@ export interface ChangeItem {
|
|
| 221 |
from_version_id: string | null; to_version_id: string; summary?: string; hunks: ChangeHunk[]; hunk_count: number; word_delta: number
|
| 222 |
acks?: { by: string; note: string; at: string }[]
|
| 223 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
export interface ChangeList {
|
| 225 |
items: ChangeItem[]; total: number; updated_at: string | null
|
| 226 |
unsaved_author_drafts: { chapter_id: string; number: number; title: string; at: string; hunks: ChangeHunk[]; hunk_count: number; word_delta: number }[]
|
|
@@ -267,7 +275,7 @@ export interface ReviewerCfg {
|
|
| 267 |
export interface PeerItem {
|
| 268 |
item_id: string; chapter_id: string | null; chapter_number: number | null; ask_id: string; topic: string
|
| 269 |
reviewer_said: string; my_view: string; decision: string; verdict: 'agree' | 'partial' | 'disagree'; created_by: string; created_at: string; updated_at: string
|
| 270 |
-
quote?: string; author_decision?: '' | 'adopt' | 'keep' | 'own'; author_note?: string; author_at?: string | null
|
| 271 |
resolved?: boolean; resolution?: string; resolved_at?: string | null
|
| 272 |
}
|
| 273 |
export interface ReadProgress {
|
|
|
|
| 203 |
saveProgress: (id: string, body: { reader?: { chapter_id: string; para: number; ratio?: number }; chapter?: { chapter_id: string; read_para?: number; read_ratio?: number; edit_ratio?: number } }) => put<ReadProgress>(`${P}/${id}/progress`, body),
|
| 204 |
allNotes: (id: string, status?: string) => get<{ chapters: { chapter_id: string; number: number; title: string; current_version_id: string | null; notes: Note[] }[] }>(`${P}/${id}/notes${qs({ status })}`),
|
| 205 |
changes: (id: string, p: { by?: string; chapter_id?: string; limit?: number } = {}) => get<ChangeList>(`${P}/${id}/changes${qs(p)}`),
|
| 206 |
+
publish: (id: string) => get<{ chapters: PublishRow[]; updated_at: string | null }>(`${P}/${id}/publish`),
|
| 207 |
+
setPublish: (id: string, cid: string, published: boolean) => put<{ chapter_id: string; published: PublishRow['published'] }>(`${P}/${id}/publish/${cid}`, { published }),
|
| 208 |
saveDraft: (id: string, cid: string, body: { text: string; base: string | null }) => put<{ ok: boolean }>(`${P}/${id}/chapters/${cid}/draft`, body),
|
| 209 |
createNote: (id: string, cid: string, body: Partial<Note>) => post<Note>(`${P}/${id}/chapters/${cid}/notes`, body),
|
| 210 |
updateNote: (id: string, cid: string, nid: string, body: Partial<Note>) => patch<Note>(`${P}/${id}/chapters/${cid}/notes/${nid}`, body),
|
|
|
|
| 223 |
from_version_id: string | null; to_version_id: string; summary?: string; hunks: ChangeHunk[]; hunk_count: number; word_delta: number
|
| 224 |
acks?: { by: string; note: string; at: string }[]
|
| 225 |
}
|
| 226 |
+
export interface PublishRow {
|
| 227 |
+
chapter_id: string; number: number; title: string; volume: string; status: string; words: number; current_version_id: string | null; updated_at: string
|
| 228 |
+
check: { status: 'none' | 'pass' | 'warn' | 'fail'; stale: boolean; kinds: { kind: string; status: string; at: string; version_id: string | null }[] }
|
| 229 |
+
open_notes: number; peer_todo: number; unsaved_draft: boolean
|
| 230 |
+
published: { at: string; version_id: string; words: number; changed: boolean } | null
|
| 231 |
+
}
|
| 232 |
export interface ChangeList {
|
| 233 |
items: ChangeItem[]; total: number; updated_at: string | null
|
| 234 |
unsaved_author_drafts: { chapter_id: string; number: number; title: string; at: string; hunks: ChangeHunk[]; hunk_count: number; word_delta: number }[]
|
|
|
|
| 275 |
export interface PeerItem {
|
| 276 |
item_id: string; chapter_id: string | null; chapter_number: number | null; ask_id: string; topic: string
|
| 277 |
reviewer_said: string; my_view: string; decision: string; verdict: 'agree' | 'partial' | 'disagree'; created_by: string; created_at: string; updated_at: string
|
| 278 |
+
quote?: string; evidence?: string; author_decision?: '' | 'adopt' | 'keep' | 'own'; author_note?: string; author_at?: string | null
|
| 279 |
resolved?: boolean; resolution?: string; resolved_at?: string | null
|
| 280 |
}
|
| 281 |
export interface ReadProgress {
|
ui-src/src/rooms/Book.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import React, { useCallback, useEffect, useMemo, useState } from 'react'
|
| 2 |
-
import { ChevronLeft, ScrollText, Users, ListTree, Bookmark, Plus, PanelLeftClose, PanelLeftOpen, Info, FileText, BookOpenText, Highlighter, History } from 'lucide-react'
|
| 3 |
import { Chapter, ProjectBundle, projectsApi } from '../api'
|
| 4 |
import { cnNum, cx, fmtAgo, fmtDate, fmtNum, go, CHAPTER_STATUS, PROJECT_STATUS, useLocal } from '../lib'
|
| 5 |
import { ErrorNote, Field, Loading, useConfirm, useToast, AutoText, Empty } from '../ui'
|
|
@@ -7,6 +7,7 @@ import ChapterEditor from './Editor'
|
|
| 7 |
import { BibleView, OutlineView, RefsView } from './Bible'
|
| 8 |
import Reader from './Reader'
|
| 9 |
import NotesHub from './NotesHub'
|
|
|
|
| 10 |
import { useBookProgress, pct, isDone } from './progress'
|
| 11 |
|
| 12 |
export type BookCtx = {
|
|
@@ -72,6 +73,7 @@ export default function Book({ projectId, sub, arg = '' }: { projectId: string;
|
|
| 72 |
else if (sub === 'bible') main = <BibleView ctx={ctx} />
|
| 73 |
else if (sub === 'outline') main = <OutlineView ctx={ctx} />
|
| 74 |
else if (sub === 'refs') main = <RefsView ctx={ctx} />
|
|
|
|
| 75 |
else if (sub === 'notes' || sub === 'changes') main = <NotesHub key={sub} ctx={ctx} initial={sub} />
|
| 76 |
else if (chapter) main = <ChapterEditor key={chapter.chapter_id} ctx={ctx} chapter={chapter} />
|
| 77 |
else if (sub && sub !== 'about') main = <div className="page"><Empty title="找不到这一章" >它可能已被移动。<button className="link-btn" onClick={() => go(`book/${projectId}/about`)}>回到作品概览</button></Empty></div>
|
|
@@ -112,6 +114,12 @@ function Binder({ ctx, sub, onAddChapter, onCollapse }: { ctx: BookCtx; sub: str
|
|
| 112 |
return () => { alive = false }
|
| 113 |
}, [pid, sub])
|
| 114 |
const totalWords = bundle.chapters.reduce((n, c) => n + (c.word_count || 0), 0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
const prog = useBookProgress(pid)
|
| 116 |
return (
|
| 117 |
<aside className="binder">
|
|
@@ -133,6 +141,7 @@ function Binder({ ctx, sub, onAddChapter, onCollapse }: { ctx: BookCtx; sub: str
|
|
| 133 |
<BinderLink on={sub === 'refs'} icon={<Bookmark size={15} />} onClick={() => go(`book/${pid}/refs`)} meta={`${refs}/3`}>参考素材</BinderLink>
|
| 134 |
<BinderLink on={sub === 'notes'} icon={<Highlighter size={15} />} onClick={() => go(`book/${pid}/notes`)} meta={openNotes ? `${openNotes} 待改` : ''}>批阅汇总</BinderLink>
|
| 135 |
<BinderLink on={sub === 'changes'} icon={<History size={15} />} onClick={() => go(`book/${pid}/changes`)}>修改记录</BinderLink>
|
|
|
|
| 136 |
<BinderLink on={sub === 'read'} icon={<BookOpenText size={15} />} onClick={() => go(`book/${pid}/read`)} meta={totalWords ? `${fmtNum(totalWords)} 字` : ''}>通读全书</BinderLink>
|
| 137 |
</div>
|
| 138 |
|
|
|
|
| 1 |
import React, { useCallback, useEffect, useMemo, useState } from 'react'
|
| 2 |
+
import { ChevronLeft, ScrollText, Users, ListTree, Bookmark, Plus, PanelLeftClose, PanelLeftOpen, Info, FileText, BookOpenText, Highlighter, History, Send } from 'lucide-react'
|
| 3 |
import { Chapter, ProjectBundle, projectsApi } from '../api'
|
| 4 |
import { cnNum, cx, fmtAgo, fmtDate, fmtNum, go, CHAPTER_STATUS, PROJECT_STATUS, useLocal } from '../lib'
|
| 5 |
import { ErrorNote, Field, Loading, useConfirm, useToast, AutoText, Empty } from '../ui'
|
|
|
|
| 7 |
import { BibleView, OutlineView, RefsView } from './Bible'
|
| 8 |
import Reader from './Reader'
|
| 9 |
import NotesHub from './NotesHub'
|
| 10 |
+
import Publish from './Publish'
|
| 11 |
import { useBookProgress, pct, isDone } from './progress'
|
| 12 |
|
| 13 |
export type BookCtx = {
|
|
|
|
| 73 |
else if (sub === 'bible') main = <BibleView ctx={ctx} />
|
| 74 |
else if (sub === 'outline') main = <OutlineView ctx={ctx} />
|
| 75 |
else if (sub === 'refs') main = <RefsView ctx={ctx} />
|
| 76 |
+
else if (sub === 'publish') main = <Publish ctx={ctx} />
|
| 77 |
else if (sub === 'notes' || sub === 'changes') main = <NotesHub key={sub} ctx={ctx} initial={sub} />
|
| 78 |
else if (chapter) main = <ChapterEditor key={chapter.chapter_id} ctx={ctx} chapter={chapter} />
|
| 79 |
else if (sub && sub !== 'about') main = <div className="page"><Empty title="找不到这一章" >它可能已被移动。<button className="link-btn" onClick={() => go(`book/${projectId}/about`)}>回到作品概览</button></Empty></div>
|
|
|
|
| 114 |
return () => { alive = false }
|
| 115 |
}, [pid, sub])
|
| 116 |
const totalWords = bundle.chapters.reduce((n, c) => n + (c.word_count || 0), 0)
|
| 117 |
+
const [pubMeta, setPubMeta] = useState('')
|
| 118 |
+
useEffect(() => {
|
| 119 |
+
let alive = true
|
| 120 |
+
projectsApi.publish(pid).then(r => { if (!alive) return; const w = r.chapters.filter(c => c.current_version_id); const p = w.filter(c => c.published).length; setPubMeta(w.length ? `${p}/${w.length}` : '') }, () => {})
|
| 121 |
+
return () => { alive = false }
|
| 122 |
+
}, [pid, sub])
|
| 123 |
const prog = useBookProgress(pid)
|
| 124 |
return (
|
| 125 |
<aside className="binder">
|
|
|
|
| 141 |
<BinderLink on={sub === 'refs'} icon={<Bookmark size={15} />} onClick={() => go(`book/${pid}/refs`)} meta={`${refs}/3`}>参考素材</BinderLink>
|
| 142 |
<BinderLink on={sub === 'notes'} icon={<Highlighter size={15} />} onClick={() => go(`book/${pid}/notes`)} meta={openNotes ? `${openNotes} 待改` : ''}>批阅汇总</BinderLink>
|
| 143 |
<BinderLink on={sub === 'changes'} icon={<History size={15} />} onClick={() => go(`book/${pid}/changes`)}>修改记录</BinderLink>
|
| 144 |
+
<BinderLink on={sub === 'publish'} icon={<Send size={15} />} onClick={() => go(`book/${pid}/publish`)} meta={pubMeta}>发布台</BinderLink>
|
| 145 |
<BinderLink on={sub === 'read'} icon={<BookOpenText size={15} />} onClick={() => go(`book/${pid}/read`)} meta={totalWords ? `${fmtNum(totalWords)} 字` : ''}>通读全书</BinderLink>
|
| 146 |
</div>
|
| 147 |
|
ui-src/src/rooms/Peer.tsx
CHANGED
|
@@ -61,6 +61,7 @@ function PeerCard({ x, pid, onChange }: { x: PeerItem; pid: string; onChange: (n
|
|
| 61 |
{x.quote && <div className="peer-quote">「{x.quote}」</div>}
|
| 62 |
<div className="peer-row"><span className="peer-who">协作 AI 说</span><p>{x.reviewer_said}</p></div>
|
| 63 |
<div className="peer-row mine"><span className="peer-who">写作 AI 认为</span><p>{x.my_view}</p></div>
|
|
|
|
| 64 |
{x.decision && <div className="peer-row final"><span className="peer-who">目前的做法</span><p>{x.decision}</p></div>}
|
| 65 |
{x.resolved && x.resolution && <div className="peer-row final"><span className="peer-who">已处理</span><p>{x.resolution}</p></div>}
|
| 66 |
|
|
|
|
| 61 |
{x.quote && <div className="peer-quote">「{x.quote}」</div>}
|
| 62 |
<div className="peer-row"><span className="peer-who">协作 AI 说</span><p>{x.reviewer_said}</p></div>
|
| 63 |
<div className="peer-row mine"><span className="peer-who">写作 AI 认为</span><p>{x.my_view}</p></div>
|
| 64 |
+
{x.evidence && <div className="peer-row evid"><span className="peer-who">原文依据</span><p>{x.evidence}</p></div>}
|
| 65 |
{x.decision && <div className="peer-row final"><span className="peer-who">目前的做法</span><p>{x.decision}</p></div>}
|
| 66 |
{x.resolved && x.resolution && <div className="peer-row final"><span className="peer-who">已处理</span><p>{x.resolution}</p></div>}
|
| 67 |
|
ui-src/src/rooms/Publish.tsx
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React, { useEffect, useMemo, useState } from 'react'
|
| 2 |
+
import { Send, Copy, Check, CheckCircle2, AlertTriangle, XCircle, CircleDashed, ChevronDown, ChevronRight, FileDown, BookOpenText, PenLine, RefreshCw, Undo2 } from 'lucide-react'
|
| 3 |
+
import { PublishRow, projectsApi } from '../api'
|
| 4 |
+
import { cnNum, copyText, cx, fmtDate, fmtNum, go, useAsync, useLocal } from '../lib'
|
| 5 |
+
import { Empty, ErrorNote, Loading, Segmented, useConfirm, useToast } from '../ui'
|
| 6 |
+
import type { BookCtx } from './Book'
|
| 7 |
+
|
| 8 |
+
/* 发布台:每一章能不能发、发没发;一键复制成番茄后台要的样子。
|
| 9 |
+
* 「能不能发」只看定稿状态:有没有正文、作者有没有没存的改动、待改批注、检查结果、正文里有没有残留标记。 */
|
| 10 |
+
|
| 11 |
+
const MIN_WORDS = 1000
|
| 12 |
+
type Level = 'block' | 'warn' | 'info'
|
| 13 |
+
type Issue = { level: Level; text: string }
|
| 14 |
+
|
| 15 |
+
// 复制到番茄后台的正文:去掉首尾空白、全角缩进和多余空行,段与段之间空一行
|
| 16 |
+
export function fanqieBody(text: string) {
|
| 17 |
+
return text.replace(/\r/g, '').split(/\n+/).map(p => p.replace(/^[\s ]+|[\s ]+$/g, '')).filter(Boolean).join('\n\n')
|
| 18 |
+
}
|
| 19 |
+
const plainTitle = (t: string) => t.replace(/^第[0-9零一二三四五六七八九十百千两]+章[\s::·、]*/, '').trim()
|
| 20 |
+
|
| 21 |
+
// 正文体检(只在作者自己的浏览器里跑,不改正文)
|
| 22 |
+
function lint(text: string): Issue[] {
|
| 23 |
+
const out: Issue[] = []
|
| 24 |
+
const paras = text.replace(/\r/g, '').split(/\n+/).map(p => p.trim()).filter(Boolean)
|
| 25 |
+
const marks = paras.filter(p => /【|】|\*\*|^#|<<<|>>>|TODO|待补|此处(省略|补充|待)|(作者注|(注:/.test(p))
|
| 26 |
+
if (marks.length) out.push({ level: 'block', text: `有 ${marks.length} 段带着编辑标记(如【】、**、待补),发出去读者会看到:「${marks[0].slice(0, 24)}…」` })
|
| 27 |
+
const tail = paras.slice(-3).filter(p => /^(自检|字数|修改说明|交付|报告|注)[::]/.test(p))
|
| 28 |
+
if (tail.length) out.push({ level: 'block', text: `结尾像是留着 AI 的说明文字:「${tail[0].slice(0, 24)}…」` })
|
| 29 |
+
const dup = paras.filter((p, i) => i > 0 && p.length > 8 && p === paras[i - 1])
|
| 30 |
+
if (dup.length) out.push({ level: 'warn', text: `有 ${dup.length} 段和上一段一模一样:「${dup[0].slice(0, 20)}…」` })
|
| 31 |
+
const long = paras.filter(p => [...p].length > 260)
|
| 32 |
+
if (long.length) out.push({ level: 'info', text: `有 ${long.length} 段超过 260 字,手机上读会显得很挤,可以考虑拆开` })
|
| 33 |
+
return out
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
function rowIssues(r: PublishRow, text?: string): Issue[] {
|
| 37 |
+
const out: Issue[] = []
|
| 38 |
+
if (!r.current_version_id) return [{ level: 'block', text: '还没有正文' }]
|
| 39 |
+
if (r.unsaved_draft) out.push({ level: 'block', text: '你在稿纸上还有没存为版本的改动,先回去存版本' })
|
| 40 |
+
if (r.open_notes) out.push({ level: 'block', text: `还有 ${r.open_notes} 条批注待修改` })
|
| 41 |
+
if (r.check.status === 'fail') out.push({ level: 'block', text: '检查没通过,先看该章「检查」栏' })
|
| 42 |
+
if (r.check.status === 'none') out.push({ level: 'warn', text: '这一章还没有做发布前检查' })
|
| 43 |
+
else if (r.check.stale) out.push({ level: 'warn', text: '检查之后正文又改过,检查结果可能过时' })
|
| 44 |
+
if (r.check.status === 'warn') out.push({ level: 'warn', text: '检查有提醒项,发之前看一眼' })
|
| 45 |
+
if (r.peer_todo) out.push({ level: 'warn', text: `有 ${r.peer_todo} 条分歧等你决定` })
|
| 46 |
+
if (r.words < MIN_WORDS) out.push({ level: 'warn', text: `只有 ${r.words} 字,番茄单章一般不少于 ${MIN_WORDS} 字` })
|
| 47 |
+
if (text) out.push(...lint(text))
|
| 48 |
+
return out
|
| 49 |
+
}
|
| 50 |
+
const readiness = (iss: Issue[]) => iss.some(i => i.level === 'block') ? 'block' : iss.some(i => i.level === 'warn') ? 'warn' : 'ok'
|
| 51 |
+
|
| 52 |
+
const CHECK_TAG: Record<string, { t: string; tone: string }> = {
|
| 53 |
+
pass: { t: '检查通过', tone: 'ok' }, warn: { t: '检查有提醒', tone: 'warn' }, fail: { t: '检查未通过', tone: 'err' }, none: { t: '未检查', tone: '' },
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
export default function Publish({ ctx }: { ctx: BookCtx }) {
|
| 57 |
+
const pid = ctx.bundle.project.project_id
|
| 58 |
+
const res = useAsync(() => projectsApi.publish(pid), [pid])
|
| 59 |
+
const [rows, setRows] = useState<PublishRow[] | null>(null)
|
| 60 |
+
useEffect(() => { if (res.data) setRows(res.data.chapters) }, [res.data])
|
| 61 |
+
const [view, setView] = useLocal<'todo' | 'done' | 'all'>('xs_pub_view', 'todo')
|
| 62 |
+
const [open, setOpen] = useState<string>('')
|
| 63 |
+
const [texts, setTexts] = useState<Record<string, string>>({})
|
| 64 |
+
const toast = useToast()
|
| 65 |
+
const confirm = useConfirm()
|
| 66 |
+
|
| 67 |
+
const written = (rows || []).filter(r => r.current_version_id)
|
| 68 |
+
const pubd = written.filter(r => r.published)
|
| 69 |
+
const next = written.find(r => !r.published) || null
|
| 70 |
+
const changed = pubd.filter(r => r.published!.changed)
|
| 71 |
+
const list = useMemo(() => (rows || []).filter(r => view === 'all' ? true : view === 'done' ? !!r.published : !r.published && !!r.current_version_id), [rows, view])
|
| 72 |
+
|
| 73 |
+
const loadText = async (r: PublishRow) => {
|
| 74 |
+
if (!r.current_version_id || texts[r.chapter_id] !== undefined) return
|
| 75 |
+
try { const v = await projectsApi.version(pid, r.chapter_id, r.current_version_id); setTexts(t => ({ ...t, [r.chapter_id]: v.text || '' })) }
|
| 76 |
+
catch (e: any) { toast(e.message, 'err') }
|
| 77 |
+
}
|
| 78 |
+
useEffect(() => { if (next) loadText(next) }, [next?.chapter_id])
|
| 79 |
+
useEffect(() => { const r = (rows || []).find(x => x.chapter_id === open); if (r) loadText(r) }, [open])
|
| 80 |
+
|
| 81 |
+
const mark = async (r: PublishRow, on: boolean) => {
|
| 82 |
+
try {
|
| 83 |
+
const x = await projectsApi.setPublish(pid, r.chapter_id, on)
|
| 84 |
+
setRows(rs => (rs || []).map(y => y.chapter_id === r.chapter_id ? { ...y, published: x.published ? { ...x.published, changed: false } : null } : y))
|
| 85 |
+
toast(on ? `第 ${r.number} 章已标为已发布` : `已撤销第 ${r.number} 章的发布标记`, 'ok')
|
| 86 |
+
} catch (e: any) { toast(e.message, 'err') }
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
if (res.error) return <div className="page narrow"><ErrorNote error={res.error} onRetry={res.reload} /></div>
|
| 90 |
+
if (!rows) return <Loading label="正在清点章节…" />
|
| 91 |
+
const totalWords = written.reduce((n, r) => n + r.words, 0)
|
| 92 |
+
const ready = written.filter(r => !r.published && readiness(rowIssues(r, texts[r.chapter_id])) !== 'block').length
|
| 93 |
+
|
| 94 |
+
return (
|
| 95 |
+
<div className="page narrow pub">
|
| 96 |
+
<div className="eyebrow"><Send size={13} />发布台</div>
|
| 97 |
+
<h1 className="hub-title">发到番茄之前</h1>
|
| 98 |
+
<p className="muted hub-lead">每章能不能发、发到了哪一章,都在这里。复制按钮会把正文整理成番茄后台要的样子(段与段之间空一行,去掉缩进和编辑标记以外的多余空白);发完点「标为已发布」,之后再改这一章,这里会提醒你去后台同步。</p>
|
| 99 |
+
|
| 100 |
+
<div className="pub-stats">
|
| 101 |
+
<div><b>{written.length}</b><span>已写章节</span></div>
|
| 102 |
+
<div><b>{fmtNum(totalWords)}</b><span>总字数</span></div>
|
| 103 |
+
<div><b>{pubd.length}</b><span>已发布</span></div>
|
| 104 |
+
<div className={cx(ready && 'hot')}><b>{ready}</b><span>可以发</span></div>
|
| 105 |
+
</div>
|
| 106 |
+
|
| 107 |
+
{changed.length > 0 && (
|
| 108 |
+
<div className="callout warn pub-changed"><AlertTriangle size={16} /><span>第 {changed.map(r => r.number).join('、')} 章发布后又改过,记得到番茄后台同步修改,同步完点该章的「已同步」。</span></div>
|
| 109 |
+
)}
|
| 110 |
+
|
| 111 |
+
{next && <NextCard r={next} text={texts[next.chapter_id]} pid={pid} onMark={() => mark(next, true)} />}
|
| 112 |
+
|
| 113 |
+
<div className="hub-bar pub-bar">
|
| 114 |
+
<Segmented value={view} onChange={setView} items={[{ id: 'todo', label: `待发布 ${written.length - pubd.length}` }, { id: 'done', label: `已发布 ${pubd.length}` }, { id: 'all', label: `全部 ${rows.length}` }]} />
|
| 115 |
+
<button className="link-btn" onClick={() => { setTexts({}); res.reload() }}><RefreshCw size={13} />刷新</button>
|
| 116 |
+
</div>
|
| 117 |
+
|
| 118 |
+
{list.length === 0 ? <Empty icon={<Send size={20} />} title={view === 'done' ? '还没有标记过已发布的章节' : '没有待发布的章节'}>{view === 'done' ? '发到番茄之后,回来点一下「标为已发布」。' : '写好的章节都发完了。'}</Empty> : (
|
| 119 |
+
<ul className="pub-list">
|
| 120 |
+
{list.map(r => (
|
| 121 |
+
<PubRow key={r.chapter_id} r={r} pid={pid} text={texts[r.chapter_id]} open={open === r.chapter_id}
|
| 122 |
+
onToggle={() => setOpen(o => o === r.chapter_id ? '' : r.chapter_id)}
|
| 123 |
+
onMark={on => on ? mark(r, true) : confirm({ title: `撤销第 ${r.number} 章的发布标记?`, body: '只是改这里的记录,不会影响番茄后台。', ok: '撤销' }).then(ok => { if (ok) mark(r, false) })} />
|
| 124 |
+
))}
|
| 125 |
+
</ul>
|
| 126 |
+
)}
|
| 127 |
+
|
| 128 |
+
<BatchTools rows={written} pid={pid} title={ctx.bundle.project.title} onMarked={res.reload} />
|
| 129 |
+
</div>
|
| 130 |
+
)
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
function CopyBtn({ label, get, disabled }: { label: string; get: () => string; disabled?: boolean }) {
|
| 134 |
+
const [done, setDone] = useState(false)
|
| 135 |
+
const toast = useToast()
|
| 136 |
+
return (
|
| 137 |
+
<button className={cx('btn', done ? 'ok' : 'ghost')} disabled={disabled} onClick={async () => {
|
| 138 |
+
const ok = await copyText(get())
|
| 139 |
+
if (ok) { setDone(true); setTimeout(() => setDone(false), 1600) } else toast('复制失败,请长按正文手动复制', 'err')
|
| 140 |
+
}}>{done ? <Check size={14} /> : <Copy size={14} />}{done ? '已复制' : label}</button>
|
| 141 |
+
)
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
function IssueList({ issues }: { issues: Issue[] }) {
|
| 145 |
+
if (!issues.length) return <div className="pub-ok"><CheckCircle2 size={15} />没有发现问题,可以发。</div>
|
| 146 |
+
return (
|
| 147 |
+
<ul className="pub-issues">
|
| 148 |
+
{issues.map((i, k) => (
|
| 149 |
+
<li key={k} className={i.level}>{i.level === 'block' ? <XCircle size={14} /> : i.level === 'warn' ? <AlertTriangle size={14} /> : <CircleDashed size={14} />}<span>{i.text}</span></li>
|
| 150 |
+
))}
|
| 151 |
+
</ul>
|
| 152 |
+
)
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
function NextCard({ r, text, pid, onMark }: { r: PublishRow; text?: string; pid: string; onMark: () => void }) {
|
| 156 |
+
const issues = rowIssues(r, text)
|
| 157 |
+
const st = readiness(issues)
|
| 158 |
+
return (
|
| 159 |
+
<section className={cx('pub-next', st)}>
|
| 160 |
+
<div className="pub-next-head">
|
| 161 |
+
<span className="pub-next-label">下一章该发</span>
|
| 162 |
+
<b>第{cnNum(r.number)}章 {r.title}</b>
|
| 163 |
+
<span className="muted">{fmtNum(r.words)} 字</span>
|
| 164 |
+
</div>
|
| 165 |
+
{text === undefined ? <div className="muted small-note">正在读正文…</div> : <IssueList issues={issues} />}
|
| 166 |
+
<div className="pub-steps">
|
| 167 |
+
<div className="pub-step"><em>1</em><span>番茄后台章节号填「第 {r.number} 章」,标题:</span><CopyBtn label="复制标题" get={() => plainTitle(r.title)} /></div>
|
| 168 |
+
<div className="pub-step"><em>2</em><span>正文:</span><CopyBtn label="复制正文" disabled={text === undefined} get={() => fanqieBody(text || '')} /></div>
|
| 169 |
+
<div className="pub-step"><em>3</em><span>发好以后:</span><button className="btn primary" onClick={onMark}><Send size={14} />标为已发布</button></div>
|
| 170 |
+
</div>
|
| 171 |
+
<div className="pub-links">
|
| 172 |
+
<button className="link-btn" onClick={() => go(`book/${pid}/read/${r.chapter_id}`)}><BookOpenText size={13} />先通读一遍</button>
|
| 173 |
+
<button className="link-btn" onClick={() => go(`book/${pid}/${r.chapter_id}`)}><PenLine size={13} />去修改</button>
|
| 174 |
+
</div>
|
| 175 |
+
</section>
|
| 176 |
+
)
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
function PubRow({ r, pid, text, open, onToggle, onMark }: { r: PublishRow; pid: string; text?: string; open: boolean; onToggle: () => void; onMark: (on: boolean) => void }) {
|
| 180 |
+
const issues = rowIssues(r, text)
|
| 181 |
+
const st = r.current_version_id ? readiness(issues) : 'block'
|
| 182 |
+
const ck = CHECK_TAG[r.check.status]
|
| 183 |
+
return (
|
| 184 |
+
<li className={cx('pub-row', open && 'open', r.published && 'is-pub')}>
|
| 185 |
+
<button className="pub-row-head" onClick={onToggle} aria-expanded={open}>
|
| 186 |
+
<span className={cx('pub-dot', r.published ? (r.published.changed ? 'warn' : 'pub') : st)} />
|
| 187 |
+
<span className="pub-row-title">第{cnNum(r.number)}章 {r.title}</span>
|
| 188 |
+
<span className="pub-row-meta">
|
| 189 |
+
<span>{r.current_version_id ? `${fmtNum(r.words)} 字` : '未写'}</span>
|
| 190 |
+
{r.current_version_id && <span className={cx('tag', ck.tone && `tag-${ck.tone}`)}>{ck.t}{r.check.stale ? '·已过时' : ''}</span>}
|
| 191 |
+
{r.open_notes > 0 && <span className="tag tag-err">{r.open_notes} 条批注</span>}
|
| 192 |
+
{r.unsaved_draft && <span className="tag tag-warn">有未存改动</span>}
|
| 193 |
+
{r.published && <span className={cx('tag', r.published.changed ? 'tag-warn' : 'tag-ok')}>{r.published.changed ? '发布后改过' : `${fmtDate(r.published.at, false)} 已发布`}</span>}
|
| 194 |
+
</span>
|
| 195 |
+
{open ? <ChevronDown size={15} /> : <ChevronRight size={15} />}
|
| 196 |
+
</button>
|
| 197 |
+
{open && (
|
| 198 |
+
<div className="pub-row-body">
|
| 199 |
+
{r.current_version_id && (text === undefined ? <div className="muted small-note">正在读正文…</div> : <IssueList issues={issues} />)}
|
| 200 |
+
<div className="pub-actions">
|
| 201 |
+
{r.current_version_id && <CopyBtn label="复制标题" get={() => plainTitle(r.title)} />}
|
| 202 |
+
{r.current_version_id && <CopyBtn label="复制正文" disabled={text === undefined} get={() => fanqieBody(text || '')} />}
|
| 203 |
+
{r.current_version_id && !r.published && <button className="btn primary" onClick={() => onMark(true)}><Send size={14} />标为已发布</button>}
|
| 204 |
+
{r.published?.changed && <button className="btn" onClick={() => onMark(true)}><Check size={14} />已同步到番茄</button>}
|
| 205 |
+
{r.published && <button className="btn ghost" onClick={() => onMark(false)}><Undo2 size={14} />撤销标记</button>}
|
| 206 |
+
</div>
|
| 207 |
+
<div className="pub-links">
|
| 208 |
+
{r.current_version_id && <button className="link-btn" onClick={() => go(`book/${pid}/read/${r.chapter_id}`)}><BookOpenText size={13} />通读</button>}
|
| 209 |
+
<button className="link-btn" onClick={() => go(`book/${pid}/${r.chapter_id}`)}><PenLine size={13} />打开这一章</button>
|
| 210 |
+
</div>
|
| 211 |
+
</div>
|
| 212 |
+
)}
|
| 213 |
+
</li>
|
| 214 |
+
)
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
function download(name: string, text: string) {
|
| 218 |
+
const url = URL.createObjectURL(new Blob([text], { type: 'text/plain;charset=utf-8' }))
|
| 219 |
+
const a = document.createElement('a'); a.href = url; a.download = name; a.click()
|
| 220 |
+
setTimeout(() => URL.revokeObjectURL(url), 2000)
|
| 221 |
+
}
|
| 222 |
+
|
| 223 |
+
// 批量:导出一段章节为 TXT;把以前已经发过的章节一次补记为已发布
|
| 224 |
+
function BatchTools({ rows, pid, title, onMarked }: { rows: PublishRow[]; pid: string; title: string; onMarked: () => void }) {
|
| 225 |
+
const first = rows[0]?.number || 1, last = rows[rows.length - 1]?.number || 1
|
| 226 |
+
const [from, setFrom] = useState(first)
|
| 227 |
+
const [to, setTo] = useState(last)
|
| 228 |
+
const [busy, setBusy] = useState('')
|
| 229 |
+
const toast = useToast()
|
| 230 |
+
const confirm = useConfirm()
|
| 231 |
+
if (!rows.length) return null
|
| 232 |
+
const pick = () => rows.filter(r => r.number >= Math.min(from, to) && r.number <= Math.max(from, to))
|
| 233 |
+
const exportTxt = async () => {
|
| 234 |
+
setBusy('txt')
|
| 235 |
+
try {
|
| 236 |
+
const parts: string[] = []
|
| 237 |
+
for (const r of pick()) {
|
| 238 |
+
const v = await projectsApi.version(pid, r.chapter_id, r.current_version_id!)
|
| 239 |
+
parts.push(`第${r.number}章 ${plainTitle(r.title)}\n\n${fanqieBody(v.text || '')}`)
|
| 240 |
+
}
|
| 241 |
+
download(`${title}_第${Math.min(from, to)}-${Math.max(from, to)}章.txt`, parts.join('\n\n\n') + '\n')
|
| 242 |
+
toast(`已导出 ${parts.length} 章`, 'ok')
|
| 243 |
+
} catch (e: any) { toast(e.message, 'err') } finally { setBusy('') }
|
| 244 |
+
}
|
| 245 |
+
const markAll = async () => {
|
| 246 |
+
const list = pick().filter(r => !r.published)
|
| 247 |
+
if (!list.length) return toast('这一段都已经标记过了', 'ok')
|
| 248 |
+
if (!(await confirm({ title: `把第 ${Math.min(from, to)}–${Math.max(from, to)} 章标为已发布?`, body: `共 ${list.length} 章。适合补记以前已经发到番茄的章节。`, ok: '标记' }))) return
|
| 249 |
+
setBusy('mark')
|
| 250 |
+
try { for (const r of list) await projectsApi.setPublish(pid, r.chapter_id, true); toast(`已标记 ${list.length} 章`, 'ok'); onMarked() }
|
| 251 |
+
catch (e: any) { toast(e.message, 'err') } finally { setBusy('') }
|
| 252 |
+
}
|
| 253 |
+
const nums = rows.map(r => r.number)
|
| 254 |
+
return (
|
| 255 |
+
<section className="pub-batch">
|
| 256 |
+
<div className="hub-sub">一次处理多章</div>
|
| 257 |
+
<div className="pub-batch-row">
|
| 258 |
+
<span>第</span>
|
| 259 |
+
<select className="input auto" value={from} onChange={e => setFrom(Number(e.target.value))}>{nums.map(n => <option key={n} value={n}>{n}</option>)}</select>
|
| 260 |
+
<span>到</span>
|
| 261 |
+
<select className="input auto" value={to} onChange={e => setTo(Number(e.target.value))}>{nums.map(n => <option key={n} value={n}>{n}</option>)}</select>
|
| 262 |
+
<span>章</span>
|
| 263 |
+
</div>
|
| 264 |
+
<div className="pub-actions">
|
| 265 |
+
<button className="btn ghost" disabled={!!busy} onClick={exportTxt}><FileDown size={14} />{busy === 'txt' ? '正在导出…' : '导出 TXT'}</button>
|
| 266 |
+
<button className="btn ghost" disabled={!!busy} onClick={markAll}><Send size={14} />{busy === 'mark' ? '正在标记…' : '补记为已发布'}</button>
|
| 267 |
+
</div>
|
| 268 |
+
</section>
|
| 269 |
+
)
|
| 270 |
+
}
|
ui-src/src/styles.css
CHANGED
|
@@ -1918,3 +1918,61 @@ details.older[open] { display: flex; flex-direction: column; gap: 8px; }
|
|
| 1918 |
.pick-pill .btn { border-radius: 99px; flex: none; height: 34px; }
|
| 1919 |
.reader-tools.tb-group { gap: 6px; }
|
| 1920 |
.reader.themed .tb-btn:not(.on):not(.primary) { background: transparent; border-color: color-mix(in srgb, var(--rink) 20%, transparent); color: color-mix(in srgb, var(--rink) 80%, transparent); box-shadow: none; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1918 |
.pick-pill .btn { border-radius: 99px; flex: none; height: 34px; }
|
| 1919 |
.reader-tools.tb-group { gap: 6px; }
|
| 1920 |
.reader.themed .tb-btn:not(.on):not(.primary) { background: transparent; border-color: color-mix(in srgb, var(--rink) 20%, transparent); color: color-mix(in srgb, var(--rink) 80%, transparent); box-shadow: none; }
|
| 1921 |
+
|
| 1922 |
+
.peer-row.evid p { font-size: 12.5px; color: var(--ink-2); background: var(--bg-2); border-radius: 6px; padding: 4px 8px; }
|
| 1923 |
+
|
| 1924 |
+
/* ---------- 发布台 ---------- */
|
| 1925 |
+
.callout.warn { background: var(--warn-soft); color: var(--warn); align-items: flex-start; line-height: 1.6; }
|
| 1926 |
+
.callout.warn svg { flex: none; margin-top: 2px; }
|
| 1927 |
+
.pub-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 4px 0 16px; }
|
| 1928 |
+
.pub-stats > div { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
|
| 1929 |
+
.pub-stats b { font-family: var(--serif); font-size: 22px; line-height: 1.1; }
|
| 1930 |
+
.pub-stats span { font-size: 12px; color: var(--ink-3); }
|
| 1931 |
+
.pub-stats .hot { border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: var(--ok-soft); }
|
| 1932 |
+
.pub-stats .hot b { color: var(--ok); }
|
| 1933 |
+
.pub-next { border: 1px solid var(--line-2); border-left: 4px solid var(--ok); background: var(--paper); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow-s); margin-bottom: 20px; }
|
| 1934 |
+
.pub-next.warn { border-left-color: var(--warn); }
|
| 1935 |
+
.pub-next.block { border-left-color: var(--err); }
|
| 1936 |
+
.pub-next-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
|
| 1937 |
+
.pub-next-head b { font-family: var(--serif); font-size: 18px; }
|
| 1938 |
+
.pub-next-label { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; color: var(--ink-3); }
|
| 1939 |
+
.pub-steps { display: flex; flex-direction: column; gap: 8px; }
|
| 1940 |
+
.pub-step { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13.5px; }
|
| 1941 |
+
.pub-step em { font-style: normal; width: 22px; height: 22px; border-radius: 50%; background: var(--bg-2); color: var(--ink-2); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; flex: none; }
|
| 1942 |
+
.pub-step span { flex: 1 1 auto; min-width: 0; color: var(--ink-2); }
|
| 1943 |
+
.pub-links { display: flex; gap: 14px; flex-wrap: wrap; }
|
| 1944 |
+
.pub-ok { display: flex; align-items: center; gap: 6px; color: var(--ok); font-size: 13px; }
|
| 1945 |
+
.pub-issues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
|
| 1946 |
+
.pub-issues li { display: flex; gap: 7px; align-items: flex-start; font-size: 13px; line-height: 1.55; }
|
| 1947 |
+
.pub-issues li svg { flex: none; margin-top: 3px; }
|
| 1948 |
+
.pub-issues li.block { color: var(--err); }
|
| 1949 |
+
.pub-issues li.warn { color: var(--warn); }
|
| 1950 |
+
.pub-issues li.info { color: var(--ink-3); }
|
| 1951 |
+
.pub-bar { margin-bottom: 10px; }
|
| 1952 |
+
.pub-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
|
| 1953 |
+
.pub-row { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; overflow: hidden; }
|
| 1954 |
+
.pub-row.open { border-color: var(--line-2); box-shadow: var(--shadow-s); }
|
| 1955 |
+
.pub-row-head { width: 100%; display: flex; align-items: center; gap: 10px; padding: 11px 12px; background: none; border: 0; font: inherit; color: var(--ink); cursor: pointer; text-align: left; flex-wrap: wrap; }
|
| 1956 |
+
.pub-row-head:hover { background: var(--raised); }
|
| 1957 |
+
.pub-row-head > svg { margin-left: auto; color: var(--ink-4); flex: none; }
|
| 1958 |
+
.pub-row-title { font-weight: 600; font-size: 14.5px; }
|
| 1959 |
+
.pub-row-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-3); }
|
| 1960 |
+
.pub-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--ink-4); }
|
| 1961 |
+
.pub-dot.ok { background: var(--ok); } .pub-dot.warn { background: var(--warn); } .pub-dot.block { background: var(--err); }
|
| 1962 |
+
.pub-dot.pub { background: var(--blue); }
|
| 1963 |
+
.pub-row-body { padding: 4px 14px 14px 31px; display: flex; flex-direction: column; gap: 12px; }
|
| 1964 |
+
.pub-actions { display: flex; gap: 8px; flex-wrap: wrap; }
|
| 1965 |
+
.btn.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
|
| 1966 |
+
.pub-batch { margin-top: 28px; padding-top: 16px; border-top: 1px dashed var(--line-2); display: flex; flex-direction: column; gap: 10px; }
|
| 1967 |
+
.pub-batch-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
|
| 1968 |
+
@media (max-width: 760px) {
|
| 1969 |
+
.pub-stats { grid-template-columns: repeat(2, 1fr); }
|
| 1970 |
+
.pub-step { align-items: stretch; }
|
| 1971 |
+
.pub-step span { flex-basis: calc(100% - 32px); }
|
| 1972 |
+
.pub-step .btn { flex: 1 1 100%; justify-content: center; height: 42px; }
|
| 1973 |
+
.pub-row-body { padding-left: 14px; }
|
| 1974 |
+
.pub-actions .btn { flex: 1 1 calc(50% - 4px); justify-content: center; height: 40px; }
|
| 1975 |
+
.pub-row-meta { flex-basis: 100%; padding-left: 19px; }
|
| 1976 |
+
.pub-row-head > svg { position: absolute; right: 12px; }
|
| 1977 |
+
.pub-row { position: relative; }
|
| 1978 |
+
}
|