@superatomai/sdk-node 0.0.17 → 0.0.18
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.js +10 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -469,6 +469,8 @@ var ComponentPropsSchema = import_zod3.z.object({
|
|
|
469
469
|
var ComponentSchema = import_zod3.z.object({
|
|
470
470
|
id: import_zod3.z.string(),
|
|
471
471
|
name: import_zod3.z.string(),
|
|
472
|
+
displayName: import_zod3.z.string().optional(),
|
|
473
|
+
isDisplayComp: import_zod3.z.boolean().optional(),
|
|
472
474
|
type: import_zod3.z.string(),
|
|
473
475
|
description: import_zod3.z.string(),
|
|
474
476
|
props: ComponentPropsSchema,
|
|
@@ -5252,19 +5254,20 @@ async function handleUserPromptSuggestions(data, components, sendMessage) {
|
|
|
5252
5254
|
}, sendMessage, wsId);
|
|
5253
5255
|
return;
|
|
5254
5256
|
}
|
|
5255
|
-
|
|
5257
|
+
const displayComponents = components.filter((c) => c.isDisplayComp === true);
|
|
5258
|
+
if (!displayComponents || displayComponents.length === 0) {
|
|
5256
5259
|
sendResponse(id, {
|
|
5257
5260
|
success: true,
|
|
5258
5261
|
data: {
|
|
5259
5262
|
prompt,
|
|
5260
5263
|
suggestions: [],
|
|
5261
5264
|
count: 0,
|
|
5262
|
-
message: "No components available"
|
|
5265
|
+
message: "No display components available"
|
|
5263
5266
|
}
|
|
5264
5267
|
}, sendMessage, wsId);
|
|
5265
5268
|
return;
|
|
5266
5269
|
}
|
|
5267
|
-
const suggestions = searchComponents(prompt,
|
|
5270
|
+
const suggestions = searchComponents(prompt, displayComponents, limit);
|
|
5268
5271
|
sendResponse(id, {
|
|
5269
5272
|
success: true,
|
|
5270
5273
|
data: {
|
|
@@ -5288,6 +5291,7 @@ function searchComponents(prompt, components, limit) {
|
|
|
5288
5291
|
const scoredComponents = components.map((component) => {
|
|
5289
5292
|
let score = 0;
|
|
5290
5293
|
const componentName = component.name.toLowerCase();
|
|
5294
|
+
const componentDisplayName = (component.displayName || "").toLowerCase();
|
|
5291
5295
|
const componentDesc = component.description.toLowerCase();
|
|
5292
5296
|
const componentKeywords = (component.keywords || []).map((k) => k.toLowerCase());
|
|
5293
5297
|
const componentCategory = (component.category || "").toLowerCase();
|
|
@@ -5297,6 +5301,9 @@ function searchComponents(prompt, components, limit) {
|
|
|
5297
5301
|
} else if (componentName.includes(token)) {
|
|
5298
5302
|
score += 5;
|
|
5299
5303
|
}
|
|
5304
|
+
if (componentDisplayName.includes(token)) {
|
|
5305
|
+
score += 6;
|
|
5306
|
+
}
|
|
5300
5307
|
if (componentKeywords.includes(token)) {
|
|
5301
5308
|
score += 8;
|
|
5302
5309
|
} else if (componentKeywords.some((k) => k.includes(token))) {
|