@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.mjs
CHANGED
|
@@ -429,6 +429,8 @@ var ComponentPropsSchema = z3.object({
|
|
|
429
429
|
var ComponentSchema = z3.object({
|
|
430
430
|
id: z3.string(),
|
|
431
431
|
name: z3.string(),
|
|
432
|
+
displayName: z3.string().optional(),
|
|
433
|
+
isDisplayComp: z3.boolean().optional(),
|
|
432
434
|
type: z3.string(),
|
|
433
435
|
description: z3.string(),
|
|
434
436
|
props: ComponentPropsSchema,
|
|
@@ -5212,19 +5214,20 @@ async function handleUserPromptSuggestions(data, components, sendMessage) {
|
|
|
5212
5214
|
}, sendMessage, wsId);
|
|
5213
5215
|
return;
|
|
5214
5216
|
}
|
|
5215
|
-
|
|
5217
|
+
const displayComponents = components.filter((c) => c.isDisplayComp === true);
|
|
5218
|
+
if (!displayComponents || displayComponents.length === 0) {
|
|
5216
5219
|
sendResponse(id, {
|
|
5217
5220
|
success: true,
|
|
5218
5221
|
data: {
|
|
5219
5222
|
prompt,
|
|
5220
5223
|
suggestions: [],
|
|
5221
5224
|
count: 0,
|
|
5222
|
-
message: "No components available"
|
|
5225
|
+
message: "No display components available"
|
|
5223
5226
|
}
|
|
5224
5227
|
}, sendMessage, wsId);
|
|
5225
5228
|
return;
|
|
5226
5229
|
}
|
|
5227
|
-
const suggestions = searchComponents(prompt,
|
|
5230
|
+
const suggestions = searchComponents(prompt, displayComponents, limit);
|
|
5228
5231
|
sendResponse(id, {
|
|
5229
5232
|
success: true,
|
|
5230
5233
|
data: {
|
|
@@ -5248,6 +5251,7 @@ function searchComponents(prompt, components, limit) {
|
|
|
5248
5251
|
const scoredComponents = components.map((component) => {
|
|
5249
5252
|
let score = 0;
|
|
5250
5253
|
const componentName = component.name.toLowerCase();
|
|
5254
|
+
const componentDisplayName = (component.displayName || "").toLowerCase();
|
|
5251
5255
|
const componentDesc = component.description.toLowerCase();
|
|
5252
5256
|
const componentKeywords = (component.keywords || []).map((k) => k.toLowerCase());
|
|
5253
5257
|
const componentCategory = (component.category || "").toLowerCase();
|
|
@@ -5257,6 +5261,9 @@ function searchComponents(prompt, components, limit) {
|
|
|
5257
5261
|
} else if (componentName.includes(token)) {
|
|
5258
5262
|
score += 5;
|
|
5259
5263
|
}
|
|
5264
|
+
if (componentDisplayName.includes(token)) {
|
|
5265
|
+
score += 6;
|
|
5266
|
+
}
|
|
5260
5267
|
if (componentKeywords.includes(token)) {
|
|
5261
5268
|
score += 8;
|
|
5262
5269
|
} else if (componentKeywords.some((k) => k.includes(token))) {
|