ei-tui 0.6.2 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -123,9 +123,9 @@ export async function handleFactFind(response: LLMResponse, state: StateManager)
|
|
|
123
123
|
continue;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
// Skip if the LLM returned a null/empty value — don't store
|
|
127
|
-
if (!factResult.value) {
|
|
128
|
-
console.log(`[handleFactFind] Skipping fact with null/empty value: "${factResult.name}"`);
|
|
126
|
+
// Skip if the LLM returned a null/empty/non-string value — don't store booleans or nulls
|
|
127
|
+
if (!factResult.value || typeof factResult.value !== 'string') {
|
|
128
|
+
console.log(`[handleFactFind] Skipping fact with null/empty/non-string value: "${factResult.name}" (got ${typeof factResult.value})`);
|
|
129
129
|
continue;
|
|
130
130
|
}
|
|
131
131
|
|
|
@@ -216,10 +216,6 @@ export async function handlePersonUpdate(response: LLMResponse, state: StateMana
|
|
|
216
216
|
const candidateRelationship = response.request.data.candidateRelationship as string | undefined;
|
|
217
217
|
const candidateIdentifiers = (response.request.data.candidateIdentifiers ?? []) as PersonIdentifier[];
|
|
218
218
|
|
|
219
|
-
if (!result.description || result.sentiment === undefined) {
|
|
220
|
-
throw new Error(`[handlePersonUpdate] Missing required fields: description=${!!result.description}, sentiment=${result.sentiment}`);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
219
|
const candidateName = response.request.data.candidateName as string;
|
|
224
220
|
const personaIds = personaId.split("|").filter(Boolean);
|
|
225
221
|
const primaryId = personaIds[0] ?? personaId;
|
|
@@ -241,11 +237,18 @@ export async function handlePersonUpdate(response: LLMResponse, state: StateMana
|
|
|
241
237
|
|
|
242
238
|
const existingPerson = isNewItem ? undefined : human.people.find(p => p.id === existingItemId);
|
|
243
239
|
|
|
240
|
+
const resolvedDescription = typeof result.description === 'string' ? result.description : existingPerson?.description;
|
|
241
|
+
const resolvedSentiment = result.sentiment !== undefined ? result.sentiment : existingPerson?.sentiment;
|
|
242
|
+
|
|
243
|
+
if (!resolvedDescription || resolvedSentiment === undefined) {
|
|
244
|
+
throw new Error(`[handlePersonUpdate] Missing required fields: description=${!!resolvedDescription}, sentiment=${resolvedSentiment}`);
|
|
245
|
+
}
|
|
246
|
+
|
|
244
247
|
let embedding: number[] | undefined;
|
|
245
248
|
try {
|
|
246
249
|
const embeddingService = getEmbeddingService();
|
|
247
250
|
const relationship = result.relationship ?? candidateRelationship ?? existingPerson?.relationship;
|
|
248
|
-
const text = getPersonEmbeddingText({ name: candidateName, relationship, description:
|
|
251
|
+
const text = getPersonEmbeddingText({ name: candidateName, relationship, description: resolvedDescription });
|
|
249
252
|
embedding = await embeddingService.embed(text);
|
|
250
253
|
} catch (err) {
|
|
251
254
|
console.warn(`[handlePersonUpdate] Failed to compute embedding for person "${candidateName}":`, err);
|
|
@@ -295,8 +298,8 @@ export async function handlePersonUpdate(response: LLMResponse, state: StateMana
|
|
|
295
298
|
const person: Person = {
|
|
296
299
|
id: itemId,
|
|
297
300
|
name: candidateName,
|
|
298
|
-
description:
|
|
299
|
-
sentiment:
|
|
301
|
+
description: resolvedDescription,
|
|
302
|
+
sentiment: resolvedSentiment,
|
|
300
303
|
relationship: result.relationship ?? candidateRelationship ?? existingPerson?.relationship ?? "Unknown",
|
|
301
304
|
exposure_current: calculateExposureCurrent(exposureImpact, existingPerson?.exposure_current ?? 0),
|
|
302
305
|
exposure_desired: result.exposure_desired ?? 0.5,
|