ai-speedometer 2.2.0 → 2.2.1
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/dist/ai-speedometer +1554 -781
- package/package.json +1 -1
package/dist/ai-speedometer
CHANGED
|
@@ -390,9 +390,11 @@ var init_models_dev = __esm(() => {
|
|
|
390
390
|
// ../core/src/ai-config.ts
|
|
391
391
|
var exports_ai_config = {};
|
|
392
392
|
__export(exports_ai_config, {
|
|
393
|
+
writeThemeToConfig: () => writeThemeToConfig,
|
|
393
394
|
writeAIConfig: () => writeAIConfig,
|
|
394
395
|
removeVerifiedProvider: () => removeVerifiedProvider,
|
|
395
396
|
removeCustomProvider: () => removeCustomProvider,
|
|
397
|
+
readThemeFromConfig: () => readThemeFromConfig,
|
|
396
398
|
readAIConfig: () => readAIConfig,
|
|
397
399
|
getVerifiedProvidersFromConfig: () => getVerifiedProvidersFromConfig,
|
|
398
400
|
getRecentModels: () => getRecentModels,
|
|
@@ -433,6 +435,12 @@ var getAIConfigPaths = () => {
|
|
|
433
435
|
console.warn("Warning: Could not read ai-benchmark-config.json:", error.message);
|
|
434
436
|
return { verifiedProviders: {}, customProviders: [] };
|
|
435
437
|
}
|
|
438
|
+
}, readThemeFromConfig = async () => {
|
|
439
|
+
const config = await readAIConfig();
|
|
440
|
+
return config.theme ?? "tokyonight";
|
|
441
|
+
}, writeThemeToConfig = async (theme) => {
|
|
442
|
+
const config = await readAIConfig();
|
|
443
|
+
await writeAIConfig({ ...config, theme });
|
|
436
444
|
}, writeAIConfig = async (config) => {
|
|
437
445
|
const { configJson } = getAIConfigPaths();
|
|
438
446
|
try {
|
|
@@ -2283,12 +2291,727 @@ var init_AppContext = __esm(() => {
|
|
|
2283
2291
|
AppContext = createContext(null);
|
|
2284
2292
|
});
|
|
2285
2293
|
|
|
2294
|
+
// src/tui/theme/themes.ts
|
|
2295
|
+
function getTheme(name) {
|
|
2296
|
+
return THEMES[name] ?? THEMES[DEFAULT_THEME];
|
|
2297
|
+
}
|
|
2298
|
+
var THEMES, DEFAULT_THEME = "tokyonight", THEME_NAMES;
|
|
2299
|
+
var init_themes = __esm(() => {
|
|
2300
|
+
THEMES = {
|
|
2301
|
+
tokyonight: {
|
|
2302
|
+
background: "#1a1b26",
|
|
2303
|
+
surface: "#1e2030",
|
|
2304
|
+
border: "#292e42",
|
|
2305
|
+
dim: "#565f89",
|
|
2306
|
+
text: "#c0caf5",
|
|
2307
|
+
primary: "#7aa2f7",
|
|
2308
|
+
accent: "#7dcfff",
|
|
2309
|
+
secondary: "#bb9af7",
|
|
2310
|
+
success: "#9ece6a",
|
|
2311
|
+
error: "#f7768e",
|
|
2312
|
+
warning: "#ff9e64"
|
|
2313
|
+
},
|
|
2314
|
+
dracula: {
|
|
2315
|
+
background: "#282a36",
|
|
2316
|
+
surface: "#21222c",
|
|
2317
|
+
border: "#44475a",
|
|
2318
|
+
dim: "#6272a4",
|
|
2319
|
+
text: "#f8f8f2",
|
|
2320
|
+
primary: "#bd93f9",
|
|
2321
|
+
accent: "#8be9fd",
|
|
2322
|
+
secondary: "#ff79c6",
|
|
2323
|
+
success: "#50fa7b",
|
|
2324
|
+
error: "#ff5555",
|
|
2325
|
+
warning: "#f1fa8c"
|
|
2326
|
+
},
|
|
2327
|
+
catppuccin: {
|
|
2328
|
+
background: "#1e1e2e",
|
|
2329
|
+
surface: "#181825",
|
|
2330
|
+
border: "#313244",
|
|
2331
|
+
dim: "#585b70",
|
|
2332
|
+
text: "#cdd6f4",
|
|
2333
|
+
primary: "#89b4fa",
|
|
2334
|
+
accent: "#89dceb",
|
|
2335
|
+
secondary: "#cba6f7",
|
|
2336
|
+
success: "#a6e3a1",
|
|
2337
|
+
error: "#f38ba8",
|
|
2338
|
+
warning: "#fab387"
|
|
2339
|
+
},
|
|
2340
|
+
"catppuccin-frappe": {
|
|
2341
|
+
background: "#303446",
|
|
2342
|
+
surface: "#292c3c",
|
|
2343
|
+
border: "#414559",
|
|
2344
|
+
dim: "#b5bfe2",
|
|
2345
|
+
text: "#c6d0f5",
|
|
2346
|
+
primary: "#8da4e2",
|
|
2347
|
+
accent: "#f4b8e4",
|
|
2348
|
+
secondary: "#ca9ee6",
|
|
2349
|
+
success: "#a6d189",
|
|
2350
|
+
error: "#e78284",
|
|
2351
|
+
warning: "#e5c890"
|
|
2352
|
+
},
|
|
2353
|
+
"catppuccin-macchiato": {
|
|
2354
|
+
background: "#24273a",
|
|
2355
|
+
surface: "#1e2030",
|
|
2356
|
+
border: "#363a4f",
|
|
2357
|
+
dim: "#b8c0e0",
|
|
2358
|
+
text: "#cad3f5",
|
|
2359
|
+
primary: "#8aadf4",
|
|
2360
|
+
accent: "#f5bde6",
|
|
2361
|
+
secondary: "#c6a0f6",
|
|
2362
|
+
success: "#a6da95",
|
|
2363
|
+
error: "#ed8796",
|
|
2364
|
+
warning: "#eed49f"
|
|
2365
|
+
},
|
|
2366
|
+
kanagawa: {
|
|
2367
|
+
background: "#1F1F28",
|
|
2368
|
+
surface: "#2A2A37",
|
|
2369
|
+
border: "#54546D",
|
|
2370
|
+
dim: "#727169",
|
|
2371
|
+
text: "#DCD7BA",
|
|
2372
|
+
primary: "#7E9CD8",
|
|
2373
|
+
accent: "#7FB4CA",
|
|
2374
|
+
secondary: "#957FB8",
|
|
2375
|
+
success: "#98BB6C",
|
|
2376
|
+
error: "#E82424",
|
|
2377
|
+
warning: "#D7A657"
|
|
2378
|
+
},
|
|
2379
|
+
rosepine: {
|
|
2380
|
+
background: "#191724",
|
|
2381
|
+
surface: "#1f1d2e",
|
|
2382
|
+
border: "#403d52",
|
|
2383
|
+
dim: "#6e6a86",
|
|
2384
|
+
text: "#e0def4",
|
|
2385
|
+
primary: "#9ccfd8",
|
|
2386
|
+
accent: "#ebbcba",
|
|
2387
|
+
secondary: "#c4a7e7",
|
|
2388
|
+
success: "#31748f",
|
|
2389
|
+
error: "#eb6f92",
|
|
2390
|
+
warning: "#f6c177"
|
|
2391
|
+
},
|
|
2392
|
+
nord: {
|
|
2393
|
+
background: "#2E3440",
|
|
2394
|
+
surface: "#3B4252",
|
|
2395
|
+
border: "#434C5E",
|
|
2396
|
+
dim: "#8B95A7",
|
|
2397
|
+
text: "#ECEFF4",
|
|
2398
|
+
primary: "#88C0D0",
|
|
2399
|
+
accent: "#8FBCBB",
|
|
2400
|
+
secondary: "#81A1C1",
|
|
2401
|
+
success: "#A3BE8C",
|
|
2402
|
+
error: "#BF616A",
|
|
2403
|
+
warning: "#D08770"
|
|
2404
|
+
},
|
|
2405
|
+
aura: {
|
|
2406
|
+
background: "#0f0f0f",
|
|
2407
|
+
surface: "#15141b",
|
|
2408
|
+
border: "#2d2d2d",
|
|
2409
|
+
dim: "#6d6d6d",
|
|
2410
|
+
text: "#edecee",
|
|
2411
|
+
primary: "#a277ff",
|
|
2412
|
+
accent: "#a277ff",
|
|
2413
|
+
secondary: "#f694ff",
|
|
2414
|
+
success: "#61ffca",
|
|
2415
|
+
error: "#ff6767",
|
|
2416
|
+
warning: "#ffca85"
|
|
2417
|
+
},
|
|
2418
|
+
ayu: {
|
|
2419
|
+
background: "#0B0E14",
|
|
2420
|
+
surface: "#0F131A",
|
|
2421
|
+
border: "#6C7380",
|
|
2422
|
+
dim: "#565B66",
|
|
2423
|
+
text: "#BFBDB6",
|
|
2424
|
+
primary: "#59C2FF",
|
|
2425
|
+
accent: "#E6B450",
|
|
2426
|
+
secondary: "#D2A6FF",
|
|
2427
|
+
success: "#7FD962",
|
|
2428
|
+
error: "#D95757",
|
|
2429
|
+
warning: "#E6B673"
|
|
2430
|
+
},
|
|
2431
|
+
carbonfox: {
|
|
2432
|
+
background: "#161616",
|
|
2433
|
+
surface: "#1a1a1a",
|
|
2434
|
+
border: "#303030",
|
|
2435
|
+
dim: "#7d848f",
|
|
2436
|
+
text: "#f2f4f8",
|
|
2437
|
+
primary: "#33b1ff",
|
|
2438
|
+
accent: "#ff7eb6",
|
|
2439
|
+
secondary: "#78a9ff",
|
|
2440
|
+
success: "#25be6a",
|
|
2441
|
+
error: "#ee5396",
|
|
2442
|
+
warning: "#f1c21b"
|
|
2443
|
+
},
|
|
2444
|
+
cobalt2: {
|
|
2445
|
+
background: "#193549",
|
|
2446
|
+
surface: "#122738",
|
|
2447
|
+
border: "#1f4662",
|
|
2448
|
+
dim: "#adb7c9",
|
|
2449
|
+
text: "#ffffff",
|
|
2450
|
+
primary: "#0088ff",
|
|
2451
|
+
accent: "#2affdf",
|
|
2452
|
+
secondary: "#9a5feb",
|
|
2453
|
+
success: "#9eff80",
|
|
2454
|
+
error: "#ff0088",
|
|
2455
|
+
warning: "#ffc600"
|
|
2456
|
+
},
|
|
2457
|
+
cursor: {
|
|
2458
|
+
background: "#181818",
|
|
2459
|
+
surface: "#141414",
|
|
2460
|
+
border: "#333333",
|
|
2461
|
+
dim: "#666666",
|
|
2462
|
+
text: "#e4e4e4",
|
|
2463
|
+
primary: "#88c0d0",
|
|
2464
|
+
accent: "#88c0d0",
|
|
2465
|
+
secondary: "#81a1c1",
|
|
2466
|
+
success: "#3fa266",
|
|
2467
|
+
error: "#e34671",
|
|
2468
|
+
warning: "#f1b467"
|
|
2469
|
+
},
|
|
2470
|
+
gruvbox: {
|
|
2471
|
+
background: "#282828",
|
|
2472
|
+
surface: "#3c3836",
|
|
2473
|
+
border: "#665c54",
|
|
2474
|
+
dim: "#928374",
|
|
2475
|
+
text: "#ebdbb2",
|
|
2476
|
+
primary: "#83a598",
|
|
2477
|
+
accent: "#8ec07c",
|
|
2478
|
+
secondary: "#d3869b",
|
|
2479
|
+
success: "#b8bb26",
|
|
2480
|
+
error: "#fb4934",
|
|
2481
|
+
warning: "#fe8019"
|
|
2482
|
+
},
|
|
2483
|
+
material: {
|
|
2484
|
+
background: "#263238",
|
|
2485
|
+
surface: "#1e272c",
|
|
2486
|
+
border: "#37474f",
|
|
2487
|
+
dim: "#546e7a",
|
|
2488
|
+
text: "#eeffff",
|
|
2489
|
+
primary: "#82aaff",
|
|
2490
|
+
accent: "#89ddff",
|
|
2491
|
+
secondary: "#c792ea",
|
|
2492
|
+
success: "#c3e88d",
|
|
2493
|
+
error: "#f07178",
|
|
2494
|
+
warning: "#ffcb6b"
|
|
2495
|
+
},
|
|
2496
|
+
matrix: {
|
|
2497
|
+
background: "#0a0e0a",
|
|
2498
|
+
surface: "#0e130d",
|
|
2499
|
+
border: "#1e2a1b",
|
|
2500
|
+
dim: "#8ca391",
|
|
2501
|
+
text: "#62ff94",
|
|
2502
|
+
primary: "#2eff6a",
|
|
2503
|
+
accent: "#c770ff",
|
|
2504
|
+
secondary: "#00efff",
|
|
2505
|
+
success: "#62ff94",
|
|
2506
|
+
error: "#ff4b4b",
|
|
2507
|
+
warning: "#e6ff57"
|
|
2508
|
+
},
|
|
2509
|
+
monokai: {
|
|
2510
|
+
background: "#272822",
|
|
2511
|
+
surface: "#1e1f1c",
|
|
2512
|
+
border: "#3e3d32",
|
|
2513
|
+
dim: "#75715e",
|
|
2514
|
+
text: "#f8f8f2",
|
|
2515
|
+
primary: "#66d9ef",
|
|
2516
|
+
accent: "#a6e22e",
|
|
2517
|
+
secondary: "#ae81ff",
|
|
2518
|
+
success: "#a6e22e",
|
|
2519
|
+
error: "#f92672",
|
|
2520
|
+
warning: "#e6db74"
|
|
2521
|
+
},
|
|
2522
|
+
nightowl: {
|
|
2523
|
+
background: "#011627",
|
|
2524
|
+
surface: "#0b253a",
|
|
2525
|
+
border: "#5f7e97",
|
|
2526
|
+
dim: "#5f7e97",
|
|
2527
|
+
text: "#d6deeb",
|
|
2528
|
+
primary: "#82AAFF",
|
|
2529
|
+
accent: "#c792ea",
|
|
2530
|
+
secondary: "#7fdbca",
|
|
2531
|
+
success: "#c5e478",
|
|
2532
|
+
error: "#EF5350",
|
|
2533
|
+
warning: "#ecc48d"
|
|
2534
|
+
},
|
|
2535
|
+
"one-dark": {
|
|
2536
|
+
background: "#282c34",
|
|
2537
|
+
surface: "#21252b",
|
|
2538
|
+
border: "#393f4a",
|
|
2539
|
+
dim: "#5c6370",
|
|
2540
|
+
text: "#abb2bf",
|
|
2541
|
+
primary: "#61afef",
|
|
2542
|
+
accent: "#56b6c2",
|
|
2543
|
+
secondary: "#c678dd",
|
|
2544
|
+
success: "#98c379",
|
|
2545
|
+
error: "#e06c75",
|
|
2546
|
+
warning: "#e5c07b"
|
|
2547
|
+
},
|
|
2548
|
+
opencode: {
|
|
2549
|
+
background: "#0a0a0a",
|
|
2550
|
+
surface: "#141414",
|
|
2551
|
+
border: "#484848",
|
|
2552
|
+
dim: "#808080",
|
|
2553
|
+
text: "#eeeeee",
|
|
2554
|
+
primary: "#fab283",
|
|
2555
|
+
accent: "#9d7cd8",
|
|
2556
|
+
secondary: "#5c9cf5",
|
|
2557
|
+
success: "#7fd88f",
|
|
2558
|
+
error: "#e06c75",
|
|
2559
|
+
warning: "#f5a742"
|
|
2560
|
+
},
|
|
2561
|
+
"osaka-jade": {
|
|
2562
|
+
background: "#111c18",
|
|
2563
|
+
surface: "#1a2520",
|
|
2564
|
+
border: "#3d4a44",
|
|
2565
|
+
dim: "#53685B",
|
|
2566
|
+
text: "#C1C497",
|
|
2567
|
+
primary: "#2DD5B7",
|
|
2568
|
+
accent: "#549e6a",
|
|
2569
|
+
secondary: "#D2689C",
|
|
2570
|
+
success: "#549e6a",
|
|
2571
|
+
error: "#FF5345",
|
|
2572
|
+
warning: "#E5C736"
|
|
2573
|
+
},
|
|
2574
|
+
palenight: {
|
|
2575
|
+
background: "#292d3e",
|
|
2576
|
+
surface: "#1e2132",
|
|
2577
|
+
border: "#32364a",
|
|
2578
|
+
dim: "#676e95",
|
|
2579
|
+
text: "#a6accd",
|
|
2580
|
+
primary: "#82aaff",
|
|
2581
|
+
accent: "#89ddff",
|
|
2582
|
+
secondary: "#c792ea",
|
|
2583
|
+
success: "#c3e88d",
|
|
2584
|
+
error: "#f07178",
|
|
2585
|
+
warning: "#ffcb6b"
|
|
2586
|
+
},
|
|
2587
|
+
synthwave84: {
|
|
2588
|
+
background: "#262335",
|
|
2589
|
+
surface: "#1e1a29",
|
|
2590
|
+
border: "#495495",
|
|
2591
|
+
dim: "#848bbd",
|
|
2592
|
+
text: "#ffffff",
|
|
2593
|
+
primary: "#36f9f6",
|
|
2594
|
+
accent: "#b084eb",
|
|
2595
|
+
secondary: "#ff7edb",
|
|
2596
|
+
success: "#72f1b8",
|
|
2597
|
+
error: "#fe4450",
|
|
2598
|
+
warning: "#fede5d"
|
|
2599
|
+
},
|
|
2600
|
+
vesper: {
|
|
2601
|
+
background: "#101010",
|
|
2602
|
+
surface: "#181818",
|
|
2603
|
+
border: "#282828",
|
|
2604
|
+
dim: "#A0A0A0",
|
|
2605
|
+
text: "#ffffff",
|
|
2606
|
+
primary: "#FFC799",
|
|
2607
|
+
accent: "#FFC799",
|
|
2608
|
+
secondary: "#99FFE4",
|
|
2609
|
+
success: "#99FFE4",
|
|
2610
|
+
error: "#FF8080",
|
|
2611
|
+
warning: "#FFC799"
|
|
2612
|
+
},
|
|
2613
|
+
zenburn: {
|
|
2614
|
+
background: "#3f3f3f",
|
|
2615
|
+
surface: "#4f4f4f",
|
|
2616
|
+
border: "#5f5f5f",
|
|
2617
|
+
dim: "#9f9f9f",
|
|
2618
|
+
text: "#dcdccc",
|
|
2619
|
+
primary: "#8cd0d3",
|
|
2620
|
+
accent: "#93e0e3",
|
|
2621
|
+
secondary: "#dc8cc3",
|
|
2622
|
+
success: "#7f9f7f",
|
|
2623
|
+
error: "#cc9393",
|
|
2624
|
+
warning: "#f0dfaf"
|
|
2625
|
+
},
|
|
2626
|
+
orng: {
|
|
2627
|
+
background: "#0a0a0a",
|
|
2628
|
+
surface: "#141414",
|
|
2629
|
+
border: "#EC5B2B",
|
|
2630
|
+
dim: "#808080",
|
|
2631
|
+
text: "#eeeeee",
|
|
2632
|
+
primary: "#EC5B2B",
|
|
2633
|
+
accent: "#FFF7F1",
|
|
2634
|
+
secondary: "#EE7948",
|
|
2635
|
+
success: "#6ba1e6",
|
|
2636
|
+
error: "#e06c75",
|
|
2637
|
+
warning: "#EC5B2B"
|
|
2638
|
+
},
|
|
2639
|
+
"lucent-orng": {
|
|
2640
|
+
background: "#000000",
|
|
2641
|
+
surface: "#0a0a0a",
|
|
2642
|
+
border: "#EC5B2B",
|
|
2643
|
+
dim: "#808080",
|
|
2644
|
+
text: "#eeeeee",
|
|
2645
|
+
primary: "#EC5B2B",
|
|
2646
|
+
accent: "#FFF7F1",
|
|
2647
|
+
secondary: "#EE7948",
|
|
2648
|
+
success: "#6ba1e6",
|
|
2649
|
+
error: "#e06c75",
|
|
2650
|
+
warning: "#EC5B2B"
|
|
2651
|
+
},
|
|
2652
|
+
github: {
|
|
2653
|
+
background: "#ffffff",
|
|
2654
|
+
surface: "#f6f8fa",
|
|
2655
|
+
border: "#d0d7de",
|
|
2656
|
+
dim: "#57606a",
|
|
2657
|
+
text: "#24292f",
|
|
2658
|
+
primary: "#0969da",
|
|
2659
|
+
accent: "#1b7c83",
|
|
2660
|
+
secondary: "#8250df",
|
|
2661
|
+
success: "#1a7f37",
|
|
2662
|
+
error: "#cf222e",
|
|
2663
|
+
warning: "#9a6700"
|
|
2664
|
+
},
|
|
2665
|
+
everforest: {
|
|
2666
|
+
background: "#fdf6e3",
|
|
2667
|
+
surface: "#efebd4",
|
|
2668
|
+
border: "#939f91",
|
|
2669
|
+
dim: "#a6b0a0",
|
|
2670
|
+
text: "#5c6a72",
|
|
2671
|
+
primary: "#8da101",
|
|
2672
|
+
accent: "#3a94c5",
|
|
2673
|
+
secondary: "#df69ba",
|
|
2674
|
+
success: "#8da101",
|
|
2675
|
+
error: "#f85552",
|
|
2676
|
+
warning: "#f57d26"
|
|
2677
|
+
},
|
|
2678
|
+
solarized: {
|
|
2679
|
+
background: "#fdf6e3",
|
|
2680
|
+
surface: "#eee8d5",
|
|
2681
|
+
border: "#cdc8b1",
|
|
2682
|
+
dim: "#93a1a1",
|
|
2683
|
+
text: "#657b83",
|
|
2684
|
+
primary: "#268bd2",
|
|
2685
|
+
accent: "#2aa198",
|
|
2686
|
+
secondary: "#6c71c4",
|
|
2687
|
+
success: "#859900",
|
|
2688
|
+
error: "#dc322f",
|
|
2689
|
+
warning: "#b58900"
|
|
2690
|
+
},
|
|
2691
|
+
flexoki: {
|
|
2692
|
+
background: "#FFFCF0",
|
|
2693
|
+
surface: "#F2F0E5",
|
|
2694
|
+
border: "#B7B5AC",
|
|
2695
|
+
dim: "#6F6E69",
|
|
2696
|
+
text: "#100F0F",
|
|
2697
|
+
primary: "#205EA6",
|
|
2698
|
+
accent: "#BC5215",
|
|
2699
|
+
secondary: "#5E409D",
|
|
2700
|
+
success: "#66800B",
|
|
2701
|
+
error: "#AF3029",
|
|
2702
|
+
warning: "#BC5215"
|
|
2703
|
+
},
|
|
2704
|
+
mercury: {
|
|
2705
|
+
background: "#ffffff",
|
|
2706
|
+
surface: "#fbfcfd",
|
|
2707
|
+
border: "#e0e0e8",
|
|
2708
|
+
dim: "#70707d",
|
|
2709
|
+
text: "#363644",
|
|
2710
|
+
primary: "#5266eb",
|
|
2711
|
+
accent: "#8da4f5",
|
|
2712
|
+
secondary: "#465bd1",
|
|
2713
|
+
success: "#036e43",
|
|
2714
|
+
error: "#b0175f",
|
|
2715
|
+
warning: "#a44200"
|
|
2716
|
+
},
|
|
2717
|
+
vercel: {
|
|
2718
|
+
background: "#FFFFFF",
|
|
2719
|
+
surface: "#FAFAFA",
|
|
2720
|
+
border: "#EAEAEA",
|
|
2721
|
+
dim: "#666666",
|
|
2722
|
+
text: "#171717",
|
|
2723
|
+
primary: "#0070F3",
|
|
2724
|
+
accent: "#8E4EC6",
|
|
2725
|
+
secondary: "#0062D1",
|
|
2726
|
+
success: "#388E3C",
|
|
2727
|
+
error: "#DC3545",
|
|
2728
|
+
warning: "#FF9500"
|
|
2729
|
+
}
|
|
2730
|
+
};
|
|
2731
|
+
THEME_NAMES = Object.keys(THEMES);
|
|
2732
|
+
});
|
|
2733
|
+
|
|
2734
|
+
// src/tui/theme/ThemeContext.tsx
|
|
2735
|
+
import { createContext as createContext2, useContext as useContext2, useState, useCallback } from "react";
|
|
2736
|
+
import { jsxDEV as jsxDEV2 } from "@opentui/react/jsx-dev-runtime";
|
|
2737
|
+
function ThemeProvider({ name, children }) {
|
|
2738
|
+
const [themeName, setThemeName] = useState(name);
|
|
2739
|
+
const setTheme = useCallback(async (next) => {
|
|
2740
|
+
setThemeName(next);
|
|
2741
|
+
try {
|
|
2742
|
+
const { writeThemeToConfig: writeThemeToConfig2 } = await Promise.resolve().then(() => (init_ai_config(), exports_ai_config));
|
|
2743
|
+
await writeThemeToConfig2(next);
|
|
2744
|
+
} catch {}
|
|
2745
|
+
}, []);
|
|
2746
|
+
return /* @__PURE__ */ jsxDEV2(ThemeContext.Provider, {
|
|
2747
|
+
value: { theme: getTheme(themeName), themeName, setTheme },
|
|
2748
|
+
children
|
|
2749
|
+
}, undefined, false, undefined, this);
|
|
2750
|
+
}
|
|
2751
|
+
function useTheme() {
|
|
2752
|
+
return useContext2(ThemeContext).theme;
|
|
2753
|
+
}
|
|
2754
|
+
function useThemeCtx() {
|
|
2755
|
+
return useContext2(ThemeContext);
|
|
2756
|
+
}
|
|
2757
|
+
var ThemeContext;
|
|
2758
|
+
var init_ThemeContext = __esm(() => {
|
|
2759
|
+
init_themes();
|
|
2760
|
+
ThemeContext = createContext2({
|
|
2761
|
+
theme: getTheme(DEFAULT_THEME),
|
|
2762
|
+
themeName: DEFAULT_THEME,
|
|
2763
|
+
setTheme: () => {}
|
|
2764
|
+
});
|
|
2765
|
+
});
|
|
2766
|
+
|
|
2767
|
+
// src/tui/context/ModalContext.tsx
|
|
2768
|
+
import { createContext as createContext3, useContext as useContext3, useState as useState2 } from "react";
|
|
2769
|
+
import { jsxDEV as jsxDEV3 } from "@opentui/react/jsx-dev-runtime";
|
|
2770
|
+
function ModalProvider({ children }) {
|
|
2771
|
+
const [modalOpen, setModalOpen] = useState2(false);
|
|
2772
|
+
return /* @__PURE__ */ jsxDEV3(ModalContext.Provider, {
|
|
2773
|
+
value: { modalOpen, setModalOpen },
|
|
2774
|
+
children
|
|
2775
|
+
}, undefined, false, undefined, this);
|
|
2776
|
+
}
|
|
2777
|
+
function useModal() {
|
|
2778
|
+
return useContext3(ModalContext);
|
|
2779
|
+
}
|
|
2780
|
+
var ModalContext;
|
|
2781
|
+
var init_ModalContext = __esm(() => {
|
|
2782
|
+
ModalContext = createContext3({ modalOpen: false, setModalOpen: () => {} });
|
|
2783
|
+
});
|
|
2784
|
+
|
|
2785
|
+
// src/tui/components/ThemePicker.tsx
|
|
2786
|
+
import { useState as useState3, useEffect as useEffect2, useRef } from "react";
|
|
2787
|
+
import { useKeyboard } from "@opentui/react";
|
|
2788
|
+
import { jsxDEV as jsxDEV4 } from "@opentui/react/jsx-dev-runtime";
|
|
2789
|
+
function ThemePicker({ onClose }) {
|
|
2790
|
+
const { theme, themeName, setTheme } = useThemeCtx();
|
|
2791
|
+
const [query, setQuery] = useState3("");
|
|
2792
|
+
const [cursor, setCursor] = useState3(0);
|
|
2793
|
+
const scrollRef = useRef(null);
|
|
2794
|
+
const filtered = THEME_NAMES.filter((n) => n.includes(query.toLowerCase()));
|
|
2795
|
+
useEffect2(() => {
|
|
2796
|
+
setCursor(0);
|
|
2797
|
+
const name = filtered[0];
|
|
2798
|
+
if (name)
|
|
2799
|
+
setTheme(name);
|
|
2800
|
+
}, [query]);
|
|
2801
|
+
useEffect2(() => {
|
|
2802
|
+
const sb = scrollRef.current;
|
|
2803
|
+
if (!sb)
|
|
2804
|
+
return;
|
|
2805
|
+
if (cursor < sb.scrollTop)
|
|
2806
|
+
sb.scrollTo(cursor);
|
|
2807
|
+
else if (cursor >= sb.scrollTop + LIST_H)
|
|
2808
|
+
sb.scrollTo(cursor - LIST_H + 1);
|
|
2809
|
+
}, [cursor]);
|
|
2810
|
+
useEffect2(() => {
|
|
2811
|
+
const idx = filtered.indexOf(themeName);
|
|
2812
|
+
if (idx >= 0)
|
|
2813
|
+
setCursor(idx);
|
|
2814
|
+
}, []);
|
|
2815
|
+
useKeyboard((key) => {
|
|
2816
|
+
if (key.name === "escape" || !key.ctrl && key.sequence === "T") {
|
|
2817
|
+
onClose();
|
|
2818
|
+
return;
|
|
2819
|
+
}
|
|
2820
|
+
if (key.name === "up") {
|
|
2821
|
+
const n = Math.max(0, cursor - 1);
|
|
2822
|
+
setCursor(n);
|
|
2823
|
+
const name = filtered[n];
|
|
2824
|
+
if (name)
|
|
2825
|
+
setTheme(name);
|
|
2826
|
+
return;
|
|
2827
|
+
}
|
|
2828
|
+
if (key.name === "down") {
|
|
2829
|
+
const n = Math.min(filtered.length - 1, cursor + 1);
|
|
2830
|
+
setCursor(n);
|
|
2831
|
+
const name = filtered[n];
|
|
2832
|
+
if (name)
|
|
2833
|
+
setTheme(name);
|
|
2834
|
+
return;
|
|
2835
|
+
}
|
|
2836
|
+
if (key.name === "return" || key.name === "enter") {
|
|
2837
|
+
onClose();
|
|
2838
|
+
return;
|
|
2839
|
+
}
|
|
2840
|
+
if (key.name === "backspace" || key.name === "delete") {
|
|
2841
|
+
setQuery((q) => q.slice(0, -1));
|
|
2842
|
+
return;
|
|
2843
|
+
}
|
|
2844
|
+
if (key.sequence && key.sequence.length === 1 && !key.ctrl && !key.meta && key.sequence >= " ") {
|
|
2845
|
+
setQuery((q) => q + key.sequence);
|
|
2846
|
+
}
|
|
2847
|
+
});
|
|
2848
|
+
const W = 32;
|
|
2849
|
+
const LIST_H = 9;
|
|
2850
|
+
return /* @__PURE__ */ jsxDEV4("box", {
|
|
2851
|
+
position: "absolute",
|
|
2852
|
+
top: 3,
|
|
2853
|
+
right: 3,
|
|
2854
|
+
width: W,
|
|
2855
|
+
flexDirection: "column",
|
|
2856
|
+
border: true,
|
|
2857
|
+
borderStyle: "rounded",
|
|
2858
|
+
borderColor: theme.primary,
|
|
2859
|
+
backgroundColor: theme.surface,
|
|
2860
|
+
zIndex: 100,
|
|
2861
|
+
children: [
|
|
2862
|
+
/* @__PURE__ */ jsxDEV4("box", {
|
|
2863
|
+
height: 1,
|
|
2864
|
+
flexDirection: "row",
|
|
2865
|
+
paddingLeft: 2,
|
|
2866
|
+
paddingRight: 2,
|
|
2867
|
+
paddingTop: 1,
|
|
2868
|
+
children: [
|
|
2869
|
+
/* @__PURE__ */ jsxDEV4("text", {
|
|
2870
|
+
fg: theme.primary,
|
|
2871
|
+
children: "\uDB80\uDFD8 "
|
|
2872
|
+
}, undefined, false, undefined, this),
|
|
2873
|
+
/* @__PURE__ */ jsxDEV4("text", {
|
|
2874
|
+
fg: theme.text,
|
|
2875
|
+
children: "Themes"
|
|
2876
|
+
}, undefined, false, undefined, this),
|
|
2877
|
+
/* @__PURE__ */ jsxDEV4("text", {
|
|
2878
|
+
fg: theme.dim,
|
|
2879
|
+
children: [
|
|
2880
|
+
" ",
|
|
2881
|
+
themeName
|
|
2882
|
+
]
|
|
2883
|
+
}, undefined, true, undefined, this)
|
|
2884
|
+
]
|
|
2885
|
+
}, undefined, true, undefined, this),
|
|
2886
|
+
/* @__PURE__ */ jsxDEV4("box", {
|
|
2887
|
+
height: 1,
|
|
2888
|
+
backgroundColor: theme.border
|
|
2889
|
+
}, undefined, false, undefined, this),
|
|
2890
|
+
/* @__PURE__ */ jsxDEV4("box", {
|
|
2891
|
+
height: 1,
|
|
2892
|
+
flexDirection: "row",
|
|
2893
|
+
paddingLeft: 2,
|
|
2894
|
+
paddingRight: 2,
|
|
2895
|
+
paddingTop: 1,
|
|
2896
|
+
paddingBottom: 1,
|
|
2897
|
+
children: [
|
|
2898
|
+
/* @__PURE__ */ jsxDEV4("text", {
|
|
2899
|
+
fg: theme.dim,
|
|
2900
|
+
children: " "
|
|
2901
|
+
}, undefined, false, undefined, this),
|
|
2902
|
+
/* @__PURE__ */ jsxDEV4("text", {
|
|
2903
|
+
fg: query ? theme.text : theme.dim,
|
|
2904
|
+
children: query || "search..."
|
|
2905
|
+
}, undefined, false, undefined, this),
|
|
2906
|
+
query.length > 0 && /* @__PURE__ */ jsxDEV4("text", {
|
|
2907
|
+
fg: theme.accent,
|
|
2908
|
+
children: "_"
|
|
2909
|
+
}, undefined, false, undefined, this)
|
|
2910
|
+
]
|
|
2911
|
+
}, undefined, true, undefined, this),
|
|
2912
|
+
/* @__PURE__ */ jsxDEV4("box", {
|
|
2913
|
+
height: 1,
|
|
2914
|
+
backgroundColor: theme.border
|
|
2915
|
+
}, undefined, false, undefined, this),
|
|
2916
|
+
/* @__PURE__ */ jsxDEV4("scrollbox", {
|
|
2917
|
+
ref: scrollRef,
|
|
2918
|
+
height: LIST_H,
|
|
2919
|
+
focused: false,
|
|
2920
|
+
children: filtered.length === 0 ? /* @__PURE__ */ jsxDEV4("box", {
|
|
2921
|
+
height: 1,
|
|
2922
|
+
paddingLeft: 3,
|
|
2923
|
+
children: /* @__PURE__ */ jsxDEV4("text", {
|
|
2924
|
+
fg: theme.dim,
|
|
2925
|
+
children: "no match"
|
|
2926
|
+
}, undefined, false, undefined, this)
|
|
2927
|
+
}, undefined, false, undefined, this) : filtered.map((name, i) => {
|
|
2928
|
+
const isActive = i === cursor;
|
|
2929
|
+
const isCurrent = name === themeName;
|
|
2930
|
+
const isDark = !LIGHT_THEMES.has(name);
|
|
2931
|
+
const tag = isDark ? "\u25C6" : "\u25C7";
|
|
2932
|
+
const tagColor = isDark ? theme.secondary : theme.accent;
|
|
2933
|
+
return /* @__PURE__ */ jsxDEV4("box", {
|
|
2934
|
+
height: 1,
|
|
2935
|
+
flexDirection: "row",
|
|
2936
|
+
backgroundColor: isActive ? theme.border : "transparent",
|
|
2937
|
+
paddingLeft: 2,
|
|
2938
|
+
paddingRight: 2,
|
|
2939
|
+
children: [
|
|
2940
|
+
/* @__PURE__ */ jsxDEV4("text", {
|
|
2941
|
+
fg: isCurrent ? theme.success : theme.dim,
|
|
2942
|
+
width: 2,
|
|
2943
|
+
children: isCurrent ? "\u2713" : " "
|
|
2944
|
+
}, undefined, false, undefined, this),
|
|
2945
|
+
/* @__PURE__ */ jsxDEV4("text", {
|
|
2946
|
+
fg: tagColor,
|
|
2947
|
+
width: 2,
|
|
2948
|
+
children: tag
|
|
2949
|
+
}, undefined, false, undefined, this),
|
|
2950
|
+
/* @__PURE__ */ jsxDEV4("text", {
|
|
2951
|
+
fg: isActive ? theme.text : theme.dim,
|
|
2952
|
+
children: [
|
|
2953
|
+
" ",
|
|
2954
|
+
name
|
|
2955
|
+
]
|
|
2956
|
+
}, undefined, true, undefined, this),
|
|
2957
|
+
isActive && /* @__PURE__ */ jsxDEV4("text", {
|
|
2958
|
+
fg: theme.primary,
|
|
2959
|
+
children: " \u203A"
|
|
2960
|
+
}, undefined, false, undefined, this)
|
|
2961
|
+
]
|
|
2962
|
+
}, name, true, undefined, this);
|
|
2963
|
+
})
|
|
2964
|
+
}, undefined, false, undefined, this),
|
|
2965
|
+
/* @__PURE__ */ jsxDEV4("box", {
|
|
2966
|
+
height: 1,
|
|
2967
|
+
backgroundColor: theme.border
|
|
2968
|
+
}, undefined, false, undefined, this),
|
|
2969
|
+
/* @__PURE__ */ jsxDEV4("box", {
|
|
2970
|
+
height: 1,
|
|
2971
|
+
flexDirection: "row",
|
|
2972
|
+
paddingLeft: 2,
|
|
2973
|
+
paddingRight: 2,
|
|
2974
|
+
paddingTop: 1,
|
|
2975
|
+
paddingBottom: 1,
|
|
2976
|
+
children: [
|
|
2977
|
+
/* @__PURE__ */ jsxDEV4("text", {
|
|
2978
|
+
fg: theme.secondary,
|
|
2979
|
+
children: "\u25C6"
|
|
2980
|
+
}, undefined, false, undefined, this),
|
|
2981
|
+
/* @__PURE__ */ jsxDEV4("text", {
|
|
2982
|
+
fg: theme.dim,
|
|
2983
|
+
children: " dark "
|
|
2984
|
+
}, undefined, false, undefined, this),
|
|
2985
|
+
/* @__PURE__ */ jsxDEV4("text", {
|
|
2986
|
+
fg: theme.accent,
|
|
2987
|
+
children: "\u25C7"
|
|
2988
|
+
}, undefined, false, undefined, this),
|
|
2989
|
+
/* @__PURE__ */ jsxDEV4("text", {
|
|
2990
|
+
fg: theme.dim,
|
|
2991
|
+
children: " light "
|
|
2992
|
+
}, undefined, false, undefined, this),
|
|
2993
|
+
/* @__PURE__ */ jsxDEV4("text", {
|
|
2994
|
+
fg: theme.dim,
|
|
2995
|
+
children: " [\u2191\u2193] [Esc]"
|
|
2996
|
+
}, undefined, false, undefined, this)
|
|
2997
|
+
]
|
|
2998
|
+
}, undefined, true, undefined, this)
|
|
2999
|
+
]
|
|
3000
|
+
}, undefined, true, undefined, this);
|
|
3001
|
+
}
|
|
3002
|
+
var LIGHT_THEMES;
|
|
3003
|
+
var init_ThemePicker = __esm(() => {
|
|
3004
|
+
init_ThemeContext();
|
|
3005
|
+
init_themes();
|
|
3006
|
+
LIGHT_THEMES = new Set(["github", "everforest", "solarized", "flexoki", "mercury", "vercel"]);
|
|
3007
|
+
});
|
|
3008
|
+
|
|
2286
3009
|
// package.json
|
|
2287
3010
|
var package_default;
|
|
2288
3011
|
var init_package = __esm(() => {
|
|
2289
3012
|
package_default = {
|
|
2290
3013
|
name: "ai-speedometer",
|
|
2291
|
-
version: "2.2.
|
|
3014
|
+
version: "2.2.1",
|
|
2292
3015
|
description: "A comprehensive CLI tool for benchmarking AI models across multiple providers with parallel execution and professional metrics",
|
|
2293
3016
|
bin: {
|
|
2294
3017
|
"ai-speedometer": "dist/ai-speedometer",
|
|
@@ -2349,27 +3072,28 @@ var init_package = __esm(() => {
|
|
|
2349
3072
|
});
|
|
2350
3073
|
|
|
2351
3074
|
// src/tui/components/Header.tsx
|
|
2352
|
-
import { jsxDEV as
|
|
3075
|
+
import { jsxDEV as jsxDEV5 } from "@opentui/react/jsx-dev-runtime";
|
|
2353
3076
|
function Header({ screen }) {
|
|
3077
|
+
const theme = useTheme();
|
|
2354
3078
|
if (screen === "main-menu")
|
|
2355
3079
|
return null;
|
|
2356
|
-
return /* @__PURE__ */
|
|
3080
|
+
return /* @__PURE__ */ jsxDEV5("box", {
|
|
2357
3081
|
height: 1,
|
|
2358
3082
|
flexDirection: "row",
|
|
2359
3083
|
alignItems: "center",
|
|
2360
3084
|
paddingLeft: 2,
|
|
2361
|
-
backgroundColor:
|
|
3085
|
+
backgroundColor: theme.background,
|
|
2362
3086
|
children: [
|
|
2363
|
-
/* @__PURE__ */
|
|
2364
|
-
fg:
|
|
3087
|
+
/* @__PURE__ */ jsxDEV5("text", {
|
|
3088
|
+
fg: theme.primary,
|
|
2365
3089
|
children: "AI-SPEEDOMETER"
|
|
2366
3090
|
}, undefined, false, undefined, this),
|
|
2367
|
-
/* @__PURE__ */
|
|
2368
|
-
fg:
|
|
3091
|
+
/* @__PURE__ */ jsxDEV5("text", {
|
|
3092
|
+
fg: theme.border,
|
|
2369
3093
|
children: " \xB7 "
|
|
2370
3094
|
}, undefined, false, undefined, this),
|
|
2371
|
-
/* @__PURE__ */
|
|
2372
|
-
fg:
|
|
3095
|
+
/* @__PURE__ */ jsxDEV5("text", {
|
|
3096
|
+
fg: theme.dim,
|
|
2373
3097
|
children: [
|
|
2374
3098
|
"v",
|
|
2375
3099
|
package_default.version
|
|
@@ -2380,37 +3104,60 @@ function Header({ screen }) {
|
|
|
2380
3104
|
}
|
|
2381
3105
|
var init_Header = __esm(() => {
|
|
2382
3106
|
init_package();
|
|
3107
|
+
init_ThemeContext();
|
|
2383
3108
|
});
|
|
2384
3109
|
|
|
2385
3110
|
// src/tui/components/Footer.tsx
|
|
2386
|
-
import { jsxDEV as
|
|
3111
|
+
import { jsxDEV as jsxDEV6 } from "@opentui/react/jsx-dev-runtime";
|
|
2387
3112
|
function Footer({ hints }) {
|
|
3113
|
+
const theme = useTheme();
|
|
2388
3114
|
const joined = hints.join(" \xB7 ");
|
|
2389
|
-
return /* @__PURE__ */
|
|
3115
|
+
return /* @__PURE__ */ jsxDEV6("box", {
|
|
2390
3116
|
height: 1,
|
|
2391
3117
|
flexDirection: "row",
|
|
2392
3118
|
alignItems: "center",
|
|
2393
3119
|
paddingLeft: 1,
|
|
2394
3120
|
paddingRight: 1,
|
|
2395
|
-
backgroundColor:
|
|
2396
|
-
children: /* @__PURE__ */
|
|
2397
|
-
fg:
|
|
3121
|
+
backgroundColor: theme.background,
|
|
3122
|
+
children: /* @__PURE__ */ jsxDEV6("text", {
|
|
3123
|
+
fg: theme.dim,
|
|
2398
3124
|
children: joined
|
|
2399
3125
|
}, undefined, false, undefined, this)
|
|
2400
3126
|
}, undefined, false, undefined, this);
|
|
2401
3127
|
}
|
|
2402
|
-
var init_Footer = () => {
|
|
3128
|
+
var init_Footer = __esm(() => {
|
|
3129
|
+
init_ThemeContext();
|
|
3130
|
+
});
|
|
3131
|
+
|
|
3132
|
+
// src/tui/hooks/useAppKeyboard.ts
|
|
3133
|
+
import { useKeyboard as useKeyboard2 } from "@opentui/react";
|
|
3134
|
+
function useAppKeyboard(handler) {
|
|
3135
|
+
const { modalOpen } = useModal();
|
|
3136
|
+
useKeyboard2((key) => {
|
|
3137
|
+
if (modalOpen)
|
|
3138
|
+
return;
|
|
3139
|
+
handler(key);
|
|
3140
|
+
});
|
|
3141
|
+
}
|
|
3142
|
+
var init_useAppKeyboard = __esm(() => {
|
|
3143
|
+
init_ModalContext();
|
|
3144
|
+
});
|
|
2403
3145
|
|
|
2404
3146
|
// src/tui/screens/MainMenuScreen.tsx
|
|
2405
|
-
import { useState } from "react";
|
|
3147
|
+
import { useState as useState4 } from "react";
|
|
2406
3148
|
import { useRenderer } from "@opentui/react";
|
|
2407
|
-
import {
|
|
2408
|
-
import { jsxDEV as jsxDEV4 } from "@opentui/react/jsx-dev-runtime";
|
|
3149
|
+
import { jsxDEV as jsxDEV7 } from "@opentui/react/jsx-dev-runtime";
|
|
2409
3150
|
function MainMenuScreen() {
|
|
2410
3151
|
const navigate = useNavigate();
|
|
2411
3152
|
const renderer = useRenderer();
|
|
2412
|
-
const
|
|
2413
|
-
|
|
3153
|
+
const theme = useTheme();
|
|
3154
|
+
const [cursor, setCursor] = useState4(0);
|
|
3155
|
+
const ITEMS = [
|
|
3156
|
+
{ label: "\u26A1 Run Benchmark", desc: "test model speed & throughput", color: theme.accent },
|
|
3157
|
+
{ label: "\u2699 Manage Models", desc: "add providers and configure", color: theme.secondary },
|
|
3158
|
+
{ label: "\u2715 Exit", desc: "quit the application", color: theme.error }
|
|
3159
|
+
];
|
|
3160
|
+
useAppKeyboard((key) => {
|
|
2414
3161
|
if (key.name === "up") {
|
|
2415
3162
|
setCursor((i) => (i - 1 + ITEMS.length) % ITEMS.length);
|
|
2416
3163
|
} else if (key.name === "down") {
|
|
@@ -2424,24 +3171,24 @@ function MainMenuScreen() {
|
|
|
2424
3171
|
renderer.destroy();
|
|
2425
3172
|
}
|
|
2426
3173
|
});
|
|
2427
|
-
return /* @__PURE__ */
|
|
3174
|
+
return /* @__PURE__ */ jsxDEV7("box", {
|
|
2428
3175
|
flexDirection: "column",
|
|
2429
3176
|
flexGrow: 1,
|
|
2430
3177
|
alignItems: "center",
|
|
2431
3178
|
justifyContent: "center",
|
|
2432
3179
|
children: [
|
|
2433
|
-
/* @__PURE__ */
|
|
3180
|
+
/* @__PURE__ */ jsxDEV7("box", {
|
|
2434
3181
|
flexDirection: "column",
|
|
2435
3182
|
alignItems: "center",
|
|
2436
3183
|
marginBottom: 2,
|
|
2437
3184
|
children: [
|
|
2438
|
-
/* @__PURE__ */
|
|
3185
|
+
/* @__PURE__ */ jsxDEV7("ascii-font", {
|
|
2439
3186
|
text: "AI-SPEEDOMETER",
|
|
2440
3187
|
font: "tiny",
|
|
2441
|
-
color:
|
|
3188
|
+
color: theme.primary
|
|
2442
3189
|
}, undefined, false, undefined, this),
|
|
2443
|
-
/* @__PURE__ */
|
|
2444
|
-
fg:
|
|
3190
|
+
/* @__PURE__ */ jsxDEV7("text", {
|
|
3191
|
+
fg: theme.dim,
|
|
2445
3192
|
children: [
|
|
2446
3193
|
"v",
|
|
2447
3194
|
package_default.version
|
|
@@ -2449,39 +3196,39 @@ function MainMenuScreen() {
|
|
|
2449
3196
|
}, undefined, true, undefined, this)
|
|
2450
3197
|
]
|
|
2451
3198
|
}, undefined, true, undefined, this),
|
|
2452
|
-
/* @__PURE__ */
|
|
3199
|
+
/* @__PURE__ */ jsxDEV7("box", {
|
|
2453
3200
|
flexDirection: "column",
|
|
2454
3201
|
border: true,
|
|
2455
3202
|
borderStyle: "rounded",
|
|
2456
|
-
borderColor:
|
|
2457
|
-
backgroundColor:
|
|
3203
|
+
borderColor: theme.border,
|
|
3204
|
+
backgroundColor: theme.background,
|
|
2458
3205
|
width: 46,
|
|
2459
3206
|
children: ITEMS.map((item, i) => {
|
|
2460
3207
|
const active = i === cursor;
|
|
2461
|
-
return /* @__PURE__ */
|
|
3208
|
+
return /* @__PURE__ */ jsxDEV7("box", {
|
|
2462
3209
|
flexDirection: "row",
|
|
2463
3210
|
alignItems: "center",
|
|
2464
|
-
backgroundColor: active ?
|
|
3211
|
+
backgroundColor: active ? theme.border : "transparent",
|
|
2465
3212
|
paddingLeft: 2,
|
|
2466
3213
|
paddingRight: 2,
|
|
2467
3214
|
paddingTop: 1,
|
|
2468
3215
|
paddingBottom: 1,
|
|
2469
3216
|
children: [
|
|
2470
|
-
/* @__PURE__ */
|
|
3217
|
+
/* @__PURE__ */ jsxDEV7("box", {
|
|
2471
3218
|
flexDirection: "column",
|
|
2472
3219
|
flexGrow: 1,
|
|
2473
3220
|
children: [
|
|
2474
|
-
/* @__PURE__ */
|
|
2475
|
-
fg: active ? item.color :
|
|
3221
|
+
/* @__PURE__ */ jsxDEV7("text", {
|
|
3222
|
+
fg: active ? item.color : theme.dim,
|
|
2476
3223
|
children: item.label
|
|
2477
3224
|
}, undefined, false, undefined, this),
|
|
2478
|
-
/* @__PURE__ */
|
|
2479
|
-
fg: active ?
|
|
3225
|
+
/* @__PURE__ */ jsxDEV7("text", {
|
|
3226
|
+
fg: active ? theme.dim : theme.border,
|
|
2480
3227
|
children: item.desc
|
|
2481
3228
|
}, undefined, false, undefined, this)
|
|
2482
3229
|
]
|
|
2483
3230
|
}, undefined, true, undefined, this),
|
|
2484
|
-
active && /* @__PURE__ */
|
|
3231
|
+
active && /* @__PURE__ */ jsxDEV7("text", {
|
|
2485
3232
|
fg: item.color,
|
|
2486
3233
|
children: "\u203A"
|
|
2487
3234
|
}, undefined, false, undefined, this)
|
|
@@ -2492,24 +3239,20 @@ function MainMenuScreen() {
|
|
|
2492
3239
|
]
|
|
2493
3240
|
}, undefined, true, undefined, this);
|
|
2494
3241
|
}
|
|
2495
|
-
var ITEMS;
|
|
2496
3242
|
var init_MainMenuScreen = __esm(() => {
|
|
3243
|
+
init_useAppKeyboard();
|
|
2497
3244
|
init_AppContext();
|
|
3245
|
+
init_ThemeContext();
|
|
2498
3246
|
init_package();
|
|
2499
|
-
ITEMS = [
|
|
2500
|
-
{ label: "\u26A1 Run Benchmark", desc: "test model speed & throughput", color: "#7dcfff" },
|
|
2501
|
-
{ label: "\u2699 Manage Models", desc: "add providers and configure", color: "#bb9af7" },
|
|
2502
|
-
{ label: "\u2715 Exit", desc: "quit the application", color: "#f7768e" }
|
|
2503
|
-
];
|
|
2504
3247
|
});
|
|
2505
3248
|
|
|
2506
3249
|
// src/tui/components/MenuList.tsx
|
|
2507
|
-
import { useState as
|
|
2508
|
-
import {
|
|
2509
|
-
import { jsxDEV as jsxDEV5 } from "@opentui/react/jsx-dev-runtime";
|
|
3250
|
+
import { useState as useState5 } from "react";
|
|
3251
|
+
import { jsxDEV as jsxDEV8 } from "@opentui/react/jsx-dev-runtime";
|
|
2510
3252
|
function MenuList({ items, selectedIndex: initialIndex = 0, onSelect, onNavigate }) {
|
|
2511
|
-
const
|
|
2512
|
-
|
|
3253
|
+
const theme = useTheme();
|
|
3254
|
+
const [cursor, setCursor] = useState5(initialIndex);
|
|
3255
|
+
useAppKeyboard((key) => {
|
|
2513
3256
|
if (key.name === "up") {
|
|
2514
3257
|
const next = (cursor - 1 + items.length) % items.length;
|
|
2515
3258
|
setCursor(next);
|
|
@@ -2522,33 +3265,33 @@ function MenuList({ items, selectedIndex: initialIndex = 0, onSelect, onNavigate
|
|
|
2522
3265
|
onSelect(cursor);
|
|
2523
3266
|
}
|
|
2524
3267
|
});
|
|
2525
|
-
return /* @__PURE__ */
|
|
3268
|
+
return /* @__PURE__ */ jsxDEV8("box", {
|
|
2526
3269
|
flexDirection: "column",
|
|
2527
3270
|
children: items.map((item, i) => {
|
|
2528
3271
|
const isSelected = i === cursor;
|
|
2529
|
-
return /* @__PURE__ */
|
|
3272
|
+
return /* @__PURE__ */ jsxDEV8("box", {
|
|
2530
3273
|
flexDirection: "row",
|
|
2531
3274
|
alignItems: "center",
|
|
2532
|
-
backgroundColor: isSelected ?
|
|
3275
|
+
backgroundColor: isSelected ? theme.border : "transparent",
|
|
2533
3276
|
paddingLeft: 1,
|
|
2534
3277
|
paddingRight: 1,
|
|
2535
3278
|
children: [
|
|
2536
|
-
/* @__PURE__ */
|
|
3279
|
+
/* @__PURE__ */ jsxDEV8("box", {
|
|
2537
3280
|
flexDirection: "column",
|
|
2538
3281
|
flexGrow: 1,
|
|
2539
3282
|
children: [
|
|
2540
|
-
/* @__PURE__ */
|
|
2541
|
-
fg: isSelected ?
|
|
3283
|
+
/* @__PURE__ */ jsxDEV8("text", {
|
|
3284
|
+
fg: isSelected ? theme.text : theme.dim,
|
|
2542
3285
|
children: item.label
|
|
2543
3286
|
}, undefined, false, undefined, this),
|
|
2544
|
-
item.description ? /* @__PURE__ */
|
|
2545
|
-
fg: isSelected ?
|
|
3287
|
+
item.description ? /* @__PURE__ */ jsxDEV8("text", {
|
|
3288
|
+
fg: isSelected ? theme.dim : theme.border,
|
|
2546
3289
|
children: item.description
|
|
2547
3290
|
}, undefined, false, undefined, this) : null
|
|
2548
3291
|
]
|
|
2549
3292
|
}, undefined, true, undefined, this),
|
|
2550
|
-
isSelected && /* @__PURE__ */
|
|
2551
|
-
fg:
|
|
3293
|
+
isSelected && /* @__PURE__ */ jsxDEV8("text", {
|
|
3294
|
+
fg: theme.primary,
|
|
2552
3295
|
children: "\u203A"
|
|
2553
3296
|
}, undefined, false, undefined, this)
|
|
2554
3297
|
]
|
|
@@ -2556,14 +3299,17 @@ function MenuList({ items, selectedIndex: initialIndex = 0, onSelect, onNavigate
|
|
|
2556
3299
|
})
|
|
2557
3300
|
}, undefined, false, undefined, this);
|
|
2558
3301
|
}
|
|
2559
|
-
var init_MenuList = () => {
|
|
3302
|
+
var init_MenuList = __esm(() => {
|
|
3303
|
+
init_useAppKeyboard();
|
|
3304
|
+
init_ThemeContext();
|
|
3305
|
+
});
|
|
2560
3306
|
|
|
2561
3307
|
// src/tui/screens/ModelMenuScreen.tsx
|
|
2562
|
-
import {
|
|
2563
|
-
import { jsxDEV as jsxDEV6 } from "@opentui/react/jsx-dev-runtime";
|
|
3308
|
+
import { jsxDEV as jsxDEV9 } from "@opentui/react/jsx-dev-runtime";
|
|
2564
3309
|
function ModelMenuScreen() {
|
|
2565
3310
|
const navigate = useNavigate();
|
|
2566
|
-
|
|
3311
|
+
const theme = useTheme();
|
|
3312
|
+
useAppKeyboard((key) => {
|
|
2567
3313
|
if (key.name === "escape" || key.name === "q") {
|
|
2568
3314
|
navigate("main-menu");
|
|
2569
3315
|
}
|
|
@@ -2580,30 +3326,32 @@ function ModelMenuScreen() {
|
|
|
2580
3326
|
else if (index === 4)
|
|
2581
3327
|
navigate("main-menu");
|
|
2582
3328
|
}
|
|
2583
|
-
return /* @__PURE__ */
|
|
3329
|
+
return /* @__PURE__ */ jsxDEV9("box", {
|
|
2584
3330
|
flexDirection: "column",
|
|
2585
3331
|
flexGrow: 1,
|
|
2586
3332
|
padding: 1,
|
|
2587
3333
|
children: [
|
|
2588
|
-
/* @__PURE__ */
|
|
2589
|
-
fg:
|
|
3334
|
+
/* @__PURE__ */ jsxDEV9("text", {
|
|
3335
|
+
fg: theme.primary,
|
|
2590
3336
|
children: "Model Management"
|
|
2591
3337
|
}, undefined, false, undefined, this),
|
|
2592
|
-
/* @__PURE__ */
|
|
3338
|
+
/* @__PURE__ */ jsxDEV9("box", {
|
|
2593
3339
|
marginTop: 1,
|
|
2594
|
-
children: /* @__PURE__ */
|
|
2595
|
-
items:
|
|
3340
|
+
children: /* @__PURE__ */ jsxDEV9(MenuList, {
|
|
3341
|
+
items: ITEMS,
|
|
2596
3342
|
onSelect: handleSelect
|
|
2597
3343
|
}, undefined, false, undefined, this)
|
|
2598
3344
|
}, undefined, false, undefined, this)
|
|
2599
3345
|
]
|
|
2600
3346
|
}, undefined, true, undefined, this);
|
|
2601
3347
|
}
|
|
2602
|
-
var
|
|
3348
|
+
var ITEMS;
|
|
2603
3349
|
var init_ModelMenuScreen = __esm(() => {
|
|
3350
|
+
init_useAppKeyboard();
|
|
2604
3351
|
init_AppContext();
|
|
3352
|
+
init_ThemeContext();
|
|
2605
3353
|
init_MenuList();
|
|
2606
|
-
|
|
3354
|
+
ITEMS = [
|
|
2607
3355
|
{ label: "Add Verified Provider" },
|
|
2608
3356
|
{ label: "Add Custom Provider" },
|
|
2609
3357
|
{ label: "Add Models to Provider" },
|
|
@@ -2613,13 +3361,13 @@ var init_ModelMenuScreen = __esm(() => {
|
|
|
2613
3361
|
});
|
|
2614
3362
|
|
|
2615
3363
|
// src/tui/hooks/usePaste.ts
|
|
2616
|
-
import { useEffect as
|
|
3364
|
+
import { useEffect as useEffect3, useRef as useRef2 } from "react";
|
|
2617
3365
|
import { useRenderer as useRenderer2 } from "@opentui/react";
|
|
2618
3366
|
function usePaste(onPaste) {
|
|
2619
3367
|
const renderer = useRenderer2();
|
|
2620
|
-
const callbackRef =
|
|
3368
|
+
const callbackRef = useRef2(onPaste);
|
|
2621
3369
|
callbackRef.current = onPaste;
|
|
2622
|
-
|
|
3370
|
+
useEffect3(() => {
|
|
2623
3371
|
const handler = (event) => callbackRef.current(event.text);
|
|
2624
3372
|
renderer.keyInput.on("paste", handler);
|
|
2625
3373
|
return () => {
|
|
@@ -2630,36 +3378,29 @@ function usePaste(onPaste) {
|
|
|
2630
3378
|
var init_usePaste = () => {};
|
|
2631
3379
|
|
|
2632
3380
|
// src/tui/screens/ModelSelectScreen.tsx
|
|
2633
|
-
import { useState as
|
|
2634
|
-
import {
|
|
2635
|
-
import { jsxDEV as
|
|
3381
|
+
import { useState as useState6, useEffect as useEffect4, useCallback as useCallback2, useRef as useRef3 } from "react";
|
|
3382
|
+
import { useTerminalDimensions } from "@opentui/react";
|
|
3383
|
+
import { jsxDEV as jsxDEV10 } from "@opentui/react/jsx-dev-runtime";
|
|
2636
3384
|
function ModelSelectScreen() {
|
|
2637
3385
|
const { state, dispatch } = useAppContext();
|
|
2638
3386
|
const navigate = useNavigate();
|
|
3387
|
+
const theme = useTheme();
|
|
2639
3388
|
const { height, width } = useTerminalDimensions();
|
|
2640
|
-
const [searchQuery, setSearchQuery] =
|
|
2641
|
-
const [cursor, setCursor] =
|
|
2642
|
-
const [selected, setSelected] =
|
|
2643
|
-
const [allModels, setAllModels] =
|
|
2644
|
-
const [recentKeys, setRecentKeys] =
|
|
2645
|
-
const [debouncedQuery, setDebouncedQuery] =
|
|
2646
|
-
const scrollboxRef =
|
|
3389
|
+
const [searchQuery, setSearchQuery] = useState6("");
|
|
3390
|
+
const [cursor, setCursor] = useState6(0);
|
|
3391
|
+
const [selected, setSelected] = useState6(new Set);
|
|
3392
|
+
const [allModels, setAllModels] = useState6([]);
|
|
3393
|
+
const [recentKeys, setRecentKeys] = useState6(new Set);
|
|
3394
|
+
const [debouncedQuery, setDebouncedQuery] = useState6("");
|
|
3395
|
+
const scrollboxRef = useRef3(null);
|
|
2647
3396
|
const PAGE_SIZE = Math.max(3, height - 14);
|
|
2648
3397
|
const CARD_W = Math.min(60, width - 4);
|
|
2649
|
-
|
|
3398
|
+
useEffect4(() => {
|
|
2650
3399
|
const providers = state.config?.providers ?? [];
|
|
2651
3400
|
const models = [];
|
|
2652
3401
|
for (const provider of providers) {
|
|
2653
3402
|
for (const m of provider.models) {
|
|
2654
|
-
models.push({
|
|
2655
|
-
id: m.id,
|
|
2656
|
-
name: m.name || m.id,
|
|
2657
|
-
providerName: provider.name,
|
|
2658
|
-
providerType: provider.type,
|
|
2659
|
-
providerId: provider.id,
|
|
2660
|
-
providerConfig: { baseUrl: provider.baseUrl, apiKey: provider.apiKey },
|
|
2661
|
-
key: `${provider.id}::${m.id}`
|
|
2662
|
-
});
|
|
3403
|
+
models.push({ id: m.id, name: m.name || m.id, providerName: provider.name, providerType: provider.type, providerId: provider.id, providerConfig: { baseUrl: provider.baseUrl, apiKey: provider.apiKey }, key: `${provider.id}::${m.id}` });
|
|
2663
3404
|
}
|
|
2664
3405
|
}
|
|
2665
3406
|
setAllModels(models);
|
|
@@ -2681,11 +3422,11 @@ function ModelSelectScreen() {
|
|
|
2681
3422
|
}
|
|
2682
3423
|
loadRecents();
|
|
2683
3424
|
}, [state.config]);
|
|
2684
|
-
|
|
3425
|
+
useEffect4(() => {
|
|
2685
3426
|
const t = setTimeout(() => setDebouncedQuery(searchQuery), DEBOUNCE_MS);
|
|
2686
3427
|
return () => clearTimeout(t);
|
|
2687
3428
|
}, [searchQuery]);
|
|
2688
|
-
|
|
3429
|
+
useEffect4(() => {
|
|
2689
3430
|
setCursor(0);
|
|
2690
3431
|
}, [debouncedQuery]);
|
|
2691
3432
|
function isRecent(m) {
|
|
@@ -2693,14 +3434,13 @@ function ModelSelectScreen() {
|
|
|
2693
3434
|
}
|
|
2694
3435
|
const orderedModels = (() => {
|
|
2695
3436
|
if (!debouncedQuery) {
|
|
2696
|
-
const
|
|
2697
|
-
|
|
2698
|
-
return [...recents, ...rest];
|
|
3437
|
+
const r = allModels.filter((m) => isRecent(m));
|
|
3438
|
+
return [...r, ...allModels.filter((m) => !isRecent(m))];
|
|
2699
3439
|
}
|
|
2700
3440
|
const words = debouncedQuery.toLowerCase().split(/\s+/).filter((w) => w.length > 0);
|
|
2701
3441
|
return allModels.filter((m) => {
|
|
2702
|
-
const
|
|
2703
|
-
return words.every((w) =>
|
|
3442
|
+
const h = `${m.name} ${m.providerName} ${m.providerId} ${m.id}`.toLowerCase();
|
|
3443
|
+
return words.every((w) => h.includes(w));
|
|
2704
3444
|
});
|
|
2705
3445
|
})();
|
|
2706
3446
|
const recentCount = !debouncedQuery ? orderedModels.filter((m) => isRecent(m)).length : 0;
|
|
@@ -2712,11 +3452,10 @@ function ModelSelectScreen() {
|
|
|
2712
3452
|
const mIsRecent = isRecent(m);
|
|
2713
3453
|
const prevIsRecent = i > 0 ? isRecent(orderedModels[i - 1]) : false;
|
|
2714
3454
|
if (!debouncedQuery && recentCount > 0) {
|
|
2715
|
-
if (i === 0 && mIsRecent)
|
|
3455
|
+
if (i === 0 && mIsRecent)
|
|
2716
3456
|
rows.push({ kind: "separator", label: "\u2500\u2500 recent \u2500\u2500" });
|
|
2717
|
-
|
|
3457
|
+
else if (!mIsRecent && prevIsRecent)
|
|
2718
3458
|
rows.push({ kind: "separator", label: "\u2500\u2500 all models \u2500\u2500" });
|
|
2719
|
-
}
|
|
2720
3459
|
}
|
|
2721
3460
|
rows.push({ kind: "model", model: m, idx: modelIdx++ });
|
|
2722
3461
|
}
|
|
@@ -2724,26 +3463,25 @@ function ModelSelectScreen() {
|
|
|
2724
3463
|
})();
|
|
2725
3464
|
const allModelRows = allRows.filter((r) => r.kind === "model");
|
|
2726
3465
|
const cursorModel = allModelRows[cursor]?.model;
|
|
2727
|
-
|
|
3466
|
+
useEffect4(() => {
|
|
2728
3467
|
const sb = scrollboxRef.current;
|
|
2729
3468
|
if (!sb)
|
|
2730
3469
|
return;
|
|
2731
3470
|
const top = sb.scrollTop;
|
|
2732
3471
|
const visible = PAGE_SIZE;
|
|
2733
|
-
if (cursor < top)
|
|
3472
|
+
if (cursor < top)
|
|
2734
3473
|
sb.scrollTo(cursor);
|
|
2735
|
-
|
|
3474
|
+
else if (cursor >= top + visible)
|
|
2736
3475
|
sb.scrollTo(cursor - visible + 1);
|
|
2737
|
-
}
|
|
2738
3476
|
}, [cursor, PAGE_SIZE]);
|
|
2739
|
-
const launchBench =
|
|
3477
|
+
const launchBench = useCallback2((models) => {
|
|
2740
3478
|
dispatch({ type: "BENCH_START", models });
|
|
2741
3479
|
navigate("benchmark");
|
|
2742
3480
|
}, [dispatch, navigate]);
|
|
2743
3481
|
usePaste((text) => {
|
|
2744
3482
|
setSearchQuery((q) => q + text.replace(/[\r\n]/g, ""));
|
|
2745
3483
|
});
|
|
2746
|
-
|
|
3484
|
+
useAppKeyboard((key) => {
|
|
2747
3485
|
if (key.name === "escape") {
|
|
2748
3486
|
navigate("main-menu");
|
|
2749
3487
|
return;
|
|
@@ -2778,11 +3516,10 @@ function ModelSelectScreen() {
|
|
|
2778
3516
|
return;
|
|
2779
3517
|
}
|
|
2780
3518
|
if (key.name === "return" || key.name === "enter") {
|
|
2781
|
-
if (selected.size > 0)
|
|
3519
|
+
if (selected.size > 0)
|
|
2782
3520
|
launchBench(allModels.filter((m) => selected.has(m.key)));
|
|
2783
|
-
|
|
3521
|
+
else if (cursorModel)
|
|
2784
3522
|
launchBench([cursorModel]);
|
|
2785
|
-
}
|
|
2786
3523
|
return;
|
|
2787
3524
|
}
|
|
2788
3525
|
if (!searchQuery && key.sequence === "A") {
|
|
@@ -2801,50 +3538,49 @@ function ModelSelectScreen() {
|
|
|
2801
3538
|
setSearchQuery((q) => q.slice(0, -1));
|
|
2802
3539
|
return;
|
|
2803
3540
|
}
|
|
2804
|
-
if (key.sequence && key.sequence.length === 1 && !key.ctrl && !key.meta && key.sequence >= " ")
|
|
3541
|
+
if (key.sequence && key.sequence.length === 1 && !key.ctrl && !key.meta && key.sequence >= " ")
|
|
2805
3542
|
setSearchQuery((q) => q + key.sequence);
|
|
2806
|
-
}
|
|
2807
3543
|
});
|
|
2808
3544
|
if (state.isLoadingConfig) {
|
|
2809
|
-
return /* @__PURE__ */
|
|
3545
|
+
return /* @__PURE__ */ jsxDEV10("box", {
|
|
2810
3546
|
flexDirection: "column",
|
|
2811
3547
|
flexGrow: 1,
|
|
2812
3548
|
alignItems: "center",
|
|
2813
3549
|
justifyContent: "center",
|
|
2814
|
-
children: /* @__PURE__ */
|
|
2815
|
-
fg:
|
|
3550
|
+
children: /* @__PURE__ */ jsxDEV10("text", {
|
|
3551
|
+
fg: theme.dim,
|
|
2816
3552
|
children: "Loading config..."
|
|
2817
3553
|
}, undefined, false, undefined, this)
|
|
2818
3554
|
}, undefined, false, undefined, this);
|
|
2819
3555
|
}
|
|
2820
3556
|
const nameW = Math.floor((CARD_W - 10) / 2);
|
|
2821
3557
|
const provW = CARD_W - nameW - 10;
|
|
2822
|
-
return /* @__PURE__ */
|
|
3558
|
+
return /* @__PURE__ */ jsxDEV10("box", {
|
|
2823
3559
|
flexDirection: "column",
|
|
2824
3560
|
flexGrow: 1,
|
|
2825
3561
|
alignItems: "center",
|
|
2826
3562
|
justifyContent: "center",
|
|
2827
|
-
children: /* @__PURE__ */
|
|
3563
|
+
children: /* @__PURE__ */ jsxDEV10("box", {
|
|
2828
3564
|
flexDirection: "column",
|
|
2829
3565
|
border: true,
|
|
2830
3566
|
borderStyle: "rounded",
|
|
2831
|
-
borderColor:
|
|
2832
|
-
backgroundColor:
|
|
3567
|
+
borderColor: theme.border,
|
|
3568
|
+
backgroundColor: theme.background,
|
|
2833
3569
|
width: CARD_W,
|
|
2834
3570
|
children: [
|
|
2835
|
-
/* @__PURE__ */
|
|
3571
|
+
/* @__PURE__ */ jsxDEV10("box", {
|
|
2836
3572
|
flexDirection: "row",
|
|
2837
3573
|
paddingLeft: 2,
|
|
2838
3574
|
paddingRight: 2,
|
|
2839
3575
|
paddingTop: 1,
|
|
2840
3576
|
paddingBottom: 1,
|
|
2841
3577
|
children: [
|
|
2842
|
-
/* @__PURE__ */
|
|
2843
|
-
fg:
|
|
3578
|
+
/* @__PURE__ */ jsxDEV10("text", {
|
|
3579
|
+
fg: theme.accent,
|
|
2844
3580
|
children: "Search: "
|
|
2845
3581
|
}, undefined, false, undefined, this),
|
|
2846
|
-
/* @__PURE__ */
|
|
2847
|
-
fg:
|
|
3582
|
+
/* @__PURE__ */ jsxDEV10("text", {
|
|
3583
|
+
fg: theme.text,
|
|
2848
3584
|
children: [
|
|
2849
3585
|
searchQuery,
|
|
2850
3586
|
"_"
|
|
@@ -2852,74 +3588,73 @@ function ModelSelectScreen() {
|
|
|
2852
3588
|
}, undefined, true, undefined, this)
|
|
2853
3589
|
]
|
|
2854
3590
|
}, undefined, true, undefined, this),
|
|
2855
|
-
/* @__PURE__ */
|
|
3591
|
+
/* @__PURE__ */ jsxDEV10("box", {
|
|
2856
3592
|
height: 1,
|
|
2857
|
-
backgroundColor:
|
|
3593
|
+
backgroundColor: theme.border
|
|
2858
3594
|
}, undefined, false, undefined, this),
|
|
2859
|
-
/* @__PURE__ */
|
|
3595
|
+
/* @__PURE__ */ jsxDEV10("scrollbox", {
|
|
2860
3596
|
ref: scrollboxRef,
|
|
2861
3597
|
height: PAGE_SIZE,
|
|
2862
|
-
style: { scrollbarOptions: { showArrows: true, trackOptions: { foregroundColor:
|
|
3598
|
+
style: { scrollbarOptions: { showArrows: true, trackOptions: { foregroundColor: theme.primary, backgroundColor: theme.border } } },
|
|
2863
3599
|
children: [
|
|
2864
|
-
allRows.length === 0 && /* @__PURE__ */
|
|
3600
|
+
allRows.length === 0 && /* @__PURE__ */ jsxDEV10("box", {
|
|
2865
3601
|
height: 1,
|
|
2866
3602
|
paddingLeft: 2,
|
|
2867
|
-
children: /* @__PURE__ */
|
|
2868
|
-
fg:
|
|
3603
|
+
children: /* @__PURE__ */ jsxDEV10("text", {
|
|
3604
|
+
fg: theme.dim,
|
|
2869
3605
|
children: "No models found"
|
|
2870
3606
|
}, undefined, false, undefined, this)
|
|
2871
3607
|
}, undefined, false, undefined, this),
|
|
2872
3608
|
(() => {
|
|
2873
3609
|
let modelCursor = 0;
|
|
2874
3610
|
return allRows.map((row, i) => {
|
|
2875
|
-
if (row.kind === "separator")
|
|
2876
|
-
return /* @__PURE__ */
|
|
3611
|
+
if (row.kind === "separator")
|
|
3612
|
+
return /* @__PURE__ */ jsxDEV10("box", {
|
|
2877
3613
|
height: 1,
|
|
2878
3614
|
paddingLeft: 2,
|
|
2879
|
-
children: /* @__PURE__ */
|
|
2880
|
-
fg:
|
|
3615
|
+
children: /* @__PURE__ */ jsxDEV10("text", {
|
|
3616
|
+
fg: theme.dim,
|
|
2881
3617
|
children: row.label
|
|
2882
3618
|
}, undefined, false, undefined, this)
|
|
2883
3619
|
}, `sep-${i}`, false, undefined, this);
|
|
2884
|
-
}
|
|
2885
3620
|
const localCursor = modelCursor++;
|
|
2886
3621
|
const isActive = localCursor === cursor;
|
|
2887
3622
|
const isSel = selected.has(row.model.key);
|
|
2888
|
-
let nameFg =
|
|
3623
|
+
let nameFg = theme.dim;
|
|
2889
3624
|
if (isActive && isSel)
|
|
2890
|
-
nameFg =
|
|
3625
|
+
nameFg = theme.accent;
|
|
2891
3626
|
else if (isActive)
|
|
2892
|
-
nameFg =
|
|
3627
|
+
nameFg = theme.text;
|
|
2893
3628
|
else if (isSel)
|
|
2894
|
-
nameFg =
|
|
2895
|
-
return /* @__PURE__ */
|
|
3629
|
+
nameFg = theme.success;
|
|
3630
|
+
return /* @__PURE__ */ jsxDEV10("box", {
|
|
2896
3631
|
height: 1,
|
|
2897
3632
|
width: "100%",
|
|
2898
3633
|
flexDirection: "row",
|
|
2899
|
-
backgroundColor: isActive ?
|
|
3634
|
+
backgroundColor: isActive ? theme.border : "transparent",
|
|
2900
3635
|
children: [
|
|
2901
|
-
/* @__PURE__ */
|
|
2902
|
-
fg:
|
|
3636
|
+
/* @__PURE__ */ jsxDEV10("text", {
|
|
3637
|
+
fg: theme.dim,
|
|
2903
3638
|
width: 2,
|
|
2904
3639
|
children: " "
|
|
2905
3640
|
}, undefined, false, undefined, this),
|
|
2906
|
-
/* @__PURE__ */
|
|
3641
|
+
/* @__PURE__ */ jsxDEV10("text", {
|
|
2907
3642
|
fg: nameFg,
|
|
2908
3643
|
width: nameW,
|
|
2909
3644
|
children: row.model.name
|
|
2910
3645
|
}, undefined, false, undefined, this),
|
|
2911
|
-
/* @__PURE__ */
|
|
2912
|
-
fg: isActive ?
|
|
3646
|
+
/* @__PURE__ */ jsxDEV10("text", {
|
|
3647
|
+
fg: isActive ? theme.primary : theme.dim,
|
|
2913
3648
|
width: provW,
|
|
2914
3649
|
children: row.model.providerName
|
|
2915
3650
|
}, undefined, false, undefined, this),
|
|
2916
|
-
/* @__PURE__ */
|
|
2917
|
-
fg:
|
|
3651
|
+
/* @__PURE__ */ jsxDEV10("text", {
|
|
3652
|
+
fg: theme.success,
|
|
2918
3653
|
width: 2,
|
|
2919
3654
|
children: isSel ? "\u2713" : " "
|
|
2920
3655
|
}, undefined, false, undefined, this),
|
|
2921
|
-
/* @__PURE__ */
|
|
2922
|
-
fg:
|
|
3656
|
+
/* @__PURE__ */ jsxDEV10("text", {
|
|
3657
|
+
fg: theme.accent,
|
|
2923
3658
|
width: 2,
|
|
2924
3659
|
children: isActive ? "\u203A" : " "
|
|
2925
3660
|
}, undefined, false, undefined, this)
|
|
@@ -2929,19 +3664,19 @@ function ModelSelectScreen() {
|
|
|
2929
3664
|
})()
|
|
2930
3665
|
]
|
|
2931
3666
|
}, undefined, true, undefined, this),
|
|
2932
|
-
/* @__PURE__ */
|
|
3667
|
+
/* @__PURE__ */ jsxDEV10("box", {
|
|
2933
3668
|
height: 1,
|
|
2934
|
-
backgroundColor:
|
|
3669
|
+
backgroundColor: theme.border
|
|
2935
3670
|
}, undefined, false, undefined, this),
|
|
2936
|
-
/* @__PURE__ */
|
|
3671
|
+
/* @__PURE__ */ jsxDEV10("box", {
|
|
2937
3672
|
flexDirection: "row",
|
|
2938
3673
|
paddingLeft: 2,
|
|
2939
3674
|
paddingRight: 2,
|
|
2940
3675
|
paddingTop: 1,
|
|
2941
3676
|
paddingBottom: 1,
|
|
2942
3677
|
children: [
|
|
2943
|
-
/* @__PURE__ */
|
|
2944
|
-
fg:
|
|
3678
|
+
/* @__PURE__ */ jsxDEV10("text", {
|
|
3679
|
+
fg: theme.secondary,
|
|
2945
3680
|
children: [
|
|
2946
3681
|
"Selected: ",
|
|
2947
3682
|
selected.size,
|
|
@@ -2949,16 +3684,16 @@ function ModelSelectScreen() {
|
|
|
2949
3684
|
selected.size !== 1 ? "s" : ""
|
|
2950
3685
|
]
|
|
2951
3686
|
}, undefined, true, undefined, this),
|
|
2952
|
-
recentCount > 0 && /* @__PURE__ */
|
|
2953
|
-
fg:
|
|
3687
|
+
recentCount > 0 && /* @__PURE__ */ jsxDEV10("text", {
|
|
3688
|
+
fg: theme.dim,
|
|
2954
3689
|
children: [
|
|
2955
3690
|
" [R] recent (",
|
|
2956
3691
|
recentCount,
|
|
2957
3692
|
")"
|
|
2958
3693
|
]
|
|
2959
3694
|
}, undefined, true, undefined, this),
|
|
2960
|
-
/* @__PURE__ */
|
|
2961
|
-
fg:
|
|
3695
|
+
/* @__PURE__ */ jsxDEV10("text", {
|
|
3696
|
+
fg: theme.dim,
|
|
2962
3697
|
children: " [\u2191\u2193/PgUp/PgDn/wheel] scroll"
|
|
2963
3698
|
}, undefined, false, undefined, this)
|
|
2964
3699
|
]
|
|
@@ -2969,25 +3704,107 @@ function ModelSelectScreen() {
|
|
|
2969
3704
|
}
|
|
2970
3705
|
var DEBOUNCE_MS = 50;
|
|
2971
3706
|
var init_ModelSelectScreen = __esm(() => {
|
|
3707
|
+
init_useAppKeyboard();
|
|
2972
3708
|
init_AppContext();
|
|
3709
|
+
init_ThemeContext();
|
|
2973
3710
|
init_usePaste();
|
|
2974
3711
|
});
|
|
2975
3712
|
|
|
2976
3713
|
// src/tui/components/BarChart.tsx
|
|
2977
|
-
import { jsxDEV as
|
|
3714
|
+
import { jsxDEV as jsxDEV11 } from "@opentui/react/jsx-dev-runtime";
|
|
2978
3715
|
function BarChart({ value, max, width, color }) {
|
|
2979
3716
|
const filled = max === 0 ? 0 : Math.round(value / max * width);
|
|
2980
3717
|
const empty = width - filled;
|
|
2981
3718
|
const bar = "\u2588".repeat(filled) + "\u2591".repeat(empty);
|
|
2982
|
-
return /* @__PURE__ */
|
|
3719
|
+
return /* @__PURE__ */ jsxDEV11("text", {
|
|
2983
3720
|
fg: color,
|
|
2984
3721
|
children: bar
|
|
2985
3722
|
}, undefined, false, undefined, this);
|
|
2986
3723
|
}
|
|
2987
3724
|
var init_BarChart = () => {};
|
|
2988
3725
|
|
|
3726
|
+
// src/tui/components/GlowBar.tsx
|
|
3727
|
+
import { useState as useState7, useEffect as useEffect5 } from "react";
|
|
3728
|
+
import { engine, Timeline } from "@opentui/core";
|
|
3729
|
+
import { jsxDEV as jsxDEV12 } from "@opentui/react/jsx-dev-runtime";
|
|
3730
|
+
function blendHex(hex, toward, t) {
|
|
3731
|
+
const parse3 = (h) => [
|
|
3732
|
+
parseInt(h.slice(1, 3), 16),
|
|
3733
|
+
parseInt(h.slice(3, 5), 16),
|
|
3734
|
+
parseInt(h.slice(5, 7), 16)
|
|
3735
|
+
];
|
|
3736
|
+
const [r1, g1, b1] = parse3(hex.length === 7 ? hex : "#ffffff");
|
|
3737
|
+
const [r2, g2, b2] = parse3(toward.length === 7 ? toward : "#ffffff");
|
|
3738
|
+
const r = Math.round(r1 + (r2 - r1) * t);
|
|
3739
|
+
const g = Math.round(g1 + (g2 - g1) * t);
|
|
3740
|
+
const b = Math.round(b1 + (b2 - b1) * t);
|
|
3741
|
+
return `#${r.toString(16).padStart(2, "0")}${g.toString(16).padStart(2, "0")}${b.toString(16).padStart(2, "0")}`;
|
|
3742
|
+
}
|
|
3743
|
+
function GlowBar({ done, total, running }) {
|
|
3744
|
+
const theme = useTheme();
|
|
3745
|
+
const [pos, setPos] = useState7(0);
|
|
3746
|
+
useEffect5(() => {
|
|
3747
|
+
const tl = new Timeline({ loop: true, duration: 2200 });
|
|
3748
|
+
const target = { pos: 0 };
|
|
3749
|
+
tl.add(target, { pos: 1, duration: 2200, ease: "linear", onUpdate: (anim) => {
|
|
3750
|
+
setPos(anim.targets[0].pos);
|
|
3751
|
+
} }, 0);
|
|
3752
|
+
tl.play();
|
|
3753
|
+
engine.register(tl);
|
|
3754
|
+
return () => {
|
|
3755
|
+
tl.pause();
|
|
3756
|
+
engine.unregister(tl);
|
|
3757
|
+
};
|
|
3758
|
+
}, []);
|
|
3759
|
+
const filled = Math.round(done / (total || 1) * BAR_W);
|
|
3760
|
+
const barChars = Array.from({ length: BAR_W }, (_, i) => {
|
|
3761
|
+
if (i >= filled)
|
|
3762
|
+
return { ch: "\u2591", fg: theme.border };
|
|
3763
|
+
const phase = pos - i / BAR_W;
|
|
3764
|
+
const intensity = Math.sin(Math.PI * phase * 1.5);
|
|
3765
|
+
const fg = intensity >= 0 ? blendHex(theme.accent, "#ffffff", intensity * 0.55) : blendHex(theme.accent, theme.background, Math.abs(intensity) * 0.5);
|
|
3766
|
+
return { ch: "\u2588", fg };
|
|
3767
|
+
});
|
|
3768
|
+
return /* @__PURE__ */ jsxDEV12("box", {
|
|
3769
|
+
height: 1,
|
|
3770
|
+
flexDirection: "row",
|
|
3771
|
+
paddingLeft: 2,
|
|
3772
|
+
children: [
|
|
3773
|
+
/* @__PURE__ */ jsxDEV12("text", {
|
|
3774
|
+
fg: theme.dim,
|
|
3775
|
+
children: "Benchmarking "
|
|
3776
|
+
}, undefined, false, undefined, this),
|
|
3777
|
+
/* @__PURE__ */ jsxDEV12("text", {
|
|
3778
|
+
fg: theme.accent,
|
|
3779
|
+
children: [
|
|
3780
|
+
done,
|
|
3781
|
+
"/",
|
|
3782
|
+
total,
|
|
3783
|
+
" "
|
|
3784
|
+
]
|
|
3785
|
+
}, undefined, true, undefined, this),
|
|
3786
|
+
barChars.map((b, i) => /* @__PURE__ */ jsxDEV12("text", {
|
|
3787
|
+
fg: b.fg,
|
|
3788
|
+
children: b.ch
|
|
3789
|
+
}, i, false, undefined, this)),
|
|
3790
|
+
/* @__PURE__ */ jsxDEV12("text", {
|
|
3791
|
+
fg: theme.warning,
|
|
3792
|
+
children: [
|
|
3793
|
+
" ",
|
|
3794
|
+
running,
|
|
3795
|
+
" running..."
|
|
3796
|
+
]
|
|
3797
|
+
}, undefined, true, undefined, this)
|
|
3798
|
+
]
|
|
3799
|
+
}, undefined, true, undefined, this);
|
|
3800
|
+
}
|
|
3801
|
+
var BAR_W = 25;
|
|
3802
|
+
var init_GlowBar = __esm(() => {
|
|
3803
|
+
init_ThemeContext();
|
|
3804
|
+
});
|
|
3805
|
+
|
|
2989
3806
|
// src/tui/components/ResultsTable.tsx
|
|
2990
|
-
import { jsxDEV as
|
|
3807
|
+
import { jsxDEV as jsxDEV13 } from "@opentui/react/jsx-dev-runtime";
|
|
2991
3808
|
function lpad(s, w) {
|
|
2992
3809
|
return s.length >= w ? s.slice(0, w) : " ".repeat(w - s.length) + s;
|
|
2993
3810
|
}
|
|
@@ -2998,6 +3815,7 @@ function trunc(s, w) {
|
|
|
2998
3815
|
return s.length > w ? s.slice(0, w - 1) + "\u2026" : s;
|
|
2999
3816
|
}
|
|
3000
3817
|
function ResultsTable({ results, pendingCount }) {
|
|
3818
|
+
const theme = useTheme();
|
|
3001
3819
|
const sorted = [...results].sort((a, b) => b.tokensPerSecond - a.tokensPerSecond);
|
|
3002
3820
|
const C = { rank: 4, model: 18, prov: 12, time: 10, ttft: 8, tps: 11, out: 8, inp: 8, tot: 8 };
|
|
3003
3821
|
const totalW = C.rank + C.model + C.prov + C.time + C.ttft + C.tps + C.out + C.inp + C.tot + 9;
|
|
@@ -3006,22 +3824,22 @@ function ResultsTable({ results, pendingCount }) {
|
|
|
3006
3824
|
return lpad(rank, C.rank) + " \u2502 " + rpad(model, C.model) + " \u2502 " + rpad(prov, C.prov) + " \u2502 " + lpad(time, C.time) + " \u2502 " + lpad(ttft, C.ttft) + " \u2502 " + lpad(tps, C.tps) + " \u2502 " + lpad(out, C.out) + " \u2502 " + lpad(inp, C.inp) + " \u2502 " + lpad(tot, C.tot);
|
|
3007
3825
|
}
|
|
3008
3826
|
const header = row("#", "Model", "Provider", "Time(s)", "TTFT(s)", "Tokens/Sec", "Out", "In", "Total");
|
|
3009
|
-
return /* @__PURE__ */
|
|
3827
|
+
return /* @__PURE__ */ jsxDEV13("box", {
|
|
3010
3828
|
flexDirection: "column",
|
|
3011
3829
|
paddingLeft: 1,
|
|
3012
3830
|
paddingRight: 1,
|
|
3013
3831
|
children: [
|
|
3014
|
-
/* @__PURE__ */
|
|
3832
|
+
/* @__PURE__ */ jsxDEV13("box", {
|
|
3015
3833
|
height: 1,
|
|
3016
|
-
children: /* @__PURE__ */
|
|
3017
|
-
fg:
|
|
3834
|
+
children: /* @__PURE__ */ jsxDEV13("text", {
|
|
3835
|
+
fg: theme.accent,
|
|
3018
3836
|
children: header
|
|
3019
3837
|
}, undefined, false, undefined, this)
|
|
3020
3838
|
}, undefined, false, undefined, this),
|
|
3021
|
-
/* @__PURE__ */
|
|
3839
|
+
/* @__PURE__ */ jsxDEV13("box", {
|
|
3022
3840
|
height: 1,
|
|
3023
|
-
children: /* @__PURE__ */
|
|
3024
|
-
fg:
|
|
3841
|
+
children: /* @__PURE__ */ jsxDEV13("text", {
|
|
3842
|
+
fg: theme.border,
|
|
3025
3843
|
children: sep
|
|
3026
3844
|
}, undefined, false, undefined, this)
|
|
3027
3845
|
}, undefined, false, undefined, this),
|
|
@@ -3035,32 +3853,32 @@ function ResultsTable({ results, pendingCount }) {
|
|
|
3035
3853
|
const totTok = r.totalTokens.toString() + (r.usedEstimateForOutput || r.usedEstimateForInput ? "[e]" : "");
|
|
3036
3854
|
const hasEst = r.usedEstimateForOutput || r.usedEstimateForInput;
|
|
3037
3855
|
const line = row(rank, trunc(r.model, C.model), trunc(r.provider, C.prov), timeSec, ttftSec, tps, outTok, inTok, totTok);
|
|
3038
|
-
return /* @__PURE__ */
|
|
3856
|
+
return /* @__PURE__ */ jsxDEV13("box", {
|
|
3039
3857
|
height: 1,
|
|
3040
3858
|
flexDirection: "row",
|
|
3041
3859
|
children: [
|
|
3042
|
-
/* @__PURE__ */
|
|
3043
|
-
fg:
|
|
3860
|
+
/* @__PURE__ */ jsxDEV13("text", {
|
|
3861
|
+
fg: theme.text,
|
|
3044
3862
|
children: line
|
|
3045
3863
|
}, undefined, false, undefined, this),
|
|
3046
|
-
hasEst && /* @__PURE__ */
|
|
3047
|
-
fg:
|
|
3864
|
+
hasEst && /* @__PURE__ */ jsxDEV13("text", {
|
|
3865
|
+
fg: theme.warning,
|
|
3048
3866
|
children: " [est]"
|
|
3049
3867
|
}, undefined, false, undefined, this)
|
|
3050
3868
|
]
|
|
3051
3869
|
}, `${r.model}-${r.provider}-${i}`, true, undefined, this);
|
|
3052
3870
|
}),
|
|
3053
|
-
/* @__PURE__ */
|
|
3871
|
+
/* @__PURE__ */ jsxDEV13("box", {
|
|
3054
3872
|
height: 1,
|
|
3055
|
-
children: /* @__PURE__ */
|
|
3056
|
-
fg:
|
|
3873
|
+
children: /* @__PURE__ */ jsxDEV13("text", {
|
|
3874
|
+
fg: theme.border,
|
|
3057
3875
|
children: sep
|
|
3058
3876
|
}, undefined, false, undefined, this)
|
|
3059
3877
|
}, undefined, false, undefined, this),
|
|
3060
|
-
pendingCount > 0 && /* @__PURE__ */
|
|
3878
|
+
pendingCount > 0 && /* @__PURE__ */ jsxDEV13("box", {
|
|
3061
3879
|
height: 1,
|
|
3062
|
-
children: /* @__PURE__ */
|
|
3063
|
-
fg:
|
|
3880
|
+
children: /* @__PURE__ */ jsxDEV13("text", {
|
|
3881
|
+
fg: theme.dim,
|
|
3064
3882
|
children: [
|
|
3065
3883
|
" Waiting for ",
|
|
3066
3884
|
pendingCount,
|
|
@@ -3073,13 +3891,13 @@ function ResultsTable({ results, pendingCount }) {
|
|
|
3073
3891
|
]
|
|
3074
3892
|
}, undefined, true, undefined, this);
|
|
3075
3893
|
}
|
|
3076
|
-
var init_ResultsTable = () => {
|
|
3894
|
+
var init_ResultsTable = __esm(() => {
|
|
3895
|
+
init_ThemeContext();
|
|
3896
|
+
});
|
|
3077
3897
|
|
|
3078
3898
|
// src/tui/screens/BenchmarkScreen.tsx
|
|
3079
|
-
import { useState as
|
|
3080
|
-
import {
|
|
3081
|
-
import { engine, Timeline } from "@opentui/core";
|
|
3082
|
-
import { jsxDEV as jsxDEV10 } from "@opentui/react/jsx-dev-runtime";
|
|
3899
|
+
import { useState as useState8, useEffect as useEffect6, useRef as useRef4, useMemo } from "react";
|
|
3900
|
+
import { jsxDEV as jsxDEV14 } from "@opentui/react/jsx-dev-runtime";
|
|
3083
3901
|
function rankBadge(rank) {
|
|
3084
3902
|
if (rank === 1)
|
|
3085
3903
|
return "1st";
|
|
@@ -3089,35 +3907,16 @@ function rankBadge(rank) {
|
|
|
3089
3907
|
return "3rd";
|
|
3090
3908
|
return `${rank}th`;
|
|
3091
3909
|
}
|
|
3092
|
-
function Divider() {
|
|
3093
|
-
return /* @__PURE__ */ jsxDEV10("box", {
|
|
3094
|
-
height: 1,
|
|
3095
|
-
backgroundColor: "#292e42"
|
|
3096
|
-
}, undefined, false, undefined, this);
|
|
3097
|
-
}
|
|
3098
3910
|
function BenchmarkScreen() {
|
|
3099
3911
|
const { state, dispatch } = useAppContext();
|
|
3100
3912
|
const navigate = useNavigate();
|
|
3101
|
-
const
|
|
3102
|
-
const [
|
|
3103
|
-
const [
|
|
3104
|
-
const [allDone, setAllDone] =
|
|
3105
|
-
const spinnerRef =
|
|
3106
|
-
const startedRef =
|
|
3107
|
-
|
|
3108
|
-
const tl = new Timeline({ loop: true, duration: 1400 });
|
|
3109
|
-
const target = { pos: 0 };
|
|
3110
|
-
tl.add(target, { pos: 1, duration: 1400, ease: "inOutSine", onUpdate: (anim) => {
|
|
3111
|
-
setShimmerPos(anim.targets[0].pos);
|
|
3112
|
-
} }, 0);
|
|
3113
|
-
tl.play();
|
|
3114
|
-
engine.register(tl);
|
|
3115
|
-
return () => {
|
|
3116
|
-
tl.pause();
|
|
3117
|
-
engine.unregister(tl);
|
|
3118
|
-
};
|
|
3119
|
-
}, []);
|
|
3120
|
-
useEffect4(() => {
|
|
3913
|
+
const theme = useTheme();
|
|
3914
|
+
const [modelStates, setModelStates] = useState8([]);
|
|
3915
|
+
const [spinnerFrame, setSpinnerFrame] = useState8(0);
|
|
3916
|
+
const [allDone, setAllDone] = useState8(false);
|
|
3917
|
+
const spinnerRef = useRef4(null);
|
|
3918
|
+
const startedRef = useRef4(false);
|
|
3919
|
+
useEffect6(() => {
|
|
3121
3920
|
if (startedRef.current)
|
|
3122
3921
|
return;
|
|
3123
3922
|
startedRef.current = true;
|
|
@@ -3182,89 +3981,38 @@ function BenchmarkScreen() {
|
|
|
3182
3981
|
const allRows = useMemo(() => {
|
|
3183
3982
|
const rows = [];
|
|
3184
3983
|
if (!allDone) {
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
const barChars = Array.from({ length: BAR_W }, (_, i) => {
|
|
3191
|
-
const isFilled = i < filled;
|
|
3192
|
-
const dist = Math.abs(i - shimmerCenter);
|
|
3193
|
-
const inWindow = dist <= shimmerHalf;
|
|
3194
|
-
const intensity = inWindow ? 1 - dist / shimmerHalf : 0;
|
|
3195
|
-
if (isFilled) {
|
|
3196
|
-
if (intensity > 0.6)
|
|
3197
|
-
return { ch: "\u2588", fg: "#c8eeff" };
|
|
3198
|
-
if (intensity > 0)
|
|
3199
|
-
return { ch: "\u2593", fg: "#a0d8f0" };
|
|
3200
|
-
return { ch: "\u2588", fg: "#4a9abb" };
|
|
3201
|
-
} else {
|
|
3202
|
-
if (intensity > 0.6)
|
|
3203
|
-
return { ch: "\u2591", fg: "#2a3a52" };
|
|
3204
|
-
if (intensity > 0)
|
|
3205
|
-
return { ch: "\u2591", fg: "#222d40" };
|
|
3206
|
-
return { ch: "\u2591", fg: "#1a2030" };
|
|
3207
|
-
}
|
|
3208
|
-
});
|
|
3209
|
-
rows.push(/* @__PURE__ */ jsxDEV10("box", {
|
|
3210
|
-
height: 1,
|
|
3211
|
-
flexDirection: "row",
|
|
3212
|
-
paddingLeft: 2,
|
|
3213
|
-
children: [
|
|
3214
|
-
/* @__PURE__ */ jsxDEV10("text", {
|
|
3215
|
-
fg: "#565f89",
|
|
3216
|
-
children: "Benchmarking "
|
|
3217
|
-
}, undefined, false, undefined, this),
|
|
3218
|
-
/* @__PURE__ */ jsxDEV10("text", {
|
|
3219
|
-
fg: "#7dcfff",
|
|
3220
|
-
children: [
|
|
3221
|
-
done.length + errors.length,
|
|
3222
|
-
"/",
|
|
3223
|
-
modelStates.length,
|
|
3224
|
-
" "
|
|
3225
|
-
]
|
|
3226
|
-
}, undefined, true, undefined, this),
|
|
3227
|
-
barChars.map((b, i) => /* @__PURE__ */ jsxDEV10("text", {
|
|
3228
|
-
fg: b.fg,
|
|
3229
|
-
children: b.ch
|
|
3230
|
-
}, i, false, undefined, this)),
|
|
3231
|
-
/* @__PURE__ */ jsxDEV10("text", {
|
|
3232
|
-
fg: "#ff9e64",
|
|
3233
|
-
children: [
|
|
3234
|
-
" ",
|
|
3235
|
-
running.length,
|
|
3236
|
-
" running..."
|
|
3237
|
-
]
|
|
3238
|
-
}, undefined, true, undefined, this)
|
|
3239
|
-
]
|
|
3240
|
-
}, "progress-bar", true, undefined, this));
|
|
3984
|
+
rows.push(/* @__PURE__ */ jsxDEV14(GlowBar, {
|
|
3985
|
+
done: done.length + errors.length,
|
|
3986
|
+
total: modelStates.length,
|
|
3987
|
+
running: running.length
|
|
3988
|
+
}, "progress-bar", false, undefined, this));
|
|
3241
3989
|
for (const s of modelStates.filter((s2) => s2.status === "done" || s2.status === "error")) {
|
|
3242
3990
|
if (s.status === "done") {
|
|
3243
|
-
rows.push(/* @__PURE__ */
|
|
3991
|
+
rows.push(/* @__PURE__ */ jsxDEV14("box", {
|
|
3244
3992
|
height: 1,
|
|
3245
3993
|
flexDirection: "row",
|
|
3246
3994
|
paddingLeft: 2,
|
|
3247
3995
|
children: [
|
|
3248
|
-
/* @__PURE__ */
|
|
3249
|
-
fg:
|
|
3996
|
+
/* @__PURE__ */ jsxDEV14("text", {
|
|
3997
|
+
fg: theme.success,
|
|
3250
3998
|
children: " \u2713 "
|
|
3251
3999
|
}, undefined, false, undefined, this),
|
|
3252
|
-
/* @__PURE__ */
|
|
3253
|
-
fg:
|
|
4000
|
+
/* @__PURE__ */ jsxDEV14("text", {
|
|
4001
|
+
fg: theme.text,
|
|
3254
4002
|
children: [
|
|
3255
4003
|
s.model.name,
|
|
3256
4004
|
" "
|
|
3257
4005
|
]
|
|
3258
4006
|
}, undefined, true, undefined, this),
|
|
3259
|
-
/* @__PURE__ */
|
|
3260
|
-
fg:
|
|
4007
|
+
/* @__PURE__ */ jsxDEV14("text", {
|
|
4008
|
+
fg: theme.accent,
|
|
3261
4009
|
children: [
|
|
3262
4010
|
(s.result?.tokensPerSecond ?? 0).toFixed(1),
|
|
3263
4011
|
" tok/s "
|
|
3264
4012
|
]
|
|
3265
4013
|
}, undefined, true, undefined, this),
|
|
3266
|
-
/* @__PURE__ */
|
|
3267
|
-
fg:
|
|
4014
|
+
/* @__PURE__ */ jsxDEV14("text", {
|
|
4015
|
+
fg: theme.secondary,
|
|
3268
4016
|
children: [
|
|
3269
4017
|
((s.result?.timeToFirstToken ?? 0) / 1000).toFixed(2),
|
|
3270
4018
|
"s TTFT"
|
|
@@ -3273,213 +4021,213 @@ function BenchmarkScreen() {
|
|
|
3273
4021
|
]
|
|
3274
4022
|
}, `prog-${s.model.id}-${s.model.providerId}`, true, undefined, this));
|
|
3275
4023
|
} else {
|
|
3276
|
-
rows.push(/* @__PURE__ */
|
|
4024
|
+
rows.push(/* @__PURE__ */ jsxDEV14("box", {
|
|
3277
4025
|
height: 1,
|
|
3278
4026
|
flexDirection: "row",
|
|
3279
4027
|
paddingLeft: 2,
|
|
3280
4028
|
children: [
|
|
3281
|
-
/* @__PURE__ */
|
|
3282
|
-
fg:
|
|
4029
|
+
/* @__PURE__ */ jsxDEV14("text", {
|
|
4030
|
+
fg: theme.error,
|
|
3283
4031
|
children: " \u2717 "
|
|
3284
4032
|
}, undefined, false, undefined, this),
|
|
3285
|
-
/* @__PURE__ */
|
|
3286
|
-
fg:
|
|
4033
|
+
/* @__PURE__ */ jsxDEV14("text", {
|
|
4034
|
+
fg: theme.text,
|
|
3287
4035
|
children: [
|
|
3288
4036
|
s.model.name,
|
|
3289
4037
|
" "
|
|
3290
4038
|
]
|
|
3291
4039
|
}, undefined, true, undefined, this),
|
|
3292
|
-
/* @__PURE__ */
|
|
3293
|
-
fg:
|
|
4040
|
+
/* @__PURE__ */ jsxDEV14("text", {
|
|
4041
|
+
fg: theme.error,
|
|
3294
4042
|
children: s.error ?? "error"
|
|
3295
4043
|
}, undefined, false, undefined, this)
|
|
3296
4044
|
]
|
|
3297
4045
|
}, `prog-${s.model.id}-${s.model.providerId}`, true, undefined, this));
|
|
3298
4046
|
}
|
|
3299
4047
|
}
|
|
3300
|
-
rows.push(/* @__PURE__ */
|
|
4048
|
+
rows.push(/* @__PURE__ */ jsxDEV14("box", {
|
|
3301
4049
|
height: 1
|
|
3302
4050
|
}, "prog-spacer", false, undefined, this));
|
|
3303
4051
|
}
|
|
3304
4052
|
if (tpsRanked.length > 0) {
|
|
3305
|
-
rows.push(/* @__PURE__ */
|
|
4053
|
+
rows.push(/* @__PURE__ */ jsxDEV14("box", {
|
|
3306
4054
|
height: 1,
|
|
3307
|
-
backgroundColor:
|
|
4055
|
+
backgroundColor: theme.border
|
|
3308
4056
|
}, "div-tps", false, undefined, this));
|
|
3309
|
-
rows.push(/* @__PURE__ */
|
|
4057
|
+
rows.push(/* @__PURE__ */ jsxDEV14("box", {
|
|
3310
4058
|
height: 1,
|
|
3311
4059
|
flexDirection: "row",
|
|
3312
4060
|
paddingLeft: 1,
|
|
3313
|
-
children: /* @__PURE__ */
|
|
3314
|
-
fg:
|
|
4061
|
+
children: /* @__PURE__ */ jsxDEV14("text", {
|
|
4062
|
+
fg: theme.primary,
|
|
3315
4063
|
children: " TOKENS/SEC RANKING (higher is better) "
|
|
3316
4064
|
}, undefined, false, undefined, this)
|
|
3317
4065
|
}, "hdr-tps", false, undefined, this));
|
|
3318
4066
|
for (const [i, s] of tpsRanked.entries()) {
|
|
3319
4067
|
const rank = i + 1;
|
|
3320
|
-
const rankFg = rank === 1 ?
|
|
4068
|
+
const rankFg = rank === 1 ? theme.accent : rank === 2 ? theme.secondary : theme.dim;
|
|
3321
4069
|
const tps = s.result?.tokensPerSecond ?? 0;
|
|
3322
4070
|
const timeSec = (s.result?.totalTime ?? 0) / 1000;
|
|
3323
4071
|
const badge = rankBadge(rank).padStart(3);
|
|
3324
4072
|
const modelCol = s.model.name.padEnd(18).slice(0, 18);
|
|
3325
4073
|
const provCol = s.model.providerName.padEnd(12).slice(0, 12);
|
|
3326
|
-
rows.push(/* @__PURE__ */
|
|
4074
|
+
rows.push(/* @__PURE__ */ jsxDEV14("box", {
|
|
3327
4075
|
height: 1,
|
|
3328
4076
|
flexDirection: "row",
|
|
3329
4077
|
paddingLeft: 2,
|
|
3330
4078
|
children: [
|
|
3331
|
-
/* @__PURE__ */
|
|
4079
|
+
/* @__PURE__ */ jsxDEV14("text", {
|
|
3332
4080
|
fg: rankFg,
|
|
3333
4081
|
children: [
|
|
3334
4082
|
badge,
|
|
3335
4083
|
" "
|
|
3336
4084
|
]
|
|
3337
4085
|
}, undefined, true, undefined, this),
|
|
3338
|
-
/* @__PURE__ */
|
|
3339
|
-
fg:
|
|
4086
|
+
/* @__PURE__ */ jsxDEV14("text", {
|
|
4087
|
+
fg: theme.dim,
|
|
3340
4088
|
children: " \u2502 "
|
|
3341
4089
|
}, undefined, false, undefined, this),
|
|
3342
|
-
/* @__PURE__ */
|
|
3343
|
-
fg:
|
|
4090
|
+
/* @__PURE__ */ jsxDEV14("text", {
|
|
4091
|
+
fg: theme.accent,
|
|
3344
4092
|
children: [
|
|
3345
4093
|
tps.toFixed(1).padStart(8),
|
|
3346
4094
|
" tok/s "
|
|
3347
4095
|
]
|
|
3348
4096
|
}, undefined, true, undefined, this),
|
|
3349
|
-
/* @__PURE__ */
|
|
3350
|
-
fg:
|
|
4097
|
+
/* @__PURE__ */ jsxDEV14("text", {
|
|
4098
|
+
fg: theme.dim,
|
|
3351
4099
|
children: " \u2502 "
|
|
3352
4100
|
}, undefined, false, undefined, this),
|
|
3353
|
-
/* @__PURE__ */
|
|
3354
|
-
fg:
|
|
4101
|
+
/* @__PURE__ */ jsxDEV14("text", {
|
|
4102
|
+
fg: theme.secondary,
|
|
3355
4103
|
children: [
|
|
3356
4104
|
timeSec.toFixed(2).padStart(6),
|
|
3357
4105
|
"s "
|
|
3358
4106
|
]
|
|
3359
4107
|
}, undefined, true, undefined, this),
|
|
3360
|
-
/* @__PURE__ */
|
|
3361
|
-
fg:
|
|
4108
|
+
/* @__PURE__ */ jsxDEV14("text", {
|
|
4109
|
+
fg: theme.dim,
|
|
3362
4110
|
children: " \u2502 "
|
|
3363
4111
|
}, undefined, false, undefined, this),
|
|
3364
|
-
/* @__PURE__ */
|
|
3365
|
-
fg:
|
|
4112
|
+
/* @__PURE__ */ jsxDEV14("text", {
|
|
4113
|
+
fg: theme.text,
|
|
3366
4114
|
children: [
|
|
3367
4115
|
modelCol,
|
|
3368
4116
|
" "
|
|
3369
4117
|
]
|
|
3370
4118
|
}, undefined, true, undefined, this),
|
|
3371
|
-
/* @__PURE__ */
|
|
3372
|
-
fg:
|
|
4119
|
+
/* @__PURE__ */ jsxDEV14("text", {
|
|
4120
|
+
fg: theme.dim,
|
|
3373
4121
|
children: [
|
|
3374
4122
|
provCol,
|
|
3375
4123
|
" \u2502 "
|
|
3376
4124
|
]
|
|
3377
4125
|
}, undefined, true, undefined, this),
|
|
3378
|
-
/* @__PURE__ */
|
|
4126
|
+
/* @__PURE__ */ jsxDEV14(BarChart, {
|
|
3379
4127
|
value: tps,
|
|
3380
4128
|
max: maxTps,
|
|
3381
|
-
width:
|
|
3382
|
-
color:
|
|
4129
|
+
width: BAR_W2,
|
|
4130
|
+
color: theme.accent
|
|
3383
4131
|
}, undefined, false, undefined, this)
|
|
3384
4132
|
]
|
|
3385
4133
|
}, `tps-${s.model.id}-${s.model.providerId}`, true, undefined, this));
|
|
3386
4134
|
}
|
|
3387
4135
|
}
|
|
3388
4136
|
if (ttftRanked.length > 0) {
|
|
3389
|
-
rows.push(/* @__PURE__ */
|
|
4137
|
+
rows.push(/* @__PURE__ */ jsxDEV14("box", {
|
|
3390
4138
|
height: 1,
|
|
3391
|
-
backgroundColor:
|
|
4139
|
+
backgroundColor: theme.border
|
|
3392
4140
|
}, "div-ttft", false, undefined, this));
|
|
3393
|
-
rows.push(/* @__PURE__ */
|
|
4141
|
+
rows.push(/* @__PURE__ */ jsxDEV14("box", {
|
|
3394
4142
|
height: 1,
|
|
3395
4143
|
flexDirection: "row",
|
|
3396
4144
|
paddingLeft: 1,
|
|
3397
|
-
children: /* @__PURE__ */
|
|
3398
|
-
fg:
|
|
4145
|
+
children: /* @__PURE__ */ jsxDEV14("text", {
|
|
4146
|
+
fg: theme.primary,
|
|
3399
4147
|
children: " TIME TO FIRST TOKEN RANKING (lower is better) "
|
|
3400
4148
|
}, undefined, false, undefined, this)
|
|
3401
4149
|
}, "hdr-ttft", false, undefined, this));
|
|
3402
4150
|
for (const [i, s] of ttftRanked.entries()) {
|
|
3403
4151
|
const rank = i + 1;
|
|
3404
|
-
const rankFg = rank === 1 ?
|
|
4152
|
+
const rankFg = rank === 1 ? theme.accent : rank === 2 ? theme.secondary : theme.dim;
|
|
3405
4153
|
const ttft = (s.result?.timeToFirstToken ?? 0) / 1000;
|
|
3406
4154
|
const tps = s.result?.tokensPerSecond ?? 0;
|
|
3407
4155
|
const badge = rankBadge(rank).padStart(3);
|
|
3408
4156
|
const modelCol = s.model.name.padEnd(18).slice(0, 18);
|
|
3409
4157
|
const provCol = s.model.providerName.padEnd(12).slice(0, 12);
|
|
3410
|
-
rows.push(/* @__PURE__ */
|
|
4158
|
+
rows.push(/* @__PURE__ */ jsxDEV14("box", {
|
|
3411
4159
|
height: 1,
|
|
3412
4160
|
flexDirection: "row",
|
|
3413
4161
|
paddingLeft: 2,
|
|
3414
4162
|
children: [
|
|
3415
|
-
/* @__PURE__ */
|
|
4163
|
+
/* @__PURE__ */ jsxDEV14("text", {
|
|
3416
4164
|
fg: rankFg,
|
|
3417
4165
|
children: [
|
|
3418
4166
|
badge,
|
|
3419
4167
|
" "
|
|
3420
4168
|
]
|
|
3421
4169
|
}, undefined, true, undefined, this),
|
|
3422
|
-
/* @__PURE__ */
|
|
3423
|
-
fg:
|
|
4170
|
+
/* @__PURE__ */ jsxDEV14("text", {
|
|
4171
|
+
fg: theme.dim,
|
|
3424
4172
|
children: " \u2502 "
|
|
3425
4173
|
}, undefined, false, undefined, this),
|
|
3426
|
-
/* @__PURE__ */
|
|
3427
|
-
fg:
|
|
4174
|
+
/* @__PURE__ */ jsxDEV14("text", {
|
|
4175
|
+
fg: theme.secondary,
|
|
3428
4176
|
children: [
|
|
3429
4177
|
ttft.toFixed(2).padStart(7),
|
|
3430
4178
|
"s "
|
|
3431
4179
|
]
|
|
3432
4180
|
}, undefined, true, undefined, this),
|
|
3433
|
-
/* @__PURE__ */
|
|
3434
|
-
fg:
|
|
4181
|
+
/* @__PURE__ */ jsxDEV14("text", {
|
|
4182
|
+
fg: theme.dim,
|
|
3435
4183
|
children: " \u2502 "
|
|
3436
4184
|
}, undefined, false, undefined, this),
|
|
3437
|
-
/* @__PURE__ */
|
|
3438
|
-
fg:
|
|
4185
|
+
/* @__PURE__ */ jsxDEV14("text", {
|
|
4186
|
+
fg: theme.accent,
|
|
3439
4187
|
children: [
|
|
3440
4188
|
tps.toFixed(1).padStart(8),
|
|
3441
4189
|
" tok/s "
|
|
3442
4190
|
]
|
|
3443
4191
|
}, undefined, true, undefined, this),
|
|
3444
|
-
/* @__PURE__ */
|
|
3445
|
-
fg:
|
|
4192
|
+
/* @__PURE__ */ jsxDEV14("text", {
|
|
4193
|
+
fg: theme.dim,
|
|
3446
4194
|
children: " \u2502 "
|
|
3447
4195
|
}, undefined, false, undefined, this),
|
|
3448
|
-
/* @__PURE__ */
|
|
3449
|
-
fg:
|
|
4196
|
+
/* @__PURE__ */ jsxDEV14("text", {
|
|
4197
|
+
fg: theme.text,
|
|
3450
4198
|
children: [
|
|
3451
4199
|
modelCol,
|
|
3452
4200
|
" "
|
|
3453
4201
|
]
|
|
3454
4202
|
}, undefined, true, undefined, this),
|
|
3455
|
-
/* @__PURE__ */
|
|
3456
|
-
fg:
|
|
4203
|
+
/* @__PURE__ */ jsxDEV14("text", {
|
|
4204
|
+
fg: theme.dim,
|
|
3457
4205
|
children: [
|
|
3458
4206
|
provCol,
|
|
3459
4207
|
" \u2502 "
|
|
3460
4208
|
]
|
|
3461
4209
|
}, undefined, true, undefined, this),
|
|
3462
|
-
/* @__PURE__ */
|
|
4210
|
+
/* @__PURE__ */ jsxDEV14(BarChart, {
|
|
3463
4211
|
value: ttft,
|
|
3464
4212
|
max: maxTtftForBar,
|
|
3465
|
-
width:
|
|
3466
|
-
color:
|
|
4213
|
+
width: BAR_W2,
|
|
4214
|
+
color: theme.secondary
|
|
3467
4215
|
}, undefined, false, undefined, this)
|
|
3468
4216
|
]
|
|
3469
4217
|
}, `ttft-${s.model.id}-${s.model.providerId}`, true, undefined, this));
|
|
3470
4218
|
}
|
|
3471
4219
|
}
|
|
3472
4220
|
if (allDone && errors.length > 0) {
|
|
3473
|
-
rows.push(/* @__PURE__ */
|
|
4221
|
+
rows.push(/* @__PURE__ */ jsxDEV14("box", {
|
|
3474
4222
|
height: 1,
|
|
3475
|
-
backgroundColor:
|
|
4223
|
+
backgroundColor: theme.border
|
|
3476
4224
|
}, "div-errors", false, undefined, this));
|
|
3477
|
-
rows.push(/* @__PURE__ */
|
|
4225
|
+
rows.push(/* @__PURE__ */ jsxDEV14("box", {
|
|
3478
4226
|
height: 1,
|
|
3479
4227
|
flexDirection: "row",
|
|
3480
4228
|
paddingLeft: 1,
|
|
3481
|
-
children: /* @__PURE__ */
|
|
3482
|
-
fg:
|
|
4229
|
+
children: /* @__PURE__ */ jsxDEV14("text", {
|
|
4230
|
+
fg: theme.error,
|
|
3483
4231
|
children: [
|
|
3484
4232
|
" FAILED (",
|
|
3485
4233
|
errors.length,
|
|
@@ -3488,29 +4236,29 @@ function BenchmarkScreen() {
|
|
|
3488
4236
|
}, undefined, true, undefined, this)
|
|
3489
4237
|
}, "hdr-errors", false, undefined, this));
|
|
3490
4238
|
for (const s of errors) {
|
|
3491
|
-
rows.push(/* @__PURE__ */
|
|
4239
|
+
rows.push(/* @__PURE__ */ jsxDEV14("box", {
|
|
3492
4240
|
flexDirection: "column",
|
|
3493
4241
|
paddingLeft: 2,
|
|
3494
4242
|
paddingTop: 1,
|
|
3495
4243
|
paddingBottom: 1,
|
|
3496
4244
|
children: [
|
|
3497
|
-
/* @__PURE__ */
|
|
4245
|
+
/* @__PURE__ */ jsxDEV14("box", {
|
|
3498
4246
|
height: 1,
|
|
3499
4247
|
flexDirection: "row",
|
|
3500
4248
|
children: [
|
|
3501
|
-
/* @__PURE__ */
|
|
3502
|
-
fg:
|
|
4249
|
+
/* @__PURE__ */ jsxDEV14("text", {
|
|
4250
|
+
fg: theme.error,
|
|
3503
4251
|
children: "\u2717 "
|
|
3504
4252
|
}, undefined, false, undefined, this),
|
|
3505
|
-
/* @__PURE__ */
|
|
3506
|
-
fg:
|
|
4253
|
+
/* @__PURE__ */ jsxDEV14("text", {
|
|
4254
|
+
fg: theme.text,
|
|
3507
4255
|
children: [
|
|
3508
4256
|
s.model.name,
|
|
3509
4257
|
" "
|
|
3510
4258
|
]
|
|
3511
4259
|
}, undefined, true, undefined, this),
|
|
3512
|
-
/* @__PURE__ */
|
|
3513
|
-
fg:
|
|
4260
|
+
/* @__PURE__ */ jsxDEV14("text", {
|
|
4261
|
+
fg: theme.dim,
|
|
3514
4262
|
children: [
|
|
3515
4263
|
"(",
|
|
3516
4264
|
s.model.providerName,
|
|
@@ -3519,11 +4267,11 @@ function BenchmarkScreen() {
|
|
|
3519
4267
|
}, undefined, true, undefined, this)
|
|
3520
4268
|
]
|
|
3521
4269
|
}, undefined, true, undefined, this),
|
|
3522
|
-
/* @__PURE__ */
|
|
4270
|
+
/* @__PURE__ */ jsxDEV14("box", {
|
|
3523
4271
|
height: 1,
|
|
3524
4272
|
paddingLeft: 3,
|
|
3525
|
-
children: /* @__PURE__ */
|
|
3526
|
-
fg:
|
|
4273
|
+
children: /* @__PURE__ */ jsxDEV14("text", {
|
|
4274
|
+
fg: theme.error,
|
|
3527
4275
|
children: s.error ?? "Unknown error"
|
|
3528
4276
|
}, undefined, false, undefined, this)
|
|
3529
4277
|
}, undefined, false, undefined, this)
|
|
@@ -3531,40 +4279,40 @@ function BenchmarkScreen() {
|
|
|
3531
4279
|
}, `err-${s.model.id}-${s.model.providerId}`, true, undefined, this));
|
|
3532
4280
|
}
|
|
3533
4281
|
}
|
|
3534
|
-
rows.push(/* @__PURE__ */
|
|
4282
|
+
rows.push(/* @__PURE__ */ jsxDEV14("box", {
|
|
3535
4283
|
height: 1,
|
|
3536
|
-
backgroundColor:
|
|
4284
|
+
backgroundColor: theme.border
|
|
3537
4285
|
}, "div-results", false, undefined, this));
|
|
3538
|
-
rows.push(/* @__PURE__ */
|
|
4286
|
+
rows.push(/* @__PURE__ */ jsxDEV14("box", {
|
|
3539
4287
|
height: 1,
|
|
3540
4288
|
flexDirection: "row",
|
|
3541
4289
|
paddingLeft: 1,
|
|
3542
|
-
children: /* @__PURE__ */
|
|
3543
|
-
fg:
|
|
4290
|
+
children: /* @__PURE__ */ jsxDEV14("text", {
|
|
4291
|
+
fg: theme.primary,
|
|
3544
4292
|
children: " RESULTS "
|
|
3545
4293
|
}, undefined, false, undefined, this)
|
|
3546
4294
|
}, "hdr-results", false, undefined, this));
|
|
3547
4295
|
if (doneResults.length > 0) {
|
|
3548
|
-
rows.push(/* @__PURE__ */
|
|
4296
|
+
rows.push(/* @__PURE__ */ jsxDEV14("box", {
|
|
3549
4297
|
flexDirection: "column",
|
|
3550
|
-
children: /* @__PURE__ */
|
|
4298
|
+
children: /* @__PURE__ */ jsxDEV14(ResultsTable, {
|
|
3551
4299
|
results: doneResults,
|
|
3552
4300
|
pendingCount
|
|
3553
4301
|
}, undefined, false, undefined, this)
|
|
3554
4302
|
}, "results-table", false, undefined, this));
|
|
3555
4303
|
} else {
|
|
3556
|
-
rows.push(/* @__PURE__ */
|
|
4304
|
+
rows.push(/* @__PURE__ */ jsxDEV14("box", {
|
|
3557
4305
|
paddingLeft: 2,
|
|
3558
4306
|
paddingBottom: 1,
|
|
3559
|
-
children: /* @__PURE__ */
|
|
3560
|
-
fg:
|
|
4307
|
+
children: /* @__PURE__ */ jsxDEV14("text", {
|
|
4308
|
+
fg: theme.dim,
|
|
3561
4309
|
children: "No results yet..."
|
|
3562
4310
|
}, undefined, false, undefined, this)
|
|
3563
4311
|
}, "results-empty", false, undefined, this));
|
|
3564
4312
|
}
|
|
3565
4313
|
return rows;
|
|
3566
|
-
}, [modelStates, allDone,
|
|
3567
|
-
|
|
4314
|
+
}, [modelStates, allDone, tpsRanked, ttftRanked, doneResults, pendingCount, maxTps, maxTtftForBar, theme]);
|
|
4315
|
+
useAppKeyboard((key) => {
|
|
3568
4316
|
if (!allDone)
|
|
3569
4317
|
return;
|
|
3570
4318
|
if (key.name === "q" || key.name === "return" || key.name === "enter") {
|
|
@@ -3572,94 +4320,97 @@ function BenchmarkScreen() {
|
|
|
3572
4320
|
navigate("main-menu");
|
|
3573
4321
|
}
|
|
3574
4322
|
});
|
|
3575
|
-
const statusLine = allDone ? /* @__PURE__ */
|
|
4323
|
+
const statusLine = allDone ? /* @__PURE__ */ jsxDEV14("box", {
|
|
3576
4324
|
flexDirection: "row",
|
|
3577
4325
|
children: [
|
|
3578
|
-
/* @__PURE__ */
|
|
3579
|
-
fg:
|
|
4326
|
+
/* @__PURE__ */ jsxDEV14("text", {
|
|
4327
|
+
fg: theme.success,
|
|
3580
4328
|
children: "All done! [Enter]/[Q] return [\u2191\u2193/PgUp/PgDn/wheel] scroll"
|
|
3581
4329
|
}, undefined, false, undefined, this),
|
|
3582
|
-
state.logMode && state.logPath && /* @__PURE__ */
|
|
3583
|
-
fg:
|
|
4330
|
+
state.logMode && state.logPath && /* @__PURE__ */ jsxDEV14("text", {
|
|
4331
|
+
fg: theme.dim,
|
|
3584
4332
|
children: [
|
|
3585
4333
|
" log: ",
|
|
3586
4334
|
state.logPath
|
|
3587
4335
|
]
|
|
3588
4336
|
}, undefined, true, undefined, this)
|
|
3589
4337
|
]
|
|
3590
|
-
}, undefined, true, undefined, this) : /* @__PURE__ */
|
|
4338
|
+
}, undefined, true, undefined, this) : /* @__PURE__ */ jsxDEV14("box", {
|
|
3591
4339
|
flexDirection: "row",
|
|
3592
4340
|
children: [
|
|
3593
|
-
running.length > 0 && /* @__PURE__ */
|
|
3594
|
-
fg:
|
|
4341
|
+
running.length > 0 && /* @__PURE__ */ jsxDEV14("text", {
|
|
4342
|
+
fg: theme.warning,
|
|
3595
4343
|
children: [
|
|
3596
4344
|
running.length,
|
|
3597
4345
|
" running "
|
|
3598
4346
|
]
|
|
3599
4347
|
}, undefined, true, undefined, this),
|
|
3600
|
-
done.length > 0 && /* @__PURE__ */
|
|
3601
|
-
fg:
|
|
4348
|
+
done.length > 0 && /* @__PURE__ */ jsxDEV14("text", {
|
|
4349
|
+
fg: theme.success,
|
|
3602
4350
|
children: [
|
|
3603
4351
|
done.length,
|
|
3604
4352
|
" done "
|
|
3605
4353
|
]
|
|
3606
4354
|
}, undefined, true, undefined, this),
|
|
3607
|
-
errors.length > 0 && /* @__PURE__ */
|
|
3608
|
-
fg:
|
|
4355
|
+
errors.length > 0 && /* @__PURE__ */ jsxDEV14("text", {
|
|
4356
|
+
fg: theme.error,
|
|
3609
4357
|
children: [
|
|
3610
4358
|
errors.length,
|
|
3611
4359
|
" errors "
|
|
3612
4360
|
]
|
|
3613
4361
|
}, undefined, true, undefined, this),
|
|
3614
|
-
/* @__PURE__ */
|
|
3615
|
-
fg:
|
|
4362
|
+
/* @__PURE__ */ jsxDEV14("text", {
|
|
4363
|
+
fg: theme.dim,
|
|
3616
4364
|
children: "[\u2191\u2193/wheel] scroll"
|
|
3617
4365
|
}, undefined, false, undefined, this)
|
|
3618
4366
|
]
|
|
3619
4367
|
}, undefined, true, undefined, this);
|
|
3620
|
-
return /* @__PURE__ */
|
|
4368
|
+
return /* @__PURE__ */ jsxDEV14("box", {
|
|
3621
4369
|
flexDirection: "column",
|
|
3622
4370
|
flexGrow: 1,
|
|
3623
4371
|
padding: 1,
|
|
3624
4372
|
children: [
|
|
3625
|
-
/* @__PURE__ */
|
|
4373
|
+
/* @__PURE__ */ jsxDEV14("box", {
|
|
3626
4374
|
alignItems: "center",
|
|
3627
4375
|
justifyContent: "center",
|
|
3628
4376
|
marginBottom: 1,
|
|
3629
|
-
children: /* @__PURE__ */
|
|
4377
|
+
children: /* @__PURE__ */ jsxDEV14("ascii-font", {
|
|
3630
4378
|
text: "AI-SPEEDOMETER",
|
|
3631
4379
|
font: "tiny",
|
|
3632
|
-
color:
|
|
4380
|
+
color: theme.primary
|
|
3633
4381
|
}, undefined, false, undefined, this)
|
|
3634
4382
|
}, undefined, false, undefined, this),
|
|
3635
|
-
/* @__PURE__ */
|
|
4383
|
+
/* @__PURE__ */ jsxDEV14("box", {
|
|
3636
4384
|
flexDirection: "column",
|
|
3637
4385
|
border: true,
|
|
3638
4386
|
borderStyle: "rounded",
|
|
3639
|
-
borderColor:
|
|
3640
|
-
backgroundColor:
|
|
4387
|
+
borderColor: theme.border,
|
|
4388
|
+
backgroundColor: theme.background,
|
|
3641
4389
|
flexGrow: 1,
|
|
3642
4390
|
children: [
|
|
3643
|
-
/* @__PURE__ */
|
|
4391
|
+
/* @__PURE__ */ jsxDEV14("box", {
|
|
3644
4392
|
height: 1,
|
|
3645
4393
|
paddingLeft: 2,
|
|
3646
4394
|
paddingRight: 2,
|
|
3647
4395
|
flexDirection: "row",
|
|
3648
4396
|
children: [
|
|
3649
|
-
/* @__PURE__ */
|
|
3650
|
-
fg:
|
|
4397
|
+
/* @__PURE__ */ jsxDEV14("text", {
|
|
4398
|
+
fg: theme.accent,
|
|
3651
4399
|
children: "LIVE BENCHMARK "
|
|
3652
4400
|
}, undefined, false, undefined, this),
|
|
3653
4401
|
statusLine
|
|
3654
4402
|
]
|
|
3655
4403
|
}, undefined, true, undefined, this),
|
|
3656
|
-
/* @__PURE__ */
|
|
3657
|
-
|
|
4404
|
+
/* @__PURE__ */ jsxDEV14("box", {
|
|
4405
|
+
height: 1,
|
|
4406
|
+
backgroundColor: theme.border
|
|
4407
|
+
}, undefined, false, undefined, this),
|
|
4408
|
+
/* @__PURE__ */ jsxDEV14("scrollbox", {
|
|
3658
4409
|
focused: true,
|
|
3659
4410
|
flexGrow: 1,
|
|
3660
4411
|
stickyScroll: true,
|
|
3661
4412
|
stickyStart: "bottom",
|
|
3662
|
-
style: { scrollbarOptions: { showArrows: true, trackOptions: { foregroundColor:
|
|
4413
|
+
style: { scrollbarOptions: { showArrows: true, trackOptions: { foregroundColor: theme.primary, backgroundColor: theme.border } } },
|
|
3663
4414
|
children: allRows
|
|
3664
4415
|
}, undefined, false, undefined, this)
|
|
3665
4416
|
]
|
|
@@ -3667,36 +4418,40 @@ function BenchmarkScreen() {
|
|
|
3667
4418
|
]
|
|
3668
4419
|
}, undefined, true, undefined, this);
|
|
3669
4420
|
}
|
|
3670
|
-
var
|
|
4421
|
+
var BAR_W2 = 25;
|
|
3671
4422
|
var init_BenchmarkScreen = __esm(() => {
|
|
4423
|
+
init_useAppKeyboard();
|
|
3672
4424
|
init_AppContext();
|
|
4425
|
+
init_ThemeContext();
|
|
3673
4426
|
init_BarChart();
|
|
4427
|
+
init_GlowBar();
|
|
3674
4428
|
init_ResultsTable();
|
|
3675
4429
|
});
|
|
3676
4430
|
|
|
3677
4431
|
// src/tui/screens/AddVerifiedScreen.tsx
|
|
3678
|
-
import { useState as
|
|
3679
|
-
import {
|
|
3680
|
-
import { jsxDEV as
|
|
4432
|
+
import { useState as useState9, useEffect as useEffect7, useRef as useRef5 } from "react";
|
|
4433
|
+
import { useTerminalDimensions as useTerminalDimensions2 } from "@opentui/react";
|
|
4434
|
+
import { jsxDEV as jsxDEV15 } from "@opentui/react/jsx-dev-runtime";
|
|
3681
4435
|
function AddVerifiedScreen() {
|
|
3682
4436
|
const { dispatch } = useAppContext();
|
|
3683
4437
|
const navigate = useNavigate();
|
|
4438
|
+
const theme = useTheme();
|
|
3684
4439
|
const { height, width } = useTerminalDimensions2();
|
|
3685
4440
|
const PAGE_SIZE = Math.max(3, height - 16);
|
|
3686
4441
|
const CARD_W = Math.min(62, width - 4);
|
|
3687
|
-
const [step, setStep] =
|
|
3688
|
-
const [allProviders, setAllProviders] =
|
|
3689
|
-
const [filtered, setFiltered] =
|
|
3690
|
-
const [cursor, setCursor] =
|
|
3691
|
-
const [searchQuery, setSearchQuery] =
|
|
3692
|
-
const scrollboxRef =
|
|
3693
|
-
const [selectedProvider, setSelectedProvider] =
|
|
3694
|
-
const [apiKey, setApiKey] =
|
|
3695
|
-
const [saving, setSaving] =
|
|
3696
|
-
const [saveError, setSaveError] =
|
|
3697
|
-
const [saveSuccess, setSaveSuccess] =
|
|
3698
|
-
const [loadError, setLoadError] =
|
|
3699
|
-
|
|
4442
|
+
const [step, setStep] = useState9("browse");
|
|
4443
|
+
const [allProviders, setAllProviders] = useState9([]);
|
|
4444
|
+
const [filtered, setFiltered] = useState9([]);
|
|
4445
|
+
const [cursor, setCursor] = useState9(0);
|
|
4446
|
+
const [searchQuery, setSearchQuery] = useState9("");
|
|
4447
|
+
const scrollboxRef = useRef5(null);
|
|
4448
|
+
const [selectedProvider, setSelectedProvider] = useState9(null);
|
|
4449
|
+
const [apiKey, setApiKey] = useState9("");
|
|
4450
|
+
const [saving, setSaving] = useState9(false);
|
|
4451
|
+
const [saveError, setSaveError] = useState9("");
|
|
4452
|
+
const [saveSuccess, setSaveSuccess] = useState9(false);
|
|
4453
|
+
const [loadError, setLoadError] = useState9("");
|
|
4454
|
+
useEffect7(() => {
|
|
3700
4455
|
async function load() {
|
|
3701
4456
|
try {
|
|
3702
4457
|
const { getAllProviders: getAllProviders2 } = await Promise.resolve().then(() => (init_models_dev(), exports_models_dev));
|
|
@@ -3709,7 +4464,7 @@ function AddVerifiedScreen() {
|
|
|
3709
4464
|
}
|
|
3710
4465
|
load();
|
|
3711
4466
|
}, []);
|
|
3712
|
-
|
|
4467
|
+
useEffect7(() => {
|
|
3713
4468
|
if (!searchQuery) {
|
|
3714
4469
|
setFiltered(allProviders);
|
|
3715
4470
|
} else {
|
|
@@ -3718,7 +4473,7 @@ function AddVerifiedScreen() {
|
|
|
3718
4473
|
}
|
|
3719
4474
|
setCursor(0);
|
|
3720
4475
|
}, [searchQuery, allProviders]);
|
|
3721
|
-
|
|
4476
|
+
useEffect7(() => {
|
|
3722
4477
|
const sb = scrollboxRef.current;
|
|
3723
4478
|
if (!sb)
|
|
3724
4479
|
return;
|
|
@@ -3737,7 +4492,7 @@ function AddVerifiedScreen() {
|
|
|
3737
4492
|
setSaveError("");
|
|
3738
4493
|
try {
|
|
3739
4494
|
const { addApiKey: addApiKey2 } = await Promise.resolve().then(() => (init_opencode_integration(), exports_opencode_integration));
|
|
3740
|
-
const { addVerifiedProvider: addVerifiedProvider2
|
|
4495
|
+
const { addVerifiedProvider: addVerifiedProvider2 } = await Promise.resolve().then(() => (init_ai_config(), exports_ai_config));
|
|
3741
4496
|
await addApiKey2(selectedProvider.id, apiKey.trim());
|
|
3742
4497
|
await addVerifiedProvider2(selectedProvider.id, apiKey.trim());
|
|
3743
4498
|
const { getAllAvailableProviders: getAllAvailableProviders2 } = await Promise.resolve().then(() => (init_opencode_integration(), exports_opencode_integration));
|
|
@@ -3757,7 +4512,7 @@ function AddVerifiedScreen() {
|
|
|
3757
4512
|
else if (step === "confirm")
|
|
3758
4513
|
setApiKey((k) => k + clean);
|
|
3759
4514
|
});
|
|
3760
|
-
|
|
4515
|
+
useAppKeyboard((key) => {
|
|
3761
4516
|
if (step === "browse") {
|
|
3762
4517
|
if (key.name === "escape" || key.sequence === "q" || key.sequence === "Q") {
|
|
3763
4518
|
navigate("model-menu");
|
|
@@ -3801,9 +4556,8 @@ function AddVerifiedScreen() {
|
|
|
3801
4556
|
}
|
|
3802
4557
|
if (step === "confirm") {
|
|
3803
4558
|
if (saveSuccess) {
|
|
3804
|
-
if (key.name === "return" || key.name === "enter")
|
|
4559
|
+
if (key.name === "return" || key.name === "enter")
|
|
3805
4560
|
navigate("model-menu");
|
|
3806
|
-
}
|
|
3807
4561
|
return;
|
|
3808
4562
|
}
|
|
3809
4563
|
if (saving)
|
|
@@ -3826,91 +4580,91 @@ function AddVerifiedScreen() {
|
|
|
3826
4580
|
}
|
|
3827
4581
|
});
|
|
3828
4582
|
if (step === "confirm" && selectedProvider) {
|
|
3829
|
-
return /* @__PURE__ */
|
|
4583
|
+
return /* @__PURE__ */ jsxDEV15("box", {
|
|
3830
4584
|
flexDirection: "column",
|
|
3831
4585
|
flexGrow: 1,
|
|
3832
4586
|
alignItems: "center",
|
|
3833
4587
|
justifyContent: "center",
|
|
3834
|
-
children: /* @__PURE__ */
|
|
4588
|
+
children: /* @__PURE__ */ jsxDEV15("box", {
|
|
3835
4589
|
flexDirection: "column",
|
|
3836
4590
|
border: true,
|
|
3837
4591
|
borderStyle: "rounded",
|
|
3838
|
-
borderColor:
|
|
3839
|
-
backgroundColor:
|
|
4592
|
+
borderColor: theme.border,
|
|
4593
|
+
backgroundColor: theme.background,
|
|
3840
4594
|
width: CARD_W,
|
|
3841
4595
|
children: [
|
|
3842
|
-
/* @__PURE__ */
|
|
4596
|
+
/* @__PURE__ */ jsxDEV15("box", {
|
|
3843
4597
|
height: 1,
|
|
3844
4598
|
paddingLeft: 2,
|
|
3845
4599
|
paddingTop: 1,
|
|
3846
|
-
children: /* @__PURE__ */
|
|
3847
|
-
fg:
|
|
4600
|
+
children: /* @__PURE__ */ jsxDEV15("text", {
|
|
4601
|
+
fg: theme.accent,
|
|
3848
4602
|
children: "Add Verified Provider"
|
|
3849
4603
|
}, undefined, false, undefined, this)
|
|
3850
4604
|
}, undefined, false, undefined, this),
|
|
3851
|
-
/* @__PURE__ */
|
|
4605
|
+
/* @__PURE__ */ jsxDEV15("box", {
|
|
3852
4606
|
height: 1,
|
|
3853
|
-
backgroundColor:
|
|
4607
|
+
backgroundColor: theme.border
|
|
3854
4608
|
}, undefined, false, undefined, this),
|
|
3855
|
-
/* @__PURE__ */
|
|
4609
|
+
/* @__PURE__ */ jsxDEV15("box", {
|
|
3856
4610
|
flexDirection: "column",
|
|
3857
4611
|
paddingLeft: 2,
|
|
3858
4612
|
paddingRight: 2,
|
|
3859
4613
|
paddingTop: 1,
|
|
3860
4614
|
paddingBottom: 1,
|
|
3861
4615
|
children: [
|
|
3862
|
-
/* @__PURE__ */
|
|
4616
|
+
/* @__PURE__ */ jsxDEV15("box", {
|
|
3863
4617
|
height: 1,
|
|
3864
4618
|
flexDirection: "row",
|
|
3865
4619
|
children: [
|
|
3866
|
-
/* @__PURE__ */
|
|
3867
|
-
fg:
|
|
4620
|
+
/* @__PURE__ */ jsxDEV15("text", {
|
|
4621
|
+
fg: theme.primary,
|
|
3868
4622
|
children: "Provider: "
|
|
3869
4623
|
}, undefined, false, undefined, this),
|
|
3870
|
-
/* @__PURE__ */
|
|
3871
|
-
fg:
|
|
4624
|
+
/* @__PURE__ */ jsxDEV15("text", {
|
|
4625
|
+
fg: theme.text,
|
|
3872
4626
|
children: selectedProvider.name
|
|
3873
4627
|
}, undefined, false, undefined, this)
|
|
3874
4628
|
]
|
|
3875
4629
|
}, undefined, true, undefined, this),
|
|
3876
|
-
/* @__PURE__ */
|
|
4630
|
+
/* @__PURE__ */ jsxDEV15("box", {
|
|
3877
4631
|
height: 1,
|
|
3878
4632
|
flexDirection: "row",
|
|
3879
4633
|
children: [
|
|
3880
|
-
/* @__PURE__ */
|
|
3881
|
-
fg:
|
|
4634
|
+
/* @__PURE__ */ jsxDEV15("text", {
|
|
4635
|
+
fg: theme.dim,
|
|
3882
4636
|
children: "Type: "
|
|
3883
4637
|
}, undefined, false, undefined, this),
|
|
3884
|
-
/* @__PURE__ */
|
|
3885
|
-
fg:
|
|
4638
|
+
/* @__PURE__ */ jsxDEV15("text", {
|
|
4639
|
+
fg: theme.dim,
|
|
3886
4640
|
children: selectedProvider.type
|
|
3887
4641
|
}, undefined, false, undefined, this)
|
|
3888
4642
|
]
|
|
3889
4643
|
}, undefined, true, undefined, this),
|
|
3890
|
-
/* @__PURE__ */
|
|
4644
|
+
/* @__PURE__ */ jsxDEV15("box", {
|
|
3891
4645
|
height: 1,
|
|
3892
4646
|
flexDirection: "row",
|
|
3893
4647
|
children: [
|
|
3894
|
-
/* @__PURE__ */
|
|
3895
|
-
fg:
|
|
4648
|
+
/* @__PURE__ */ jsxDEV15("text", {
|
|
4649
|
+
fg: theme.dim,
|
|
3896
4650
|
children: "URL: "
|
|
3897
4651
|
}, undefined, false, undefined, this),
|
|
3898
|
-
/* @__PURE__ */
|
|
3899
|
-
fg:
|
|
4652
|
+
/* @__PURE__ */ jsxDEV15("text", {
|
|
4653
|
+
fg: theme.dim,
|
|
3900
4654
|
children: selectedProvider.baseUrl
|
|
3901
4655
|
}, undefined, false, undefined, this)
|
|
3902
4656
|
]
|
|
3903
4657
|
}, undefined, true, undefined, this),
|
|
3904
|
-
/* @__PURE__ */
|
|
4658
|
+
/* @__PURE__ */ jsxDEV15("box", {
|
|
3905
4659
|
height: 1,
|
|
3906
4660
|
flexDirection: "row",
|
|
3907
4661
|
children: [
|
|
3908
|
-
/* @__PURE__ */
|
|
3909
|
-
fg:
|
|
4662
|
+
/* @__PURE__ */ jsxDEV15("text", {
|
|
4663
|
+
fg: theme.dim,
|
|
3910
4664
|
children: "Models: "
|
|
3911
4665
|
}, undefined, false, undefined, this),
|
|
3912
|
-
/* @__PURE__ */
|
|
3913
|
-
fg:
|
|
4666
|
+
/* @__PURE__ */ jsxDEV15("text", {
|
|
4667
|
+
fg: theme.dim,
|
|
3914
4668
|
children: [
|
|
3915
4669
|
selectedProvider.models.length,
|
|
3916
4670
|
" available"
|
|
@@ -3920,21 +4674,21 @@ function AddVerifiedScreen() {
|
|
|
3920
4674
|
}, undefined, true, undefined, this)
|
|
3921
4675
|
]
|
|
3922
4676
|
}, undefined, true, undefined, this),
|
|
3923
|
-
/* @__PURE__ */
|
|
4677
|
+
/* @__PURE__ */ jsxDEV15("box", {
|
|
3924
4678
|
height: 1,
|
|
3925
|
-
backgroundColor:
|
|
4679
|
+
backgroundColor: theme.border
|
|
3926
4680
|
}, undefined, false, undefined, this),
|
|
3927
|
-
saveSuccess ? /* @__PURE__ */
|
|
4681
|
+
saveSuccess ? /* @__PURE__ */ jsxDEV15("box", {
|
|
3928
4682
|
flexDirection: "column",
|
|
3929
4683
|
paddingLeft: 2,
|
|
3930
4684
|
paddingRight: 2,
|
|
3931
4685
|
paddingTop: 1,
|
|
3932
4686
|
paddingBottom: 1,
|
|
3933
4687
|
children: [
|
|
3934
|
-
/* @__PURE__ */
|
|
4688
|
+
/* @__PURE__ */ jsxDEV15("box", {
|
|
3935
4689
|
height: 1,
|
|
3936
|
-
children: /* @__PURE__ */
|
|
3937
|
-
fg:
|
|
4690
|
+
children: /* @__PURE__ */ jsxDEV15("text", {
|
|
4691
|
+
fg: theme.success,
|
|
3938
4692
|
children: [
|
|
3939
4693
|
"Provider added! ",
|
|
3940
4694
|
selectedProvider.models.length,
|
|
@@ -3942,31 +4696,31 @@ function AddVerifiedScreen() {
|
|
|
3942
4696
|
]
|
|
3943
4697
|
}, undefined, true, undefined, this)
|
|
3944
4698
|
}, undefined, false, undefined, this),
|
|
3945
|
-
/* @__PURE__ */
|
|
4699
|
+
/* @__PURE__ */ jsxDEV15("box", {
|
|
3946
4700
|
height: 1,
|
|
3947
|
-
children: /* @__PURE__ */
|
|
3948
|
-
fg:
|
|
4701
|
+
children: /* @__PURE__ */ jsxDEV15("text", {
|
|
4702
|
+
fg: theme.dim,
|
|
3949
4703
|
children: "Press [Enter] to return"
|
|
3950
4704
|
}, undefined, false, undefined, this)
|
|
3951
4705
|
}, undefined, false, undefined, this)
|
|
3952
4706
|
]
|
|
3953
|
-
}, undefined, true, undefined, this) : /* @__PURE__ */
|
|
4707
|
+
}, undefined, true, undefined, this) : /* @__PURE__ */ jsxDEV15("box", {
|
|
3954
4708
|
flexDirection: "column",
|
|
3955
4709
|
paddingLeft: 2,
|
|
3956
4710
|
paddingRight: 2,
|
|
3957
4711
|
paddingTop: 1,
|
|
3958
4712
|
paddingBottom: 1,
|
|
3959
4713
|
children: [
|
|
3960
|
-
/* @__PURE__ */
|
|
4714
|
+
/* @__PURE__ */ jsxDEV15("box", {
|
|
3961
4715
|
height: 1,
|
|
3962
4716
|
flexDirection: "row",
|
|
3963
4717
|
children: [
|
|
3964
|
-
/* @__PURE__ */
|
|
3965
|
-
fg:
|
|
4718
|
+
/* @__PURE__ */ jsxDEV15("text", {
|
|
4719
|
+
fg: theme.accent,
|
|
3966
4720
|
children: "API Key: "
|
|
3967
4721
|
}, undefined, false, undefined, this),
|
|
3968
|
-
/* @__PURE__ */
|
|
3969
|
-
fg:
|
|
4722
|
+
/* @__PURE__ */ jsxDEV15("text", {
|
|
4723
|
+
fg: theme.text,
|
|
3970
4724
|
children: [
|
|
3971
4725
|
apiKey,
|
|
3972
4726
|
"_"
|
|
@@ -3974,26 +4728,26 @@ function AddVerifiedScreen() {
|
|
|
3974
4728
|
}, undefined, true, undefined, this)
|
|
3975
4729
|
]
|
|
3976
4730
|
}, undefined, true, undefined, this),
|
|
3977
|
-
saveError ? /* @__PURE__ */
|
|
4731
|
+
saveError ? /* @__PURE__ */ jsxDEV15("box", {
|
|
3978
4732
|
height: 1,
|
|
3979
|
-
children: /* @__PURE__ */
|
|
3980
|
-
fg:
|
|
4733
|
+
children: /* @__PURE__ */ jsxDEV15("text", {
|
|
4734
|
+
fg: theme.error,
|
|
3981
4735
|
children: [
|
|
3982
4736
|
"Error: ",
|
|
3983
4737
|
saveError
|
|
3984
4738
|
]
|
|
3985
4739
|
}, undefined, true, undefined, this)
|
|
3986
4740
|
}, undefined, false, undefined, this) : null,
|
|
3987
|
-
saving ? /* @__PURE__ */
|
|
4741
|
+
saving ? /* @__PURE__ */ jsxDEV15("box", {
|
|
3988
4742
|
height: 1,
|
|
3989
|
-
children: /* @__PURE__ */
|
|
3990
|
-
fg:
|
|
4743
|
+
children: /* @__PURE__ */ jsxDEV15("text", {
|
|
4744
|
+
fg: theme.warning,
|
|
3991
4745
|
children: "Saving..."
|
|
3992
4746
|
}, undefined, false, undefined, this)
|
|
3993
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */
|
|
4747
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV15("box", {
|
|
3994
4748
|
height: 1,
|
|
3995
|
-
children: /* @__PURE__ */
|
|
3996
|
-
fg:
|
|
4749
|
+
children: /* @__PURE__ */ jsxDEV15("text", {
|
|
4750
|
+
fg: theme.dim,
|
|
3997
4751
|
children: "[Enter] save [Esc] back to list"
|
|
3998
4752
|
}, undefined, false, undefined, this)
|
|
3999
4753
|
}, undefined, false, undefined, this)
|
|
@@ -4003,32 +4757,32 @@ function AddVerifiedScreen() {
|
|
|
4003
4757
|
}, undefined, true, undefined, this)
|
|
4004
4758
|
}, undefined, false, undefined, this);
|
|
4005
4759
|
}
|
|
4006
|
-
return /* @__PURE__ */
|
|
4760
|
+
return /* @__PURE__ */ jsxDEV15("box", {
|
|
4007
4761
|
flexDirection: "column",
|
|
4008
4762
|
flexGrow: 1,
|
|
4009
4763
|
alignItems: "center",
|
|
4010
4764
|
justifyContent: "center",
|
|
4011
|
-
children: /* @__PURE__ */
|
|
4765
|
+
children: /* @__PURE__ */ jsxDEV15("box", {
|
|
4012
4766
|
flexDirection: "column",
|
|
4013
4767
|
border: true,
|
|
4014
4768
|
borderStyle: "rounded",
|
|
4015
|
-
borderColor:
|
|
4016
|
-
backgroundColor:
|
|
4769
|
+
borderColor: theme.border,
|
|
4770
|
+
backgroundColor: theme.background,
|
|
4017
4771
|
width: CARD_W,
|
|
4018
4772
|
children: [
|
|
4019
|
-
/* @__PURE__ */
|
|
4773
|
+
/* @__PURE__ */ jsxDEV15("box", {
|
|
4020
4774
|
flexDirection: "row",
|
|
4021
4775
|
paddingLeft: 2,
|
|
4022
4776
|
paddingRight: 2,
|
|
4023
4777
|
paddingTop: 1,
|
|
4024
4778
|
paddingBottom: 1,
|
|
4025
4779
|
children: [
|
|
4026
|
-
/* @__PURE__ */
|
|
4027
|
-
fg:
|
|
4780
|
+
/* @__PURE__ */ jsxDEV15("text", {
|
|
4781
|
+
fg: theme.accent,
|
|
4028
4782
|
children: "Search: "
|
|
4029
4783
|
}, undefined, false, undefined, this),
|
|
4030
|
-
/* @__PURE__ */
|
|
4031
|
-
fg:
|
|
4784
|
+
/* @__PURE__ */ jsxDEV15("text", {
|
|
4785
|
+
fg: theme.text,
|
|
4032
4786
|
children: [
|
|
4033
4787
|
searchQuery,
|
|
4034
4788
|
"_"
|
|
@@ -4036,59 +4790,59 @@ function AddVerifiedScreen() {
|
|
|
4036
4790
|
}, undefined, true, undefined, this)
|
|
4037
4791
|
]
|
|
4038
4792
|
}, undefined, true, undefined, this),
|
|
4039
|
-
/* @__PURE__ */
|
|
4793
|
+
/* @__PURE__ */ jsxDEV15("box", {
|
|
4040
4794
|
height: 1,
|
|
4041
|
-
backgroundColor:
|
|
4795
|
+
backgroundColor: theme.border
|
|
4042
4796
|
}, undefined, false, undefined, this),
|
|
4043
|
-
/* @__PURE__ */
|
|
4797
|
+
/* @__PURE__ */ jsxDEV15("scrollbox", {
|
|
4044
4798
|
ref: scrollboxRef,
|
|
4045
4799
|
height: PAGE_SIZE,
|
|
4046
|
-
style: { scrollbarOptions: { showArrows: true, trackOptions: { foregroundColor:
|
|
4800
|
+
style: { scrollbarOptions: { showArrows: true, trackOptions: { foregroundColor: theme.primary, backgroundColor: theme.border } } },
|
|
4047
4801
|
children: [
|
|
4048
|
-
loadError && /* @__PURE__ */
|
|
4802
|
+
loadError && /* @__PURE__ */ jsxDEV15("box", {
|
|
4049
4803
|
height: 1,
|
|
4050
4804
|
paddingLeft: 2,
|
|
4051
|
-
children: /* @__PURE__ */
|
|
4052
|
-
fg:
|
|
4805
|
+
children: /* @__PURE__ */ jsxDEV15("text", {
|
|
4806
|
+
fg: theme.error,
|
|
4053
4807
|
children: [
|
|
4054
4808
|
"Error loading providers: ",
|
|
4055
4809
|
loadError
|
|
4056
4810
|
]
|
|
4057
4811
|
}, undefined, true, undefined, this)
|
|
4058
4812
|
}, undefined, false, undefined, this),
|
|
4059
|
-
!loadError && filtered.length === 0 && /* @__PURE__ */
|
|
4813
|
+
!loadError && filtered.length === 0 && /* @__PURE__ */ jsxDEV15("box", {
|
|
4060
4814
|
height: 1,
|
|
4061
4815
|
paddingLeft: 2,
|
|
4062
|
-
children: /* @__PURE__ */
|
|
4063
|
-
fg:
|
|
4816
|
+
children: /* @__PURE__ */ jsxDEV15("text", {
|
|
4817
|
+
fg: theme.dim,
|
|
4064
4818
|
children: allProviders.length === 0 ? "Loading..." : "No providers found"
|
|
4065
4819
|
}, undefined, false, undefined, this)
|
|
4066
4820
|
}, undefined, false, undefined, this),
|
|
4067
4821
|
filtered.map((prov, i) => {
|
|
4068
4822
|
const isActive = i === cursor;
|
|
4069
|
-
return /* @__PURE__ */
|
|
4823
|
+
return /* @__PURE__ */ jsxDEV15("box", {
|
|
4070
4824
|
height: 1,
|
|
4071
4825
|
width: "100%",
|
|
4072
4826
|
flexDirection: "row",
|
|
4073
|
-
backgroundColor: isActive ?
|
|
4827
|
+
backgroundColor: isActive ? theme.border : "transparent",
|
|
4074
4828
|
children: [
|
|
4075
|
-
/* @__PURE__ */
|
|
4076
|
-
fg:
|
|
4829
|
+
/* @__PURE__ */ jsxDEV15("text", {
|
|
4830
|
+
fg: theme.dim,
|
|
4077
4831
|
width: 2,
|
|
4078
4832
|
children: " "
|
|
4079
4833
|
}, undefined, false, undefined, this),
|
|
4080
|
-
/* @__PURE__ */
|
|
4081
|
-
fg: isActive ?
|
|
4834
|
+
/* @__PURE__ */ jsxDEV15("text", {
|
|
4835
|
+
fg: isActive ? theme.text : theme.dim,
|
|
4082
4836
|
width: Math.floor((CARD_W - 10) / 2),
|
|
4083
4837
|
children: prov.name
|
|
4084
4838
|
}, undefined, false, undefined, this),
|
|
4085
|
-
/* @__PURE__ */
|
|
4086
|
-
fg: isActive ?
|
|
4839
|
+
/* @__PURE__ */ jsxDEV15("text", {
|
|
4840
|
+
fg: isActive ? theme.primary : theme.border,
|
|
4087
4841
|
width: Math.floor((CARD_W - 10) / 2),
|
|
4088
4842
|
children: prov.type
|
|
4089
4843
|
}, undefined, false, undefined, this),
|
|
4090
|
-
/* @__PURE__ */
|
|
4091
|
-
fg:
|
|
4844
|
+
/* @__PURE__ */ jsxDEV15("text", {
|
|
4845
|
+
fg: theme.accent,
|
|
4092
4846
|
width: 2,
|
|
4093
4847
|
children: isActive ? "\u203A" : " "
|
|
4094
4848
|
}, undefined, false, undefined, this)
|
|
@@ -4097,26 +4851,26 @@ function AddVerifiedScreen() {
|
|
|
4097
4851
|
})
|
|
4098
4852
|
]
|
|
4099
4853
|
}, undefined, true, undefined, this),
|
|
4100
|
-
/* @__PURE__ */
|
|
4854
|
+
/* @__PURE__ */ jsxDEV15("box", {
|
|
4101
4855
|
height: 1,
|
|
4102
|
-
backgroundColor:
|
|
4856
|
+
backgroundColor: theme.border
|
|
4103
4857
|
}, undefined, false, undefined, this),
|
|
4104
|
-
/* @__PURE__ */
|
|
4858
|
+
/* @__PURE__ */ jsxDEV15("box", {
|
|
4105
4859
|
flexDirection: "row",
|
|
4106
4860
|
paddingLeft: 2,
|
|
4107
4861
|
paddingRight: 2,
|
|
4108
4862
|
paddingTop: 1,
|
|
4109
4863
|
paddingBottom: 1,
|
|
4110
4864
|
children: [
|
|
4111
|
-
/* @__PURE__ */
|
|
4112
|
-
fg:
|
|
4865
|
+
/* @__PURE__ */ jsxDEV15("text", {
|
|
4866
|
+
fg: theme.dim,
|
|
4113
4867
|
children: [
|
|
4114
4868
|
filtered.length,
|
|
4115
4869
|
" providers"
|
|
4116
4870
|
]
|
|
4117
4871
|
}, undefined, true, undefined, this),
|
|
4118
|
-
/* @__PURE__ */
|
|
4119
|
-
fg:
|
|
4872
|
+
/* @__PURE__ */ jsxDEV15("text", {
|
|
4873
|
+
fg: theme.dim,
|
|
4120
4874
|
children: " [\u2191\u2193/PgUp/PgDn/wheel] scroll"
|
|
4121
4875
|
}, undefined, false, undefined, this)
|
|
4122
4876
|
]
|
|
@@ -4126,34 +4880,37 @@ function AddVerifiedScreen() {
|
|
|
4126
4880
|
}, undefined, false, undefined, this);
|
|
4127
4881
|
}
|
|
4128
4882
|
var init_AddVerifiedScreen = __esm(() => {
|
|
4883
|
+
init_useAppKeyboard();
|
|
4129
4884
|
init_AppContext();
|
|
4885
|
+
init_ThemeContext();
|
|
4130
4886
|
init_usePaste();
|
|
4131
4887
|
});
|
|
4132
4888
|
|
|
4133
4889
|
// src/tui/screens/AddCustomScreen.tsx
|
|
4134
|
-
import { useState as
|
|
4135
|
-
import {
|
|
4136
|
-
import { jsxDEV as
|
|
4890
|
+
import { useState as useState10 } from "react";
|
|
4891
|
+
import { useTerminalDimensions as useTerminalDimensions3 } from "@opentui/react";
|
|
4892
|
+
import { jsxDEV as jsxDEV16 } from "@opentui/react/jsx-dev-runtime";
|
|
4137
4893
|
function stepIndex(s) {
|
|
4138
4894
|
return STEPS.indexOf(s);
|
|
4139
4895
|
}
|
|
4140
4896
|
function AddCustomScreen() {
|
|
4141
4897
|
const { dispatch } = useAppContext();
|
|
4142
4898
|
const navigate = useNavigate();
|
|
4899
|
+
const theme = useTheme();
|
|
4143
4900
|
const { width } = useTerminalDimensions3();
|
|
4144
4901
|
const CARD_W = Math.min(60, width - 4);
|
|
4145
|
-
const [step, setStep] =
|
|
4146
|
-
const [providerType, setProviderType] =
|
|
4147
|
-
const [typeCursor, setTypeCursor] =
|
|
4148
|
-
const [providerId, setProviderId] =
|
|
4149
|
-
const [providerName, setProviderName] =
|
|
4150
|
-
const [baseUrl, setBaseUrl] =
|
|
4151
|
-
const [apiKey, setApiKey] =
|
|
4152
|
-
const [modelInput, setModelInput] =
|
|
4153
|
-
const [models, setModels] =
|
|
4154
|
-
const [saveError, setSaveError] =
|
|
4155
|
-
const [savedModelCount, setSavedModelCount] =
|
|
4156
|
-
const [inputError, setInputError] =
|
|
4902
|
+
const [step, setStep] = useState10("type");
|
|
4903
|
+
const [providerType, setProviderType] = useState10("openai-compatible");
|
|
4904
|
+
const [typeCursor, setTypeCursor] = useState10(0);
|
|
4905
|
+
const [providerId, setProviderId] = useState10("");
|
|
4906
|
+
const [providerName, setProviderName] = useState10("");
|
|
4907
|
+
const [baseUrl, setBaseUrl] = useState10("");
|
|
4908
|
+
const [apiKey, setApiKey] = useState10("");
|
|
4909
|
+
const [modelInput, setModelInput] = useState10("");
|
|
4910
|
+
const [models, setModels] = useState10([]);
|
|
4911
|
+
const [saveError, setSaveError] = useState10("");
|
|
4912
|
+
const [savedModelCount, setSavedModelCount] = useState10(0);
|
|
4913
|
+
const [inputError, setInputError] = useState10("");
|
|
4157
4914
|
const typeItems = ["OpenAI Compatible", "Anthropic", "Back"];
|
|
4158
4915
|
async function doSave() {
|
|
4159
4916
|
setStep("saving");
|
|
@@ -4166,10 +4923,7 @@ function AddCustomScreen() {
|
|
|
4166
4923
|
type: providerType,
|
|
4167
4924
|
baseUrl: baseUrl.trim(),
|
|
4168
4925
|
apiKey: apiKey.trim(),
|
|
4169
|
-
models: models.map((m) => ({
|
|
4170
|
-
id: m,
|
|
4171
|
-
name: m
|
|
4172
|
-
}))
|
|
4926
|
+
models: models.map((m) => ({ id: m, name: m }))
|
|
4173
4927
|
});
|
|
4174
4928
|
const { getAllAvailableProviders: getAllAvailableProviders2 } = await Promise.resolve().then(() => (init_opencode_integration(), exports_opencode_integration));
|
|
4175
4929
|
const providers = await getAllAvailableProviders2(false);
|
|
@@ -4194,7 +4948,7 @@ function AddCustomScreen() {
|
|
|
4194
4948
|
else if (step === "models")
|
|
4195
4949
|
setModelInput((v) => v + clean);
|
|
4196
4950
|
});
|
|
4197
|
-
|
|
4951
|
+
useAppKeyboard((key) => {
|
|
4198
4952
|
if (step === "done") {
|
|
4199
4953
|
if (key.name === "return" || key.name === "enter")
|
|
4200
4954
|
navigate("model-menu");
|
|
@@ -4249,9 +5003,8 @@ function AddCustomScreen() {
|
|
|
4249
5003
|
setProviderId((v) => v.slice(0, -1));
|
|
4250
5004
|
return;
|
|
4251
5005
|
}
|
|
4252
|
-
if (key.sequence && key.sequence.length === 1 && !key.ctrl && !key.meta && key.sequence >= " ")
|
|
5006
|
+
if (key.sequence && key.sequence.length === 1 && !key.ctrl && !key.meta && key.sequence >= " ")
|
|
4253
5007
|
setProviderId((v) => v + key.sequence);
|
|
4254
|
-
}
|
|
4255
5008
|
return;
|
|
4256
5009
|
}
|
|
4257
5010
|
if (step === "name") {
|
|
@@ -4266,9 +5019,8 @@ function AddCustomScreen() {
|
|
|
4266
5019
|
setProviderName((v) => v.slice(0, -1));
|
|
4267
5020
|
return;
|
|
4268
5021
|
}
|
|
4269
|
-
if (key.sequence && key.sequence.length === 1 && !key.ctrl && !key.meta && key.sequence >= " ")
|
|
5022
|
+
if (key.sequence && key.sequence.length === 1 && !key.ctrl && !key.meta && key.sequence >= " ")
|
|
4270
5023
|
setProviderName((v) => v + key.sequence);
|
|
4271
|
-
}
|
|
4272
5024
|
return;
|
|
4273
5025
|
}
|
|
4274
5026
|
if (step === "url") {
|
|
@@ -4289,9 +5041,8 @@ function AddCustomScreen() {
|
|
|
4289
5041
|
setBaseUrl((v) => v.slice(0, -1));
|
|
4290
5042
|
return;
|
|
4291
5043
|
}
|
|
4292
|
-
if (key.sequence && key.sequence.length === 1 && !key.ctrl && !key.meta && key.sequence >= " ")
|
|
5044
|
+
if (key.sequence && key.sequence.length === 1 && !key.ctrl && !key.meta && key.sequence >= " ")
|
|
4293
5045
|
setBaseUrl((v) => v + key.sequence);
|
|
4294
|
-
}
|
|
4295
5046
|
return;
|
|
4296
5047
|
}
|
|
4297
5048
|
if (step === "key") {
|
|
@@ -4304,9 +5055,8 @@ function AddCustomScreen() {
|
|
|
4304
5055
|
setApiKey((v) => v.slice(0, -1));
|
|
4305
5056
|
return;
|
|
4306
5057
|
}
|
|
4307
|
-
if (key.sequence && key.sequence.length === 1 && !key.ctrl && !key.meta && key.sequence >= " ")
|
|
5058
|
+
if (key.sequence && key.sequence.length === 1 && !key.ctrl && !key.meta && key.sequence >= " ")
|
|
4308
5059
|
setApiKey((v) => v + key.sequence);
|
|
4309
|
-
}
|
|
4310
5060
|
return;
|
|
4311
5061
|
}
|
|
4312
5062
|
if (step === "models") {
|
|
@@ -4328,31 +5078,30 @@ function AddCustomScreen() {
|
|
|
4328
5078
|
setModelInput((v) => v.slice(0, -1));
|
|
4329
5079
|
return;
|
|
4330
5080
|
}
|
|
4331
|
-
if (key.sequence && key.sequence.length === 1 && !key.ctrl && !key.meta && key.sequence >= " ")
|
|
5081
|
+
if (key.sequence && key.sequence.length === 1 && !key.ctrl && !key.meta && key.sequence >= " ")
|
|
4332
5082
|
setModelInput((v) => v + key.sequence);
|
|
4333
|
-
}
|
|
4334
5083
|
}
|
|
4335
5084
|
});
|
|
4336
5085
|
const curStepIdx = stepIndex(step);
|
|
4337
5086
|
function ProgressBar() {
|
|
4338
|
-
return /* @__PURE__ */
|
|
5087
|
+
return /* @__PURE__ */ jsxDEV16("box", {
|
|
4339
5088
|
height: 1,
|
|
4340
5089
|
paddingLeft: 2,
|
|
4341
5090
|
paddingRight: 2,
|
|
4342
5091
|
flexDirection: "row",
|
|
4343
|
-
children: STEPS.map((s, i) => /* @__PURE__ */
|
|
5092
|
+
children: STEPS.map((s, i) => /* @__PURE__ */ jsxDEV16("box", {
|
|
4344
5093
|
flexDirection: "row",
|
|
4345
5094
|
children: [
|
|
4346
|
-
/* @__PURE__ */
|
|
4347
|
-
fg: i < curStepIdx ?
|
|
5095
|
+
/* @__PURE__ */ jsxDEV16("text", {
|
|
5096
|
+
fg: i < curStepIdx ? theme.success : i === curStepIdx ? theme.accent : theme.border,
|
|
4348
5097
|
children: [
|
|
4349
5098
|
STEP_NUM[i],
|
|
4350
5099
|
" ",
|
|
4351
5100
|
STEP_LABELS[i]
|
|
4352
5101
|
]
|
|
4353
5102
|
}, undefined, true, undefined, this),
|
|
4354
|
-
i < STEPS.length - 1 && /* @__PURE__ */
|
|
4355
|
-
fg:
|
|
5103
|
+
i < STEPS.length - 1 && /* @__PURE__ */ jsxDEV16("text", {
|
|
5104
|
+
fg: theme.border,
|
|
4356
5105
|
children: " "
|
|
4357
5106
|
}, undefined, false, undefined, this)
|
|
4358
5107
|
]
|
|
@@ -4360,29 +5109,29 @@ function AddCustomScreen() {
|
|
|
4360
5109
|
}, undefined, false, undefined, this);
|
|
4361
5110
|
}
|
|
4362
5111
|
if (step === "done") {
|
|
4363
|
-
return /* @__PURE__ */
|
|
5112
|
+
return /* @__PURE__ */ jsxDEV16("box", {
|
|
4364
5113
|
flexDirection: "column",
|
|
4365
5114
|
flexGrow: 1,
|
|
4366
5115
|
alignItems: "center",
|
|
4367
5116
|
justifyContent: "center",
|
|
4368
|
-
children: /* @__PURE__ */
|
|
5117
|
+
children: /* @__PURE__ */ jsxDEV16("box", {
|
|
4369
5118
|
flexDirection: "column",
|
|
4370
5119
|
border: true,
|
|
4371
5120
|
borderStyle: "rounded",
|
|
4372
|
-
borderColor:
|
|
4373
|
-
backgroundColor:
|
|
5121
|
+
borderColor: theme.border,
|
|
5122
|
+
backgroundColor: theme.background,
|
|
4374
5123
|
width: CARD_W,
|
|
4375
|
-
children: /* @__PURE__ */
|
|
5124
|
+
children: /* @__PURE__ */ jsxDEV16("box", {
|
|
4376
5125
|
flexDirection: "column",
|
|
4377
5126
|
paddingLeft: 2,
|
|
4378
5127
|
paddingRight: 2,
|
|
4379
5128
|
paddingTop: 1,
|
|
4380
5129
|
paddingBottom: 1,
|
|
4381
5130
|
children: [
|
|
4382
|
-
/* @__PURE__ */
|
|
5131
|
+
/* @__PURE__ */ jsxDEV16("box", {
|
|
4383
5132
|
height: 1,
|
|
4384
|
-
children: /* @__PURE__ */
|
|
4385
|
-
fg:
|
|
5133
|
+
children: /* @__PURE__ */ jsxDEV16("text", {
|
|
5134
|
+
fg: theme.success,
|
|
4386
5135
|
children: [
|
|
4387
5136
|
"Custom provider added! ",
|
|
4388
5137
|
savedModelCount,
|
|
@@ -4392,10 +5141,10 @@ function AddCustomScreen() {
|
|
|
4392
5141
|
]
|
|
4393
5142
|
}, undefined, true, undefined, this)
|
|
4394
5143
|
}, undefined, false, undefined, this),
|
|
4395
|
-
/* @__PURE__ */
|
|
5144
|
+
/* @__PURE__ */ jsxDEV16("box", {
|
|
4396
5145
|
height: 1,
|
|
4397
|
-
children: /* @__PURE__ */
|
|
4398
|
-
fg:
|
|
5146
|
+
children: /* @__PURE__ */ jsxDEV16("text", {
|
|
5147
|
+
fg: theme.dim,
|
|
4399
5148
|
children: "Press [Enter] to return"
|
|
4400
5149
|
}, undefined, false, undefined, this)
|
|
4401
5150
|
}, undefined, false, undefined, this)
|
|
@@ -4405,107 +5154,107 @@ function AddCustomScreen() {
|
|
|
4405
5154
|
}, undefined, false, undefined, this);
|
|
4406
5155
|
}
|
|
4407
5156
|
if (step === "saving") {
|
|
4408
|
-
return /* @__PURE__ */
|
|
5157
|
+
return /* @__PURE__ */ jsxDEV16("box", {
|
|
4409
5158
|
flexDirection: "column",
|
|
4410
5159
|
flexGrow: 1,
|
|
4411
5160
|
alignItems: "center",
|
|
4412
5161
|
justifyContent: "center",
|
|
4413
|
-
children: /* @__PURE__ */
|
|
5162
|
+
children: /* @__PURE__ */ jsxDEV16("box", {
|
|
4414
5163
|
flexDirection: "column",
|
|
4415
5164
|
border: true,
|
|
4416
5165
|
borderStyle: "rounded",
|
|
4417
|
-
borderColor:
|
|
4418
|
-
backgroundColor:
|
|
5166
|
+
borderColor: theme.border,
|
|
5167
|
+
backgroundColor: theme.background,
|
|
4419
5168
|
width: CARD_W,
|
|
4420
|
-
children: /* @__PURE__ */
|
|
5169
|
+
children: /* @__PURE__ */ jsxDEV16("box", {
|
|
4421
5170
|
paddingLeft: 2,
|
|
4422
5171
|
paddingTop: 1,
|
|
4423
5172
|
paddingBottom: 1,
|
|
4424
|
-
children: /* @__PURE__ */
|
|
4425
|
-
fg:
|
|
5173
|
+
children: /* @__PURE__ */ jsxDEV16("text", {
|
|
5174
|
+
fg: theme.warning,
|
|
4426
5175
|
children: "\u2839 Saving..."
|
|
4427
5176
|
}, undefined, false, undefined, this)
|
|
4428
5177
|
}, undefined, false, undefined, this)
|
|
4429
5178
|
}, undefined, false, undefined, this)
|
|
4430
5179
|
}, undefined, false, undefined, this);
|
|
4431
5180
|
}
|
|
4432
|
-
return /* @__PURE__ */
|
|
5181
|
+
return /* @__PURE__ */ jsxDEV16("box", {
|
|
4433
5182
|
flexDirection: "column",
|
|
4434
5183
|
flexGrow: 1,
|
|
4435
5184
|
alignItems: "center",
|
|
4436
5185
|
justifyContent: "center",
|
|
4437
|
-
children: /* @__PURE__ */
|
|
5186
|
+
children: /* @__PURE__ */ jsxDEV16("box", {
|
|
4438
5187
|
flexDirection: "column",
|
|
4439
5188
|
border: true,
|
|
4440
5189
|
borderStyle: "rounded",
|
|
4441
|
-
borderColor:
|
|
4442
|
-
backgroundColor:
|
|
5190
|
+
borderColor: theme.border,
|
|
5191
|
+
backgroundColor: theme.background,
|
|
4443
5192
|
width: CARD_W,
|
|
4444
5193
|
children: [
|
|
4445
|
-
/* @__PURE__ */
|
|
5194
|
+
/* @__PURE__ */ jsxDEV16("box", {
|
|
4446
5195
|
height: 1,
|
|
4447
5196
|
paddingLeft: 2,
|
|
4448
5197
|
paddingTop: 1,
|
|
4449
|
-
children: /* @__PURE__ */
|
|
4450
|
-
fg:
|
|
5198
|
+
children: /* @__PURE__ */ jsxDEV16("text", {
|
|
5199
|
+
fg: theme.accent,
|
|
4451
5200
|
children: "Add Custom Provider"
|
|
4452
5201
|
}, undefined, false, undefined, this)
|
|
4453
5202
|
}, undefined, false, undefined, this),
|
|
4454
|
-
/* @__PURE__ */
|
|
5203
|
+
/* @__PURE__ */ jsxDEV16("box", {
|
|
4455
5204
|
height: 1,
|
|
4456
|
-
backgroundColor:
|
|
5205
|
+
backgroundColor: theme.border
|
|
4457
5206
|
}, undefined, false, undefined, this),
|
|
4458
|
-
/* @__PURE__ */
|
|
5207
|
+
/* @__PURE__ */ jsxDEV16("box", {
|
|
4459
5208
|
paddingTop: 1,
|
|
4460
5209
|
paddingBottom: 1,
|
|
4461
|
-
children: /* @__PURE__ */
|
|
5210
|
+
children: /* @__PURE__ */ jsxDEV16(ProgressBar, {}, undefined, false, undefined, this)
|
|
4462
5211
|
}, undefined, false, undefined, this),
|
|
4463
|
-
/* @__PURE__ */
|
|
5212
|
+
/* @__PURE__ */ jsxDEV16("box", {
|
|
4464
5213
|
height: 1,
|
|
4465
|
-
backgroundColor:
|
|
5214
|
+
backgroundColor: theme.border
|
|
4466
5215
|
}, undefined, false, undefined, this),
|
|
4467
|
-
/* @__PURE__ */
|
|
5216
|
+
/* @__PURE__ */ jsxDEV16("box", {
|
|
4468
5217
|
flexDirection: "column",
|
|
4469
5218
|
paddingLeft: 2,
|
|
4470
5219
|
paddingRight: 2,
|
|
4471
5220
|
paddingTop: 1,
|
|
4472
5221
|
paddingBottom: 1,
|
|
4473
5222
|
children: [
|
|
4474
|
-
step === "type" && /* @__PURE__ */
|
|
5223
|
+
step === "type" && /* @__PURE__ */ jsxDEV16("box", {
|
|
4475
5224
|
flexDirection: "column",
|
|
4476
|
-
children: typeItems.map((item, i) => /* @__PURE__ */
|
|
5225
|
+
children: typeItems.map((item, i) => /* @__PURE__ */ jsxDEV16("box", {
|
|
4477
5226
|
height: 1,
|
|
4478
5227
|
width: "100%",
|
|
4479
5228
|
flexDirection: "row",
|
|
4480
|
-
backgroundColor: i === typeCursor ?
|
|
5229
|
+
backgroundColor: i === typeCursor ? theme.border : "transparent",
|
|
4481
5230
|
children: [
|
|
4482
|
-
/* @__PURE__ */
|
|
4483
|
-
fg: i === typeCursor ?
|
|
5231
|
+
/* @__PURE__ */ jsxDEV16("text", {
|
|
5232
|
+
fg: i === typeCursor ? theme.text : theme.dim,
|
|
4484
5233
|
children: [
|
|
4485
5234
|
" ",
|
|
4486
5235
|
item
|
|
4487
5236
|
]
|
|
4488
5237
|
}, undefined, true, undefined, this),
|
|
4489
|
-
i === typeCursor && /* @__PURE__ */
|
|
4490
|
-
fg:
|
|
5238
|
+
i === typeCursor && /* @__PURE__ */ jsxDEV16("text", {
|
|
5239
|
+
fg: theme.accent,
|
|
4491
5240
|
children: " \u203A"
|
|
4492
5241
|
}, undefined, false, undefined, this)
|
|
4493
5242
|
]
|
|
4494
5243
|
}, item, true, undefined, this))
|
|
4495
5244
|
}, undefined, false, undefined, this),
|
|
4496
|
-
step === "id" && /* @__PURE__ */
|
|
5245
|
+
step === "id" && /* @__PURE__ */ jsxDEV16("box", {
|
|
4497
5246
|
flexDirection: "column",
|
|
4498
5247
|
children: [
|
|
4499
|
-
/* @__PURE__ */
|
|
5248
|
+
/* @__PURE__ */ jsxDEV16("box", {
|
|
4500
5249
|
height: 1,
|
|
4501
5250
|
flexDirection: "row",
|
|
4502
5251
|
children: [
|
|
4503
|
-
/* @__PURE__ */
|
|
4504
|
-
fg:
|
|
5252
|
+
/* @__PURE__ */ jsxDEV16("text", {
|
|
5253
|
+
fg: theme.primary,
|
|
4505
5254
|
children: "Provider ID: "
|
|
4506
5255
|
}, undefined, false, undefined, this),
|
|
4507
|
-
/* @__PURE__ */
|
|
4508
|
-
fg:
|
|
5256
|
+
/* @__PURE__ */ jsxDEV16("text", {
|
|
5257
|
+
fg: theme.text,
|
|
4509
5258
|
children: [
|
|
4510
5259
|
providerId,
|
|
4511
5260
|
"_"
|
|
@@ -4513,28 +5262,28 @@ function AddCustomScreen() {
|
|
|
4513
5262
|
}, undefined, true, undefined, this)
|
|
4514
5263
|
]
|
|
4515
5264
|
}, undefined, true, undefined, this),
|
|
4516
|
-
/* @__PURE__ */
|
|
5265
|
+
/* @__PURE__ */ jsxDEV16("box", {
|
|
4517
5266
|
height: 1,
|
|
4518
|
-
children: /* @__PURE__ */
|
|
4519
|
-
fg:
|
|
5267
|
+
children: /* @__PURE__ */ jsxDEV16("text", {
|
|
5268
|
+
fg: theme.dim,
|
|
4520
5269
|
children: "e.g. my-openai"
|
|
4521
5270
|
}, undefined, false, undefined, this)
|
|
4522
5271
|
}, undefined, false, undefined, this)
|
|
4523
5272
|
]
|
|
4524
5273
|
}, undefined, true, undefined, this),
|
|
4525
|
-
step === "name" && /* @__PURE__ */
|
|
5274
|
+
step === "name" && /* @__PURE__ */ jsxDEV16("box", {
|
|
4526
5275
|
flexDirection: "column",
|
|
4527
5276
|
children: [
|
|
4528
|
-
/* @__PURE__ */
|
|
5277
|
+
/* @__PURE__ */ jsxDEV16("box", {
|
|
4529
5278
|
height: 1,
|
|
4530
5279
|
flexDirection: "row",
|
|
4531
5280
|
children: [
|
|
4532
|
-
/* @__PURE__ */
|
|
4533
|
-
fg:
|
|
5281
|
+
/* @__PURE__ */ jsxDEV16("text", {
|
|
5282
|
+
fg: theme.primary,
|
|
4534
5283
|
children: "Display Name: "
|
|
4535
5284
|
}, undefined, false, undefined, this),
|
|
4536
|
-
/* @__PURE__ */
|
|
4537
|
-
fg:
|
|
5285
|
+
/* @__PURE__ */ jsxDEV16("text", {
|
|
5286
|
+
fg: theme.text,
|
|
4538
5287
|
children: [
|
|
4539
5288
|
providerName,
|
|
4540
5289
|
"_"
|
|
@@ -4542,10 +5291,10 @@ function AddCustomScreen() {
|
|
|
4542
5291
|
}, undefined, true, undefined, this)
|
|
4543
5292
|
]
|
|
4544
5293
|
}, undefined, true, undefined, this),
|
|
4545
|
-
/* @__PURE__ */
|
|
5294
|
+
/* @__PURE__ */ jsxDEV16("box", {
|
|
4546
5295
|
height: 1,
|
|
4547
|
-
children: /* @__PURE__ */
|
|
4548
|
-
fg:
|
|
5296
|
+
children: /* @__PURE__ */ jsxDEV16("text", {
|
|
5297
|
+
fg: theme.dim,
|
|
4549
5298
|
children: [
|
|
4550
5299
|
'e.g. My OpenAI (Enter to use "',
|
|
4551
5300
|
providerId,
|
|
@@ -4555,19 +5304,19 @@ function AddCustomScreen() {
|
|
|
4555
5304
|
}, undefined, false, undefined, this)
|
|
4556
5305
|
]
|
|
4557
5306
|
}, undefined, true, undefined, this),
|
|
4558
|
-
step === "url" && /* @__PURE__ */
|
|
5307
|
+
step === "url" && /* @__PURE__ */ jsxDEV16("box", {
|
|
4559
5308
|
flexDirection: "column",
|
|
4560
5309
|
children: [
|
|
4561
|
-
/* @__PURE__ */
|
|
5310
|
+
/* @__PURE__ */ jsxDEV16("box", {
|
|
4562
5311
|
height: 1,
|
|
4563
5312
|
flexDirection: "row",
|
|
4564
5313
|
children: [
|
|
4565
|
-
/* @__PURE__ */
|
|
4566
|
-
fg:
|
|
5314
|
+
/* @__PURE__ */ jsxDEV16("text", {
|
|
5315
|
+
fg: theme.primary,
|
|
4567
5316
|
children: "Base URL: "
|
|
4568
5317
|
}, undefined, false, undefined, this),
|
|
4569
|
-
/* @__PURE__ */
|
|
4570
|
-
fg:
|
|
5318
|
+
/* @__PURE__ */ jsxDEV16("text", {
|
|
5319
|
+
fg: theme.text,
|
|
4571
5320
|
children: [
|
|
4572
5321
|
baseUrl,
|
|
4573
5322
|
"_"
|
|
@@ -4575,28 +5324,28 @@ function AddCustomScreen() {
|
|
|
4575
5324
|
}, undefined, true, undefined, this)
|
|
4576
5325
|
]
|
|
4577
5326
|
}, undefined, true, undefined, this),
|
|
4578
|
-
/* @__PURE__ */
|
|
5327
|
+
/* @__PURE__ */ jsxDEV16("box", {
|
|
4579
5328
|
height: 1,
|
|
4580
|
-
children: /* @__PURE__ */
|
|
4581
|
-
fg:
|
|
5329
|
+
children: /* @__PURE__ */ jsxDEV16("text", {
|
|
5330
|
+
fg: theme.dim,
|
|
4582
5331
|
children: "e.g. https://api.example.com/v1"
|
|
4583
5332
|
}, undefined, false, undefined, this)
|
|
4584
5333
|
}, undefined, false, undefined, this)
|
|
4585
5334
|
]
|
|
4586
5335
|
}, undefined, true, undefined, this),
|
|
4587
|
-
step === "key" && /* @__PURE__ */
|
|
5336
|
+
step === "key" && /* @__PURE__ */ jsxDEV16("box", {
|
|
4588
5337
|
flexDirection: "column",
|
|
4589
5338
|
children: [
|
|
4590
|
-
/* @__PURE__ */
|
|
5339
|
+
/* @__PURE__ */ jsxDEV16("box", {
|
|
4591
5340
|
height: 1,
|
|
4592
5341
|
flexDirection: "row",
|
|
4593
5342
|
children: [
|
|
4594
|
-
/* @__PURE__ */
|
|
4595
|
-
fg:
|
|
5343
|
+
/* @__PURE__ */ jsxDEV16("text", {
|
|
5344
|
+
fg: theme.primary,
|
|
4596
5345
|
children: "API Key: "
|
|
4597
5346
|
}, undefined, false, undefined, this),
|
|
4598
|
-
/* @__PURE__ */
|
|
4599
|
-
fg:
|
|
5347
|
+
/* @__PURE__ */ jsxDEV16("text", {
|
|
5348
|
+
fg: theme.text,
|
|
4600
5349
|
children: [
|
|
4601
5350
|
apiKey,
|
|
4602
5351
|
"_"
|
|
@@ -4604,24 +5353,24 @@ function AddCustomScreen() {
|
|
|
4604
5353
|
}, undefined, true, undefined, this)
|
|
4605
5354
|
]
|
|
4606
5355
|
}, undefined, true, undefined, this),
|
|
4607
|
-
/* @__PURE__ */
|
|
5356
|
+
/* @__PURE__ */ jsxDEV16("box", {
|
|
4608
5357
|
height: 1,
|
|
4609
|
-
children: /* @__PURE__ */
|
|
4610
|
-
fg:
|
|
5358
|
+
children: /* @__PURE__ */ jsxDEV16("text", {
|
|
5359
|
+
fg: theme.dim,
|
|
4611
5360
|
children: "sk-... (leave empty if not needed)"
|
|
4612
5361
|
}, undefined, false, undefined, this)
|
|
4613
5362
|
}, undefined, false, undefined, this)
|
|
4614
5363
|
]
|
|
4615
5364
|
}, undefined, true, undefined, this),
|
|
4616
|
-
step === "models" && /* @__PURE__ */
|
|
5365
|
+
step === "models" && /* @__PURE__ */ jsxDEV16("box", {
|
|
4617
5366
|
flexDirection: "column",
|
|
4618
5367
|
children: [
|
|
4619
|
-
models.length > 0 && /* @__PURE__ */
|
|
5368
|
+
models.length > 0 && /* @__PURE__ */ jsxDEV16("box", {
|
|
4620
5369
|
flexDirection: "column",
|
|
4621
|
-
children: models.map((m) => /* @__PURE__ */
|
|
5370
|
+
children: models.map((m) => /* @__PURE__ */ jsxDEV16("box", {
|
|
4622
5371
|
height: 1,
|
|
4623
|
-
children: /* @__PURE__ */
|
|
4624
|
-
fg:
|
|
5372
|
+
children: /* @__PURE__ */ jsxDEV16("text", {
|
|
5373
|
+
fg: theme.dim,
|
|
4625
5374
|
children: [
|
|
4626
5375
|
" \xB7 ",
|
|
4627
5376
|
m
|
|
@@ -4629,16 +5378,16 @@ function AddCustomScreen() {
|
|
|
4629
5378
|
}, undefined, true, undefined, this)
|
|
4630
5379
|
}, m, false, undefined, this))
|
|
4631
5380
|
}, undefined, false, undefined, this),
|
|
4632
|
-
/* @__PURE__ */
|
|
5381
|
+
/* @__PURE__ */ jsxDEV16("box", {
|
|
4633
5382
|
height: 1,
|
|
4634
5383
|
flexDirection: "row",
|
|
4635
5384
|
children: [
|
|
4636
|
-
/* @__PURE__ */
|
|
4637
|
-
fg:
|
|
5385
|
+
/* @__PURE__ */ jsxDEV16("text", {
|
|
5386
|
+
fg: theme.primary,
|
|
4638
5387
|
children: "Model name: "
|
|
4639
5388
|
}, undefined, false, undefined, this),
|
|
4640
|
-
/* @__PURE__ */
|
|
4641
|
-
fg:
|
|
5389
|
+
/* @__PURE__ */ jsxDEV16("text", {
|
|
5390
|
+
fg: theme.text,
|
|
4642
5391
|
children: [
|
|
4643
5392
|
modelInput,
|
|
4644
5393
|
"_"
|
|
@@ -4646,10 +5395,10 @@ function AddCustomScreen() {
|
|
|
4646
5395
|
}, undefined, true, undefined, this)
|
|
4647
5396
|
]
|
|
4648
5397
|
}, undefined, true, undefined, this),
|
|
4649
|
-
models.length > 0 && /* @__PURE__ */
|
|
5398
|
+
models.length > 0 && /* @__PURE__ */ jsxDEV16("box", {
|
|
4650
5399
|
height: 1,
|
|
4651
|
-
children: /* @__PURE__ */
|
|
4652
|
-
fg:
|
|
5400
|
+
children: /* @__PURE__ */ jsxDEV16("text", {
|
|
5401
|
+
fg: theme.success,
|
|
4653
5402
|
children: [
|
|
4654
5403
|
" ",
|
|
4655
5404
|
models.length,
|
|
@@ -4659,10 +5408,10 @@ function AddCustomScreen() {
|
|
|
4659
5408
|
]
|
|
4660
5409
|
}, undefined, true, undefined, this)
|
|
4661
5410
|
}, undefined, false, undefined, this),
|
|
4662
|
-
saveError && /* @__PURE__ */
|
|
5411
|
+
saveError && /* @__PURE__ */ jsxDEV16("box", {
|
|
4663
5412
|
height: 1,
|
|
4664
|
-
children: /* @__PURE__ */
|
|
4665
|
-
fg:
|
|
5413
|
+
children: /* @__PURE__ */ jsxDEV16("text", {
|
|
5414
|
+
fg: theme.error,
|
|
4666
5415
|
children: [
|
|
4667
5416
|
"Error: ",
|
|
4668
5417
|
saveError
|
|
@@ -4671,10 +5420,10 @@ function AddCustomScreen() {
|
|
|
4671
5420
|
}, undefined, false, undefined, this)
|
|
4672
5421
|
]
|
|
4673
5422
|
}, undefined, true, undefined, this),
|
|
4674
|
-
inputError ? /* @__PURE__ */
|
|
5423
|
+
inputError ? /* @__PURE__ */ jsxDEV16("box", {
|
|
4675
5424
|
height: 1,
|
|
4676
|
-
children: /* @__PURE__ */
|
|
4677
|
-
fg:
|
|
5425
|
+
children: /* @__PURE__ */ jsxDEV16("text", {
|
|
5426
|
+
fg: theme.error,
|
|
4678
5427
|
children: inputError
|
|
4679
5428
|
}, undefined, false, undefined, this)
|
|
4680
5429
|
}, undefined, false, undefined, this) : null
|
|
@@ -4686,7 +5435,9 @@ function AddCustomScreen() {
|
|
|
4686
5435
|
}
|
|
4687
5436
|
var STEPS, STEP_LABELS, STEP_NUM;
|
|
4688
5437
|
var init_AddCustomScreen = __esm(() => {
|
|
5438
|
+
init_useAppKeyboard();
|
|
4689
5439
|
init_AppContext();
|
|
5440
|
+
init_ThemeContext();
|
|
4690
5441
|
init_usePaste();
|
|
4691
5442
|
STEPS = ["type", "id", "name", "url", "key", "models"];
|
|
4692
5443
|
STEP_LABELS = ["Type", "ID", "Name", "URL", "Key", "Models"];
|
|
@@ -4694,25 +5445,26 @@ var init_AddCustomScreen = __esm(() => {
|
|
|
4694
5445
|
});
|
|
4695
5446
|
|
|
4696
5447
|
// src/tui/screens/AddModelsScreen.tsx
|
|
4697
|
-
import { useState as
|
|
4698
|
-
import {
|
|
4699
|
-
import { jsxDEV as
|
|
5448
|
+
import { useState as useState11, useEffect as useEffect8 } from "react";
|
|
5449
|
+
import { useTerminalDimensions as useTerminalDimensions4 } from "@opentui/react";
|
|
5450
|
+
import { jsxDEV as jsxDEV17 } from "@opentui/react/jsx-dev-runtime";
|
|
4700
5451
|
function AddModelsScreen() {
|
|
4701
5452
|
const { dispatch } = useAppContext();
|
|
4702
5453
|
const navigate = useNavigate();
|
|
5454
|
+
const theme = useTheme();
|
|
4703
5455
|
const { width } = useTerminalDimensions4();
|
|
4704
5456
|
const CARD_W = Math.min(60, width - 4);
|
|
4705
|
-
const [step, setStep] =
|
|
4706
|
-
const [providers, setProviders] =
|
|
4707
|
-
const [cursor, setCursor] =
|
|
4708
|
-
const [selectedProvider, setSelectedProvider] =
|
|
4709
|
-
const [modelInput, setModelInput] =
|
|
4710
|
-
const [addedModels, setAddedModels] =
|
|
4711
|
-
const [loadError, setLoadError] =
|
|
4712
|
-
const [saveError, setSaveError] =
|
|
4713
|
-
const [inputError, setInputError] =
|
|
4714
|
-
const [done, setDone] =
|
|
4715
|
-
|
|
5457
|
+
const [step, setStep] = useState11("pick");
|
|
5458
|
+
const [providers, setProviders] = useState11([]);
|
|
5459
|
+
const [cursor, setCursor] = useState11(0);
|
|
5460
|
+
const [selectedProvider, setSelectedProvider] = useState11(null);
|
|
5461
|
+
const [modelInput, setModelInput] = useState11("");
|
|
5462
|
+
const [addedModels, setAddedModels] = useState11([]);
|
|
5463
|
+
const [loadError, setLoadError] = useState11("");
|
|
5464
|
+
const [saveError, setSaveError] = useState11("");
|
|
5465
|
+
const [inputError, setInputError] = useState11("");
|
|
5466
|
+
const [done, setDone] = useState11(false);
|
|
5467
|
+
useEffect8(() => {
|
|
4716
5468
|
async function load() {
|
|
4717
5469
|
try {
|
|
4718
5470
|
const { getCustomProvidersFromConfig: getCustomProvidersFromConfig2 } = await Promise.resolve().then(() => (init_ai_config(), exports_ai_config));
|
|
@@ -4729,7 +5481,7 @@ function AddModelsScreen() {
|
|
|
4729
5481
|
if (step === "add")
|
|
4730
5482
|
setModelInput((v) => v + clean);
|
|
4731
5483
|
});
|
|
4732
|
-
|
|
5484
|
+
useAppKeyboard((key) => {
|
|
4733
5485
|
if (done) {
|
|
4734
5486
|
if (key.name === "return" || key.name === "enter")
|
|
4735
5487
|
navigate("model-menu");
|
|
@@ -4782,9 +5534,8 @@ function AddModelsScreen() {
|
|
|
4782
5534
|
setModelInput((v) => v.slice(0, -1));
|
|
4783
5535
|
return;
|
|
4784
5536
|
}
|
|
4785
|
-
if (key.sequence && key.sequence.length === 1 && !key.ctrl && !key.meta && key.sequence >= " ")
|
|
5537
|
+
if (key.sequence && key.sequence.length === 1 && !key.ctrl && !key.meta && key.sequence >= " ")
|
|
4786
5538
|
setModelInput((v) => v + key.sequence);
|
|
4787
|
-
}
|
|
4788
5539
|
}
|
|
4789
5540
|
});
|
|
4790
5541
|
async function addModel() {
|
|
@@ -4795,10 +5546,7 @@ function AddModelsScreen() {
|
|
|
4795
5546
|
const name = modelInput.trim();
|
|
4796
5547
|
try {
|
|
4797
5548
|
const { addModelToCustomProvider: addModelToCustomProvider2 } = await Promise.resolve().then(() => (init_ai_config(), exports_ai_config));
|
|
4798
|
-
await addModelToCustomProvider2(selectedProvider.id, {
|
|
4799
|
-
id: name.toLowerCase().replace(/[^a-z0-9-]/g, "-"),
|
|
4800
|
-
name
|
|
4801
|
-
});
|
|
5549
|
+
await addModelToCustomProvider2(selectedProvider.id, { id: name.toLowerCase().replace(/[^a-z0-9-]/g, "-"), name });
|
|
4802
5550
|
setAddedModels((ms) => [...ms, name]);
|
|
4803
5551
|
setModelInput("");
|
|
4804
5552
|
} catch (e) {
|
|
@@ -4812,29 +5560,29 @@ function AddModelsScreen() {
|
|
|
4812
5560
|
setDone(true);
|
|
4813
5561
|
}
|
|
4814
5562
|
if (done) {
|
|
4815
|
-
return /* @__PURE__ */
|
|
5563
|
+
return /* @__PURE__ */ jsxDEV17("box", {
|
|
4816
5564
|
flexDirection: "column",
|
|
4817
5565
|
flexGrow: 1,
|
|
4818
5566
|
alignItems: "center",
|
|
4819
5567
|
justifyContent: "center",
|
|
4820
|
-
children: /* @__PURE__ */
|
|
5568
|
+
children: /* @__PURE__ */ jsxDEV17("box", {
|
|
4821
5569
|
flexDirection: "column",
|
|
4822
5570
|
border: true,
|
|
4823
5571
|
borderStyle: "rounded",
|
|
4824
|
-
borderColor:
|
|
4825
|
-
backgroundColor:
|
|
5572
|
+
borderColor: theme.border,
|
|
5573
|
+
backgroundColor: theme.background,
|
|
4826
5574
|
width: CARD_W,
|
|
4827
|
-
children: /* @__PURE__ */
|
|
5575
|
+
children: /* @__PURE__ */ jsxDEV17("box", {
|
|
4828
5576
|
flexDirection: "column",
|
|
4829
5577
|
paddingLeft: 2,
|
|
4830
5578
|
paddingRight: 2,
|
|
4831
5579
|
paddingTop: 1,
|
|
4832
5580
|
paddingBottom: 1,
|
|
4833
5581
|
children: [
|
|
4834
|
-
/* @__PURE__ */
|
|
5582
|
+
/* @__PURE__ */ jsxDEV17("box", {
|
|
4835
5583
|
height: 1,
|
|
4836
|
-
children: /* @__PURE__ */
|
|
4837
|
-
fg:
|
|
5584
|
+
children: /* @__PURE__ */ jsxDEV17("text", {
|
|
5585
|
+
fg: theme.success,
|
|
4838
5586
|
children: [
|
|
4839
5587
|
"Done! Added ",
|
|
4840
5588
|
addedModels.length,
|
|
@@ -4846,10 +5594,10 @@ function AddModelsScreen() {
|
|
|
4846
5594
|
]
|
|
4847
5595
|
}, undefined, true, undefined, this)
|
|
4848
5596
|
}, undefined, false, undefined, this),
|
|
4849
|
-
/* @__PURE__ */
|
|
5597
|
+
/* @__PURE__ */ jsxDEV17("box", {
|
|
4850
5598
|
height: 1,
|
|
4851
|
-
children: /* @__PURE__ */
|
|
4852
|
-
fg:
|
|
5599
|
+
children: /* @__PURE__ */ jsxDEV17("text", {
|
|
5600
|
+
fg: theme.dim,
|
|
4853
5601
|
children: "Press [Enter] to return"
|
|
4854
5602
|
}, undefined, false, undefined, this)
|
|
4855
5603
|
}, undefined, false, undefined, this)
|
|
@@ -4859,70 +5607,70 @@ function AddModelsScreen() {
|
|
|
4859
5607
|
}, undefined, false, undefined, this);
|
|
4860
5608
|
}
|
|
4861
5609
|
if (step === "add" && selectedProvider) {
|
|
4862
|
-
return /* @__PURE__ */
|
|
5610
|
+
return /* @__PURE__ */ jsxDEV17("box", {
|
|
4863
5611
|
flexDirection: "column",
|
|
4864
5612
|
flexGrow: 1,
|
|
4865
5613
|
alignItems: "center",
|
|
4866
5614
|
justifyContent: "center",
|
|
4867
|
-
children: /* @__PURE__ */
|
|
5615
|
+
children: /* @__PURE__ */ jsxDEV17("box", {
|
|
4868
5616
|
flexDirection: "column",
|
|
4869
5617
|
border: true,
|
|
4870
5618
|
borderStyle: "rounded",
|
|
4871
|
-
borderColor:
|
|
4872
|
-
backgroundColor:
|
|
5619
|
+
borderColor: theme.border,
|
|
5620
|
+
backgroundColor: theme.background,
|
|
4873
5621
|
width: CARD_W,
|
|
4874
5622
|
children: [
|
|
4875
|
-
/* @__PURE__ */
|
|
5623
|
+
/* @__PURE__ */ jsxDEV17("box", {
|
|
4876
5624
|
height: 1,
|
|
4877
5625
|
paddingLeft: 2,
|
|
4878
5626
|
paddingTop: 1,
|
|
4879
5627
|
flexDirection: "row",
|
|
4880
5628
|
children: [
|
|
4881
|
-
/* @__PURE__ */
|
|
4882
|
-
fg:
|
|
5629
|
+
/* @__PURE__ */ jsxDEV17("text", {
|
|
5630
|
+
fg: theme.accent,
|
|
4883
5631
|
children: "Add Models to: "
|
|
4884
5632
|
}, undefined, false, undefined, this),
|
|
4885
|
-
/* @__PURE__ */
|
|
4886
|
-
fg:
|
|
5633
|
+
/* @__PURE__ */ jsxDEV17("text", {
|
|
5634
|
+
fg: theme.text,
|
|
4887
5635
|
children: selectedProvider.name
|
|
4888
5636
|
}, undefined, false, undefined, this)
|
|
4889
5637
|
]
|
|
4890
5638
|
}, undefined, true, undefined, this),
|
|
4891
|
-
/* @__PURE__ */
|
|
5639
|
+
/* @__PURE__ */ jsxDEV17("box", {
|
|
4892
5640
|
height: 1,
|
|
4893
|
-
backgroundColor:
|
|
5641
|
+
backgroundColor: theme.border
|
|
4894
5642
|
}, undefined, false, undefined, this),
|
|
4895
|
-
/* @__PURE__ */
|
|
5643
|
+
/* @__PURE__ */ jsxDEV17("box", {
|
|
4896
5644
|
flexDirection: "column",
|
|
4897
5645
|
paddingLeft: 2,
|
|
4898
5646
|
paddingRight: 2,
|
|
4899
5647
|
paddingTop: 1,
|
|
4900
5648
|
paddingBottom: 1,
|
|
4901
5649
|
children: [
|
|
4902
|
-
(selectedProvider.models.length > 0 || addedModels.length > 0) && /* @__PURE__ */
|
|
5650
|
+
(selectedProvider.models.length > 0 || addedModels.length > 0) && /* @__PURE__ */ jsxDEV17("box", {
|
|
4903
5651
|
flexDirection: "column",
|
|
4904
5652
|
children: [
|
|
4905
|
-
/* @__PURE__ */
|
|
5653
|
+
/* @__PURE__ */ jsxDEV17("box", {
|
|
4906
5654
|
height: 1,
|
|
4907
|
-
children: /* @__PURE__ */
|
|
4908
|
-
fg:
|
|
5655
|
+
children: /* @__PURE__ */ jsxDEV17("text", {
|
|
5656
|
+
fg: theme.primary,
|
|
4909
5657
|
children: "Current models:"
|
|
4910
5658
|
}, undefined, false, undefined, this)
|
|
4911
5659
|
}, undefined, false, undefined, this),
|
|
4912
|
-
selectedProvider.models.map((m) => /* @__PURE__ */
|
|
5660
|
+
selectedProvider.models.map((m) => /* @__PURE__ */ jsxDEV17("box", {
|
|
4913
5661
|
height: 1,
|
|
4914
|
-
children: /* @__PURE__ */
|
|
4915
|
-
fg:
|
|
5662
|
+
children: /* @__PURE__ */ jsxDEV17("text", {
|
|
5663
|
+
fg: theme.dim,
|
|
4916
5664
|
children: [
|
|
4917
5665
|
" \xB7 ",
|
|
4918
5666
|
m.name || m.id
|
|
4919
5667
|
]
|
|
4920
5668
|
}, undefined, true, undefined, this)
|
|
4921
5669
|
}, m.id, false, undefined, this)),
|
|
4922
|
-
addedModels.map((m) => /* @__PURE__ */
|
|
5670
|
+
addedModels.map((m) => /* @__PURE__ */ jsxDEV17("box", {
|
|
4923
5671
|
height: 1,
|
|
4924
|
-
children: /* @__PURE__ */
|
|
4925
|
-
fg:
|
|
5672
|
+
children: /* @__PURE__ */ jsxDEV17("text", {
|
|
5673
|
+
fg: theme.success,
|
|
4926
5674
|
children: [
|
|
4927
5675
|
" \xB7 ",
|
|
4928
5676
|
m,
|
|
@@ -4932,16 +5680,16 @@ function AddModelsScreen() {
|
|
|
4932
5680
|
}, m, false, undefined, this))
|
|
4933
5681
|
]
|
|
4934
5682
|
}, undefined, true, undefined, this),
|
|
4935
|
-
/* @__PURE__ */
|
|
5683
|
+
/* @__PURE__ */ jsxDEV17("box", {
|
|
4936
5684
|
height: 1,
|
|
4937
5685
|
flexDirection: "row",
|
|
4938
5686
|
children: [
|
|
4939
|
-
/* @__PURE__ */
|
|
4940
|
-
fg:
|
|
5687
|
+
/* @__PURE__ */ jsxDEV17("text", {
|
|
5688
|
+
fg: theme.primary,
|
|
4941
5689
|
children: "Model name: "
|
|
4942
5690
|
}, undefined, false, undefined, this),
|
|
4943
|
-
/* @__PURE__ */
|
|
4944
|
-
fg:
|
|
5691
|
+
/* @__PURE__ */ jsxDEV17("text", {
|
|
5692
|
+
fg: theme.text,
|
|
4945
5693
|
children: [
|
|
4946
5694
|
modelInput,
|
|
4947
5695
|
"_"
|
|
@@ -4949,10 +5697,10 @@ function AddModelsScreen() {
|
|
|
4949
5697
|
}, undefined, true, undefined, this)
|
|
4950
5698
|
]
|
|
4951
5699
|
}, undefined, true, undefined, this),
|
|
4952
|
-
addedModels.length > 0 && /* @__PURE__ */
|
|
5700
|
+
addedModels.length > 0 && /* @__PURE__ */ jsxDEV17("box", {
|
|
4953
5701
|
height: 1,
|
|
4954
|
-
children: /* @__PURE__ */
|
|
4955
|
-
fg:
|
|
5702
|
+
children: /* @__PURE__ */ jsxDEV17("text", {
|
|
5703
|
+
fg: theme.success,
|
|
4956
5704
|
children: [
|
|
4957
5705
|
"Added ",
|
|
4958
5706
|
addedModels.length,
|
|
@@ -4962,20 +5710,20 @@ function AddModelsScreen() {
|
|
|
4962
5710
|
]
|
|
4963
5711
|
}, undefined, true, undefined, this)
|
|
4964
5712
|
}, undefined, false, undefined, this),
|
|
4965
|
-
saveError && /* @__PURE__ */
|
|
5713
|
+
saveError && /* @__PURE__ */ jsxDEV17("box", {
|
|
4966
5714
|
height: 1,
|
|
4967
|
-
children: /* @__PURE__ */
|
|
4968
|
-
fg:
|
|
5715
|
+
children: /* @__PURE__ */ jsxDEV17("text", {
|
|
5716
|
+
fg: theme.error,
|
|
4969
5717
|
children: [
|
|
4970
5718
|
"Error: ",
|
|
4971
5719
|
saveError
|
|
4972
5720
|
]
|
|
4973
5721
|
}, undefined, true, undefined, this)
|
|
4974
5722
|
}, undefined, false, undefined, this),
|
|
4975
|
-
inputError && /* @__PURE__ */
|
|
5723
|
+
inputError && /* @__PURE__ */ jsxDEV17("box", {
|
|
4976
5724
|
height: 1,
|
|
4977
|
-
children: /* @__PURE__ */
|
|
4978
|
-
fg:
|
|
5725
|
+
children: /* @__PURE__ */ jsxDEV17("text", {
|
|
5726
|
+
fg: theme.error,
|
|
4979
5727
|
children: inputError
|
|
4980
5728
|
}, undefined, false, undefined, this)
|
|
4981
5729
|
}, undefined, false, undefined, this)
|
|
@@ -4985,84 +5733,84 @@ function AddModelsScreen() {
|
|
|
4985
5733
|
}, undefined, true, undefined, this)
|
|
4986
5734
|
}, undefined, false, undefined, this);
|
|
4987
5735
|
}
|
|
4988
|
-
return /* @__PURE__ */
|
|
5736
|
+
return /* @__PURE__ */ jsxDEV17("box", {
|
|
4989
5737
|
flexDirection: "column",
|
|
4990
5738
|
flexGrow: 1,
|
|
4991
5739
|
alignItems: "center",
|
|
4992
5740
|
justifyContent: "center",
|
|
4993
|
-
children: /* @__PURE__ */
|
|
5741
|
+
children: /* @__PURE__ */ jsxDEV17("box", {
|
|
4994
5742
|
flexDirection: "column",
|
|
4995
5743
|
border: true,
|
|
4996
5744
|
borderStyle: "rounded",
|
|
4997
|
-
borderColor:
|
|
4998
|
-
backgroundColor:
|
|
5745
|
+
borderColor: theme.border,
|
|
5746
|
+
backgroundColor: theme.background,
|
|
4999
5747
|
width: CARD_W,
|
|
5000
5748
|
children: [
|
|
5001
|
-
/* @__PURE__ */
|
|
5749
|
+
/* @__PURE__ */ jsxDEV17("box", {
|
|
5002
5750
|
height: 1,
|
|
5003
5751
|
paddingLeft: 2,
|
|
5004
5752
|
paddingTop: 1,
|
|
5005
|
-
children: /* @__PURE__ */
|
|
5006
|
-
fg:
|
|
5753
|
+
children: /* @__PURE__ */ jsxDEV17("text", {
|
|
5754
|
+
fg: theme.accent,
|
|
5007
5755
|
children: "Add Models to Provider"
|
|
5008
5756
|
}, undefined, false, undefined, this)
|
|
5009
5757
|
}, undefined, false, undefined, this),
|
|
5010
|
-
/* @__PURE__ */
|
|
5758
|
+
/* @__PURE__ */ jsxDEV17("box", {
|
|
5011
5759
|
height: 1,
|
|
5012
|
-
backgroundColor:
|
|
5760
|
+
backgroundColor: theme.border
|
|
5013
5761
|
}, undefined, false, undefined, this),
|
|
5014
|
-
/* @__PURE__ */
|
|
5762
|
+
/* @__PURE__ */ jsxDEV17("box", {
|
|
5015
5763
|
flexDirection: "column",
|
|
5016
5764
|
paddingLeft: 2,
|
|
5017
5765
|
paddingRight: 2,
|
|
5018
5766
|
paddingTop: 1,
|
|
5019
5767
|
paddingBottom: 1,
|
|
5020
5768
|
children: [
|
|
5021
|
-
loadError && /* @__PURE__ */
|
|
5769
|
+
loadError && /* @__PURE__ */ jsxDEV17("box", {
|
|
5022
5770
|
height: 1,
|
|
5023
|
-
children: /* @__PURE__ */
|
|
5024
|
-
fg:
|
|
5771
|
+
children: /* @__PURE__ */ jsxDEV17("text", {
|
|
5772
|
+
fg: theme.error,
|
|
5025
5773
|
children: [
|
|
5026
5774
|
"Error: ",
|
|
5027
5775
|
loadError
|
|
5028
5776
|
]
|
|
5029
5777
|
}, undefined, true, undefined, this)
|
|
5030
5778
|
}, undefined, false, undefined, this),
|
|
5031
|
-
!loadError && providers.length === 0 && /* @__PURE__ */
|
|
5779
|
+
!loadError && providers.length === 0 && /* @__PURE__ */ jsxDEV17("box", {
|
|
5032
5780
|
height: 1,
|
|
5033
|
-
children: /* @__PURE__ */
|
|
5034
|
-
fg:
|
|
5781
|
+
children: /* @__PURE__ */ jsxDEV17("text", {
|
|
5782
|
+
fg: theme.warning,
|
|
5035
5783
|
children: "No custom providers yet. Add one first."
|
|
5036
5784
|
}, undefined, false, undefined, this)
|
|
5037
5785
|
}, undefined, false, undefined, this),
|
|
5038
5786
|
providers.map((prov, i) => {
|
|
5039
5787
|
const isActive = i === cursor;
|
|
5040
|
-
return /* @__PURE__ */
|
|
5788
|
+
return /* @__PURE__ */ jsxDEV17("box", {
|
|
5041
5789
|
height: 1,
|
|
5042
5790
|
width: "100%",
|
|
5043
5791
|
flexDirection: "row",
|
|
5044
|
-
backgroundColor: isActive ?
|
|
5792
|
+
backgroundColor: isActive ? theme.border : "transparent",
|
|
5045
5793
|
children: [
|
|
5046
|
-
/* @__PURE__ */
|
|
5047
|
-
fg:
|
|
5794
|
+
/* @__PURE__ */ jsxDEV17("text", {
|
|
5795
|
+
fg: theme.dim,
|
|
5048
5796
|
width: 2,
|
|
5049
5797
|
children: " "
|
|
5050
5798
|
}, undefined, false, undefined, this),
|
|
5051
|
-
/* @__PURE__ */
|
|
5052
|
-
fg: isActive ?
|
|
5799
|
+
/* @__PURE__ */ jsxDEV17("text", {
|
|
5800
|
+
fg: isActive ? theme.text : theme.dim,
|
|
5053
5801
|
width: Math.floor((CARD_W - 8) * 0.6),
|
|
5054
5802
|
children: prov.name
|
|
5055
5803
|
}, undefined, false, undefined, this),
|
|
5056
|
-
/* @__PURE__ */
|
|
5057
|
-
fg: isActive ?
|
|
5804
|
+
/* @__PURE__ */ jsxDEV17("text", {
|
|
5805
|
+
fg: isActive ? theme.primary : theme.border,
|
|
5058
5806
|
width: Math.floor((CARD_W - 8) * 0.3),
|
|
5059
5807
|
children: [
|
|
5060
5808
|
prov.models.length,
|
|
5061
5809
|
" models"
|
|
5062
5810
|
]
|
|
5063
5811
|
}, undefined, true, undefined, this),
|
|
5064
|
-
/* @__PURE__ */
|
|
5065
|
-
fg:
|
|
5812
|
+
/* @__PURE__ */ jsxDEV17("text", {
|
|
5813
|
+
fg: theme.accent,
|
|
5066
5814
|
width: 2,
|
|
5067
5815
|
children: isActive ? "\u203A" : " "
|
|
5068
5816
|
}, undefined, false, undefined, this)
|
|
@@ -5076,84 +5824,87 @@ function AddModelsScreen() {
|
|
|
5076
5824
|
}, undefined, false, undefined, this);
|
|
5077
5825
|
}
|
|
5078
5826
|
var init_AddModelsScreen = __esm(() => {
|
|
5827
|
+
init_useAppKeyboard();
|
|
5079
5828
|
init_AppContext();
|
|
5829
|
+
init_ThemeContext();
|
|
5080
5830
|
init_usePaste();
|
|
5081
5831
|
});
|
|
5082
5832
|
|
|
5083
5833
|
// src/tui/screens/ListProvidersScreen.tsx
|
|
5084
|
-
import {
|
|
5085
|
-
import { jsxDEV as jsxDEV14 } from "@opentui/react/jsx-dev-runtime";
|
|
5834
|
+
import { jsxDEV as jsxDEV18 } from "@opentui/react/jsx-dev-runtime";
|
|
5086
5835
|
function ListProvidersScreen() {
|
|
5087
5836
|
const { state } = useAppContext();
|
|
5088
5837
|
const navigate = useNavigate();
|
|
5089
|
-
|
|
5838
|
+
const theme = useTheme();
|
|
5839
|
+
useAppKeyboard((key) => {
|
|
5090
5840
|
if (key.name === "escape" || key.name === "q") {
|
|
5091
5841
|
navigate("model-menu");
|
|
5092
5842
|
}
|
|
5093
5843
|
});
|
|
5094
5844
|
if (state.isLoadingConfig) {
|
|
5095
|
-
return /* @__PURE__ */
|
|
5845
|
+
return /* @__PURE__ */ jsxDEV18("box", {
|
|
5096
5846
|
flexDirection: "column",
|
|
5097
5847
|
flexGrow: 1,
|
|
5098
5848
|
padding: 1,
|
|
5099
|
-
children: /* @__PURE__ */
|
|
5849
|
+
children: /* @__PURE__ */ jsxDEV18("text", {
|
|
5850
|
+
fg: theme.dim,
|
|
5100
5851
|
children: "Loading providers..."
|
|
5101
5852
|
}, undefined, false, undefined, this)
|
|
5102
5853
|
}, undefined, false, undefined, this);
|
|
5103
5854
|
}
|
|
5104
5855
|
const providers = state.config?.providers ?? [];
|
|
5105
5856
|
if (providers.length === 0) {
|
|
5106
|
-
return /* @__PURE__ */
|
|
5857
|
+
return /* @__PURE__ */ jsxDEV18("box", {
|
|
5107
5858
|
flexDirection: "column",
|
|
5108
5859
|
flexGrow: 1,
|
|
5109
5860
|
padding: 1,
|
|
5110
5861
|
children: [
|
|
5111
|
-
/* @__PURE__ */
|
|
5112
|
-
fg:
|
|
5862
|
+
/* @__PURE__ */ jsxDEV18("text", {
|
|
5863
|
+
fg: theme.primary,
|
|
5113
5864
|
children: "Configured Providers"
|
|
5114
5865
|
}, undefined, false, undefined, this),
|
|
5115
|
-
/* @__PURE__ */
|
|
5866
|
+
/* @__PURE__ */ jsxDEV18("box", {
|
|
5116
5867
|
marginTop: 1,
|
|
5117
|
-
children: /* @__PURE__ */
|
|
5118
|
-
fg:
|
|
5868
|
+
children: /* @__PURE__ */ jsxDEV18("text", {
|
|
5869
|
+
fg: theme.warning,
|
|
5119
5870
|
children: "No providers configured yet."
|
|
5120
5871
|
}, undefined, false, undefined, this)
|
|
5121
5872
|
}, undefined, false, undefined, this)
|
|
5122
5873
|
]
|
|
5123
5874
|
}, undefined, true, undefined, this);
|
|
5124
5875
|
}
|
|
5125
|
-
return /* @__PURE__ */
|
|
5876
|
+
return /* @__PURE__ */ jsxDEV18("box", {
|
|
5126
5877
|
flexDirection: "column",
|
|
5127
5878
|
flexGrow: 1,
|
|
5128
5879
|
padding: 1,
|
|
5129
5880
|
children: [
|
|
5130
|
-
/* @__PURE__ */
|
|
5131
|
-
fg:
|
|
5881
|
+
/* @__PURE__ */ jsxDEV18("text", {
|
|
5882
|
+
fg: theme.primary,
|
|
5132
5883
|
children: "Configured Providers"
|
|
5133
5884
|
}, undefined, false, undefined, this),
|
|
5134
|
-
/* @__PURE__ */
|
|
5885
|
+
/* @__PURE__ */ jsxDEV18("box", {
|
|
5135
5886
|
marginTop: 1,
|
|
5136
5887
|
flexGrow: 1,
|
|
5137
|
-
children: /* @__PURE__ */
|
|
5888
|
+
children: /* @__PURE__ */ jsxDEV18("scrollbox", {
|
|
5138
5889
|
focused: true,
|
|
5139
|
-
children: providers.map((provider, i) => /* @__PURE__ */
|
|
5890
|
+
children: providers.map((provider, i) => /* @__PURE__ */ jsxDEV18("box", {
|
|
5140
5891
|
flexDirection: "column",
|
|
5141
5892
|
border: true,
|
|
5142
5893
|
borderStyle: "rounded",
|
|
5143
|
-
borderColor:
|
|
5144
|
-
backgroundColor:
|
|
5894
|
+
borderColor: theme.border,
|
|
5895
|
+
backgroundColor: theme.background,
|
|
5145
5896
|
marginBottom: 1,
|
|
5146
5897
|
padding: 1,
|
|
5147
5898
|
children: [
|
|
5148
|
-
/* @__PURE__ */
|
|
5899
|
+
/* @__PURE__ */ jsxDEV18("box", {
|
|
5149
5900
|
flexDirection: "row",
|
|
5150
5901
|
children: [
|
|
5151
|
-
/* @__PURE__ */
|
|
5152
|
-
fg:
|
|
5902
|
+
/* @__PURE__ */ jsxDEV18("text", {
|
|
5903
|
+
fg: theme.accent,
|
|
5153
5904
|
children: provider.name
|
|
5154
5905
|
}, undefined, false, undefined, this),
|
|
5155
|
-
/* @__PURE__ */
|
|
5156
|
-
fg:
|
|
5906
|
+
/* @__PURE__ */ jsxDEV18("text", {
|
|
5907
|
+
fg: theme.dim,
|
|
5157
5908
|
children: [
|
|
5158
5909
|
" [",
|
|
5159
5910
|
provider.type,
|
|
@@ -5162,8 +5913,8 @@ function ListProvidersScreen() {
|
|
|
5162
5913
|
}, undefined, true, undefined, this)
|
|
5163
5914
|
]
|
|
5164
5915
|
}, undefined, true, undefined, this),
|
|
5165
|
-
provider.models.map((model, j) => /* @__PURE__ */
|
|
5166
|
-
fg:
|
|
5916
|
+
provider.models.map((model, j) => /* @__PURE__ */ jsxDEV18("text", {
|
|
5917
|
+
fg: theme.dim,
|
|
5167
5918
|
children: [
|
|
5168
5919
|
" \xB7 ",
|
|
5169
5920
|
model.name || model.id
|
|
@@ -5177,16 +5928,18 @@ function ListProvidersScreen() {
|
|
|
5177
5928
|
}, undefined, true, undefined, this);
|
|
5178
5929
|
}
|
|
5179
5930
|
var init_ListProvidersScreen = __esm(() => {
|
|
5931
|
+
init_useAppKeyboard();
|
|
5180
5932
|
init_AppContext();
|
|
5933
|
+
init_ThemeContext();
|
|
5181
5934
|
});
|
|
5182
5935
|
|
|
5183
5936
|
// src/tui/App.tsx
|
|
5184
|
-
import { useKeyboard as
|
|
5185
|
-
import { jsxDEV as
|
|
5937
|
+
import { useKeyboard as useKeyboard3, useRenderer as useRenderer3 } from "@opentui/react";
|
|
5938
|
+
import { jsxDEV as jsxDEV19 } from "@opentui/react/jsx-dev-runtime";
|
|
5186
5939
|
function getHints(screen, benchResults) {
|
|
5187
5940
|
switch (screen) {
|
|
5188
5941
|
case "main-menu":
|
|
5189
|
-
return ["[\u2191\u2193] navigate", "[Enter] select", "[Ctrl+C] quit"];
|
|
5942
|
+
return ["[\u2191\u2193] navigate", "[Enter] select", "[T] theme", "[Ctrl+C] quit"];
|
|
5190
5943
|
case "model-menu":
|
|
5191
5944
|
return ["[\u2191\u2193] navigate", "[Enter] select", "[Q] back"];
|
|
5192
5945
|
case "model-select":
|
|
@@ -5211,59 +5964,76 @@ function ActiveScreen() {
|
|
|
5211
5964
|
const { state } = useAppContext();
|
|
5212
5965
|
switch (state.screen) {
|
|
5213
5966
|
case "main-menu":
|
|
5214
|
-
return /* @__PURE__ */
|
|
5967
|
+
return /* @__PURE__ */ jsxDEV19(MainMenuScreen, {}, undefined, false, undefined, this);
|
|
5215
5968
|
case "model-menu":
|
|
5216
|
-
return /* @__PURE__ */
|
|
5969
|
+
return /* @__PURE__ */ jsxDEV19(ModelMenuScreen, {}, undefined, false, undefined, this);
|
|
5217
5970
|
case "model-select":
|
|
5218
|
-
return /* @__PURE__ */
|
|
5971
|
+
return /* @__PURE__ */ jsxDEV19(ModelSelectScreen, {}, undefined, false, undefined, this);
|
|
5219
5972
|
case "benchmark":
|
|
5220
|
-
return /* @__PURE__ */
|
|
5973
|
+
return /* @__PURE__ */ jsxDEV19(BenchmarkScreen, {}, undefined, false, undefined, this);
|
|
5221
5974
|
case "add-verified":
|
|
5222
|
-
return /* @__PURE__ */
|
|
5975
|
+
return /* @__PURE__ */ jsxDEV19(AddVerifiedScreen, {}, undefined, false, undefined, this);
|
|
5223
5976
|
case "add-custom":
|
|
5224
|
-
return /* @__PURE__ */
|
|
5977
|
+
return /* @__PURE__ */ jsxDEV19(AddCustomScreen, {}, undefined, false, undefined, this);
|
|
5225
5978
|
case "add-models":
|
|
5226
|
-
return /* @__PURE__ */
|
|
5979
|
+
return /* @__PURE__ */ jsxDEV19(AddModelsScreen, {}, undefined, false, undefined, this);
|
|
5227
5980
|
case "list-providers":
|
|
5228
|
-
return /* @__PURE__ */
|
|
5981
|
+
return /* @__PURE__ */ jsxDEV19(ListProvidersScreen, {}, undefined, false, undefined, this);
|
|
5229
5982
|
}
|
|
5230
5983
|
}
|
|
5231
5984
|
function Shell() {
|
|
5232
5985
|
const renderer = useRenderer3();
|
|
5233
5986
|
const { state } = useAppContext();
|
|
5234
|
-
|
|
5987
|
+
const theme = useTheme();
|
|
5988
|
+
const { modalOpen, setModalOpen } = useModal();
|
|
5989
|
+
useKeyboard3((key) => {
|
|
5235
5990
|
if (key.ctrl && key.name === "c") {
|
|
5236
5991
|
renderer.destroy();
|
|
5992
|
+
return;
|
|
5993
|
+
}
|
|
5994
|
+
if (!key.ctrl && !key.meta && key.sequence === "T") {
|
|
5995
|
+
setModalOpen(!modalOpen);
|
|
5237
5996
|
}
|
|
5238
5997
|
});
|
|
5239
|
-
return /* @__PURE__ */
|
|
5998
|
+
return /* @__PURE__ */ jsxDEV19("box", {
|
|
5240
5999
|
flexDirection: "column",
|
|
5241
6000
|
height: "100%",
|
|
5242
6001
|
width: "100%",
|
|
5243
|
-
backgroundColor:
|
|
6002
|
+
backgroundColor: theme.background,
|
|
5244
6003
|
children: [
|
|
5245
|
-
/* @__PURE__ */
|
|
6004
|
+
/* @__PURE__ */ jsxDEV19(Header, {
|
|
5246
6005
|
screen: state.screen
|
|
5247
6006
|
}, undefined, false, undefined, this),
|
|
5248
|
-
/* @__PURE__ */
|
|
6007
|
+
/* @__PURE__ */ jsxDEV19("box", {
|
|
5249
6008
|
flexGrow: 1,
|
|
5250
6009
|
flexDirection: "column",
|
|
5251
|
-
children: /* @__PURE__ */
|
|
6010
|
+
children: /* @__PURE__ */ jsxDEV19(ActiveScreen, {}, undefined, false, undefined, this)
|
|
5252
6011
|
}, undefined, false, undefined, this),
|
|
5253
|
-
/* @__PURE__ */
|
|
6012
|
+
/* @__PURE__ */ jsxDEV19(Footer, {
|
|
5254
6013
|
hints: getHints(state.screen, state.benchResults)
|
|
6014
|
+
}, undefined, false, undefined, this),
|
|
6015
|
+
modalOpen && /* @__PURE__ */ jsxDEV19(ThemePicker, {
|
|
6016
|
+
onClose: () => setModalOpen(false)
|
|
5255
6017
|
}, undefined, false, undefined, this)
|
|
5256
6018
|
]
|
|
5257
6019
|
}, undefined, true, undefined, this);
|
|
5258
6020
|
}
|
|
5259
|
-
function App({ logMode = false }) {
|
|
5260
|
-
return /* @__PURE__ */
|
|
5261
|
-
|
|
5262
|
-
children: /* @__PURE__ */
|
|
6021
|
+
function App({ logMode = false, theme = "tokyonight" }) {
|
|
6022
|
+
return /* @__PURE__ */ jsxDEV19(ThemeProvider, {
|
|
6023
|
+
name: theme,
|
|
6024
|
+
children: /* @__PURE__ */ jsxDEV19(ModalProvider, {
|
|
6025
|
+
children: /* @__PURE__ */ jsxDEV19(AppProvider, {
|
|
6026
|
+
logMode,
|
|
6027
|
+
children: /* @__PURE__ */ jsxDEV19(Shell, {}, undefined, false, undefined, this)
|
|
6028
|
+
}, undefined, false, undefined, this)
|
|
6029
|
+
}, undefined, false, undefined, this)
|
|
5263
6030
|
}, undefined, false, undefined, this);
|
|
5264
6031
|
}
|
|
5265
6032
|
var init_App = __esm(() => {
|
|
5266
6033
|
init_AppContext();
|
|
6034
|
+
init_ThemeContext();
|
|
6035
|
+
init_ModalContext();
|
|
6036
|
+
init_ThemePicker();
|
|
5267
6037
|
init_Header();
|
|
5268
6038
|
init_Footer();
|
|
5269
6039
|
init_MainMenuScreen();
|
|
@@ -5283,8 +6053,10 @@ __export(exports_tui, {
|
|
|
5283
6053
|
});
|
|
5284
6054
|
import { createCliRenderer } from "@opentui/core";
|
|
5285
6055
|
import { createRoot } from "@opentui/react";
|
|
5286
|
-
import { jsxDEV as
|
|
6056
|
+
import { jsxDEV as jsxDEV20 } from "@opentui/react/jsx-dev-runtime";
|
|
5287
6057
|
async function startTui(logMode = false) {
|
|
6058
|
+
const { readThemeFromConfig: readThemeFromConfig2 } = await Promise.resolve().then(() => (init_ai_config(), exports_ai_config));
|
|
6059
|
+
const theme = await readThemeFromConfig2();
|
|
5288
6060
|
const renderer = await createCliRenderer({
|
|
5289
6061
|
exitOnCtrlC: false
|
|
5290
6062
|
});
|
|
@@ -5298,8 +6070,9 @@ async function startTui(logMode = false) {
|
|
|
5298
6070
|
renderer.destroy();
|
|
5299
6071
|
process.exit(0);
|
|
5300
6072
|
});
|
|
5301
|
-
createRoot(renderer).render(/* @__PURE__ */
|
|
5302
|
-
logMode
|
|
6073
|
+
createRoot(renderer).render(/* @__PURE__ */ jsxDEV20(App, {
|
|
6074
|
+
logMode,
|
|
6075
|
+
theme
|
|
5303
6076
|
}, undefined, false, undefined, this));
|
|
5304
6077
|
}
|
|
5305
6078
|
var ENABLE_BRACKETED_PASTE = "\x1B[?2004h", DISABLE_BRACKETED_PASTE = "\x1B[?2004l";
|