create-nextblock 0.15.3 → 0.15.4

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.
@@ -1,688 +0,0 @@
1
- 'use client';
2
-
3
- import React, { useEffect, useState } from 'react';
4
- import {
5
- Alert,
6
- AlertDescription,
7
- AlertTitle,
8
- Badge,
9
- Button,
10
- Card,
11
- CardContent,
12
- CardDescription,
13
- CardHeader,
14
- CardTitle,
15
- Input,
16
- Label,
17
- SearchableSelect,
18
- } from '@nextblock-cms/ui';
19
- import {
20
- AlertTriangle,
21
- Brain,
22
- CheckCircle2,
23
- ChevronDown,
24
- ChevronRight,
25
- Cpu,
26
- ImageIcon,
27
- Info,
28
- KeyRound,
29
- Lock,
30
- SlidersHorizontal,
31
- Trash2,
32
- } from 'lucide-react';
33
- import {
34
- createCortexAiStoredModelSelection,
35
- type CortexAiStoredModelSelection,
36
- } from '@nextblock-cms/cortex/client';
37
- import type { CortexAiAgentSettings } from '@nextblock-cms/cortex';
38
-
39
- const CORTEX_AI_SANDBOX_KEY_LOCAL_STORAGE = 'cortex_ai_sandbox_openrouter_api_key';
40
- const CORTEX_AI_SANDBOX_MODEL_LOCAL_STORAGE = 'cortex_ai_sandbox_openrouter_model_selection';
41
- const CORTEX_AI_SETTINGS_CHANGED_EVENT = 'nextblock:cortex-ai-settings-changed';
42
-
43
- type SandboxCortexAiSettingsClientProps = {
44
- compatibleModels: Array<{
45
- id: string;
46
- name: string;
47
- pricing: Record<string, string>;
48
- context_length: number | null;
49
- created?: number | null;
50
- architecture?: {
51
- modality?: string;
52
- tokenizer?: string;
53
- instruct_type?: string | null;
54
- } | null;
55
- description?: string;
56
- top_provider?: {
57
- max_completion_tokens?: number | null;
58
- is_moderated?: boolean;
59
- } | null;
60
- }>;
61
- isPackageActive: boolean;
62
- hasEnvOpenRouterKey: boolean;
63
- maskedEnvOpenRouterKey: string | null;
64
- modelCatalogError: string | null;
65
- activeStockProvider: 'pexels' | 'unsplash' | null;
66
- hasStoredPexelsKey: boolean;
67
- maskedStoredPexelsKey: string | null;
68
- hasStoredUnsplashKey: boolean;
69
- maskedStoredUnsplashKey: string | null;
70
- hasEnvPexelsKey: boolean;
71
- hasEnvUnsplashKey: boolean;
72
- unsplashAppName: string | null;
73
- agentSettings: CortexAiAgentSettings;
74
- };
75
-
76
- function formatTokenPrice(value: string | undefined) {
77
- const amount = Number(value);
78
- if (!Number.isFinite(amount)) return null;
79
- if (amount === 0) return '$0';
80
- const perMillion = amount * 1_000_000;
81
- return `$${perMillion < 0.01 ? perMillion.toFixed(4) : perMillion.toFixed(2)}`;
82
- }
83
-
84
- function formatModelPricing(pricing: Record<string, string>) {
85
- const promptPrice = formatTokenPrice(pricing.prompt);
86
- const completionPrice = formatTokenPrice(pricing.completion);
87
- if (promptPrice === '$0' && completionPrice === '$0') return 'Free';
88
- if (promptPrice && completionPrice) return `${promptPrice}/1M input - ${completionPrice}/1M output`;
89
- return 'Pricing varies';
90
- }
91
-
92
- function getMaskedKey(key: string) {
93
- if (key.length <= 8) return '****';
94
- return `**** ${key.slice(-4)}`;
95
- }
96
-
97
- function notifyCortexAiSettingsChanged() {
98
- window.dispatchEvent(new Event(CORTEX_AI_SETTINGS_CHANGED_EVENT));
99
- }
100
-
101
- function StatusPill({
102
- label,
103
- value,
104
- active,
105
- detail,
106
- }: {
107
- label: string;
108
- value: string;
109
- active: boolean;
110
- detail?: string | null;
111
- }) {
112
- return (
113
- <div className="flex min-w-[8rem] flex-col gap-1 rounded-md border bg-muted/30 px-3 py-2">
114
- <span className="text-[10px] font-semibold uppercase tracking-wider text-muted-foreground">
115
- {label}
116
- </span>
117
- <div className="flex items-center gap-2">
118
- <span className={`h-2 w-2 rounded-full ${active ? 'bg-emerald-500' : 'bg-muted-foreground/40'}`} />
119
- <span className="text-sm font-medium">{value}</span>
120
- </div>
121
- {detail && <span className="truncate font-mono text-[11px] text-muted-foreground">{detail}</span>}
122
- </div>
123
- );
124
- }
125
-
126
- // Sandbox mirrors the production layout, but every server-backed setting is
127
- // read-only: the settings actions refuse to write to the shared sandbox DB, and
128
- // only the OpenRouter key + model have a per-visitor override channel
129
- // (localStorage -> x-sandbox-openrouter-* headers).
130
- function ReadOnlyRow({
131
- label,
132
- value,
133
- detail,
134
- }: {
135
- label: string;
136
- value: string;
137
- detail?: string | null;
138
- }) {
139
- return (
140
- <div className="flex items-center justify-between gap-3 rounded-md border bg-muted/20 px-3 py-2">
141
- <span className="text-xs font-medium">{label}</span>
142
- <div className="flex items-center gap-2 text-right">
143
- <span className="text-xs text-muted-foreground">{value}</span>
144
- {detail && <span className="font-mono text-[11px] text-muted-foreground">{detail}</span>}
145
- </div>
146
- </div>
147
- );
148
- }
149
-
150
- export function SandboxCortexAiSettingsClient({
151
- compatibleModels,
152
- isPackageActive,
153
- hasEnvOpenRouterKey,
154
- maskedEnvOpenRouterKey,
155
- modelCatalogError,
156
- activeStockProvider,
157
- hasStoredPexelsKey,
158
- maskedStoredPexelsKey,
159
- hasStoredUnsplashKey,
160
- maskedStoredUnsplashKey,
161
- hasEnvPexelsKey,
162
- hasEnvUnsplashKey,
163
- unsplashAppName,
164
- agentSettings,
165
- }: SandboxCortexAiSettingsClientProps) {
166
- const [mounted, setMounted] = useState(false);
167
- const [sandboxKey, setSandboxKey] = useState<string | null>(null);
168
- const [sandboxModel, setSandboxModel] = useState<CortexAiStoredModelSelection | null>(null);
169
- const [inputValue, setInputValue] = useState('');
170
- const [modelInput, setModelInput] = useState<string>('');
171
- const [successMessage, setSuccessMessage] = useState<string | null>(null);
172
- const [showAdvanced, setShowAdvanced] = useState(false);
173
-
174
- useEffect(() => {
175
- try {
176
- const storedKey = window.localStorage.getItem(CORTEX_AI_SANDBOX_KEY_LOCAL_STORAGE);
177
- if (storedKey) {
178
- setSandboxKey(storedKey);
179
- }
180
-
181
- const storedModel = window.localStorage.getItem(CORTEX_AI_SANDBOX_MODEL_LOCAL_STORAGE);
182
- if (storedModel) {
183
- const parsed = JSON.parse(storedModel) as CortexAiStoredModelSelection;
184
- setSandboxModel(parsed);
185
- setModelInput(parsed.modelId);
186
- }
187
- } catch (error) {
188
- console.error('Failed to read Cortex AI sandbox settings from localStorage', error);
189
- }
190
- setMounted(true);
191
- }, []);
192
-
193
- const handleSaveKey = (e: React.FormEvent) => {
194
- e.preventDefault();
195
- const key = inputValue.trim();
196
- if (!key) return;
197
-
198
- try {
199
- window.localStorage.setItem(CORTEX_AI_SANDBOX_KEY_LOCAL_STORAGE, key);
200
- setSandboxKey(key);
201
- setInputValue('');
202
- notifyCortexAiSettingsChanged();
203
- setSuccessMessage('Sandbox OpenRouter key saved to your browser.');
204
- setTimeout(() => setSuccessMessage(null), 3000);
205
- } catch (error) {
206
- console.error('Failed to save sandbox key', error);
207
- }
208
- };
209
-
210
- const handleClearKey = () => {
211
- try {
212
- window.localStorage.removeItem(CORTEX_AI_SANDBOX_KEY_LOCAL_STORAGE);
213
- window.localStorage.removeItem(CORTEX_AI_SANDBOX_MODEL_LOCAL_STORAGE);
214
- setSandboxKey(null);
215
- setSandboxModel(null);
216
- setModelInput('');
217
- notifyCortexAiSettingsChanged();
218
- setSuccessMessage('Sandbox OpenRouter key cleared from your browser.');
219
- setTimeout(() => setSuccessMessage(null), 3000);
220
- } catch (error) {
221
- console.error('Failed to clear sandbox key', error);
222
- }
223
- };
224
-
225
- const handleSaveModel = (e: React.FormEvent<HTMLFormElement>) => {
226
- e.preventDefault();
227
- const formData = new FormData(e.currentTarget);
228
- const modelId = String(formData.get('openrouter_model_id') || '').trim();
229
- if (!modelId) return;
230
-
231
- const selectedModel = compatibleModels.find((m) => m.id === modelId);
232
- if (!selectedModel) return;
233
-
234
- try {
235
- const storedSelection = createCortexAiStoredModelSelection(selectedModel as any);
236
- window.localStorage.setItem(
237
- CORTEX_AI_SANDBOX_MODEL_LOCAL_STORAGE,
238
- JSON.stringify(storedSelection)
239
- );
240
- setSandboxModel(storedSelection);
241
- notifyCortexAiSettingsChanged();
242
- setSuccessMessage('Sandbox Cortex AI model selection saved to your browser.');
243
- setTimeout(() => setSuccessMessage(null), 3000);
244
- } catch (error) {
245
- console.error('Failed to save sandbox model', error);
246
- }
247
- };
248
-
249
- const handleClearModel = () => {
250
- try {
251
- window.localStorage.removeItem(CORTEX_AI_SANDBOX_MODEL_LOCAL_STORAGE);
252
- setSandboxModel(null);
253
- setModelInput('');
254
- notifyCortexAiSettingsChanged();
255
- setSuccessMessage('Sandbox Cortex AI model selection cleared.');
256
- setTimeout(() => setSuccessMessage(null), 3000);
257
- } catch (error) {
258
- console.error('Failed to clear sandbox model', error);
259
- }
260
- };
261
-
262
- if (!mounted) {
263
- return null; // Avoid hydration mismatch
264
- }
265
-
266
- const selectedModelIsInCatalog = compatibleModels.some(
267
- (model) => model.id === sandboxModel?.modelId
268
- );
269
-
270
- const modelOptions =
271
- sandboxModel && !selectedModelIsInCatalog
272
- ? [
273
- {
274
- context_length: sandboxModel.contextLength,
275
- created: null,
276
- expirationDate: null,
277
- id: sandboxModel.modelId,
278
- name: `${sandboxModel.name} (saved)`,
279
- pricing: sandboxModel.pricing,
280
- supportedParameters: sandboxModel.supportedParameters,
281
- },
282
- ...compatibleModels,
283
- ]
284
- : compatibleModels;
285
-
286
- const canSelectModel = !!sandboxKey && compatibleModels.length > 0;
287
- const maskedSandboxKey = sandboxKey ? getMaskedKey(sandboxKey) : null;
288
- const isKeyDirty = inputValue.trim().length > 0;
289
- const isModelDirty = modelInput !== (sandboxModel?.modelId || '');
290
-
291
- const searchableOptions = modelOptions.map((model) => ({
292
- value: model.id,
293
- label: model.name,
294
- description: `${model.id} - ${formatModelPricing(model.pricing as any)}`,
295
- }));
296
-
297
- const keySourceValue = sandboxKey ? 'Sandbox BYOK' : hasEnvOpenRouterKey ? 'Environment' : 'None';
298
- // Ordered by preference (Pexels primary, Unsplash fallback). Configured = a
299
- // stored DB key OR an env var for that provider.
300
- const configuredStockProviders = [
301
- hasStoredPexelsKey || hasEnvPexelsKey ? { name: 'Pexels', stored: hasStoredPexelsKey } : null,
302
- hasStoredUnsplashKey || hasEnvUnsplashKey
303
- ? { name: 'Unsplash', stored: hasStoredUnsplashKey }
304
- : null,
305
- ].filter(Boolean) as Array<{ name: string; stored: boolean }>;
306
- const stockValue =
307
- configuredStockProviders.length > 0
308
- ? configuredStockProviders.map((provider) => provider.name).join(' + ')
309
- : 'Off';
310
-
311
- return (
312
- <div className="mx-auto w-full max-w-5xl space-y-4 px-4 py-6">
313
- <div className="flex items-center gap-2.5">
314
- <Brain className="h-6 w-6 text-primary" />
315
- <div>
316
- <h1 className="text-xl font-semibold leading-tight">
317
- NextBlock Cortex AI{' '}
318
- <Badge variant="secondary" className="ml-1 align-middle font-normal">
319
- Sandbox
320
- </Badge>
321
- </h1>
322
- <p className="text-xs text-muted-foreground">
323
- Manage the OpenRouter model key used by Cortex AI in your own browser session.
324
- </p>
325
- </div>
326
- </div>
327
-
328
- {successMessage && (
329
- <Alert variant="success">
330
- <CheckCircle2 className="h-4 w-4" />
331
- <AlertTitle>Saved</AlertTitle>
332
- <AlertDescription>{successMessage}</AlertDescription>
333
- </Alert>
334
- )}
335
-
336
- {/* Compact status strip */}
337
- <div className="flex flex-wrap gap-2">
338
- <StatusPill
339
- label="Package"
340
- value={isPackageActive ? 'Active' : 'Inactive'}
341
- active={isPackageActive}
342
- />
343
- <StatusPill
344
- label="Model key"
345
- value={keySourceValue}
346
- active={Boolean(sandboxKey) || hasEnvOpenRouterKey}
347
- detail={maskedSandboxKey || maskedEnvOpenRouterKey}
348
- />
349
- <StatusPill
350
- label="Model"
351
- value={sandboxModel ? sandboxModel.name : 'Free registry'}
352
- active={Boolean(sandboxModel)}
353
- />
354
- <StatusPill
355
- label="Stock photos"
356
- value={stockValue}
357
- active={Boolean(activeStockProvider)}
358
- />
359
- </div>
360
-
361
- <Alert
362
- variant="warning"
363
- className="border-amber-200 bg-amber-50 text-amber-900 dark:border-amber-800 dark:bg-amber-950/30 dark:text-amber-200"
364
- >
365
- <Info className="h-4 w-4" />
366
- <AlertTitle>Sandbox environment active</AlertTitle>
367
- <AlertDescription>
368
- The key and model you set here are stored{' '}
369
- <strong>only in your own browser (localStorage)</strong> and are never written to the
370
- shared sandbox database. Server-backed settings below are read-only here.
371
- </AlertDescription>
372
- </Alert>
373
-
374
- {hasEnvOpenRouterKey && !sandboxKey && (
375
- <Alert>
376
- <KeyRound className="h-4 w-4" />
377
- <AlertTitle>Free-model lock active</AlertTitle>
378
- <AlertDescription>
379
- Cortex AI will only use the configured free OpenRouter models until you save a sandbox
380
- key to your browser.
381
- </AlertDescription>
382
- </Alert>
383
- )}
384
-
385
- {/* OpenRouter BYOK + Model side by side */}
386
- <div className="grid gap-4 lg:grid-cols-2">
387
- <Card>
388
- <CardHeader className="flex flex-row items-start justify-between space-y-0 pb-3">
389
- <div>
390
- <CardTitle className="text-base">OpenRouter key</CardTitle>
391
- <CardDescription className="text-xs">
392
- Saved to your browser only, never uploaded.
393
- </CardDescription>
394
- </div>
395
- {sandboxKey && (
396
- <Button
397
- type="button"
398
- onClick={handleClearKey}
399
- variant="ghost"
400
- size="sm"
401
- className="h-7 text-destructive hover:text-destructive"
402
- >
403
- <Trash2 className="mr-1.5 h-3.5 w-3.5" />
404
- Clear
405
- </Button>
406
- )}
407
- </CardHeader>
408
- <CardContent className="pt-0">
409
- <form onSubmit={handleSaveKey} className="flex items-end gap-2">
410
- <div className="flex-1 space-y-1.5">
411
- <Label htmlFor="openrouter_api_key" className="text-xs">
412
- API key
413
- </Label>
414
- <Input
415
- id="openrouter_api_key"
416
- name="openrouter_api_key"
417
- type="password"
418
- autoComplete="off"
419
- minLength={12}
420
- placeholder={sandboxKey ? 'Enter new key to overwrite...' : 'sk-or-v1-...'}
421
- value={inputValue}
422
- onChange={(e) => setInputValue(e.target.value)}
423
- required
424
- />
425
- </div>
426
- <Button type="submit" disabled={!isKeyDirty} size="sm">
427
- <KeyRound className="mr-1.5 h-3.5 w-3.5" />
428
- Save
429
- </Button>
430
- </form>
431
- </CardContent>
432
- </Card>
433
-
434
- <Card>
435
- <CardHeader className="flex flex-row items-start justify-between space-y-0 pb-3">
436
- <div>
437
- <CardTitle className="text-base">OpenRouter model</CardTitle>
438
- <CardDescription className="text-xs">
439
- Needs a sandbox key; supports tools + structured output.
440
- </CardDescription>
441
- </div>
442
- {sandboxModel && (
443
- <Button
444
- type="button"
445
- onClick={handleClearModel}
446
- variant="ghost"
447
- size="sm"
448
- className="h-7 text-destructive hover:text-destructive"
449
- >
450
- <Trash2 className="mr-1.5 h-3.5 w-3.5" />
451
- Clear
452
- </Button>
453
- )}
454
- </CardHeader>
455
- <CardContent className="space-y-2 pt-0">
456
- {modelCatalogError && (
457
- <Alert variant="warning">
458
- <AlertTriangle className="h-4 w-4" />
459
- <AlertTitle>Model catalog unavailable</AlertTitle>
460
- <AlertDescription>{modelCatalogError}</AlertDescription>
461
- </Alert>
462
- )}
463
- <form onSubmit={handleSaveModel} className="flex items-end gap-2">
464
- <input type="hidden" name="openrouter_model_id" value={modelInput} />
465
- <div className="flex-1 space-y-1.5">
466
- <Label htmlFor="openrouter_model_id_select" className="text-xs">
467
- Model
468
- </Label>
469
- <SearchableSelect
470
- options={searchableOptions}
471
- value={modelInput}
472
- onChange={(val) => setModelInput(val)}
473
- disabled={!canSelectModel}
474
- placeholder="Select a compatible model..."
475
- />
476
- </div>
477
- <Button type="submit" disabled={!canSelectModel || !isModelDirty} size="sm">
478
- <Cpu className="mr-1.5 h-3.5 w-3.5" />
479
- Save
480
- </Button>
481
- </form>
482
- <p className="text-[11px] text-muted-foreground">
483
- {canSelectModel
484
- ? `${compatibleModels.length} compatible models available.`
485
- : 'Cortex AI uses the free registry until a sandbox key + model are set.'}
486
- </p>
487
- </CardContent>
488
- </Card>
489
- </div>
490
-
491
- {/* Stock photos - read-only in sandbox */}
492
- <Card>
493
- <CardHeader className="pb-3">
494
- <CardTitle className="flex flex-wrap items-center gap-2 text-base">
495
- <ImageIcon className="h-4 w-4" />
496
- Stock photos
497
- {configuredStockProviders.length > 0 ? (
498
- configuredStockProviders.map((provider, index) => (
499
- <Badge
500
- key={provider.name}
501
- variant={index === 0 ? 'default' : 'secondary'}
502
- className="ml-0.5 font-normal"
503
- >
504
- {provider.name} · {index === 0 ? 'primary' : 'fallback'}
505
- {!provider.stored && ' (env)'}
506
- </Badge>
507
- ))
508
- ) : (
509
- <Badge variant="outline" className="ml-0.5">
510
- Not configured
511
- </Badge>
512
- )}
513
- <Badge variant="outline" className="ml-auto gap-1 font-normal">
514
- <Lock className="h-3 w-3" />
515
- Read-only
516
- </Badge>
517
- </CardTitle>
518
- <CardDescription className="text-xs">
519
- A Pexels/Unsplash key lets Cortex insert real photos into pages. Pexels is used first;
520
- Cortex automatically falls back to Unsplash if Pexels is rate-limited.
521
- </CardDescription>
522
- </CardHeader>
523
- <CardContent className="space-y-4 pt-0">
524
- <div className="grid gap-4 md:grid-cols-2">
525
- <div className="rounded-md border bg-muted/20 p-3 text-sm">
526
- <p className="font-medium">What this does</p>
527
- <p className="mt-1 text-xs text-muted-foreground">
528
- When you ask Cortex to build or revamp a page, a stock key lets it fetch relevant,
529
- high-quality photos for the hero and sections automatically — instant, zero
530
- image-generation cost, and you can save any photo into your media library with one
531
- click. Without a key Cortex still builds pages, but uses gradient/theme backgrounds
532
- instead of photos, and it will not call the photo tool at all.
533
- </p>
534
- <p className="mt-3 text-[11px] text-muted-foreground">
535
- In your own NextBlock install you add these keys on this page and they are encrypted
536
- into your database. In the shared sandbox they are provided by the host environment
537
- and cannot be changed.
538
- </p>
539
- </div>
540
-
541
- <div className="space-y-2">
542
- <ReadOnlyRow
543
- label="Pexels API key"
544
- value={
545
- hasStoredPexelsKey
546
- ? 'Configured (stored)'
547
- : hasEnvPexelsKey
548
- ? 'Configured (env)'
549
- : 'Not set'
550
- }
551
- detail={maskedStoredPexelsKey}
552
- />
553
- <ReadOnlyRow
554
- label="Unsplash Access key"
555
- value={
556
- hasStoredUnsplashKey
557
- ? 'Configured (stored)'
558
- : hasEnvUnsplashKey
559
- ? 'Configured (env)'
560
- : 'Not set'
561
- }
562
- detail={maskedStoredUnsplashKey}
563
- />
564
- <ReadOnlyRow label="Unsplash app name" value={unsplashAppName || 'Not set'} />
565
- <p className="text-[11px] text-muted-foreground">
566
- {configuredStockProviders.length > 0
567
- ? `Using ${configuredStockProviders.map((provider) => provider.name).join(', ')}.`
568
- : 'No provider configured in this sandbox.'}
569
- </p>
570
- </div>
571
- </div>
572
- </CardContent>
573
- </Card>
574
-
575
- {/* Advanced settings (collapsed by default) - read-only in sandbox */}
576
- <div>
577
- <button
578
- type="button"
579
- onClick={() => setShowAdvanced((open) => !open)}
580
- className="flex w-full items-center gap-2 rounded-md border bg-muted/20 px-3 py-2 text-left text-sm font-medium hover:bg-muted/40"
581
- >
582
- <SlidersHorizontal className="h-4 w-4" />
583
- Advanced settings
584
- <span className="ml-auto text-xs text-muted-foreground">
585
- {agentSettings.maxOutputTokens === null
586
- ? 'Unlimited output'
587
- : `${agentSettings.maxOutputTokens} tokens`}{' '}
588
- · {agentSettings.maxSteps} steps
589
- </span>
590
- {showAdvanced ? (
591
- <ChevronDown className="h-4 w-4" />
592
- ) : (
593
- <ChevronRight className="h-4 w-4" />
594
- )}
595
- </button>
596
-
597
- {showAdvanced && (
598
- <Card className="mt-2">
599
- <CardHeader className="pb-3">
600
- <CardTitle className="flex items-center gap-2 text-base">
601
- Agent tuning
602
- <Badge variant="outline" className="gap-1 font-normal">
603
- <Lock className="h-3 w-3" />
604
- Read-only
605
- </Badge>
606
- </CardTitle>
607
- <CardDescription className="text-xs">
608
- Controls how much room the page-building agent has. These are set by the sandbox host
609
- and shared by every visitor, so they cannot be edited here.
610
- </CardDescription>
611
- </CardHeader>
612
- <CardContent className="space-y-4 pt-0">
613
- <div className="grid gap-4 sm:grid-cols-2">
614
- <div className="space-y-1.5">
615
- <Label htmlFor="max_output_tokens" className="text-xs">
616
- Max output tokens per step
617
- </Label>
618
- <Input
619
- id="max_output_tokens"
620
- type="text"
621
- value={
622
- agentSettings.maxOutputTokens === null
623
- ? 'Unlimited'
624
- : String(agentSettings.maxOutputTokens)
625
- }
626
- readOnly
627
- disabled
628
- />
629
- <p className="text-[11px] text-muted-foreground">
630
- The per-step output budget. Range 256–200,000, or Unlimited. Default 16,000.
631
- </p>
632
- </div>
633
- <div className="space-y-1.5">
634
- <Label htmlFor="max_steps" className="text-xs">
635
- Max tool steps
636
- </Label>
637
- <Input
638
- id="max_steps"
639
- type="text"
640
- value={String(agentSettings.maxSteps)}
641
- readOnly
642
- disabled
643
- />
644
- <p className="text-[11px] text-muted-foreground">
645
- Range 2–100 tool-call rounds. Default 8; each step is one model call.
646
- </p>
647
- </div>
648
- <div className="space-y-1.5">
649
- <Label htmlFor="temperature" className="text-xs">
650
- Temperature
651
- </Label>
652
- <Input
653
- id="temperature"
654
- type="text"
655
- value={String(agentSettings.temperature)}
656
- readOnly
657
- disabled
658
- />
659
- <p className="text-[11px] text-muted-foreground">
660
- Range 0–2. Cortex default 0.1 (low = reliable; most models default higher).
661
- </p>
662
- </div>
663
- <div className="space-y-1.5">
664
- <Label htmlFor="response_timeout_seconds" className="text-xs">
665
- Response timeout (seconds)
666
- </Label>
667
- <Input
668
- id="response_timeout_seconds"
669
- type="text"
670
- value={String(Math.round(agentSettings.responseTimeoutMs / 1000))}
671
- readOnly
672
- disabled
673
- />
674
- <p className="text-[11px] text-muted-foreground">
675
- Range 15–600s. Default 120; aborts only after this long with no activity.
676
- </p>
677
- </div>
678
- </div>
679
- <p className="text-[11px] text-muted-foreground">
680
- Applies to the global page-building agent. Editable on a self-hosted install.
681
- </p>
682
- </CardContent>
683
- </Card>
684
- )}
685
- </div>
686
- </div>
687
- );
688
- }