xiaoshuo commited on
Commit
7258810
·
1 Parent(s): e709062

rank: AI 灵感(灵感卡 + AI 阅读版 + 写作台自动附带)

Browse files
fanqie/mount.js CHANGED
@@ -90,6 +90,16 @@ module.exports = function mountFanqie(app, passwordOk, express) {
90
  res.setHeader('Content-Disposition', `attachment; filename="batch-${String(number).padStart(3, '0')}.jsonl"`)
91
  res.type('application/x-ndjson').send(data)
92
  }))
 
 
 
 
 
 
 
 
 
 
93
  app.use('/fanqie', express.static(DIST, { index: false, maxAge: '1h' }))
94
  // 原有工具作为全局服务保留在独立入口,服务所有项目,不绑定当前 project_id。
95
  app.get(['/fanqie/tools', '/fanqie/tools/*'], (_req, res) => {
 
90
  res.setHeader('Content-Disposition', `attachment; filename="batch-${String(number).padStart(3, '0')}.jsonl"`)
91
  res.type('application/x-ndjson').send(data)
92
  }))
93
+ // 热榜灵感包「AI 阅读版」:纯文本,给能上网的 AI 直接读。浏览器外的 AI 发不了请求头,所以允许 ?key=访问密码。
94
+ app.get('/fanqie/feed/rank.md', async (req, res) => {
95
+ const ok = passwordOk(req) || passwordOk({ headers: { 'x-app-password': String(req.query.key || '') } })
96
+ if (!ok) return res.status(401).type('text/plain; charset=utf-8').send('需要访问密码:在链接后加 ?key=访问密码')
97
+ try {
98
+ const r = await require('./rank.js').feed({ date: String(req.query.date || ''), scope: String(req.query.scope || 'all'), brief: req.query.brief === '1' })
99
+ res.setHeader('Cache-Control', 'no-cache')
100
+ res.type('text/markdown; charset=utf-8').send(r.text)
101
+ } catch (e) { res.status(500).type('text/plain; charset=utf-8').send(e.message || String(e)) }
102
+ })
103
  app.use('/fanqie', express.static(DIST, { index: false, maxAge: '1h' }))
104
  // 原有工具作为全局服务保留在独立入口,服务所有项目,不绑定当前 project_id。
