Spaces:
Running
Running
xiaoshuo commited on
Commit ·
e709062
1
Parent(s): 5f674d2
rank: split plan pack builder
Browse files
public/assets/{index-B9H0vwhc.js → index-Bz_ni1JJ.js}
RENAMED
|
The diff for this file is too large to render.
See raw diff
|
|
|
public/index.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
| 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-CGHkSQ1Y.css">
|
| 13 |
</head>
|
| 14 |
<body>
|
|
|
|
| 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-Bz_ni1JJ.js"></script>
|
| 12 |
<link rel="stylesheet" crossorigin href="/assets/index-CGHkSQ1Y.css">
|
| 13 |
</head>
|
| 14 |
<body>
|
ui-src/src/rooms/Rank.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { TrendingUp, RefreshCw, Copy, Send, Sparkles, BookPlus, ArrowUp, ArrowDo
|
|
| 3 |
import { get, post, put, del, qs } from '../api'
|
| 4 |
import { copyText, cx, fmtAgo, fmtNum, go, useAsync, useLocal } from '../lib'
|
| 5 |
import { Drawer, Empty, ErrorNote, Loading, Segmented, Tabs, Tag, useToast, useConfirm } from '../ui'
|
| 6 |
-
import {
|
| 7 |
|
| 8 |
const A = '/fanqie/api/rank'
|
| 9 |
const api = {
|
|
@@ -23,8 +23,8 @@ const api = {
|
|
| 23 |
type TabId = 'board' | 'analysis' | 'plan' | 'plans'
|
| 24 |
const G: Record<string, string> = { '1': '男频', '0': '女频' }
|
| 25 |
const MOLD: Record<string, string> = { '2': '阅读榜', '1': '新书榜' }
|
| 26 |
-
const pct = (x: number | null | undefined, d = 1) => (x == null ? '—' : `${(x * 100).toFixed(d)}%`)
|
| 27 |
-
const wan = (n: number) => (n >= 1e8 ? `${(n / 1e8).toFixed(1)} 亿` : fmtNum(n))
|
| 28 |
export type PlanDraft = { gender: string; cid: string; tags: string[]; idea: string; words: string; pov: string; extra: string }
|
| 29 |
const EMPTY_DRAFT: PlanDraft = { gender: '1', cid: '', tags: [], idea: '', words: '100', pov: '第三人称', extra: '' }
|
| 30 |
|
|
@@ -255,35 +255,6 @@ function BookDrawer({ id, date, onClose }: { id: string; date?: string; onClose:
|
|
| 255 |
}
|
| 256 |
|
| 257 |
/* ---------------- 规划总纲 ---------------- */
|
| 258 |
-
const OUTPUT_SPEC = `只输出一个 JSON 对象(放在 \`\`\`json 代码块里),字段如下:
|
| 259 |
-
{
|
| 260 |
-
"title": "书名(番茄风格,8–15 字,有钩子)",
|
| 261 |
-
"alt_titles": ["备选书名", "..."],
|
| 262 |
-
"genre": "番茄分类",
|
| 263 |
-
"tags": ["3–6 个番茄官方标签"],
|
| 264 |
-
"logline": "一句话卖点(主角是谁 + 遇到什么 + 爽点/虐点是什么)",
|
| 265 |
-
"blurb": "番茄简介(150–300 字,开头可用【】标卖点)",
|
| 266 |
-
"why": ["选题依据:引用上面榜单数据里的具体数字或书名,说明为什么这个方向现在有机会"],
|
| 267 |
-
"differentiation": ["和榜上同类书相比的差异点"],
|
| 268 |
-
"target_words": 1000000,
|
| 269 |
-
"pov": "人称",
|
| 270 |
-
"story_core": "故事内核(这本书真正在讲什么)",
|
| 271 |
-
"main_plot": "主线(300 字内)",
|
| 272 |
-
"ending_direction": "结局方向",
|
| 273 |
-
"reader_expectation": "读者追更的期待(每卷持续给什么爽感/情绪)",
|
| 274 |
-
"characters": [{"name": "", "role": "主角/女主/反派/配角", "goal": "", "fear": "", "secret": ""}],
|
| 275 |
-
"relationships": [{"from": "", "to": "", "relation": "", "change": "关系如何变化"}],
|
| 276 |
-
"settings": ["世界观/金手指/力量体系/规则,每条一句"],
|
| 277 |
-
"foreshadowing": [{"id": "F1", "plant": "在哪埋", "payoff": "在哪收"}],
|
| 278 |
-
"style_rules": ["文风要求"],
|
| 279 |
-
"safety_rules": ["本书需要特别注意的平台红线"],
|
| 280 |
-
"three_act": [{"act": "第一幕", "goal": "", "turning_point": "", "ending": ""}],
|
| 281 |
-
"volumes": [{"volume": 1, "title": "", "goal": "", "conflict": "", "ending": "卷末高潮/钩子"}],
|
| 282 |
-
"chapters": [{"number": 1, "title": "", "goal": "本章发生什么", "hook": "章末钩子"}],
|
| 283 |
-
"risks": ["这个选题的风险和应对"]
|
| 284 |
-
}
|
| 285 |
-
要求:volumes 覆盖全书(按目标字数分 4–8 卷);chapters 写前 30 章,前 3 章必须完成「主角处境 + 金手指/核心冲突亮相 + 第一个爽点或强钩子」;全部原创,不得照搬榜上书的人物、情节和书名。`
|
| 286 |
-
|
| 287 |
function PlanTab({ a }: { a: any }) {
|
| 288 |
const toast = useToast()
|
| 289 |
const [draft, setDraft] = useLocal<PlanDraft>('rk-draft', EMPTY_DRAFT)
|
|
@@ -349,36 +320,6 @@ function PlanTab({ a }: { a: any }) {
|
|
| 349 |
</div>
|
| 350 |
)
|
| 351 |
}
|
| 352 |
-
function buildPack(a: any, cat: any, lists: any, catTags: any[], d: PlanDraft) {
|
| 353 |
-
const g = G[d.gender]
|
| 354 |
-
const out: string[] = []
|
| 355 |
-
out.push('你是熟悉番茄小说平台、擅长策划爆款网文的资深主编。请根据下面的番茄热榜数据,为一本新书规划总纲。')
|
| 356 |
-
out.push(`\n【目标】${g} · ${cat.name}${d.tags.length ? ` · 标签:${d.tags.join('、')}` : ''} · 目标 ${d.words} 万字 · ${d.pov}`)
|
| 357 |
-
if (d.idea.trim()) out.push(`作者想法:${d.idea.trim()}`)
|
| 358 |
-
if (d.extra.trim()) out.push(`其他要求:${d.extra.trim()}`)
|
| 359 |
-
out.push(`\n【题材数据(番茄官网分类榜,${a.date})】`)
|
| 360 |
-
out.push(`- ${cat.name}占${g}阅读榜在读人数的 ${pct(cat.read_share)},占新书榜的 ${pct(cat.fresh_share)},新书机会指数 ${cat.chance?.toFixed(2)}(>1 表示新书更容易冒头)`)
|
| 361 |
-
out.push(`- 阅读榜前 20:完结占 ${pct(cat.read?.done_share, 0)},字数中位 ${Math.round((cat.read?.words_med || 0) / 10000)} 万;新书榜前 20 字数中位 ${Math.round((cat.fresh?.words_med || 0) / 10000)} 万`)
|
| 362 |
-
if (catTags.length) out.push(`- 该分类常见标签(阅读榜/新书榜出现次数):${catTags.slice(0, 20).map(t => `${t.k}(${t.n}/${t.f})`).join('、')}`)
|
| 363 |
-
const rising = (a.rising?.[d.gender] || []).slice(0, 10)
|
| 364 |
-
if (rising.length) out.push(`- ${g}整体在新书榜上升的标签:${rising.map((r: any) => `${r.k}(${pct(r.read, 0)}→${pct(r.fresh, 0)})`).join('、')}`)
|
| 365 |
-
const book = (b: any) => `${b.pos}.《${b.title}》${wan(b.reads)}在读·${Math.round(b.words / 10000)}万字·${b.done ? '完结' : '连载'}${b.tags?.length ? `|${b.tags.filter((t: string) => t !== g).join('/')}` : ''}\n ${String(b.abs || '').replace(/\s+/g, ' ').slice(0, 110)}`
|
| 366 |
-
out.push(`\n【阅读榜前 12(老书,代表读者长期买账的东西)】`)
|
| 367 |
-
for (const b of (lists.r?.books || []).slice(0, 12)) out.push(book(b))
|
| 368 |
-
out.push(`\n【新书榜前 15(近期新书,代表现在的竞争和风向)】`)
|
| 369 |
-
for (const b of (lists.f?.books || []).slice(0, 15)) out.push(book(b))
|
| 370 |
-
if (a.ai?.summary) out.push(`\n【AI 对当日榜单的整体判断】\n${a.ai.summary}`)
|
| 371 |
-
out.push('\n【平台写作规范(必须遵守)】')
|
| 372 |
-
AI.preamble.slice(0, 6).forEach(p => out.push(`- ${p}`))
|
| 373 |
-
AI.rules.filter(r => r.hard).slice(0, 18).forEach(r => out.push(`- ${r.rule}`))
|
| 374 |
-
out.push('\n【规划步骤】')
|
| 375 |
-
out.push('1. 先读数据:找出这个题材里读者反复买账的爽点/情绪、新书在卷什么、哪里还有空位。')
|
| 376 |
-
out.push('2. 定方向:在热门元素上做一个清晰的差异化(新身份、新金手指、新关系或新场景),不要做榜上已有书的翻版。')
|
| 377 |
-
out.push('3. 再写总纲:人物、设定、分卷、前 30 章章纲,黄金三章要立住钩子。')
|
| 378 |
-
out.push('\n【输出格式】\n' + OUTPUT_SPEC)
|
| 379 |
-
return out.join('\n')
|
| 380 |
-
}
|
| 381 |
-
|
| 382 |
/* ---------------- 我的规划 ---------------- */
|
| 383 |
function PlansTab({ arg }: { arg: string }) {
|
| 384 |
const list = useAsync(() => api.plans(), [])
|
|
|
|
| 3 |
import { get, post, put, del, qs } from '../api'
|
| 4 |
import { copyText, cx, fmtAgo, fmtNum, go, useAsync, useLocal } from '../lib'
|
| 5 |
import { Drawer, Empty, ErrorNote, Loading, Segmented, Tabs, Tag, useToast, useConfirm } from '../ui'
|
| 6 |
+
import { buildPack } from './rankPack'
|
| 7 |
|
| 8 |
const A = '/fanqie/api/rank'
|
| 9 |
const api = {
|
|
|
|
| 23 |
type TabId = 'board' | 'analysis' | 'plan' | 'plans'
|
| 24 |
const G: Record<string, string> = { '1': '男频', '0': '女频' }
|
| 25 |
const MOLD: Record<string, string> = { '2': '阅读榜', '1': '新书榜' }
|
| 26 |
+
export const pct = (x: number | null | undefined, d = 1) => (x == null ? '—' : `${(x * 100).toFixed(d)}%`)
|
| 27 |
+
export const wan = (n: number) => (n >= 1e8 ? `${(n / 1e8).toFixed(1)} 亿` : fmtNum(n))
|
| 28 |
export type PlanDraft = { gender: string; cid: string; tags: string[]; idea: string; words: string; pov: string; extra: string }
|
| 29 |
const EMPTY_DRAFT: PlanDraft = { gender: '1', cid: '', tags: [], idea: '', words: '100', pov: '第三人称', extra: '' }
|
| 30 |
|
|
|
|
| 255 |
}
|
| 256 |
|
| 257 |
/* ---------------- 规划总纲 ---------------- */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 258 |
function PlanTab({ a }: { a: any }) {
|
| 259 |
const toast = useToast()
|
| 260 |
const [draft, setDraft] = useLocal<PlanDraft>('rk-draft', EMPTY_DRAFT)
|
|
|
|
| 320 |
</div>
|
| 321 |
)
|
| 322 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 323 |
/* ---------------- 我的规划 ---------------- */
|
| 324 |
function PlansTab({ arg }: { arg: string }) {
|
| 325 |
const list = useAsync(() => api.plans(), [])
|
ui-src/src/rooms/rankPack.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// 总纲规划任务包:把榜单数据、平台规范和输出格式拼成一段交给 AI 的文字(页面和后台脚本共用)
|
| 2 |
+
import { ai as AI } from '../handbook'
|
| 3 |
+
|
| 4 |
+
const G: Record<string, string> = { '1': '男频', '0': '女频' }
|
| 5 |
+
const pct = (x: number | null | undefined, d = 1) => (x == null ? '—' : `${(x * 100).toFixed(d)}%`)
|
| 6 |
+
const wan = (n: number) => (n >= 1e8 ? `${(n / 1e8).toFixed(1)} 亿` : n >= 10000 ? `${(n / 10000).toFixed(n >= 100000 ? 0 : 1)} 万` : String(n))
|
| 7 |
+
export type PlanDraft = { gender: string; cid: string; tags: string[]; idea: string; words: string; pov: string; extra: string }
|
| 8 |
+
|
| 9 |
+
export const OUTPUT_SPEC = `只输出一个 JSON 对象(放在 \`\`\`json 代码块里),字段如下:
|
| 10 |
+
{
|
| 11 |
+
"title": "书名(番茄风格,8–15 字,有钩子)",
|
| 12 |
+
"alt_titles": ["备选书名", "..."],
|
| 13 |
+
"genre": "番茄分类",
|
| 14 |
+
"tags": ["3–6 个番茄官方标签"],
|
| 15 |
+
"logline": "一句话卖点(主角是谁 + 遇到什么 + 爽点/虐点是什么)",
|
| 16 |
+
"blurb": "番茄简介(150–300 字,开头可用【】标卖点)",
|
| 17 |
+
"why": ["选题依据:引用上面榜单数据里的具体数字或书名,说明为什么这个方向现在有机会"],
|
| 18 |
+
"differentiation": ["和榜上同类书相比的差异点"],
|
| 19 |
+
"target_words": 1000000,
|
| 20 |
+
"pov": "人称",
|
| 21 |
+
"story_core": "故事内核(这本书真正在讲什么)",
|
| 22 |
+
"main_plot": "主线(300 字内)",
|
| 23 |
+
"ending_direction": "结局方向",
|
| 24 |
+
"reader_expectation": "读者追更的期待(每卷持续给什么爽感/情绪)",
|
| 25 |
+
"characters": [{"name": "", "role": "主角/女主/反派/配角", "goal": "", "fear": "", "secret": ""}],
|
| 26 |
+
"relationships": [{"from": "", "to": "", "relation": "", "change": "关系如何变化"}],
|
| 27 |
+
"settings": ["世界观/金手指/力量体系/规则,每条一句"],
|
| 28 |
+
"foreshadowing": [{"id": "F1", "plant": "在哪埋", "payoff": "在哪收"}],
|
| 29 |
+
"style_rules": ["文风要求"],
|
| 30 |
+
"safety_rules": ["本书需要特别注意的平台红线"],
|
| 31 |
+
"three_act": [{"act": "第一幕", "goal": "", "turning_point": "", "ending": ""}],
|
| 32 |
+
"volumes": [{"volume": 1, "title": "", "goal": "", "conflict": "", "ending": "卷末高潮/钩子"}],
|
| 33 |
+
"chapters": [{"number": 1, "title": "", "goal": "本章发生什么", "hook": "章末钩子"}],
|
| 34 |
+
"risks": ["这个选题的风险和应对"]
|
| 35 |
+
}
|
| 36 |
+
要求:volumes 覆盖全书(按目标字数分 4–8 卷);chapters 写前 30 章,前 3 章必须完成「主角处境 + 金手指/核心冲突亮相 + 第一个爽点或强钩子」;全部原创,不得照搬榜上书的人物、情节和书名。`
|
| 37 |
+
|
| 38 |
+
export function buildPack(a: any, cat: any, lists: any, catTags: any[], d: PlanDraft) {
|
| 39 |
+
const g = G[d.gender]
|
| 40 |
+
const out: string[] = []
|
| 41 |
+
out.push('你是熟悉番茄小说平台、擅长策划爆款网文的资深主编。请根据下面的番茄热榜数据,为一本新书规划总纲。')
|
| 42 |
+
out.push(`\n【目标】${g} · ${cat.name}${d.tags.length ? ` · 标签:${d.tags.join('、')}` : ''} · 目标 ${d.words} 万字 · ${d.pov}`)
|
| 43 |
+
if (d.idea.trim()) out.push(`作者想法:${d.idea.trim()}`)
|
| 44 |
+
if (d.extra.trim()) out.push(`其他要求:${d.extra.trim()}`)
|
| 45 |
+
out.push(`\n【题材数据(番茄官网分类榜,${a.date})】`)
|
| 46 |
+
out.push(`- ${cat.name}占${g}阅读榜在读人数的 ${pct(cat.read_share)},占新书榜的 ${pct(cat.fresh_share)},新书机会指数 ${cat.chance?.toFixed(2)}(>1 表示新书更容易冒头)`)
|
| 47 |
+
out.push(`- 阅读榜前 20:完结占 ${pct(cat.read?.done_share, 0)},字数中位 ${Math.round((cat.read?.words_med || 0) / 10000)} 万;新书榜前 20 字数中位 ${Math.round((cat.fresh?.words_med || 0) / 10000)} 万`)
|
| 48 |
+
if (catTags.length) out.push(`- 该分类常见标签(阅读榜/新书榜出现次数):${catTags.slice(0, 20).map(t => `${t.k}(${t.n}/${t.f})`).join('、')}`)
|
| 49 |
+
const rising = (a.rising?.[d.gender] || []).slice(0, 10)
|
| 50 |
+
if (rising.length) out.push(`- ${g}整体在新书榜上升的标签:${rising.map((r: any) => `${r.k}(${pct(r.read, 0)}→${pct(r.fresh, 0)})`).join('、')}`)
|
| 51 |
+
const book = (b: any) => `${b.pos}.《${b.title}》${wan(b.reads)}在读·${Math.round(b.words / 10000)}万字·${b.done ? '完结' : '连载'}${b.tags?.length ? `|${b.tags.filter((t: string) => t !== g).join('/')}` : ''}\n ${String(b.abs || '').replace(/\s+/g, ' ').slice(0, 110)}`
|
| 52 |
+
out.push(`\n【阅读榜前 12(老书,代表读者长期买账的东西)】`)
|
| 53 |
+
for (const b of (lists.r?.books || []).slice(0, 12)) out.push(book(b))
|
| 54 |
+
out.push(`\n【新书榜前 15(近期新书,代表现在的竞争和风向)】`)
|
| 55 |
+
for (const b of (lists.f?.books || []).slice(0, 15)) out.push(book(b))
|
| 56 |
+
if (a.ai?.summary) out.push(`\n【AI 对当日榜单的整体判断】\n${a.ai.summary}`)
|
| 57 |
+
out.push('\n【平台写作规范(必须遵守)】')
|
| 58 |
+
AI.preamble.slice(0, 6).forEach(p => out.push(`- ${p}`))
|
| 59 |
+
AI.rules.filter(r => r.hard).slice(0, 18).forEach(r => out.push(`- ${r.rule}`))
|
| 60 |
+
out.push('\n【规划步骤】')
|
| 61 |
+
out.push('1. 先读数据��找出这个题材里读者反复买账的爽点/情绪、新书在卷什么、哪里还有空位。')
|
| 62 |
+
out.push('2. 定方向:在热门元素上做一个清晰的差异化(新身份、新金手指、新关系或新场景),不要做榜上已有书的翻版。')
|
| 63 |
+
out.push('3. 再写总纲:人物、设定、分卷、前 30 章章纲,黄金三章要立住钩子。')
|
| 64 |
+
out.push('\n【输出格式】\n' + OUTPUT_SPEC)
|
| 65 |
+
return out.join('\n')
|
| 66 |
+
}
|
| 67 |
+
|