@superatomai/sdk-node 0.0.16 → 0.0.17
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/dist/index.js +28 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3411,6 +3411,26 @@ var BaseLLM = class {
|
|
|
3411
3411
|
getApiKey(apiKey) {
|
|
3412
3412
|
return apiKey || this.apiKey || this.getDefaultApiKey();
|
|
3413
3413
|
}
|
|
3414
|
+
/**
|
|
3415
|
+
* Check if a component contains a Form (data_modification component)
|
|
3416
|
+
* Forms have hardcoded defaultValues that become stale when cached
|
|
3417
|
+
* This checks both single Form components and Forms inside MultiComponentContainer
|
|
3418
|
+
*/
|
|
3419
|
+
containsFormComponent(component) {
|
|
3420
|
+
if (!component) return false;
|
|
3421
|
+
if (component.type === "Form" || component.name === "DynamicForm") {
|
|
3422
|
+
return true;
|
|
3423
|
+
}
|
|
3424
|
+
if (component.type === "Container" || component.name === "MultiComponentContainer") {
|
|
3425
|
+
const nestedComponents = component.props?.config?.components || [];
|
|
3426
|
+
for (const nested of nestedComponents) {
|
|
3427
|
+
if (nested.type === "Form" || nested.name === "DynamicForm") {
|
|
3428
|
+
return true;
|
|
3429
|
+
}
|
|
3430
|
+
}
|
|
3431
|
+
}
|
|
3432
|
+
return false;
|
|
3433
|
+
}
|
|
3414
3434
|
/**
|
|
3415
3435
|
* Match components from text response suggestions and generate follow-up questions
|
|
3416
3436
|
* Takes a text response with component suggestions (c1:type format) and matches with available components
|
|
@@ -4285,9 +4305,15 @@ ${errorMsg}
|
|
|
4285
4305
|
logCollector?.info(
|
|
4286
4306
|
`\u2713 Found similar conversation (${(conversationMatch.similarity * 100).toFixed(2)}% match)`
|
|
4287
4307
|
);
|
|
4288
|
-
const
|
|
4308
|
+
const rawComponent = conversationMatch.uiBlock?.component || conversationMatch.uiBlock?.generatedComponentMetadata;
|
|
4309
|
+
const isValidComponent = rawComponent && typeof rawComponent === "object" && Object.keys(rawComponent).length > 0;
|
|
4310
|
+
const component = isValidComponent ? rawComponent : null;
|
|
4289
4311
|
const cachedTextResponse = conversationMatch.uiBlock?.analysis || conversationMatch.uiBlock?.textResponse || conversationMatch.uiBlock?.text || "";
|
|
4290
|
-
|
|
4312
|
+
logger.debug(`[${this.getProviderName()}] Cached component: ${component ? "present" : "null"}, cachedTextResponse: ${cachedTextResponse ? cachedTextResponse.substring(0, 50) + "..." : "empty"}`);
|
|
4313
|
+
if (this.containsFormComponent(component)) {
|
|
4314
|
+
logger.info(`[${this.getProviderName()}] Skipping cached result - Form components contain stale defaultValues, fetching fresh data`);
|
|
4315
|
+
logCollector?.info("Skipping cache for form - fetching current values from database...");
|
|
4316
|
+
} else if (!component) {
|
|
4291
4317
|
if (conversationMatch.similarity >= 0.99) {
|
|
4292
4318
|
const elapsedTime2 = Date.now() - startTime;
|
|
4293
4319
|
logger.info(`[${this.getProviderName()}] \u2713 Exact match for general question - returning cached text response`);
|