105
  app.get(['/fanqie/tools', '/fanqie/tools/*'], (_req, res) => {
fanqie/rank.js CHANGED
@@ -447,6 +447,95 @@ function parseResult(text) {
447
  try { return JSON.parse(body) } catch { const e = new Error('没能读出总纲:请确认粘贴的是 AI 输出的完整 JSON'); e.status = 400; throw e }
448
  }
449
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
450
  module.exports = function buildRank(express) {
451
  const router = express.Router()
452
  router.use(express.json({ limit: '4mb' }))
@@ -480,6 +569,22 @@ module.exports = function buildRank(express) {
480
  await putJ(`${P}ai/${date}.json`, doc)
481
  return doc
482
  }))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
483
  router.get('/plans', wrap(() => planIndex()))
484
  router.get('/plans/:id', wrap(async req => { const p = await getJ(`${P}plans/${req.params.id}.json`, null); if (!p) { const e = new Error('没有这个规划'); e.status = 404; throw e } return p }))
485
  router.post('/plans', wrap(async req => {
@@ -552,4 +657,5 @@ module.exports = function buildRank(express) {
552
  }, 20 * 60 * 1000).unref?.()
553
  return router
554
  }
555
- module.exports._internal = { scrape, enrich, missingOf, applyBooks, loadState, JOB, analysisFor, snapshot, decode, learn, bookPage, rankList, categories, FONT: () => FONT }
 
 
447
  try { return JSON.parse(body) } catch { const e = new Error('没能读出总纲:请确认粘贴的是 AI 输出的完整 JSON'); e.status = 400; throw e }
448
  }
449
 
450
+ /* ---------------- 灵感卡(AI 阅读榜单后撰写)+ AI 阅读版文本 ---------------- */
451
+ // fanqie_rank/inspire/index.json { dates: [] }
452
+ // fanqie_rank/inspire/YYYY-MM-DD.json { date, by, at, overview: { '1': {...}, '0': {...} }, cards: { '<g>_<cid>': card } }
453
+ async function inspireIndex() { return await getJ(P + 'inspire/index.json', { dates: [] }) || { dates: [] } }
454
+ async function inspireFor(date) {
455
+ const k = 'insp:' + (date || 'latest')
456
+ if (CACHE.has(k)) return CACHE.get(k)
457
+ const idx = await inspireIndex()
458
+ const dates = [...(idx.dates || [])].sort().reverse()
459
+ const d = date ? (dates.find(x => x <= date) || dates[dates.length - 1]) : dates[0]
460
+ const doc = d ? await getJ(`${P}inspire/${d}.json`, null) : null
461
+ CACHE.set(k, doc)
462
+ return doc
463
+ }
464
+ const L = v => (Array.isArray(v) ? v : []).filter(Boolean)
465
+ const bullets = (title, arr, fmt = x => String(x)) => { const a = L(arr); return a.length ? [`${title}`, ...a.map(x => `- ${fmt(x)}`), ''] : [] }
466
+ function cardLines(card, { brief = false } = {}) {
467
+ if (!card) return []
468
+ const out = []
469
+ if (card.verdict) out.push(`判断:${card.verdict}`, '')
470
+ out.push(...bullets('读者在为什么买单:', card.reader_wants))
471
+ out.push(...bullets('热门组合:', card.hot_combos, x => `${x.combo}${L(x.examples).length ? `(例:${L(x.examples).join(';')})` : ''}${x.note ? `:${x.note}` : ''}`))
472
+ out.push(...bullets('开篇钩子写法:', card.openings))
473
+ if (!brief) {
474
+ out.push(...bullets('书名公式:', card.title_patterns))
475
+ out.push(...bullets('简介写法:', card.blurb_tips))
476
+ out.push(...bullets('正在冒头:', card.rising))
477
+ out.push(...bullets('已经挤满(慎入):', card.saturated))
478
+ }
479
+ out.push(...bullets('还没写透的空白:', card.gaps))
480
+ if (!brief) out.push(...bullets('灵感种子(原创点子,可直接展开):', card.seeds, x => `《${x.title}》${x.logline}${x.hook ? ` |开篇:${x.hook}` : ''}${x.why ? ` |理由:${x.why}` : ''}`))
481
+ out.push(...bullets('避坑:', card.avoid))
482
+ return out
483
+ }
484
+ // scope: all | g1 | g0 | <gender>_<cid>;brief=1 只给写作台用的精简版
485
+ async function feed({ date = '', scope = 'all', brief = false } = {}) {
486
+ const a = await analysisFor(date)
487
+ if (a.empty) return { text: '还没有榜单数据。', date: '', scope }
488
+ const insp = await inspireFor(a.date)
489
+ const cats = a.cats || []
490
+ const one = /^[01]_\d+$/.test(scope) ? cats.find(c => `${c.gender}_${c.cid}` === scope) : null
491
+ const gens = one ? [one.gender] : scope === 'g1' ? [1] : scope === 'g0' ? [0] : [1, 0]
492
+ const out = []
493
+ const title = one ? `${one.g} · ${one.name}` : gens.length === 1 ? GEN[gens[0]] : '全部分类'
494
+ if (brief) {
495
+ out.push(`【番茄热榜灵感 · ${title}(榜单 ${a.date}${insp ? `,编辑判断 ${insp.date}` : ''})】`)
496
+ out.push('以下是番茄小说同类书的读者偏好和写法观察,只借鉴爽点、节奏和钩子写法,书名、人物、情节一律不得照搬。')
497
+ if (one) out.push(`数据:占${one.g}阅读榜 ${(one.read_share * 100).toFixed(1)}%、新书榜 ${(one.fresh_share * 100).toFixed(1)}%,新书机会 ${one.chance.toFixed(2)}`)
498
+ out.push(...cardLines(insp?.cards?.[scope], { brief: true }))
499
+ return { text: out.join('\n').trim(), date: a.date, inspire_date: insp?.date || '', scope }
500
+ }
501
+ out.push(`# 番茄热榜灵感包(AI 阅读版)· ${title}`)
502
+ out.push(`榜单日期:${a.date}${insp ? `|编辑判断(AI 读榜后撰写):${insp.date}` : '|编辑判断:暂无'}`)
503
+ out.push('', '## 怎么用', '- 这是番茄小说官网分类榜(阅读榜 = 读者长期买账的老书,新书榜 = 近期风向)的数据和编辑判断,用来给小说创作提供灵感。',
504
+ '- 新书机会 = 新书榜份额 ÷ 阅读榜份额,大于 1 说明新书在这个分类更容易冒头。', '- 只借鉴题材趋势、爽点组合和钩子写法;榜上的书名、人物、情节一律不得照搬。', '')
505
+ for (const g of gens) {
506
+ const mine = cats.filter(c => c.gender === g && (!one || c === one)).sort((x, y) => y.read_share - x.read_share)
507
+ if (!one) {
508
+ out.push(`## ${GEN[g]}总览`)
509
+ const ov = insp?.overview?.[g]
510
+ if (ov) { if (ov.summary) out.push(ov.summary); out.push(...bullets('', ov.points).slice(1)) }
511
+ out.push('', '| 分类 | 阅读榜份额 | 新书榜份额 | 新书机会 | 新书字数中位 |', '|---|---|---|---|---|')
512
+ for (const c of mine) out.push(`| ${c.name} | ${(c.read_share * 100).toFixed(1)}% | ${(c.fresh_share * 100).toFixed(1)}% | ${c.chance.toFixed(2)} | ${Math.round((c.fresh?.words_med || 0) / 1e4)}万 |`)
513
+ const hot = (a.tags?.[`${g}_2`]?.list || []).slice(0, 20).map(t => t.k)
514
+ const up = (a.rising?.[g] || []).slice(0, 12).map(t => `${t.k}(+${(t.d * 100).toFixed(0)}%)`)
515
+ const lab = (a.labels?.[`${g}_1`] || []).slice(0, 20).map(t => t.k)
516
+ out.push('', `长期热门标签:${hot.join('、')}`, `新书榜上升标签:${up.join('、')}`, `新书简介常用卖点:${lab.join('、')}`, '')
517
+ }
518
+ for (const c of mine) {
519
+ out.push(`## ${c.g} · ${c.name}`)
520
+ out.push(`数据:阅读榜份额 ${(c.read_share * 100).toFixed(1)}%|新书榜份额 ${(c.fresh_share * 100).toFixed(1)}%|新书机会 ${c.chance.toFixed(2)}|阅读榜前20完结 ${Math.round((c.read?.done_share || 0) * 100)}%|字数中位 老书 ${Math.round((c.read?.words_med || 0) / 1e4)}万 / 新书 ${Math.round((c.fresh?.words_med || 0) / 1e4)}万`)
521
+ const card = insp?.cards?.[`${c.gender}_${c.cid}`]
522
+ if (card) out.push('', ...cardLines(card))
523
+ else out.push('(这个分类还没有编辑判断)', '')
524
+ if (one) {
525
+ const { snap } = await snapshot(a.date)
526
+ for (const [mold, name] of [[2, '阅读榜前 15'], [1, '新书榜前 15']]) {
527
+ const l = snap?.lists.find(x => x.gender === c.gender && x.cid === c.cid && x.mold === mold)
528
+ if (!l) continue
529
+ out.push(`${name}:`)
530
+ for (const b of l.books.slice(0, 15)) out.push(`${b.pos}.《${b.title}》${Math.round(b.reads / 1e4)}万在读·${Math.round(b.words / 1e4)}万字${b.done ? '·完结' : ''}${b.tags ? `·${b.tags.slice(0, 6).join('/')}` : ''}|${String(b.abs || '').replace(/\s+/g, ' ').slice(0, 90)}`)
531
+ out.push('')
532
+ }
533
+ }
534
+ }
535
+ }
536
+ return { text: out.join('\n').replace(/\n{3,}/g, '\n\n').trim() + '\n', date: a.date, inspire_date: insp?.date || '', scope }
537
+ }
538
+
539
  module.exports = function buildRank(express) {
540
  const router = express.Router()
541
  router.use(express.json({ limit: '4mb' }))
 
569
  await putJ(`${P}ai/${date}.json`, doc)
570
  return doc
571
  }))
