mirror of
https://github.com/patdelphi/suanming.git
synced 2026-02-28 05:33:11 +08:00
- Refactored AI interpretation table to use proper 1-to-1 relationship with reading records - Fixed recordId parameter passing in AnalysisResultDisplay component - Updated database schema to use reading_id instead of analysis_id - Removed complex string ID generation logic - Fixed TypeScript type definitions for all ID fields - Added database migration scripts for AI interpretation refactoring - Improved error handling and debugging capabilities
33 lines
1.4 KiB
JavaScript
33 lines
1.4 KiB
JavaScript
const { getDB } = require('./server/database/index.cjs');
|
|
const { dbManager } = require('./server/database/index.cjs');
|
|
|
|
try {
|
|
dbManager.init();
|
|
const db = getDB();
|
|
|
|
console.log('=== 最近的分析记录 ===');
|
|
const recent = db.prepare('SELECT id, name, reading_type, created_at FROM numerology_readings ORDER BY created_at DESC LIMIT 5').all();
|
|
console.log(`总共 ${recent.length} 条分析记录`);
|
|
recent.forEach((r, i) => {
|
|
console.log(`${i+1}. ID: ${r.id}, 名称: ${r.name}, 类型: ${r.reading_type}, 创建时间: ${r.created_at}`);
|
|
});
|
|
|
|
console.log('\n=== AI解读记录 ===');
|
|
const ai = db.prepare('SELECT id, reading_id, created_at FROM ai_interpretations ORDER BY created_at DESC LIMIT 5').all();
|
|
console.log(`总共 ${ai.length} 条AI解读记录`);
|
|
ai.forEach((r, i) => {
|
|
console.log(`${i+1}. AI_ID: ${r.id}, reading_id: ${r.reading_id}, 创建时间: ${r.created_at}`);
|
|
});
|
|
|
|
console.log('\n=== 检查最新记录的AI解读状态 ===');
|
|
if (recent.length > 0) {
|
|
const latestRecord = recent[0];
|
|
const hasAI = db.prepare('SELECT COUNT(*) as count FROM ai_interpretations WHERE reading_id = ?').get(latestRecord.id);
|
|
console.log(`最新记录 ID: ${latestRecord.id} (${latestRecord.reading_type}) 是否有AI解读: ${hasAI.count > 0 ? '是' : '否'}`);
|
|
}
|
|
|
|
} catch (error) {
|
|
console.error('调试失败:', error);
|
|
} finally {
|
|
process.exit(0);
|
|
} |