extraction error logging
This commit is contained in:
@@ -58,7 +58,9 @@ async function extractAndStoreEntities(userMessage, aiResponse, projectId=null)
|
||||
try {
|
||||
// Fetch existing entities to guide the model toward consistent name/type pairs
|
||||
const db = require('../db').getDB();
|
||||
console.log('[entities] fetching known entities...'); // add this
|
||||
const knownEntities = db.prepare(`SELECT name, type FROM entities ORDER BY name`).all();
|
||||
console.log('[entities] known entities count:', knownEntities.length);
|
||||
|
||||
const prompt = buildExtractionPrompt(userMessage, aiResponse, knownEntities);
|
||||
console.log('[entities] prompt preview:', JSON.stringify(prompt.slice(0, 500)));
|
||||
@@ -69,7 +71,7 @@ async function extractAndStoreEntities(userMessage, aiResponse, projectId=null)
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
model: EXTRACTION_MODEL,
|
||||
prompt: buildExtractionPrompt(userMessage, aiResponse, knownEntities),
|
||||
prompt: prompt,
|
||||
stream: false,
|
||||
format: 'json',
|
||||
options: {
|
||||
|
||||
Reference in New Issue
Block a user