572
+ // 灵感卡:AI 读完榜单后写入(按分类合并,可分批上传)
573
+ router.get('/inspire', wrap(async req => (await inspireFor(String(req.query.date || ''))) || { cards: {}, overview: {} }))
574
+ router.put('/inspire/:date', wrap(async req => {
575
+ const date = String(req.params.date)
576
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) throw bad('日期格式不对')
577
+ const b = req.body || {}
578
+ const doc = (await getJ(`${P}inspire/${date}.json`, null)) || { date, cards: {}, overview: {} }
579
+ for (const c of L(b.cards)) { if (c && /^[01]$/.test(String(c.gender)) && c.cid) doc.cards[`${c.gender}_${c.cid}`] = c }
580
+ if (b.overview && typeof b.overview === 'object') Object.assign(doc.overview, b.overview)
581
+ Object.assign(doc, { by: String(b.by || doc.by || 'AI'), at: now() })
582
+ await putJ(`${P}inspire/${date}.json`, doc)
583
+ const idx = await inspireIndex(); if (!idx.dates.includes(date)) { idx.dates.push(date); await putJ(P + 'inspire/index.json', idx) }
584
+ for (const k of [...CACHE.keys()]) if (k.startsWith('insp:')) CACHE.delete(k)
585
+ return { date, cards: Object.keys(doc.cards).length }
586
+ }))
587
+ router.get('/feed', wrap(req => feed({ date: String(req.query.date || ''), scope: String(req.query.scope || 'all'), brief: req.query.brief === '1' })))
588
  router.get('/plans', wrap(() => planIndex()))
589
  router.get('/plans/:id', wrap(async req => { const p = await getJ(`${P}plans/${req.params.id}.json`, null); if (!p) { const e = new Error('没有这个规划'); e.status = 404; throw e } return p }))
590
  router.post('/plans', wrap(async req => {
 
657
  }, 20 * 60 * 1000).unref?.()
658
  return router
659
  }
660
+ module.exports.feed = feed
661
+ module.exports._internal = { inspireFor, scrape, enrich, missingOf, applyBooks, loadState, JOB, analysisFor, snapshot, decode, learn, bookPage, rankList, categories, FONT: () => FONT }
public/assets/{index-CGHkSQ1Y.css → index-62jZraMF.css} RENAMED
The diff for this file is too large to render. See raw diff
 
public/assets/{index-Bz_ni1JJ.js → index-CFb6cFIp.js} 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-Bz_ni1JJ.js"></script>
12
- <link rel="stylesheet" crossorigin href="/assets/index-CGHkSQ1Y.css">
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-CFb6cFIp.js"></script>
12
+ <link rel="stylesheet" crossorigin href="/assets/index-62jZraMF.css">
13
  </head>
14
  <body>
15
  <div id="root"></div>
ui-src/src/rooms/Editor.tsx CHANGED
@@ -5,10 +5,11 @@ import {
5
  Type, AlignLeft, RotateCcw, Eye, GitCompare, Copy, Search, Send, X, Check, AlertTriangle, Undo2,
6
  } from 'lucide-react'
7
  import { Chapter, Material, materialsApi, projectsApi, Version, VersionMeta } from '../api'
8
- import { cnNum, copyText, countWords, cx, diffParagraphs, fmtAgo, fmtDate, go, CHAPTER_STATUS, GENRE, KIND, VERSION_KIND, useLocal, useDebounced } from '../lib'
9
  import { AutoText, Empty, ErrorNote, Field, ListEditor, Loading, Modal, Spinner, Tabs, useConfirm, useToast, Segmented } from '../ui'
10
  import type { BookCtx } from './Book'
11
  import { toRef } from './Bible'
 
12
 
13
  type Tab = 'chapter' | 'versions' | 'check' | 'refs' | 'ai'
14
  const draftKey = (cid: string) => `xs_draft_${cid}`
