fix(工作台): 视频拆解/视频分析字段映射修正闭环
- server.js 入库映射对齐 dsh 语义:content.json→source.content_json、analysis.json→source.analysis_json(视频拆解 tab)、*拆解分析.md→account_video_analysis(视频分析 tab) - 清理 6 条俊希错位 account_video_analysis + 白昼小熊 id13 归位 source47.analysis_json - 重跑入库验证:俊希 6 条 analysis_json 均写入、account_video_analysis 12 条=王微斯拆解分析(语义正确) - 王微斯视频三 tab 验证通过(视频脚本/视频拆解/视频分析各就其位) - 临时脚本已清理
This commit is contained in:
1 parent
a519948e6b
commit
787ececedb
5 files changed
+26
-12
No files matched your search
@@ -76,7 +76,7 @@ function importAccountIntoDb(db, account, dir) {
|
||||
const stats = { video_analysis: 0, video_source: 0, persona: 0, account_analysis: 0, videos_upserted: 0, skipped: [] };
|
||||
const now = new Date().toISOString();
|
||||
const insAnalysis = db.prepare(`INSERT INTO account_video_analysis (video_id, aweme_id, analysis_time, content_json, summary) VALUES (?,?,?,?,?)`);
|
||||
const insSource = db.prepare(`INSERT INTO account_video_source (video_id, aweme_id, analysis_time, content_json, summary) VALUES (?,?,?,?,?)`);
|
||||
const insSource = db.prepare(`INSERT INTO account_video_source (video_id, aweme_id, analysis_time, content_json, summary, analysis_json) VALUES (?,?,?,?,?,?)`);
|
||||
const insPersona = db.prepare(`INSERT INTO account_persona (account_id, analysis_time, content_json, summary) VALUES (?,?,?,?)`);
|
||||
const insAccAna = db.prepare(`INSERT INTO account_analysis (account_id, analysis_time, content_json, summary) VALUES (?,?,?,?)`);
|
||||
const acc = db.prepare('SELECT id FROM hot_accounts WHERE account_name=? LIMIT 1').get(account);
|
||||
@@ -123,6 +123,9 @@ function importAccountIntoDb(db, account, dir) {
|
||||
}
|
||||
}
|
||||
// 1) 视频分析目录(功能三 Step5 产出;功能五产出在 视频对标/ 目录,由 dsh 导入机制处理)
|
||||
// 字段映射(09-01 修正,对齐 dsh 语义):content.json→account_video_source.content_json(视频脚本);
|
||||
// analysis.json→account_video_source.analysis_json(视频拆解,MCP 结构化分析);*拆解分析.md→account_video_analysis(视频分析,功能四产物)。
|
||||
// 原实现把 analysis.json 误写 account_video_analysis 导致「拆解内容进了视频分析」+「视频拆解 tab 空」
|
||||
const vaDir = path.join(dir, '视频分析');
|
||||
if (fs.existsSync(vaDir)) {
|
||||
for (const folder of fs.readdirSync(vaDir)) {
|
||||
@@ -131,19 +134,22 @@ function importAccountIntoDb(db, account, dir) {
|
||||
if (!st.isDirectory()) continue;
|
||||
const awemeId = matchAweme(folder);
|
||||
const anPath = path.join(fdir, 'analysis.json');
|
||||
if (fs.existsSync(anPath)) {
|
||||
const content = fs.readFileSync(anPath, 'utf8');
|
||||
if (awemeId) db.prepare('DELETE FROM account_video_analysis WHERE aweme_id=?').run(awemeId);
|
||||
insAnalysis.run(null, awemeId, now, content, content.slice(0, 500));
|
||||
stats.video_analysis++;
|
||||
}
|
||||
const coPath = path.join(fdir, 'content.json');
|
||||
if (fs.existsSync(coPath)) {
|
||||
const content = fs.readFileSync(coPath, 'utf8');
|
||||
const analysisJson = fs.existsSync(anPath) ? fs.readFileSync(anPath, 'utf8') : null;
|
||||
if (awemeId) db.prepare('DELETE FROM account_video_source WHERE aweme_id=?').run(awemeId);
|
||||
insSource.run(null, awemeId, now, content, '');
|
||||
insSource.run(null, awemeId, now, content, '', analysisJson);
|
||||
stats.video_source++;
|
||||
}
|
||||
// 拆解分析.md → account_video_analysis(功能四逐条拆解产物,与解析并存于同一文件夹;无则不入)
|
||||
const decon = fs.readdirSync(fdir).find((f) => f.endsWith('拆解分析.md'));
|
||||
if (decon) {
|
||||
const content = fs.readFileSync(path.join(fdir, decon), 'utf8');
|
||||
if (awemeId) db.prepare('DELETE FROM account_video_analysis WHERE aweme_id=?').run(awemeId);
|
||||
insAnalysis.run(null, awemeId, now, content, content.slice(0, 500));
|
||||
stats.video_analysis++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 2) 人设卡 + 账号分析(去重,不删旧)
|
||||
|
||||
Reference in new issue
Block a user