nitrostack 1.0.25 → 1.0.26
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
package/src/studio/app/page.tsx
CHANGED
|
@@ -305,13 +305,21 @@ export default function ToolsPage() {
|
|
|
305
305
|
</div>
|
|
306
306
|
|
|
307
307
|
{/* Widget UI Rendering */}
|
|
308
|
-
{(
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
308
|
+
{(() => {
|
|
309
|
+
// Get widget URI from multiple sources (same as ToolCard)
|
|
310
|
+
const widgetUri =
|
|
311
|
+
selectedTool.widget?.route ||
|
|
312
|
+
selectedTool.outputTemplate ||
|
|
313
|
+
selectedTool._meta?.['ui/template'] ||
|
|
314
|
+
selectedTool._meta?.['openai/outputTemplate'];
|
|
315
|
+
|
|
316
|
+
return widgetUri && toolResult ? (
|
|
317
|
+
<div>
|
|
318
|
+
<h3 className="font-semibold text-foreground mb-3">UI Widget:</h3>
|
|
319
|
+
<div className="border border-border rounded-lg overflow-hidden h-64 bg-background shadow-inner">
|
|
320
|
+
<WidgetRenderer
|
|
321
|
+
uri={widgetUri}
|
|
322
|
+
data={(() => {
|
|
315
323
|
// Try to parse JSON from content[0].text, otherwise use raw result
|
|
316
324
|
if (toolResult.content?.[0]?.text) {
|
|
317
325
|
try {
|
|
@@ -327,11 +335,12 @@ export default function ToolsPage() {
|
|
|
327
335
|
}
|
|
328
336
|
return toolResult;
|
|
329
337
|
})()}
|
|
330
|
-
|
|
331
|
-
|
|
338
|
+
className="w-full h-full"
|
|
339
|
+
/>
|
|
340
|
+
</div>
|
|
332
341
|
</div>
|
|
333
|
-
|
|
334
|
-
)}
|
|
342
|
+
) : null;
|
|
343
|
+
})()}
|
|
335
344
|
</div>
|
|
336
345
|
)}
|
|
337
346
|
</div>
|
|
@@ -21,7 +21,7 @@ export function ToolCard({ tool, onExecute }: ToolCardProps) {
|
|
|
21
21
|
tool.outputTemplate ||
|
|
22
22
|
tool._meta?.['ui/template'] ||
|
|
23
23
|
tool._meta?.['openai/outputTemplate'];
|
|
24
|
-
const hasWidget = !!widgetUri;
|
|
24
|
+
const hasWidget = !!widgetUri && widgetUri.trim().length > 0;
|
|
25
25
|
|
|
26
26
|
// Get example data for preview
|
|
27
27
|
const exampleData = tool.examples?.response;
|
|
@@ -77,8 +77,8 @@ export function ToolCard({ tool, onExecute }: ToolCardProps) {
|
|
|
77
77
|
{tool.description || 'No description'}
|
|
78
78
|
</p>
|
|
79
79
|
|
|
80
|
-
{/* Widget Preview */}
|
|
81
|
-
{hasWidget && exampleData && (
|
|
80
|
+
{/* Widget Preview - Show if widget exists AND has example data */}
|
|
81
|
+
{hasWidget && widgetUri && exampleData && (
|
|
82
82
|
<div className="relative mb-4 rounded-lg overflow-hidden border border-border bg-muted/20">
|
|
83
83
|
<div className="absolute top-2 left-2 z-10 flex items-center gap-1 bg-primary/90 backdrop-blur-sm text-black px-2 py-1 rounded-md text-xs font-semibold shadow-lg">
|
|
84
84
|
<Sparkles className="w-3 h-3" />
|
|
@@ -96,7 +96,7 @@ export function ToolCard({ tool, onExecute }: ToolCardProps) {
|
|
|
96
96
|
|
|
97
97
|
{/* Action Buttons */}
|
|
98
98
|
<div className="flex flex-wrap items-center gap-2" onClick={(e) => e.stopPropagation()}>
|
|
99
|
-
{hasWidget &&
|
|
99
|
+
{hasWidget && (
|
|
100
100
|
<button
|
|
101
101
|
onClick={handleEnlarge}
|
|
102
102
|
className="btn btn-secondary flex-1 min-w-[90px] text-xs sm:text-sm gap-1.5 px-2.5 py-1.5 sm:px-4 sm:py-2"
|