@@ -585,7 +586,15 @@ function AiPanel({ ctx, detail, text }: { ctx: BookCtx; detail: Chapter; text: s
585
  const { bundle } = ctx
586
  const [task, setTask] = useState('draft')
587
  const [extra, setExtra] = useState('')
588
- const prompt = useMemo(() => buildPrompt(bundle, detail, text, task, extra), [bundle, detail, text, task, extra])
 
 
 
 
 
 
 
 
589
  return (
590
  <div className="panel-stack">
591
  <div className="task-list">
@@ -596,6 +605,16 @@ function AiPanel({ ctx, detail, text }: { ctx: BookCtx; detail: Chapter; text: s
596
  ))}
597
  </div>
598
  <Field label="补充要求(可不填)"><AutoText value={extra} onChange={setExtra} minRows={2} placeholder="例如:节奏再快一点,结尾留一个悬念。" /></Field>
 
 
 
 
 
 
 
 
 
 
599
  <div className="prompt-box">
600
  <div className="prompt-head"><b>提示词预览</b><span className="muted">{prompt.length} 字符</span></div>
601
  <pre>{prompt}</pre>
@@ -642,7 +661,12 @@ function RequestsBox({ pid, cid }: { pid: string; cid: string }) {
642
  function listLines(arr: any[], fmt: (x: any) => string) {
643
  return (Array.isArray(arr) ? arr : []).map(x => typeof x === 'string' ? x : fmt(x)).filter(s => s && s.trim()).map(s => `- ${s}`).join('\n')
644
  }
645
- export function buildPrompt(bundle: any, ch: Chapter, text: string, task: string, extra: string) {
 
 
 
 
 
646
  const p = bundle.project, b = bundle.bible || {}
647
  const prev = bundle.chapters.filter((c: Chapter) => c.number < ch.number).sort((a: Chapter, z: Chapter) => z.number - a.number)[0]
648
  const out: string[] = [aiPromptBlock(), '']
@@ -661,6 +685,7 @@ export function buildPrompt(bundle: any, ch: Chapter, text: string, task: string
661
  if (rules) out.push(`\n【文风规则】\n${rules}`)
662
  const refs = (bundle.materials?.items || []).map((m: any, i: number) => `素材${i + 1}:${m.sum || ''}`).join('\n')
663
  if (refs && (task === 'draft' || task === 'next')) out.push(`\n【参考素材(均为清洗后版本,只借鉴情节结构,人物、地点、细节必须全部虚构化,不得照搬)】\n${refs}`)
 
664
  out.push(`\n【当前章节】第${ch.number}章 ${ch.title || ''}${ch.volume ? `(${ch.volume})` : ''}`)
665
  if (prev?.previous_summary) out.push(`前情提要:${prev.previous_summary}`)
666
  if (ch.goal) out.push(`本章目标:${ch.goal}`)
 
5
  Type, AlignLeft, RotateCcw, Eye, GitCompare, Copy, Search, Send, X, Check, AlertTriangle, Undo2,
6
  } from 'lucide-react'
7
  import { Chapter, Material, materialsApi, projectsApi, Version, VersionMeta } from '../api'
8
+ import { cnNum, copyText, countWords, cx, diffParagraphs, fmtAgo, fmtDate, go, CHAPTER_STATUS, GENRE, KIND, VERSION_KIND, useLocal, useDebounced, useAsync } from '../lib'
9
  import { AutoText, Empty, ErrorNote, Field, ListEditor, Loading, Modal, Spinner, Tabs, useConfirm, useToast, Segmented } from '../ui'
10
  import type { BookCtx } from './Book'
11
  import { toRef } from './Bible'
12
+ import { inspireApi } from './RankInspire'
13
 
14
  type Tab = 'chapter' | 'versions' | 'check' | 'refs' | 'ai'
15
  const draftKey = (cid: string) => `xs_draft_${cid}`
 
586
  const { bundle } = ctx
587
  const [task, setTask] = useState('draft')
588
  const [extra, setExtra] = useState('')
589
+ const pid = bundle.project.project_id
590
+ const [inspOn, setInspOn] = useLocal<boolean>('ai-insp-on', true)
591
+ const [inspPick, setInspPick] = useLocal<string>(`ai-insp-${pid}`, '')
592
+ const ins = useAsync(() => inspireApi.inspire().catch(() => null), [])
593
+ const inspCards = useMemo(() => Object.entries(ins.data?.cards || {}).map(([k, c]: [string, any]) => ({ k, g: String(c.gender) === '1' ? '男频' : '女频', name: c.cname })), [ins.data])
594
+ const inspScope = inspPick || guessScope(GENRE[bundle.project.genre] || bundle.project.genre || '', inspCards)
595
+ const insp = useAsync(() => (inspOn && inspScope && inspScope !== 'none' ? inspireApi.feed(inspScope, true).then(r => r.text).catch(() => '') : Promise.resolve('')), [inspOn, inspScope])
596
+ const inspText = task === 'draft' || task === 'next' || task === 'continue' ? insp.data || '' : ''
597
+ const prompt = useMemo(() => buildPrompt(bundle, detail, text, task, extra, inspText), [bundle, detail, text, task, extra, inspText])
598
  return (
599
  <div className="panel-stack">
600
  <div className="task-list">
 
605
  ))}
606
  </div>
607
  <Field label="补充要求(可不填)"><AutoText value={extra} onChange={setExtra} minRows={2} placeholder="例如:节奏再快一点,结尾留一个悬念。" /></Field>
608
+ {inspCards.length > 0 && (
609
+ <div className="insp-pick">
610
+ <label className="row gap"><input type="checkbox" checked={inspOn} onChange={e => setInspOn(e.target.checked)} /><b>附上番茄热榜灵感</b></label>
611
+ {inspOn && <select value={inspScope || 'none'} onChange={e => setInspPick(e.target.value)}>
612
+ <option value="none">选择本书所在的番茄分类…</option>
613
+ {inspCards.map(c => <option key={c.k} value={c.k}>{c.g} · {c.name}</option>)}
614
+ </select>}
615
+ <div className="muted small-note">{inspOn ? (inspText ? `已附上 ${inspText.length} 字:同类热书的读者偏好、开篇钩子和空白点,AI 只借鉴写法不照搬。` : task === 'draft' || task === 'next' || task === 'continue' ? (inspScope && inspScope !== 'none' ? '正在读取…' : '选好分类后自动附上。') : '润色和审读不附灵感。') : '已关闭。'}</div>
616
+ </div>
617
+ )}
618
  <div className="prompt-box">
619
  <div className="prompt-head"><b>提示词预览</b><span className="muted">{prompt.length} 字符</span></div>
620
  <pre>{prompt}</pre>
 
661
  function listLines(arr: any[], fmt: (x: any) => string) {
662
  return (Array.isArray(arr) ? arr : []).map(x => typeof x === 'string' ? x : fmt(x)).filter(s => s && s.trim()).map(s => `- ${s}`).join('\n')
663
  }
664
+ function guessScope(genre: string, cards: { k: string; g: string; name: string }[]) {
665
+ const hits = cards.filter(c => c.name && genre.includes(c.name))
666
+ if (!hits.length) return ''
667
+ return (hits.find(c => genre.includes(c.g)) || hits[0]).k
668
+ }
669
+ export function buildPrompt(bundle: any, ch: Chapter, text: string, task: string, extra: string, inspo = '') {
670
  const p = bundle.project, b = bundle.bible || {}
671
  const prev = bundle.chapters.filter((c: Chapter) => c.number < ch.number).sort((a: Chapter, z: Chapter) => z.number - a.number)[0]
672
  const out: string[] = [aiPromptBlock(), '']
 
685
  if (rules) out.push(`\n【文风规则】\n${rules}`)
686
  const refs = (bundle.materials?.items || []).map((m: any, i: number) => `素材${i + 1}:${m.sum || ''}`).join('\n')
687
  if (refs && (task === 'draft' || task === 'next')) out.push(`\n【参考素材(均为清洗后版本,只借鉴情节结构,人物、地点、细节必须全部虚构化,不得照搬)】\n${refs}`)
688
+ if (inspo) out.push(`\n${inspo}`)
689
  out.push(`\n【当前章节】第${ch.number}章 ${ch.title || ''}${ch.volume ? `(${ch.volume})` : ''}`)
690
  if (prev?.previous_summary) out.push(`前情提要:${prev.previous_summary}`)
691
  if (ch.goal) out.push(`本章目标:${ch.goal}`)
ui-src/src/rooms/Rank.tsx CHANGED
@@ -4,6 +4,7 @@ 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 = {
@@ -20,7 +21,7 @@ const api = {
20
  delPlan: (id: string) => del<any>(`${A}/plans/${id}`),
21
  toProject: (id: string) => post<any>(`${A}/plans/${id}/project`, {}),
22
  }
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)}%`)
@@ -29,7 +30,7 @@ export type PlanDraft = { gender: string; cid: string; tags: string[]; idea: str
29
  const EMPTY_DRAFT: PlanDraft = { gender: '1', cid: '', tags: [], idea: '', words: '100', pov: '第三人称', extra: '' }
30
 
31
  export default function RankRoom({ tab, arg }: { tab: string; arg: string }) {
32
- const t = (['board', 'analysis', 'plan', 'plans'].includes(tab) ? tab : 'analysis') as TabId
33
  const ana = useAsync(() => api.analysis(), [])
34
  const [openBook, setOpenBook] = useState('')
35
  const date = ana.data?.date
@@ -46,7 +47,7 @@ export default function RankRoom({ tab, arg }: { tab: string; arg: string }) {
46
  <ScrapeBox date={date} onDone={() => ana.reload()} />
47
  </header>
48
  <Tabs<TabId> value={t} onChange={v => go(`rank/${v}`)} className="room-tabs" items={[
49
- { id: 'analysis', label: '趋势分析' }, { id: 'board', label: '榜单' }, { id: 'plan', label: '规划总纲' }, { id: 'plans', label: '我的规划' },
50
  ]} />
51
  <div className="room-body">
52
  {ana.loading && !ana.data && <Loading label="正在读取榜单数据…" />}
@@ -54,6 +55,7 @@ export default function RankRoom({ tab, arg }: { tab: string; arg: string }) {
54
  {ana.data?.empty && t !== 'plans' && <Empty icon={<TrendingUp size={22} />} title="还没有榜单数据">点右上角「立即抓取」,大约需要 5–10 分钟。</Empty>}
55
  {ana.data && !ana.data.empty && t === 'analysis' && <AnalysisTab a={ana.data} onBook={setOpenBook} />}
56
  {ana.data && !ana.data.empty && t === 'board' && <BoardTab a={ana.data} arg={arg} onBook={setOpenBook} />}
 
57
  {ana.data && !ana.data.empty && t === 'plan' && <PlanTab a={ana.data} />}
58
  {t === 'plans' && <PlansTab arg={arg} />}
59
  </div>
@@ -272,7 +274,9 @@ function PlanTab({ a }: { a: any }) {
272
  for (const [k, l] of [['n', lists.data?.r], ['f', lists.data?.f]] as const) for (const b of l?.books || []) for (const t of b.tags || []) { if (skip.has(t) || t === b.main) continue; const x = m.get(t) || { n: 0, f: 0 }; x[k]++; m.set(t, x) }
273
  return [...m.entries()].map(([k, v]) => ({ k, ...v })).sort((x, y) => y.n + y.f - x.n - x.f).slice(0, 30)
274
  }, [lists.data, cat, draft.gender])
275
- const pack = useMemo(() => (cat && lists.data ? buildPack(a, cat, lists.data, catTags, draft) : ''), [a, cat, lists.data, catTags, draft])
 
 
276
  const [busy, setBusy] = useState(false)
277
  const submit = async () => {
278
  setBusy(true)
 
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
+ import { InspireTab, inspireApi } from './RankInspire'
8
 
9
  const A = '/fanqie/api/rank'
10
  const api = {
 
21
  delPlan: (id: string) => del<any>(`${A}/plans/${id}`),
22
  toProject: (id: string) => post<any>(`${A}/plans/${id}/project`, {}),
23
  }
24
+ type TabId = 'board' | 'analysis' | 'inspire' | 'plan' | 'plans'
25
  const G: Record<string, string> = { '1': '男频', '0': '女频' }
26
  const MOLD: Record<string, string> = { '2': '阅读榜', '1': '新书榜' }
27
  export const pct = (x: number | null | undefined, d = 1) => (x == null ? '—' : `${(x * 100).toFixed(d)}%`)
 
30
  const EMPTY_DRAFT: PlanDraft = { gender: '1', cid: '', tags: [], idea: '', words: '100', pov: '第三人称', extra: '' }
31
 
32
  export default function RankRoom({ tab, arg }: { tab: string; arg: string }) {
33
+ const t = (['board', 'analysis', 'inspire', 'plan', 'plans'].includes(tab) ? tab : 'analysis') as TabId
34
  const ana = useAsync(() => api.analysis(), [])
35
  const [openBook, setOpenBook] = useState('')
36
  const date = ana.data?.date
 
47
  <ScrapeBox date={date} onDone={() => ana.reload()} />
48
  </header>
49
  <Tabs<TabId> value={t} onChange={v => go(`rank/${v}`)} className="room-tabs" items={[
50
+ { id: 'analysis', label: '趋势分析' }, { id: 'board', label: '榜单' }, { id: 'inspire', label: 'AI 灵感' }, { id: 'plan', label: '规划总纲' }, { id: 'plans', label: '我的规划' },
51
  ]} />
52
  <div className="room-body">
53
  {ana.loading && !ana.data && <Loading label="正在读取榜单数据…" />}
 
55
  {ana.data?.empty && t !== 'plans' && <Empty icon={<TrendingUp size={22} />} title="还没有榜单数据">点右上角「立即抓取」,大约需要 5–10 分钟。</Empty>}
56
  {ana.data && !ana.data.empty && t === 'analysis' && <AnalysisTab a={ana.data} onBook={setOpenBook} />}
57
  {ana.data && !ana.data.empty && t === 'board' && <BoardTab a={ana.data} arg={arg} onBook={setOpenBook} />}
58
+ {ana.data && !ana.data.empty && t === 'inspire' && <InspireTab a={ana.data} arg={arg} />}
59
  {ana.data && !ana.data.empty && t === 'plan' && <PlanTab a={ana.data} />}
60
  {t === 'plans' && <PlansTab arg={arg} />}
61
  </div>
 
274
  for (const [k, l] of [['n', lists.data?.r], ['f', lists.data?.f]] as const) for (const b of l?.books || []) for (const t of b.tags || []) { if (skip.has(t) || t === b.main) continue; const x = m.get(t) || { n: 0, f: 0 }; x[k]++; m.set(t, x) }
275
  return [...m.entries()].map(([k, v]) => ({ k, ...v })).sort((x, y) => y.n + y.f - x.n - x.f).slice(0, 30)
276
  }, [lists.data, cat, draft.gender])
277
+ const insp = useAsync(() => inspireApi.inspire().catch(() => null), [])
278
+ const card = cat ? insp.data?.cards?.[`${cat.gender}_${cat.cid}`] : null
279
+ const pack = useMemo(() => (cat && lists.data ? buildPack(a, cat, lists.data, catTags, draft, card) : ''), [a, cat, lists.data, catTags, draft, card])
280
  const [busy, setBusy] = useState(false)
281
  const submit = async () => {
282
  setBusy(true)
ui-src/src/rooms/RankInspire.tsx ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React, { useMemo, useState } from 'react'
2
+ import { Bot, Copy, Download, Link2, Lightbulb, Sparkles, Wand2 } from 'lucide-react'
3
+ import { get, getPassword, qs } from '../api'
4
+ import { copyText, cx, go, useAsync } from '../lib'
5
+ import { ErrorNote, Loading, Segmented, Tag, useToast } from '../ui'
6
+
7
+ const A = '/fanqie/api/rank'
8
+ export const inspireApi = {
9
+ inspire: () => get<any>(`${A}/inspire`),
10
+ feed: (scope: string, brief = false) => get<{ text: string; date: string; inspire_date: string }>(`${A}/feed${qs({ scope, brief: brief ? '1' : '' })}`),
11
+ }
12
+ const pct = (x: number) => `${(x * 100).toFixed(1)}%`
13
+ const arr = (v: any) => (Array.isArray(v) ? v.filter(Boolean) : [])
14
+
15
+ function saveFile(name: string, text: string) {
16
+ const url = URL.createObjectURL(new Blob([text], { type: 'text/markdown;charset=utf-8' }))
17
+ const a = document.createElement('a'); a.href = url; a.download = name; a.click()
18
+ setTimeout(() => URL.revokeObjectURL(url), 1000)
19
+ }
20
+
21
+ export function InspireTab({ a, arg }: { a: any; arg: string }) {
22
+ const toast = useToast()
23
+ const ins = useAsync(() => inspireApi.inspire(), [])
24
+ const scope = /^[01]_\d+$/.test(arg) || arg === 'g1' || arg === 'g0' ? arg : 'g1'
25
+ const g = scope.startsWith('g') ? scope.slice(1) : scope.split('_')[0]
26
+ const cats = useMemo(() => (a.cats || []).filter((c: any) => String(c.gender) === g).sort((x: any, y: any) => y.read_share - x.read_share), [a, g])
27
+ const cat = cats.find((c: any) => `${c.gender}_${c.cid}` === scope)
28
+ const cards = ins.data?.cards || {}
29
+ const card = cat ? cards[scope] : null
30
+ const feed = useAsync(() => inspireApi.feed(scope), [scope, ins.data?.at])
31
+ const [showText, setShowText] = useState(false)
32
+ const set = (s: string) => go(`rank/inspire/${s}`)
33
+ const label = cat ? `${cat.g}·${cat.name}` : g === '1' ? '男频全部' : '女频全部'
34
+ const link = `${location.origin}/fanqie/feed/rank.md${qs({ scope, key: getPassword() })}`
35
+ const n = Object.keys(cards).length
36
+
37
+ const toPlan = (seed: any) => {
38
+ const d = { gender: g, cid: cat?.cid || '', tags: [], idea: `${seed.title ? `《${seed.title}》` : ''}${seed.logline || ''}${seed.hook ? `\n开篇:${seed.hook}` : ''}`, words: '100', pov: '第三人称', extra: '' }
39
+ try { localStorage.setItem('rk-draft', JSON.stringify(d)) } catch {}
40
+ go('rank/plan'); toast('已把这个点子带到「规划总纲」', 'ok')
41
+ }
42
+
43
+ return (
44
+ <div className="rk-insp">
45
+ <div className="rk-insp-intro">
46
+ <Bot size={18} />
47
+ <div>
48
+ <b>给 AI 读的灵感包</b>
49
+ <div className="muted small-note">
50
+ 每个分类都由 AI 读完阅读榜和新书榜前 40 本后,写出读者在为什么买单、热门组合、开篇钩子、书名套路、还没写透的空白,以及原创点子。
51
+ 右边是整理好的「AI 阅读版」文字,可以复制给任何 AI;写作台的「AI 提示词」也会自动附上本书所在分类的精简版。
52
+ {ins.data?.date && <> 编辑判断日期:{ins.data.date},已覆盖 {n} 个分类。</>}
53
+ </div>
54
+ </div>
55
+ </div>
56
+ <div className="row gap rk-bar">
57
+ <Segmented value={g} onChange={v => set(`g${v}`)} items={[{ id: '1', label: '男频' }, { id: '0', label: '女频' }]} />
58
+ </div>
59
+ <div className="chips-row">
60
+ <button className={cx('chip', scope === `g${g}` && 'on')} onClick={() => set(`g${g}`)}>整个频道</button>
61
+ {cats.map((c: any) => <button key={c.cid} className={cx('chip', `${c.gender}_${c.cid}` === scope && 'on')} onClick={() => set(`${c.gender}_${c.cid}`)}>{c.name}{cards[`${c.gender}_${c.cid}`] ? '' : ' ·待写'}</button>)}
62
+ </div>
63
+ {ins.loading && !ins.data && <Loading />}
64
+ {ins.error && <ErrorNote error={ins.error} onRetry={ins.reload} />}
65
+
66
+ <div className="rk-insp-grid">
67
+ <div className="rk-insp-main">
68
+ {!cat && <div className="rk-insp-cats">{cats.map((c: any) => {
69
+ const k = `${c.gender}_${c.cid}`, x = cards[k]
70
+ return (
71
+ <button key={k} className="rk-insp-cat" onClick={() => set(k)}>
72
+ <div className="row between"><b>{c.name}</b><span className={cx('small-note', c.chance >= 1 ? 'ok' : 'muted')}>新书机会 {c.chance.toFixed(2)}</span></div>
73
+ <div className="small-note muted">阅读榜 {pct(c.read_share)} · 新书榜 {pct(c.fresh_share)}</div>
74
+ <div className="rk-insp-verdict">{x?.verdict || <span className="muted">AI 还没写这个分类的灵感卡</span>}</div>
75
+ </button>
76
+ )
77
+ })}</div>}
78
+ {cat && !card && <div className="rk-ai empty"><Sparkles size={15} /><div><b>{cat.name}</b><div className="muted small-note">这个分类的灵感卡还没写好,AI 读完榜单后会出现在这里。</div></div></div>}
79
+ {cat && card && <CardView card={card} cat={cat} onPlan={toPlan} />}
80
+ </div>
81
+
82
+ <aside className="rk-insp-side">
83
+ <section className="sheet">
84
+ <h2 className="sheet-title serif"><Bot size={16} />AI 阅读版 · {label}</h2>
85
+ <p className="sheet-note">纯文字,包含数据、编辑判断和{cat ? '榜单前 15 本' : '各分类灵感卡'}。直接复制给 AI,或者下载成文件发给它。</p>
86
+ {feed.loading && <Loading />}
87
+ {feed.error && <ErrorNote error={feed.error} onRetry={feed.reload} />}
88
+ {feed.data && <>
89
+ <div className="muted small-note">约 {feed.data.text.length.toLocaleString()} 字</div>
90
+ <div className="col gap-s rk-insp-btns">
91
+ <button className="btn primary block" onClick={async () => { await copyText(feed.data!.text); toast('已复制,粘贴给 AI 即可', 'ok') }}><Copy size={14} />复制全文</button>
92
+ <button className="btn ghost block" onClick={() => saveFile(`番茄热榜灵感-${label}-${feed.data!.date}.md`, feed.data!.text)}><Download size={14} />下载 .md</button>
93
+ {cat && <button className="btn ghost block" onClick={async () => { const r = await inspireApi.feed(scope, true); await copyText(r.text); toast('已复制精简版(写作台用的就是这一份)', 'ok') }}><Wand2 size={14} />复制精简版</button>}
94
+ <button className="btn ghost block" onClick={async () => { await copyText(link); toast('链接已复制。能上网的 AI 打开它就能读到全文', 'ok') }}><Link2 size={14} />复制给 AI 的链接</button>
95
+ </div>
96
+ <div className="muted small-note">链接里带着访问密码,只发给你信任的 AI 工具。</div>
97
+ <button className="link-btn small-note" onClick={() => setShowText(s => !s)}>{showText ? '收起预览' : '预览全文'}</button>
98
+ {showText && <pre className="pre rk-insp-pre">{feed.data.text}</pre>}
99
+ </>}
100
+ </section>
101
+ </aside>
102
+ </div>
103
+ </div>
104
+ )
105
+ }
106
+
107
+ function Block({ title, items, render }: { title: string; items: any; render?: (x: any, i: number) => React.ReactNode }) {
108
+ const list = arr(items)
109
+ if (!list.length) return null
110
+ return (
111
+ <div className="rk-insp-block">
112
+ <h4>{title}</h4>
113
+ <ul>{list.map((x: any, i: number) => <li key={i}>{render ? render(x, i) : String(x)}</li>)}</ul>
114
+ </div>
115
+ )
116
+ }
117
+
118
+ function CardView({ card, cat, onPlan }: { card: any; cat: any; onPlan: (s: any) => void }) {
119
+ return (
120
+ <div className="rk-insp-card">
121
+ <div className="rk-ai">
122
+ <div className="eyebrow"><Sparkles size={14} />{cat.g} · {cat.name}</div>
123
+ <div className="small-note muted">阅读榜 {pct(cat.read_share)} · 新书榜 {pct(cat.fresh_share)} · 新书机会 {cat.chance.toFixed(2)} · 新书字数中位 {Math.round((cat.fresh?.words_med || 0) / 1e4)} 万</div>
124
+ {card.verdict && <p className="rk-ai-sum serif">{card.verdict}</p>}
125
+ </div>
126
+ <div className="rk-insp-two">
127
+ <Block title="读者在为什么买单" items={card.reader_wants} />
128
+ <Block title="开篇钩子写法" items={card.openings} />
129
+ </div>
130
+ <Block title="热门组合" items={card.hot_combos} render={x => <><b>{x.combo}</b>{arr(x.examples).length > 0 && <span className="muted">({arr(x.examples).join(';')})</span>}{x.note && <div className="small-note">{x.note}</div>}</>} />
131
+ <div className="rk-insp-two">
132
+ <Block title="正在冒头" items={card.rising} />
133
+ <Block title="还没写透的空白" items={card.gaps} />
134
+ <Block title="已经挤满(慎入)" items={card.saturated} />
135
+ <Block title="避坑" items={card.avoid} />
136
+ <Block title="书名公式" items={card.title_patterns} />
137
+ <Block title="简介写法" items={card.blurb_tips} />
138
+ </div>
139
+ {arr(card.seeds).length > 0 && (
140
+ <div className="rk-ideas">
141
+ <h4><Lightbulb size={14} /> 灵感种子(原创点子)</h4>
142
+ {arr(card.seeds).map((s: any, i: number) => (
143
+ <div key={i} className="rk-idea">
144
+ <div className="row between"><b>《{s.title}》</b><button className="link-btn small-note" onClick={() => onPlan(s)}>用它规划总纲</button></div>
145
+ <div className="small-note">{s.logline}</div>
146
+ {s.hook && <div className="small-note"><Tag>开篇</Tag> {s.hook}</div>}
147
+ {s.why && <div className="muted small-note">{s.why}</div>}
148
+ </div>
149
+ ))}
150
+ </div>
151
+ )}
152
+ </div>
153
+ )
154
+ }
ui-src/src/rooms/rankPack.ts CHANGED
@@ -35,7 +35,21 @@ export const OUTPUT_SPEC = `只输出一个 JSON 对象(放在 \`\`\`json 代
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('你是熟悉番茄小说平台、擅长策划爆款网文的资深主编。请根据下面的番茄热榜数据,为一本新书规划总纲。')
@@ -54,6 +68,8 @@ export function buildPack(a: any, cat: any, lists: any, catTags: any[], d: PlanD
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}`))
 
35
  }
