v25: AI写脚本页三tab脚本中心(参考选题/自定义选题/ABC占位)+UI创作写库闭环

- dsh-data: listCustomScripts/getCustomScript/saveScript(可写连接)/getRewriteStats
- server: /api/dsh/custom-scripts|custom-script|script-save|rewrite-stats
- data-pages: renderRewrites tab化重构(保留openRewriteCompare),徽标计数,账号级进入默认落有数据tab,chip清账号筛选,openCustomScriptView全文弹窗
- saveHintOf 追加全部UI创作prompt尾(参考选题带videoId/awemeId,自定义仅accountId)
- 修复: note/accChip 顶层const不随tab更新→移入load()重算
- style: rw-tabs/rw-tab-badge/rw-chip/cw-modal; app.js +copy图标
This commit is contained in:
maogeigei committed 2026-09-02 19:32:19 +08:00
1 parent 1459bede0f
commit 7261c52690
6 files changed
+333 -77

No files matched your search

@@ -479,6 +479,33 @@ const server = http.createServer((req, res) => {
if (dshGuard()) return;
return dshOk(200, dsh.listRewrites(qInt('videoId', 0)));
}
if (p === '/api/dsh/custom-scripts') { /* 09-02 v25:自定义选题(无视频载体)脚本列表 */
if (dshGuard()) return;
return dshOk(200, dsh.listCustomScripts({ page: qInt('page', 1), pageSize: qInt('pageSize', 20), search: String(q.get('search') || ''), days: String(q.get('days') || ''), account: String(q.get('account') || '') }));
}
if (p === '/api/dsh/rewrite-stats') { /* 09-02 v25:AI写脚本 tab 徽标计数(参考选题/自定义选题),可传 account 按账号统计 */
if (dshGuard()) return;
return dshOk(200, dsh.getRewriteStats(String(q.get('account') || '')));
}
if (p === '/api/dsh/custom-script') { /* 自定义选题脚本全文(查看弹窗) */
if (dshGuard()) return;
try { return dshOk(200, { script: dsh.getCustomScript(qInt('id', 0)) }); }
catch (e) { return sendErr(404, e.message); }
}
if (p === '/api/dsh/script-save' && req.method === 'POST') { /* AI创作任务完成回调写库(参考选题传 videoId;自定义选题省略→video_id 空) */
if (dshGuard()) return;
let body = '';
req.on('data', (c) => { body += c; if (body.length > 2e6) req.destroy(); });
req.on('end', () => {
try {
const { videoId, awemeId, accountId, title, scriptText } = JSON.parse(body || '{}');
if (!scriptText || !accountId) return sendErr(400, '缺少 scriptText/accountId');
const r = dsh.saveScript({ videoId, awemeId, accountId, title, scriptText });
return dshOk(200, { ok: true, id: r.id });
} catch (e) { return sendErr(500, e.message); }
});
return;
}
if (p === '/api/dsh/storyboards') {
if (dshGuard()) return;
return dshOk(200, { items: dsh.listStoryboards(qInt('videoId', 0)) });