@superatomai/sdk-node 0.0.44 → 0.0.45
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/README.md +942 -942
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +11 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +48 -49
package/dist/index.mjs
CHANGED
|
@@ -5926,8 +5926,9 @@ ${JSON.stringify(tool.requiredFields || [], null, 2)}`;
|
|
|
5926
5926
|
/**
|
|
5927
5927
|
* Adapt UI block parameters based on current user question
|
|
5928
5928
|
* Takes a matched UI block from semantic search and modifies its props to answer the new question
|
|
5929
|
+
* Also adapts the cached text response to match the new question
|
|
5929
5930
|
*/
|
|
5930
|
-
async adaptUIBlockParameters(currentUserPrompt, originalUserPrompt, matchedUIBlock, apiKey, logCollector) {
|
|
5931
|
+
async adaptUIBlockParameters(currentUserPrompt, originalUserPrompt, matchedUIBlock, apiKey, logCollector, cachedTextResponse) {
|
|
5931
5932
|
try {
|
|
5932
5933
|
const component = matchedUIBlock?.generatedComponentMetadata || matchedUIBlock?.component;
|
|
5933
5934
|
if (!matchedUIBlock || !component) {
|
|
@@ -5943,6 +5944,7 @@ ${JSON.stringify(tool.requiredFields || [], null, 2)}`;
|
|
|
5943
5944
|
CURRENT_USER_PROMPT: currentUserPrompt,
|
|
5944
5945
|
MATCHED_UI_BLOCK_COMPONENT: JSON.stringify(component, null, 2),
|
|
5945
5946
|
COMPONENT_PROPS: JSON.stringify(component.props, null, 2),
|
|
5947
|
+
CACHED_TEXT_RESPONSE: cachedTextResponse || "No cached text response available",
|
|
5946
5948
|
SCHEMA_DOC: schemaDoc || "No schema available",
|
|
5947
5949
|
DATABASE_RULES: databaseRules
|
|
5948
5950
|
});
|
|
@@ -5991,6 +5993,7 @@ ${JSON.stringify(tool.requiredFields || [], null, 2)}`;
|
|
|
5991
5993
|
return {
|
|
5992
5994
|
success: true,
|
|
5993
5995
|
adaptedComponent: result.adaptedComponent,
|
|
5996
|
+
adaptedTextResponse: result.adaptedTextResponse,
|
|
5994
5997
|
parametersChanged: result.parametersChanged,
|
|
5995
5998
|
explanation: result.explanation || "Parameters adapted successfully"
|
|
5996
5999
|
};
|
|
@@ -6686,7 +6689,8 @@ ${errorMsg}
|
|
|
6686
6689
|
originalPrompt,
|
|
6687
6690
|
conversationMatch.uiBlock,
|
|
6688
6691
|
apiKey,
|
|
6689
|
-
logCollector
|
|
6692
|
+
logCollector,
|
|
6693
|
+
cachedTextResponse
|
|
6690
6694
|
);
|
|
6691
6695
|
if (adaptResult.success && adaptResult.adaptedComponent) {
|
|
6692
6696
|
const elapsedTime2 = Date.now() - startTime;
|
|
@@ -6694,15 +6698,16 @@ ${errorMsg}
|
|
|
6694
6698
|
logger.info(`[${this.getProviderName()}] Total time taken: ${elapsedTime2}ms (${(elapsedTime2 / 1e3).toFixed(2)}s)`);
|
|
6695
6699
|
logCollector?.info(`\u2713 UI block adapted successfully`);
|
|
6696
6700
|
logCollector?.info(`Total time taken: ${elapsedTime2}ms (${(elapsedTime2 / 1e3).toFixed(2)}s)`);
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
|
|
6701
|
+
const textResponseToUse = adaptResult.adaptedTextResponse || cachedTextResponse;
|
|
6702
|
+
if (streamCallback && textResponseToUse) {
|
|
6703
|
+
logger.info(`[${this.getProviderName()}] Streaming ${adaptResult.adaptedTextResponse ? "adapted" : "cached"} text response to frontend`);
|
|
6704
|
+
streamCallback(textResponseToUse);
|
|
6700
6705
|
}
|
|
6701
6706
|
const cachedActions = conversationMatch.uiBlock?.actions || [];
|
|
6702
6707
|
return {
|
|
6703
6708
|
success: true,
|
|
6704
6709
|
data: {
|
|
6705
|
-
text:
|
|
6710
|
+
text: textResponseToUse,
|
|
6706
6711
|
component: adaptResult.adaptedComponent,
|
|
6707
6712
|
matchedComponents: adaptResult.adaptedComponent?.props?.config?.components || [],
|
|
6708
6713
|
actions: cachedActions,
|