36
  要求:volumes 覆盖全书(按目标字数分 4–8 卷);chapters 写前 30 章,前 3 章必须完成「主角处境 + 金手指/核心冲突亮相 + 第一个爽点或强钩子」;全部原创,不得照搬榜上书的人物、情节和书名。`
37
 
38
+ const arr = (v: any) => (Array.isArray(v) ? v.filter(Boolean) : [])
39
+ function cardBlock(c: any) {
40
+ if (!c) return ''
41
+ const o: string[] = []
42
+ const list = (t: string, v: any, f = (x: any) => String(x)) => { const l = arr(v); if (l.length) o.push(t, ...l.map(x => `- ${f(x)}`)) }
43
+ if (c.verdict) o.push(`判断:${c.verdict}`)
44
+ list('读者在为什么买单:', c.reader_wants)
45
+ list('热门组合:', c.hot_combos, x => `${x.combo}${x.note ? `:${x.note}` : ''}`)
46
+ list('开篇钩子写法:', c.openings)
47
+ list('已经挤满(避免做翻版):', c.saturated)
48
+ list('还没写透的空白:', c.gaps)
49
+ list('避坑:', c.avoid)
50
+ return o.join('\n')
51
+ }
52
+ export function buildPack(a: any, cat: any, lists: any, catTags: any[], d: PlanDraft, card?: any) {
53
  const g = G[d.gender]
54
  const out: string[] = []
55
  out.push('你是熟悉番茄小说平台、擅长策划爆款网文的资深主编。请根据下面的番茄热榜数据,为一本新书规划总纲。')
 
68
  out.push(`\n【新书榜前 15(近期新书,代表现在的竞争和风向)】`)
69
  for (const b of (lists.f?.books || []).slice(0, 15)) out.push(book(b))
70
  if (a.ai?.summary) out.push(`\n【AI 对当日榜单的整体判断】\n${a.ai.summary}`)
71
+ const cb = cardBlock(card)
72
+ if (cb) out.push(`\n【编辑对「${cat.name}」的判断(AI 读完榜单后撰写)】\n${cb}`)
73
  out.push('\n【平台写作规范(必须遵守)】')
74
  AI.preamble.slice(0, 6).forEach(p => out.push(`- ${p}`))
75
  AI.rules.filter(r => r.hard).slice(0, 18).forEach(r => out.push(`- ${r.rule}`))
ui-src/src/styles.css CHANGED
@@ -1213,3 +1213,27 @@ select.input { appearance: none; padding-right: 28px; background-image: linear-g
1213
  .rk-hook { color: var(--accent); }
1214
  @media (max-width: 860px) { .rk-grid2, .rk-plans, .rk-acts { grid-template-columns: 1fr; } .rk .room-head { flex-direction: column; } .rk-scrape { align-items: flex-start; } .rk-plan-list { position: static; } }
1215
  @media (max-width: 600px) { .rk-book-num { flex-basis: 70px; } .rk-abs { -webkit-line-clamp: 3; } }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1213
  .rk-hook { color: var(--accent); }
1214
  @media (max-width: 860px) { .rk-grid2, .rk-plans, .rk-acts { grid-template-columns: 1fr; } .rk .room-head { flex-direction: column; } .rk-scrape { align-items: flex-start; } .rk-plan-list { position: static; } }
1215
  @media (max-width: 600px) { .rk-book-num { flex-basis: 70px; } .rk-abs { -webkit-line-clamp: 3; } }
1216
+
1217
+ /* ---------- 热榜 · AI 灵感 ---------- */
1218
+ .rk-insp { display: flex; flex-direction: column; gap: 10px; }
1219
+ .rk-insp-intro { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); line-height: 1.7; }
1220
+ .rk-insp-intro svg { color: var(--accent); flex-shrink: 0; margin-top: 2px; }
1221
+ .rk-insp-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
1222
+ .rk-insp-side { position: sticky; top: 12px; }
1223
+ .rk-insp-btns { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
1224
+ .rk-insp-pre { max-height: 460px; overflow: auto; white-space: pre-wrap; font-size: 12px; margin-top: 8px; }
1225
+ .rk-insp-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
1226
+ .rk-insp-cat { text-align: left; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); display: flex; flex-direction: column; gap: 4px; cursor: pointer; font: inherit; color: inherit; }
1227
+ .rk-insp-cat:hover { border-color: var(--accent); }
1228
+ .rk-insp-verdict { font-size: 13px; line-height: 1.7; color: var(--ink-2); }
1229
+ .rk-insp-card { display: flex; flex-direction: column; gap: 12px; }
1230
+ .rk-insp-two { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
1231
+ .rk-insp-block { padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
1232
+ .rk-insp-block h4 { font-size: 13.5px; margin-bottom: 4px; }
1233
+ .rk-insp-block ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
1234
+ .rk-insp-block li { font-size: 13px; line-height: 1.75; color: var(--ink-2); }
1235
+ .rk-ideas h4 svg { vertical-align: -2px; }
1236
+ @media (max-width: 900px) { .rk-insp-grid { grid-template-columns: 1fr; } .rk-insp-side { position: static; } }
1237
+ .insp-pick { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: var(--r); }
1238
+ .insp-pick label { align-items: center; font-size: 13px; cursor: pointer; }
1239
+ .insp-pick select { width: 100%; }