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