Spaces:
Running
Running
root commited on
Commit ·
442d6d2
1
Parent(s): 00385f7
AI 提示词升级:创作/续写/改写/派给另一个 AI 工单
Browse files
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-BKap2zoj.js"></script>
|
| 12 |
+
<link rel="stylesheet" crossorigin href="/assets/index-DKhFBOyw.css">
|
| 13 |
</head>
|
| 14 |
<body>
|
| 15 |
<div id="root"></div>
|
public/assets/{index-BuzsbDOj.js → index-BKap2zoj.js}
RENAMED
|
The diff for this file is too large to render.
See raw diff
|
|
|
public/assets/{index-ZSg5uRI5.css → index-DKhFBOyw.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-BKap2zoj.js"></script>
|
| 12 |
+
<link rel="stylesheet" crossorigin href="/assets/index-DKhFBOyw.css">
|
| 13 |
</head>
|
| 14 |
<body>
|
| 15 |
<div id="root"></div>
|
ui-src/src/rooms/Editor.tsx
CHANGED
|
@@ -1,13 +1,13 @@
|
|
| 1 |
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
| 2 |
-
import {
|
| 3 |
import {
|
| 4 |
Save, Maximize2, Minimize2, PanelRightClose, PanelRightOpen, History, ClipboardCheck, BookmarkPlus, Sparkles, FileCog,
|
| 5 |
Type, AlignLeft, RotateCcw, Eye, GitCompare, Copy, Search, Send, X, Check, AlertTriangle, Undo2, Highlighter,
|
| 6 |
} from 'lucide-react'
|
| 7 |
-
import {
|
| 8 |
import { Chapter, Material, materialsApi, projectsApi, Version, VersionMeta } from '../api'
|
| 9 |
import { cnNum, copyText, countWords, cx, diffParagraphs, fmtAgo, fmtDate, go, CHAPTER_STATUS, GENRE, KIND, VERSION_KIND, useLocal, useDebounced, useAsync } from '../lib'
|
| 10 |
-
import { AutoText, Empty, ErrorNote, Field, ListEditor, Loading, Modal, Spinner, Tabs, useConfirm, useToast, Segmented } from '../ui'
|
| 11 |
import type { BookCtx } from './Book'
|
| 12 |
import { toRef } from './Bible'
|
| 13 |
import { feedApi } from './RankInspire'
|
|
@@ -600,27 +600,35 @@ function RefsPanel({ ctx }: { ctx: BookCtx }) {
|
|
| 600 |
}
|
| 601 |
|
| 602 |
/* ---------- AI 提示词 ---------- */
|
| 603 |
-
const TASKS = [
|
| 604 |
-
{ id: 'draft', t: '写本章正文', d: '按本章目标、章纲和场景卡起草正文' },
|
| 605 |
-
{ id: 'continue', t: '续写', d: '接着稿纸最后的内容往下写' },
|
| 606 |
-
{ id: 'polish', t: '润色', d: '保留情节,改得更顺、更有画面' },
|
| 607 |
-
{ id: 'review', t: '连续性审读', d: '对照作品圣经找矛盾和漏洞' },
|
| 608 |
-
{ id: 'next', t: '下一章章纲', d: '根据本章结尾规划下一章' },
|
| 609 |
-
]
|
| 610 |
function AiPanel({ ctx, detail, text }: { ctx: BookCtx; detail: Chapter; text: string }) {
|
| 611 |
const toast = useToast()
|
| 612 |
const { bundle } = ctx
|
| 613 |
-
const
|
| 614 |
-
const [extra, setExtra] = useState('')
|
| 615 |
const pid = bundle.project.project_id
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 616 |
const [inspOn, setInspOn] = useLocal<boolean>('ai-insp-on', true)
|
| 617 |
const [inspPick, setInspPick] = useLocal<string>(`ai-insp-${pid}`, '')
|
| 618 |
const ins = useAsync(() => feedApi.cats().catch(() => null), [])
|
| 619 |
const inspCards = useMemo(() => (ins.data?.cats || []).map(c => ({ k: c.k, g: c.g, name: c.name })), [ins.data])
|
| 620 |
const inspScope = inspPick || guessScope(GENRE[bundle.project.genre] || bundle.project.genre || '', inspCards)
|
| 621 |
const insp = useAsync(() => (inspOn && inspScope && inspScope !== 'none' ? feedApi.feed({ scope: inspScope, brief: true }).then(r => r.text).catch(() => '') : Promise.resolve('')), [inspOn, inspScope])
|
| 622 |
-
const
|
| 623 |
-
const
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 624 |
return (
|
| 625 |
<div className="panel-stack">
|
| 626 |
<div className="task-list">
|
|
@@ -630,22 +638,49 @@ function AiPanel({ ctx, detail, text }: { ctx: BookCtx; detail: Chapter; text: s
|
|
| 630 |
</button>
|
| 631 |
))}
|
| 632 |
</div>
|
| 633 |
-
|
| 634 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 635 |
<div className="insp-pick">
|
| 636 |
<label className="row gap"><input type="checkbox" checked={inspOn} onChange={e => setInspOn(e.target.checked)} /><b>附上番茄热榜同类书(原文)</b></label>
|
| 637 |
{inspOn && <select value={inspScope || 'none'} onChange={e => setInspPick(e.target.value)}>
|
| 638 |
<option value="none">选择本书所在的番茄分类…</option>
|
| 639 |
{inspCards.map(c => <option key={c.k} value={c.k}>{c.g} · {c.name}</option>)}
|
| 640 |
</select>}
|
| 641 |
-
<div className="muted small-note">{inspOn ? (inspText ? `已附上 ${inspText.length} 字:同类热榜前 10 本的书名、在读、标签和简介,AI 读完再写,只借鉴不照搬。` :
|
| 642 |
</div>
|
| 643 |
)}
|
|
|
|
| 644 |
<div className="prompt-box">
|
| 645 |
-
<div className="prompt-head"><b>提示词预览</b><span className="muted">{prompt.length} 字符</span></div>
|
| 646 |
<pre>{prompt}</pre>
|
| 647 |
</div>
|
| 648 |
-
<button className="btn primary block" onClick={async () => { await copyText(prompt); toast('提示词已复制,粘贴给你常用的 AI 即可', 'ok') }}><Copy size={14} />复制提示词</button>
|
| 649 |
<div className="divider" />
|
| 650 |
<RequestsBox pid={bundle.project.project_id} cid={detail.chapter_id} />
|
| 651 |
</div>
|
|
@@ -685,50 +720,8 @@ function RequestsBox({ pid, cid }: { pid: string; cid: string }) {
|
|
| 685 |
)
|
| 686 |
}
|
| 687 |
|
| 688 |
-
function listLines(arr: any[], fmt: (x: any) => string) {
|
| 689 |
-
return (Array.isArray(arr) ? arr : []).map(x => typeof x === 'string' ? x : fmt(x)).filter(s => s && s.trim()).map(s => `- ${s}`).join('\n')
|
| 690 |
-
}
|
| 691 |
function guessScope(genre: string, cards: { k: string; g: string; name: string }[]) {
|
| 692 |
const hits = cards.filter(c => c.name && genre.includes(c.name))
|
| 693 |
if (!hits.length) return ''
|
| 694 |
return (hits.find(c => genre.includes(c.g)) || hits[0]).k
|
| 695 |
}
|
| 696 |
-
export function buildPrompt(bundle: any, ch: Chapter, text: string, task: string, extra: string, inspo = '') {
|
| 697 |
-
const p = bundle.project, b = bundle.bible || {}
|
| 698 |
-
const prev = bundle.chapters.filter((c: Chapter) => c.number < ch.number).sort((a: Chapter, z: Chapter) => z.number - a.number)[0]
|
| 699 |
-
const out: string[] = [aiPromptBlock(), '']
|
| 700 |
-
out.push(`你是一名熟悉番茄小说平台的网文作者助手。请用简体中文完成任务。`)
|
| 701 |
-
const contract = aiContractBlock(b)
|
| 702 |
-
if (contract) out.push(`\n${contract}`)
|
| 703 |
-
out.push(`\n【作品】《${p.title}》${p.genre ? `|题材:${p.genre}` : ''}${p.pov ? `|视角:${p.pov}` : ''}${p.style ? `|文风:${p.style}` : ''}`)
|
| 704 |
-
if (p.premise) out.push(`一句话梗概:${p.premise}`)
|
| 705 |
-
const core = [['核心冲突', b.story_core], ['主线', b.main_plot], ['结局方向', b.ending_direction], ['读者期待', b.reader_expectation]].filter(([, v]) => v)
|
| 706 |
-
if (core.length) out.push(`\n【作品圣经】\n${core.map(([k, v]) => `${k}:${v}`).join('\n')}`)
|
| 707 |
-
const chars = listLines(b.characters, c => [c.name, c.role && `(${c.role})`, c.goal && `想要:${c.goal}`, c.fear && `害怕:${c.fear}`, c.secret && `秘密:${c.secret}`].filter(Boolean).join(' '))
|
| 708 |
-
if (chars) out.push(`\n【人物】\n${chars}`)
|
| 709 |
-
const rel = listLines(b.relationships, r => `${r.from || '?'} ↔ ${r.to || '?'}:${r.relation || ''}${r.change ? `(变化:${r.change})` : ''}`)
|
| 710 |
-
if (rel) out.push(`\n【人物关系】\n${rel}`)
|
| 711 |
-
const fs = listLines((b.foreshadowing || []).filter((f: any) => f?.status !== 'paid'), f => `${f.plant || ''}${f.payoff ? ` → 回收:${f.payoff}` : ''}`)
|
| 712 |
-
if (fs && task !== 'polish') out.push(`\n【未回收的伏笔】\n${fs}`)
|
| 713 |
-
const rules = listLines(b.style_rules, r => String(r))
|
| 714 |
-
if (rules) out.push(`\n【文风规则】\n${rules}`)
|
| 715 |
-
const refs = (bundle.materials?.items || []).map((m: any, i: number) => `素材${i + 1}:${m.sum || ''}`).join('\n')
|
| 716 |
-
if (refs && (task === 'draft' || task === 'next')) out.push(`\n【参考素材(均为清洗后版本,只借鉴情节结构,人物、地点、细节必须全部虚构化,不得照搬)】\n${refs}`)
|
| 717 |
-
if (inspo) out.push(`\n${inspo}`)
|
| 718 |
-
out.push(`\n【当前章节】第${ch.number}章 ${ch.title || ''}${ch.volume ? `(${ch.volume})` : ''}`)
|
| 719 |
-
if (prev?.previous_summary) out.push(`前情提要:${prev.previous_summary}`)
|
| 720 |
-
if (ch.goal) out.push(`本章目标:${ch.goal}`)
|
| 721 |
-
if (ch.outline) out.push(`章纲:\n${ch.outline}`)
|
| 722 |
-
const scenes = listLines(ch.scenes || [], s => [s.title, s.goal, s.detail].filter(Boolean).join('|'))
|
| 723 |
-
if (scenes) out.push(`场景卡:\n${scenes}`)
|
| 724 |
-
const body = text.trim()
|
| 725 |
-
if (task === 'draft') out.push(`\n【任务】根据以上设定写出本章正文,约 2000–3000 字。开头 300 字内出现冲突,章末留一个让人想看下一章的钩子。多用动作和对白推进,少用大段心理描写和背景交代。`)
|
| 726 |
-
if (task === 'continue') out.push(`\n【稿纸末尾】\n……${body.slice(-1800)}\n\n【任务】紧接上文继续写约 1000–1500 字,保持人称、语气和节奏一致,不要重复已写内容。`)
|
| 727 |
-
if (task === 'polish') out.push(`\n【待润色正文】\n${body}\n\n【任务】在不改变情节和人物关系的前提下润色:删去冗余、拆分过长段落、让对白更自然、细节更具体。直接输出润色后的全文。`)
|
| 728 |
-
if (task === 'review') out.push(`\n【本章正文】\n${body}\n\n【任务】对照作品圣经做连续性审读,逐条列出:人设前后不一致、时间线矛盾、人物知道了不该知道的事、伏笔遗漏、逻辑漏洞。每条注明原文位置和修改建议。`)
|
| 729 |
-
if (task === 'next') out.push(`\n【本章结尾】\n……${body.slice(-1200)}\n\n【任务】为第${ch.number + 1}章写章纲:本章目标、3 个场景(每个场景写清冲突和结果)、章末钩子。`)
|
| 730 |
-
if (extra.trim()) out.push(`\n【补充要求】${extra.trim()}`)
|
| 731 |
-
const sc = selfCheckBlock(b)
|
| 732 |
-
if (sc && task !== 'next') out.push(`\n${sc}`)
|
| 733 |
-
return out.join('\n')
|
| 734 |
-
}
|
|
|
|
| 1 |
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
| 2 |
+
import { buildPrompt, defaultTarget, REWRITE_MODES, SUB_JOBS, TASKS, type RewriteMode, type SubJob, type Task } from './prompts'
|
| 3 |
import {
|
| 4 |
Save, Maximize2, Minimize2, PanelRightClose, PanelRightOpen, History, ClipboardCheck, BookmarkPlus, Sparkles, FileCog,
|
| 5 |
Type, AlignLeft, RotateCcw, Eye, GitCompare, Copy, Search, Send, X, Check, AlertTriangle, Undo2, Highlighter,
|
| 6 |
} from 'lucide-react'
|
| 7 |
+
import { locateNotes, NotesPanel, ReviewText, useNotes } from './Review'
|
| 8 |
import { Chapter, Material, materialsApi, projectsApi, Version, VersionMeta } from '../api'
|
| 9 |
import { cnNum, copyText, countWords, cx, diffParagraphs, fmtAgo, fmtDate, go, CHAPTER_STATUS, GENRE, KIND, VERSION_KIND, useLocal, useDebounced, useAsync } from '../lib'
|
| 10 |
+
import { AutoText, Empty, ErrorNote, Field, ListEditor, Loading, Modal, Spinner, Tabs, useConfirm, useToast, Segmented, Tag } from '../ui'
|
| 11 |
import type { BookCtx } from './Book'
|
| 12 |
import { toRef } from './Bible'
|
| 13 |
import { feedApi } from './RankInspire'
|
|
|
|
| 600 |
}
|
| 601 |
|
| 602 |
/* ---------- AI 提示词 ---------- */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 603 |
function AiPanel({ ctx, detail, text }: { ctx: BookCtx; detail: Chapter; text: string }) {
|
| 604 |
const toast = useToast()
|
| 605 |
const { bundle } = ctx
|
| 606 |
+
const b = bundle.bible || {}
|
|
|
|
| 607 |
const pid = bundle.project.project_id
|
| 608 |
+
const [task, setTask] = useLocal<Task>('ai-task', 'draft')
|
| 609 |
+
const [sub, setSub] = useLocal<SubJob>('ai-sub', 'draft')
|
| 610 |
+
const [mode, setMode] = useLocal<RewriteMode>('ai-mode', 'polish')
|
| 611 |
+
const [extra, setExtra] = useState('')
|
| 612 |
+
const [passage, setPassage] = useState('')
|
| 613 |
+
const job = task === 'delegate' ? sub : task
|
| 614 |
+
const needsTarget = job === 'draft' || job === 'continue' || (job === 'rewrite' && (mode === 'expand' || mode === 'tighten'))
|
| 615 |
+
const autoTarget = defaultTarget(task, sub, mode, b, text)
|
| 616 |
+
const [targetIn, setTargetIn] = useState('')
|
| 617 |
+
useEffect(() => setTargetIn(''), [task, sub, mode, detail.chapter_id])
|
| 618 |
+
const target = Number(targetIn) || autoTarget
|
| 619 |
const [inspOn, setInspOn] = useLocal<boolean>('ai-insp-on', true)
|
| 620 |
const [inspPick, setInspPick] = useLocal<string>(`ai-insp-${pid}`, '')
|
| 621 |
const ins = useAsync(() => feedApi.cats().catch(() => null), [])
|
| 622 |
const inspCards = useMemo(() => (ins.data?.cats || []).map(c => ({ k: c.k, g: c.g, name: c.name })), [ins.data])
|
| 623 |
const inspScope = inspPick || guessScope(GENRE[bundle.project.genre] || bundle.project.genre || '', inspCards)
|
| 624 |
const insp = useAsync(() => (inspOn && inspScope && inspScope !== 'none' ? feedApi.feed({ scope: inspScope, brief: true }).then(r => r.text).catch(() => '') : Promise.resolve('')), [inspOn, inspScope])
|
| 625 |
+
const inspWanted = job === 'draft' || job === 'next' || job === 'continue'
|
| 626 |
+
const inspText = inspWanted ? insp.data || '' : ''
|
| 627 |
+
// 上一章结尾原文:创作新章时带给 AI,保证衔接
|
| 628 |
+
const prevCh = useMemo(() => [...bundle.chapters].sort((a, z) => a.number - z.number).filter(c => c.number < detail.number).pop(), [bundle.chapters, detail.number])
|
| 629 |
+
const prevTail = useAsync(() => (prevCh?.current_version_id ? projectsApi.version(pid, prevCh.chapter_id, prevCh.current_version_id).then(v => (v.text || '').trim().slice(-800)).catch(() => '') : Promise.resolve('')), [prevCh?.chapter_id, prevCh?.current_version_id])
|
| 630 |
+
const prompt = useMemo(() => buildPrompt(bundle, detail, text, { task, sub, mode, target, passage, extra, inspo: inspText, prevTail: prevTail.data || '' }), [bundle, detail, text, task, sub, mode, target, passage, extra, inspText, prevTail.data])
|
| 631 |
+
const emptyText = !text.trim() && (job === 'rewrite' || job === 'review' || job === 'next')
|
| 632 |
return (
|
| 633 |
<div className="panel-stack">
|
| 634 |
<div className="task-list">
|
|
|
|
| 638 |
</button>
|
| 639 |
))}
|
| 640 |
</div>
|
| 641 |
+
{task === 'delegate' && (
|
| 642 |
+
<Field label="让对方 AI 做什么" hint="生成一份不依赖上下文的完整工单,粘贴给任何 AI 都能直接干活,并按固定格式交稿。">
|
| 643 |
+
<Segmented value={sub} onChange={setSub} items={SUB_JOBS} />
|
| 644 |
+
</Field>
|
| 645 |
+
)}
|
| 646 |
+
{job === 'rewrite' && (
|
| 647 |
+
<>
|
| 648 |
+
<Field label="改写方式">
|
| 649 |
+
<div className="chip-row">
|
| 650 |
+
{REWRITE_MODES.map(m => <Tag key={m.id} active={mode === m.id} onClick={() => setMode(m.id)} title={m.d}>{m.t}</Tag>)}
|
| 651 |
+
</div>
|
| 652 |
+
<div className="muted small-note">{REWRITE_MODES.find(m => m.id === mode)?.d}</div>
|
| 653 |
+
</Field>
|
| 654 |
+
<Field label="只改一段(可不填)" hint="粘贴要改的段落;不填就改整章。">
|
| 655 |
+
<AutoText value={passage} onChange={setPassage} minRows={2} placeholder="把要改的段落粘贴到这里" />
|
| 656 |
+
</Field>
|
| 657 |
+
</>
|
| 658 |
+
)}
|
| 659 |
+
{needsTarget && (
|
| 660 |
+
<Field label={job === 'continue' ? '这次续写多少字' : job === 'draft' ? '本章目标字数' : '改写后字数'}>
|
| 661 |
+
<div className="row gap">
|
| 662 |
+
<input className="input" type="number" min={100} step={100} value={targetIn} placeholder={String(autoTarget)} onChange={e => setTargetIn(e.target.value)} style={{ maxWidth: 120 }} />
|
| 663 |
+
<span className="muted small-note">{targetIn ? <button className="link-btn" onClick={() => setTargetIn('')}>恢复建议值 {autoTarget}</button> : `建议值,按本书每章字数和稿纸现有 ${countWords(text)} 字算出`}</span>
|
| 664 |
+
</div>
|
| 665 |
+
</Field>
|
| 666 |
+
)}
|
| 667 |
+
<Field label="补充要求(可不填)"><AutoText value={extra} onChange={setExtra} minRows={2} placeholder="例如:节奏再快一点,这章多给妹妹一些戏份。" /></Field>
|
| 668 |
+
{inspCards.length > 0 && inspWanted && (
|
| 669 |
<div className="insp-pick">
|
| 670 |
<label className="row gap"><input type="checkbox" checked={inspOn} onChange={e => setInspOn(e.target.checked)} /><b>附上番茄热榜同类书(原文)</b></label>
|
| 671 |
{inspOn && <select value={inspScope || 'none'} onChange={e => setInspPick(e.target.value)}>
|
| 672 |
<option value="none">选择本书所在的番茄分类…</option>
|
| 673 |
{inspCards.map(c => <option key={c.k} value={c.k}>{c.g} · {c.name}</option>)}
|
| 674 |
</select>}
|
| 675 |
+
<div className="muted small-note">{inspOn ? (inspText ? `已附上 ${inspText.length} 字:同类热榜前 10 本的书名、在读、标签和简介,AI 读完再写,只借鉴不照搬。` : (inspScope && inspScope !== 'none' ? '正在读取…' : '选好分类后自动附上。')) : '已关闭。'}</div>
|
| 676 |
</div>
|
| 677 |
)}
|
| 678 |
+
{emptyText && <div className="note-warn">稿纸还是空的,这个任务需要先有正文。</div>}
|
| 679 |
<div className="prompt-box">
|
| 680 |
+
<div className="prompt-head"><b>提示词预览</b><span className="muted">{prompt.length.toLocaleString()} 字符{job === 'draft' && prevCh ? (prevTail.data ? ' · 已附上一章结尾' : prevTail.loading ? ' · 读取上一章…' : '') : ''}</span></div>
|
| 681 |
<pre>{prompt}</pre>
|
| 682 |
</div>
|
| 683 |
+
<button className="btn primary block" disabled={emptyText} onClick={async () => { await copyText(prompt); toast(task === 'delegate' ? '工单已复制,粘贴给另一个 AI 即可' : '提示词已复制,粘贴给你常用的 AI 即可', 'ok') }}><Copy size={14} />{task === 'delegate' ? '复制工单' : '复制提示词'}</button>
|
| 684 |
<div className="divider" />
|
| 685 |
<RequestsBox pid={bundle.project.project_id} cid={detail.chapter_id} />
|
| 686 |
</div>
|
|
|
|
| 720 |
)
|
| 721 |
}
|
| 722 |
|
|
|
|
|
|
|
|
|
|
| 723 |
function guessScope(genre: string, cards: { k: string; g: string; name: string }[]) {
|
| 724 |
const hits = cards.filter(c => c.name && genre.includes(c.name))
|
| 725 |
if (!hits.length) return ''
|
| 726 |
return (hits.find(c => genre.includes(c.g)) || hits[0]).k
|
| 727 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ui-src/src/rooms/prompts.ts
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// 写作台 AI 提示词:创作 / 续写 / 改写 / 派给另一个 AI / 审读 / 下一章章纲
|
| 2 |
+
// 所有提示词都由「作品圣经 + 大纲 + 本章信息 + 平台规范」自动拼成,作者只需复制。
|
| 3 |
+
import { aiPromptBlock } from '../handbook'
|
| 4 |
+
import { Chapter } from '../api'
|
| 5 |
+
import { cnNum, countWords } from '../lib'
|
| 6 |
+
import { aiContractBlock, selfCheckBlock } from './Review'
|
| 7 |
+
|
| 8 |
+
export type Task = 'draft' | 'continue' | 'rewrite' | 'delegate' | 'review' | 'next'
|
| 9 |
+
export type SubJob = 'draft' | 'continue' | 'rewrite' | 'review'
|
| 10 |
+
export type RewriteMode = 'polish' | 'expand' | 'tighten' | 'punch' | 'deai'
|
| 11 |
+
|
| 12 |
+
export const TASKS: { id: Task; t: string; d: string }[] = [
|
| 13 |
+
{ id: 'draft', t: '创作本章', d: '按设定、章纲和上一章结尾,一次写完整章' },
|
| 14 |
+
{ id: 'continue', t: '续写', d: '从稿纸最后一个字接着往下写' },
|
| 15 |
+
{ id: 'rewrite', t: '改写', d: '润色、扩写、精简、加强冲突、去 AI 腔' },
|
| 16 |
+
{ id: 'delegate', t: '派给另一个 AI', d: '打包成完整工单,交给别的 AI 执笔' },
|
| 17 |
+
{ id: 'review', t: '连续性审读', d: '对照作品圣经找矛盾和漏洞' },
|
| 18 |
+
{ id: 'next', t: '下一章章纲', d: '根据本章结尾规划下一章' },
|
| 19 |
+
]
|
| 20 |
+
export const SUB_JOBS: { id: SubJob; label: string }[] = [
|
| 21 |
+
{ id: 'draft', label: '写本章' }, { id: 'continue', label: '续写' }, { id: 'rewrite', label: '改写' }, { id: 'review', label: '审读' },
|
| 22 |
+
]
|
| 23 |
+
export const REWRITE_MODES: { id: RewriteMode; t: string; d: string }[] = [
|
| 24 |
+
{ id: 'polish', t: '润色', d: '情节不动,语言更顺、更有画面' },
|
| 25 |
+
{ id: 'expand', t: '扩写', d: '补场景、对白和细节,不改剧情' },
|
| 26 |
+
{ id: 'tighten', t: '精简', d: '删重复和解释,节奏更快' },
|
| 27 |
+
{ id: 'punch', t: '加强冲突', d: '加阻碍、加交锋,主角更主动' },
|
| 28 |
+
{ id: 'deai', t: '去 AI 腔', d: '删套话、总结句和空泛比喻' },
|
| 29 |
+
]
|
| 30 |
+
|
| 31 |
+
export type PromptOpts = {
|
| 32 |
+
task: Task
|
| 33 |
+
sub?: SubJob
|
| 34 |
+
mode?: RewriteMode
|
| 35 |
+
target?: number
|
| 36 |
+
passage?: string
|
| 37 |
+
extra?: string
|
| 38 |
+
inspo?: string
|
| 39 |
+
prevTail?: string
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
/** 本章目标字数:优先读作品圣经里写明的区间,否则 2700–3000 */
|
| 43 |
+
export function chapterRange(b: any): [number, number] {
|
| 44 |
+
const all = [...(b?.ai_rules || []), ...(b?.style_rules || [])].map(String).join('\n')
|
| 45 |
+
const m = all.match(/每章\s*(\d{3,5})\s*[–\-~~至到]\s*(\d{3,5})\s*字/)
|
| 46 |
+
return m ? [Number(m[1]), Number(m[2])] : [2700, 3000]
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
export function defaultTarget(task: Task, sub: SubJob, mode: RewriteMode, b: any, text: string) {
|
| 50 |
+
const job = task === 'delegate' ? sub : task
|
| 51 |
+
const [lo, hi] = chapterRange(b)
|
| 52 |
+
const now = countWords(text)
|
| 53 |
+
if (job === 'draft') return Math.round((lo + hi) / 2)
|
| 54 |
+
if (job === 'continue') return Math.max(600, Math.min(1500, Math.round((lo + hi) / 2) - now) || 1200)
|
| 55 |
+
if (job === 'rewrite' && mode === 'expand') return Math.max(now + 500, lo)
|
| 56 |
+
if (job === 'rewrite' && mode === 'tighten') return Math.max(300, Math.round(now * 0.8))
|
| 57 |
+
return 0
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
const lines = (arr: any, fmt: (x: any) => string) =>
|
| 61 |
+
(Array.isArray(arr) ? arr : []).map(x => (typeof x === 'string' ? x : fmt(x))).filter(s => s && String(s).trim()).map(s => `- ${s}`).join('\n')
|
| 62 |
+
|
| 63 |
+
const CRAFT = `【写法要求】
|
| 64 |
+
1. 场景推进:把本章拆成 2–4 个场景。每个场景都写清“人物想要什么 → 被什么挡住 → 结果怎么变了”,场景结束时局面必须和开始时不同。
|
| 65 |
+
2. 细节代替形容:情绪用动作、物件、身体反应和对白里的停顿来表现,不写“他很愤怒”“她很绝望”这类结论。
|
| 66 |
+
3. 对白要干活:每段对白要么推进冲突,要么透露信息,要么暴露人物。不同人物说话方式要有区别,少用“冷冷地说”“淡淡道”。
|
| 67 |
+
4. 信息控制:每章至少给读者一个新信息或一次小反转。设定每次最多交代三句,并且藏在动作或对白里。
|
| 68 |
+
5. 节奏:短句为主,长短交替。每段不超过四行,紧张处一句一段。单句不超过 50 字,长句用句号断开。
|
| 69 |
+
6. 不写总结句、感悟句,不提前剧透后面的情节。不用“仿佛”“宛如”“不禁”“这一刻”“五味杂陈”之类的空泛词,不用排比和对仗凑气势。
|
| 70 |
+
7. 只写视角人物能看到、听到、想到的东西。人物只知道他此时该知道的事。
|
| 71 |
+
8. 只用全角中文标点,引号用“”。`
|
| 72 |
+
|
| 73 |
+
/** 作品背景:所有任务共用 */
|
| 74 |
+
function bookContext(bundle: any, ch: Chapter, job: SubJob | 'next', inspo = '') {
|
| 75 |
+
const p = bundle.project, b = bundle.bible || {}
|
| 76 |
+
const out: string[] = []
|
| 77 |
+
const contract = aiContractBlock(b)
|
| 78 |
+
if (contract) out.push(contract)
|
| 79 |
+
out.push(`【作品】《${p.title}》${p.genre ? `|题材:${p.genre}` : ''}${p.pov ? `|视角:${p.pov}` : ''}${p.style ? `|文风:${p.style}` : ''}${p.target_platform ? `|平台:${p.target_platform}` : ''}`)
|
| 80 |
+
if (p.premise) out.push(`一句话梗概:${p.premise}`)
|
| 81 |
+
const core = [['核心冲突', b.story_core], ['���线', b.main_plot], ['结局方向', b.ending_direction], ['读者期待', b.reader_expectation]].filter(([, v]) => v)
|
| 82 |
+
if (core.length) out.push(`【作品圣经】\n${core.map(([k, v]) => `${k}:${v}`).join('\n')}`)
|
| 83 |
+
const settings = lines(b.settings, s => s?.text || s?.rule || JSON.stringify(s))
|
| 84 |
+
if (settings && job !== 'rewrite') out.push(`【世界设定】\n${settings}`)
|
| 85 |
+
const chars = lines(b.characters, c => [c.name, c.role && `(${c.role})`, c.age && `${c.age}`, c.goal && `想要:${c.goal}`, c.fear && `害怕:${c.fear}`, c.secret && `秘密:${c.secret}`, c.voice && `说话:${c.voice}`].filter(Boolean).join(' '))
|
| 86 |
+
if (chars) out.push(`【人物】\n${chars}`)
|
| 87 |
+
const rel = lines(b.relationships, r => `${r.from || '?'} ↔ ${r.to || '?'}:${r.relation || ''}${r.change ? `(变化:${r.change})` : ''}`)
|
| 88 |
+
if (rel && job !== 'rewrite') out.push(`【人物关系】\n${rel}`)
|
| 89 |
+
const tl = lines(b.timeline, t => `${t.time || ''}:${t.event || ''}${t.consequence ? `(影响:${t.consequence})` : ''}`)
|
| 90 |
+
if (tl && (job === 'draft' || job === 'review' || job === 'continue')) out.push(`【时间线】\n${tl}`)
|
| 91 |
+
const fs = lines((b.foreshadowing || []).filter((f: any) => f?.status !== 'paid'), f => `${f.plant || ''}${f.payoff ? ` → 回收:${f.payoff}` : ''}`)
|
| 92 |
+
if (fs && job !== 'rewrite') out.push(`【未回收的伏笔】\n${fs}`)
|
| 93 |
+
const style = lines(b.style_rules, r => String(r))
|
| 94 |
+
if (style) out.push(`【文风规则】\n${style}`)
|
| 95 |
+
const refs = (bundle.materials?.items || []).map((m: any, i: number) => `素材${i + 1}:${m.sum || ''}`).join('\n')
|
| 96 |
+
if (refs && (job === 'draft' || job === 'next')) out.push(`【参考素材(清洗后版本,只借鉴情节结构和情绪,人物、地点、细节必须全部虚构,不得照搬)】\n${refs}`)
|
| 97 |
+
if (inspo && (job === 'draft' || job === 'continue' || job === 'next')) out.push(inspo)
|
| 98 |
+
|
| 99 |
+
const sorted = [...bundle.chapters].sort((a: Chapter, z: Chapter) => a.number - z.number)
|
| 100 |
+
const prev = sorted.filter((c: Chapter) => c.number < ch.number).pop()
|
| 101 |
+
const next = sorted.find((c: Chapter) => c.number > ch.number)
|
| 102 |
+
const head = [`【当前章节】第${ch.number}章 ${ch.title || ''}${ch.volume ? `(${ch.volume})` : ''}`]
|
| 103 |
+
if (prev?.previous_summary) head.push(`前情提要(上一章结束时的局面):${prev.previous_summary}`)
|
| 104 |
+
if (ch.goal) head.push(`本章目标:${ch.goal}`)
|
| 105 |
+
if (ch.outline) head.push(`章纲:\n${ch.outline}`)
|
| 106 |
+
const scenes = lines(ch.scenes || [], s => [s.title, s.goal, s.detail].filter(Boolean).join('|'))
|
| 107 |
+
if (scenes) head.push(`场景卡:\n${scenes}`)
|
| 108 |
+
if (next && job !== 'next' && job !== 'rewrite') head.push(`下一章计划(只用于衔接,不要提前写):第${next.number}章 ${next.title || ''}${next.goal ? `|${next.goal}` : ''}`)
|
| 109 |
+
out.push(head.join('\n'))
|
| 110 |
+
return out.join('\n\n')
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
/** 具体任务说明 */
|
| 114 |
+
function jobBlock(bundle: any, ch: Chapter, text: string, job: SubJob | 'next', o: PromptOpts) {
|
| 115 |
+
const b = bundle.bible || {}
|
| 116 |
+
const [lo, hi] = chapterRange(b)
|
| 117 |
+
const body = text.trim()
|
| 118 |
+
const now = countWords(body)
|
| 119 |
+
const target = o.target || defaultTarget(o.task, o.sub || 'draft', o.mode || 'polish', b, body)
|
| 120 |
+
const no = `第${ch.number}章`
|
| 121 |
+
const out: string[] = []
|
| 122 |
+
|
| 123 |
+
if (job === 'draft') {
|
| 124 |
+
if (o.prevTail) out.push(`【上一章结尾原文(紧接着它写,时间、地点、人物状态要对得上)】\n……${o.prevTail}`)
|
| 125 |
+
if (body) out.push(`【稿纸上已有的草稿(可参考,可推翻)】\n${body.slice(0, 1500)}${body.length > 1500 ? '……' : ''}`)
|
| 126 |
+
out.push(CRAFT)
|
| 127 |
+
out.push(`【任务:创作${no}正文】
|
| 128 |
+
- 一次写完整章,约 ${target} 字(允许 ${lo}–${hi} 字),不要分段交付,不要中途停下来提问。
|
| 129 |
+
- 开头:第一句就进场景,300 字内出现冲突、异常或危机。不要用天气、回顾、总结开头。
|
| 130 |
+
- 中段:按章纲和场景卡依次推进,每个场景结束时局面都要变。
|
| 131 |
+
- 结尾:最后一段是钩子(新危机、反转、抉择或说了一半的信息),停在读者最想知道答案的地方。钩子之后不要再写任何总结。
|
| 132 |
+
- 正文不是大纲:不要复述章纲,要写成有对白、有动作的现场。
|
| 133 |
+
|
| 134 |
+
【输出格式】
|
| 135 |
+
第一行写“${no} ${ch.title || '(标题)'}”,空一行后是正文。
|
| 136 |
+
正文结束后空一行,写“——自检——”,逐条回答交稿前自检,再写“——衔接摘要——”,用 50 字以内写本章结束时的局面。`)
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
if (job === 'continue') {
|
| 140 |
+
out.push(`【本章已写 ${now} 字,以下是稿纸末尾原文】\n……${body.slice(-2000) || '(稿纸是空的,从本章开头写起)'}`)
|
| 141 |
+
out.push(CRAFT)
|
| 142 |
+
const willEnd = now + target >= lo
|
| 143 |
+
out.push(`【任务:续写】
|
| 144 |
+
- 从最后一个字之后直接接着写。第一句不要重复、复述或改写上文。
|
| 145 |
+
- 续写约 ${target} 字。人称、时态、语气、句长和分段习惯都和上文保持一致。
|
| 146 |
+
- 先判断当前场景还差什么:冲突还没出结果,就先把这个场景写完,再进入章纲里的下一个场景。不跳过章纲里的场景,不写到下一章的内容。
|
| 147 |
+
- ${willEnd ? `写完这段本章就到 ${lo}–${hi} 字了:请写到本章的结尾钩子并停下。` : `本章目标 ${lo}–${hi} 字,这段写完还不到:请停在一个场景内的小悬念上,方便下次接着写。`}
|
| 148 |
+
|
| 149 |
+
【输出格式】只输出新写的部分,不加标题,不加任何说明。结束后空一行写“——自检——”并逐条回答。`)
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
if (job === 'rewrite') {
|
| 153 |
+
const passage = (o.passage || '').trim()
|
| 154 |
+
const mode = o.mode || 'polish'
|
| 155 |
+
if (passage) {
|
| 156 |
+
out.push(`【本章全文(只作上下文参考)】\n${body.slice(0, 6000)}${body.length > 6000 ? '……' : ''}`)
|
| 157 |
+
out.push(`【待改写的片段(${countWords(passage)} 字)】\n${passage}`)
|
| 158 |
+
} else out.push(`【待改写的全文(${now} 字)】\n${body}`)
|
| 159 |
+
const scope = passage ? '这一段' : '全文'
|
| 160 |
+
const M: Record<RewriteMode, string> = {
|
| 161 |
+
polish: `润色${scope}:情节、人物关系、对白的意思和所有事实一律不变,只改语言。删去冗余,拆开长句,换掉空泛的词,让对白更像人说话,把概括改成具体细节。字数变化不超过 ±10%。`,
|
| 162 |
+
expand: `扩写${scope}到约 ${target} 字:只在内部插入或写丰满,补充动作、感官细节、对白的来回、配角的反应,以及符合设定的短回忆。不改剧情事实,不加会影响其他章节的新人物、新设定、新事件。${passage ? '' : '开头 300 字保持抓人,不在开头前加铺垫;结尾钩子必须仍是最后一段。'}不注水,不重复已有的句子和意思。`,
|
| 163 |
+
tighten: `精简${scope}到约 ${target} 字:先删重复的意思、解释性的句子、没用的寒暄和过渡,再压缩描写。所有推动剧情的信息、关键对白和${passage ? '' : '结尾钩子'}都要保留。`,
|
| 164 |
+
punch: `加强${scope}的冲突和节奏:给每个场景加上阻碍或时间压力,让对白有来有回、有交锋,把主角的被动反应改成主动选择。场景的最终结果和后续剧情都不变,字数变化不超过 ±15%。`,
|
| 165 |
+
deai: `去掉${scope}的 AI 腔:删除套话(如“不禁”“仿佛”“这一刻”“心中五味杂陈”“嘴角勾起一抹弧度”)、总结句、感悟句、排比、四字词堆砌和对情绪的过度解释,改成具体的动作和细节。情节和事实不变。`,
|
| 166 |
+
}
|
| 167 |
+
out.push(`【任务:改写|${REWRITE_MODES.find(m => m.id === mode)?.t}】\n${M[mode]}\n- 改完仍须满足下面的写法要求和全部规范。`)
|
| 168 |
+
out.push(CRAFT)
|
| 169 |
+
out.push(`【输出格式】先输出改写后的${passage ? '片段' : '全文'},不加任何前言。之后空一行写“——修改说明——”,用 3–5 条说明改了什么、为什么改。`)
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
if (job === 'review') {
|
| 173 |
+
out.push(`【本章正文(${now} 字)】\n${body}`)
|
| 174 |
+
out.push(`【任务:连续性审读】对照作品圣经、时间线、人物卡和前情提要,逐条找出:
|
| 175 |
+
1. 人设或称呼前后不一致;
|
| 176 |
+
2. 时间线、年龄、钱数、次数对不上或算不平;
|
| 177 |
+
3. 人物知道了他此时不该知道的事;
|
| 178 |
+
4. 伏笔遗漏,或提前泄露了后面的秘密;
|
| 179 |
+
5. 逻辑漏洞,以及“靠巧合或金手指一键解决”的地方;
|
| 180 |
+
6. 违反写作规范的地方(单句超过 50 字、禁用说法、开头没有冲突、结尾没有钩子等)。
|
| 181 |
+
【输出格式】每条一行:“[类型]原文引用(不超过 20 字)→ 问题 → 修改建议”。按严重程度从高到低排列。没有问题的类型不用写。最后用一句话给出总评。`)
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
if (job === 'next') {
|
| 185 |
+
out.push(`【本章结尾原文】\n……${body.slice(-1200)}`)
|
| 186 |
+
out.push(`【任务:为第${ch.number + 1}章写章纲】
|
| 187 |
+
- 本章目标:一句话说清这一章要让局面发生什么变化。
|
| 188 |
+
- 3 个场景:每个写清 地点|人物想要什么|阻碍|结果。
|
| 189 |
+
- 开头 300 字的切入画面,以及章末钩子。
|
| 190 |
+
- 必须衔接本章结尾,服从作品圣经和未回收的伏笔,不新增会推翻既有设定的事件。`)
|
| 191 |
+
}
|
| 192 |
+
return out.join('\n\n')
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
/** 主入口:生成可直接复制给 AI 的提示词 */
|
| 196 |
+
export function buildPrompt(bundle: any, ch: Chapter, text: string, o: PromptOpts) {
|
| 197 |
+
const b = bundle.bible || {}
|
| 198 |
+
const job: SubJob | 'next' = o.task === 'delegate' ? (o.sub || 'draft') : (o.task as SubJob | 'next')
|
| 199 |
+
const parts: string[] = []
|
| 200 |
+
const sc = selfCheckBlock(b)
|
| 201 |
+
const extra = (o.extra || '').trim()
|
| 202 |
+
|
| 203 |
+
if (o.task === 'delegate') {
|
| 204 |
+
const p = bundle.project
|
| 205 |
+
const what = SUB_JOBS.find(s => s.id === job)?.label || ''
|
| 206 |
+
parts.push(`【派活单】《${p.title}》第${cnNum(ch.number)}章 · ${what}
|
| 207 |
+
你是被调用的执笔 AI。调用你的是这本书的主编,你看不到之前的任何对话,下面就是完成任务所需的全部材料。
|
| 208 |
+
|
| 209 |
+
【工作方式】
|
| 210 |
+
1. ��通读全部材料再动笔。规范、设定和约定的优先级高于任务描述,冲突时以规范为准。
|
| 211 |
+
2. 材料里没有的设定,不要自己发明新人物、新地点、新规则。确实需要补一个细节时,用最小的、不影响其他章节的细节,并在交付报告里列出来。
|
| 212 |
+
3. 一次交付完整结果。不要寒暄,不要解释思路,不要问“要不要继续”。
|
| 213 |
+
4. 交付前按“交稿前自检”逐条检查,不合格先改再交。`)
|
| 214 |
+
parts.push(aiPromptBlock())
|
| 215 |
+
parts.push(bookContext(bundle, ch, job, o.inspo))
|
| 216 |
+
parts.push(jobBlock(bundle, ch, text, job, o).replace(/【输出格式】[\s\S]*?(?=\n\n【|$)/g, ''))
|
| 217 |
+
if (extra) parts.push(`【主编补充要求】${extra}`)
|
| 218 |
+
if (sc) parts.push(sc.replace(/正文之后另起一行写「自检:全部通过」或列出仍有疑问的条目。/, '自检结果写进交付报告。'))
|
| 219 |
+
parts.push(`【交付格式(严格遵守,主编会按标记自动读取)】
|
| 220 |
+
<<<结果
|
| 221 |
+
${job === 'review' ? '(审读意见。每条一行:[类型]原文引用 → 问题 → 修改建议)' : job === 'continue' ? '(只放新续写的正文,不加标题和说明)' : job === 'rewrite' ? '(改写后的正文,不加任何说明)' : `(第${ch.number}章 ${ch.title || ''}的完整正文,不加任何说明)`}
|
| 222 |
+
结果>>>
|
| 223 |
+
<<<报告
|
| 224 |
+
字数:(去掉空白后的字数)
|
| 225 |
+
自检:(逐条写“通过”,或写出问题)
|
| 226 |
+
新增细节:(没有就写“无”)
|
| 227 |
+
${job === 'rewrite' ? '修改说明:(3–5 条)\n' : ''}${job === 'draft' ? '衔接摘要:(50 字以内,本章结束时的局面)\n' : ''}疑问:(需要主编确认的地方,没有就写“无”)
|
| 228 |
+
报告>>>`)
|
| 229 |
+
return parts.join('\n\n').replace(/\n{3,}/g, '\n\n')
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
parts.push(aiPromptBlock())
|
| 233 |
+
parts.push(`你是《${bundle.project.title}》的执笔 AI,熟悉番茄小说平台的读者口味。请用简体中文完成下面的任务。`)
|
| 234 |
+
parts.push(bookContext(bundle, ch, job, o.inspo))
|
| 235 |
+
parts.push(jobBlock(bundle, ch, text, job, o))
|
| 236 |
+
if (extra) parts.push(`【补充要求】${extra}`)
|
| 237 |
+
if (sc && job !== 'next' && job !== 'review') parts.push(sc)
|
| 238 |
+
return parts.join('\n\n').replace(/\n{3,}/g, '\n\n')
|
| 239 |
+
}
|
ui-src/src/styles.css
CHANGED
|
@@ -1349,3 +1349,5 @@ mark.nm.flash { animation: nmflash 1.2s ease-out; }
|
|
| 1349 |
.review-history { font-size: 12.5px; color: var(--ink-2); }
|
| 1350 |
.review-history summary { cursor: pointer; color: var(--ink-3); }
|
| 1351 |
.rh-item { border-top: 1px dashed var(--line); padding: 7px 0; display: flex; flex-direction: column; gap: 3px; line-height: 1.55; }
|
|
|
|
|
|
|
|
|
| 1349 |
.review-history { font-size: 12.5px; color: var(--ink-2); }
|
| 1350 |
.review-history summary { cursor: pointer; color: var(--ink-3); }
|
| 1351 |
.rh-item { border-top: 1px dashed var(--line); padding: 7px 0; display: flex; flex-direction: column; gap: 3px; line-height: 1.55; }
|
| 1352 |
+
.note-warn { font-size: 12.5px; padding: 8px 10px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); }
|
| 1353 |
+
.panel-stack .chip-row .tag { padding: 4px 10px; font-size: 12.5px; }
|