@lynn123411/dsh-model-submenu 0.3.16 → 0.3.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -7
- package/docs/DETAIL.md +1 -1
- package/docs/DETAIL.zh.md +1 -1
- package/docs/preview.svg +24 -23
- package/docs/preview.zh.svg +24 -23
- package/lib/client.js +324 -168
- package/lib/client.js.map +1 -1
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +2 -2
- package/src/client/ModelMenuBridge.tsx +66 -15
- package/src/client/ModelOptions.module.css +88 -2
- package/src/client/ModelPickerHost.tsx +1 -10
- package/src/client/QuickModels.tsx +90 -0
- package/src/client/favorites.ts +9 -0
- package/src/client/index.ts +8 -0
- package/src/client/locales.ts +6 -0
package/lib/client.js
CHANGED
|
@@ -258,10 +258,12 @@ window.__ModuleLoader__.load({
|
|
|
258
258
|
}
|
|
259
259
|
//#endregion
|
|
260
260
|
//#region \0dsh-css:/home/runner/work/my-dsh/my-dsh/plugins/dsh-model-submenu/src/client/ModelOptions.module.css.mjs
|
|
261
|
-
const stylesheet = ".TcCbqa_pickerHost{display:contents}.TcCbqa_sliderCell{flex:auto;align-self:stretch;align-items:center;min-width:96px;display:flex}.TcCbqa_slider{cursor:pointer;touch-action:none;-webkit-user-select:none;user-select:none;outline:none;flex:1;align-items:center;min-width:0;height:100%;display:flex}.TcCbqa_slider[data-busy]{cursor:default}.TcCbqa_sliderTrack{corner-shape:round;background:var(--dsw-alias-border-l3);border-radius:999px;width:100%;height:16px;position:relative}.TcCbqa_sliderFill{corner-shape:round;pointer-events:none;border-radius:999px;transition:width .16s cubic-bezier(.2,0,0,1);position:absolute;top:0;bottom:0;left:0}.TcCbqa_sliderTick{corner-shape:round;background:var(--dsw-alias-label-tertiary);pointer-events:none;border-radius:50%;width:4px;height:4px;margin:-2px 0 0 -2px;position:absolute;top:50%}.TcCbqa_sliderTick[data-on]{background:#00000047}.TcCbqa_sliderKnob{box-sizing:border-box;corner-shape:round;background:var(--dsw-alias-label-primary-foreground);width:20px;height:20px;box-shadow:var(--dsw-elevation-soft);pointer-events:none;border-radius:50%;margin:-10px 0 0 -10px;transition:left .16s cubic-bezier(.2,0,0,1);position:absolute;top:50%}.TcCbqa_slider[data-dragging] .TcCbqa_sliderKnob,.TcCbqa_slider[data-dragging] .TcCbqa_sliderFill{transition:none}@media (prefers-reduced-motion:reduce){.TcCbqa_sliderKnob,.TcCbqa_sliderFill{transition:none}}.TcCbqa_slider[data-default] .TcCbqa_sliderKnob{background:var(--dsw-alias-bg-layer-1);border:1.5px solid var(--dsw-alias-label-tertiary);box-shadow:none}.TcCbqa_slider[data-busy] .TcCbqa_sliderKnob{opacity:.6}.TcCbqa_slider:focus-visible .TcCbqa_sliderTrack{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:3px}.TcCbqa_rowBadge{flex:none;margin-inline-start:6px}.TcCbqa_row{align-items:center;gap:2px;display:flex}.TcCbqa_rowPick{box-sizing:border-box;width:100%;min-width:0;min-height:34px;color:inherit;text-align:left;cursor:pointer;border-radius:var(--dsw-radius-md);padding-inline:6px;background:0 0;border:none;outline:none;flex:1;align-items:center;gap:4px;padding:5px 7px;display:flex}.TcCbqa_rowPick:hover:not(:disabled),.TcCbqa_rowPick:focus-visible{background:var(--dsw-alias-interactive-bg-hover)}.TcCbqa_rowPick:disabled{color:var(--dsw-alias-label-dimmed);cursor:default}.TcCbqa_rowCopy{flex-direction:column;flex:1;min-width:0;display:flex}.TcCbqa_rowName{color:inherit;text-overflow:ellipsis;white-space:nowrap;font-size:11.5px;font-weight:400;line-height:17px;overflow:hidden}.TcCbqa_rowMeta{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:18px;overflow:hidden}.TcCbqa_check{color:var(--dsw-alias-label-primary);flex:0 0 15px;place-items:center;display:grid}.TcCbqa_starButton{color:var(--dsw-alias-label-tertiary);cursor:pointer;border-radius:var(--dsw-radius-sm);opacity:0;background:0 0;border:none;outline:none;flex:none;place-items:center;width:26px;height:26px;display:grid}.TcCbqa_starButton:focus-visible{outline:2px solid var(--dsw-alias-border-l3)}.TcCbqa_row:hover .TcCbqa_starButton,.TcCbqa_row:focus-within .TcCbqa_starButton{opacity:1}.TcCbqa_starButton[aria-pressed=true]{color:var(--dsw-alias-state-warn-primary);opacity:1}@media (hover:none){.TcCbqa_starButton{opacity:1}}.TcCbqa_star{flex:none}.TcCbqa_notice{color:var(--dsw-alias-label-tertiary);justify-content:space-between;align-items:flex-start;gap:8px;padding:6px 10px;font-size:12px;line-height:18px;display:flex}.TcCbqa_retry{color:inherit;font:inherit;cursor:pointer;background:0 0;border:none;flex:none;padding:0;font-weight:600;text-decoration:underline}.TcCbqa_pickerDialog{gap:0;width:min(680px,100%);height:min(640px,80vh);padding:0}.TcCbqa_pickerContent,.TcCbqa_pickerContent>:last-child{flex-direction:column;flex:1;min-height:0;display:flex}.TcCbqa_pickerSearch{padding:0 20px 12px}.TcCbqa_pickerSearchInput{width:100%}.TcCbqa_pickerTabs{border-bottom:.5px solid var(--dsw-alias-border-l2);overscroll-behavior-x:contain;scrollbar-width:none;flex-wrap:nowrap;gap:2px;padding:0 16px;display:flex;overflow-x:auto}.TcCbqa_pickerTabs::-webkit-scrollbar{display:none}.TcCbqa_pickerTab{color:var(--dsw-alias-label-secondary);cursor:pointer;border-radius:var(--dsw-radius-sm);white-space:nowrap;background:0 0;border:none;outline:none;flex:none;padding:6px 10px;font-size:13px;line-height:18px}.TcCbqa_pickerTab:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}.TcCbqa_pickerTab[aria-selected=true]{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover);font-weight:600}.TcCbqa_pickerTab:focus-visible{outline:2px solid var(--dsw-alias-border-l3)}.TcCbqa_pickerList{flex:1;min-height:0;padding:8px 12px;overflow-y:auto}.TcCbqa_pickerFooter{border-top:.5px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;padding:10px 20px;font-size:12px;line-height:18px;display:flex}.TcCbqa_footerHint{flex-wrap:wrap;align-items:center;gap:6px;display:flex}";
|
|
261
|
+
const stylesheet = ".TcCbqa_pickerHost{display:contents}.TcCbqa_modelCell.TcCbqa_modelCell{anchor-name:--dsh-quick-model-row;padding-inline-end:14px}.TcCbqa_modelCell>svg:last-child{visibility:hidden}.TcCbqa_modelBrowse{position-anchor:--dsh-quick-model-row;top:anchor(top);bottom:anchor(bottom);border-radius:var(--dsw-radius-md);width:32px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;place-items:center;padding:0;display:grid;position:absolute;inset-inline-end:anchor(end)}.TcCbqa_modelBrowse:hover:not(:disabled),.TcCbqa_modelBrowse:focus-visible{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.TcCbqa_quickOption{border-radius:var(--dsw-radius-md);width:100%;min-height:34px;color:inherit;text-align:start;cursor:pointer;background:0 0;border:0;outline:none;align-items:center;gap:6px;padding:5px 7px;font-size:13px;font-weight:400;line-height:18px;display:flex}.TcCbqa_quickOption:hover:not([aria-disabled=true]),.TcCbqa_quickOption:focus-visible{background:var(--dsw-alias-interactive-bg-hover)}.TcCbqa_quickOption[aria-disabled=true]{color:var(--dsw-alias-label-dimmed);cursor:default}.TcCbqa_quickCopy{flex:1;align-items:center;gap:4px;min-width:0;display:flex}.TcCbqa_quickName{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.TcCbqa_quickBadge{flex:none}.TcCbqa_quickCheck{flex:0 0 14px;place-items:center;display:grid}.TcCbqa_sliderCell{flex:auto;align-self:stretch;align-items:center;min-width:96px;display:flex}.TcCbqa_slider{cursor:pointer;touch-action:none;-webkit-user-select:none;user-select:none;outline:none;flex:1;align-items:center;min-width:0;height:100%;display:flex}.TcCbqa_slider[data-busy]{cursor:default}.TcCbqa_sliderTrack{corner-shape:round;background:var(--dsw-alias-border-l3);border-radius:999px;width:100%;height:16px;position:relative}.TcCbqa_sliderFill{corner-shape:round;pointer-events:none;border-radius:999px;transition:width .16s cubic-bezier(.2,0,0,1);position:absolute;top:0;bottom:0;left:0}.TcCbqa_sliderTick{corner-shape:round;background:var(--dsw-alias-label-tertiary);pointer-events:none;border-radius:50%;width:4px;height:4px;margin:-2px 0 0 -2px;position:absolute;top:50%}.TcCbqa_sliderTick[data-on]{background:#00000047}.TcCbqa_sliderKnob{box-sizing:border-box;corner-shape:round;background:var(--dsw-alias-label-primary-foreground);width:20px;height:20px;box-shadow:var(--dsw-elevation-soft);pointer-events:none;border-radius:50%;margin:-10px 0 0 -10px;transition:left .16s cubic-bezier(.2,0,0,1);position:absolute;top:50%}.TcCbqa_slider[data-dragging] .TcCbqa_sliderKnob,.TcCbqa_slider[data-dragging] .TcCbqa_sliderFill{transition:none}@media (prefers-reduced-motion:reduce){.TcCbqa_sliderKnob,.TcCbqa_sliderFill{transition:none}}.TcCbqa_slider[data-default] .TcCbqa_sliderKnob{background:var(--dsw-alias-bg-layer-1);border:1.5px solid var(--dsw-alias-label-tertiary);box-shadow:none}.TcCbqa_slider[data-busy] .TcCbqa_sliderKnob{opacity:.6}.TcCbqa_slider:focus-visible .TcCbqa_sliderTrack{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:3px}.TcCbqa_rowBadge{flex:none;margin-inline-start:6px}.TcCbqa_row{align-items:center;gap:2px;display:flex}.TcCbqa_rowPick{box-sizing:border-box;width:100%;min-width:0;min-height:34px;color:inherit;text-align:left;cursor:pointer;border-radius:var(--dsw-radius-md);padding-inline:6px;background:0 0;border:none;outline:none;flex:1;align-items:center;gap:4px;padding:5px 7px;display:flex}.TcCbqa_rowPick:hover:not(:disabled),.TcCbqa_rowPick:focus-visible{background:var(--dsw-alias-interactive-bg-hover)}.TcCbqa_rowPick:disabled{color:var(--dsw-alias-label-dimmed);cursor:default}.TcCbqa_rowCopy{flex-direction:column;flex:1;min-width:0;display:flex}.TcCbqa_rowName{color:inherit;text-overflow:ellipsis;white-space:nowrap;font-size:11.5px;font-weight:400;line-height:17px;overflow:hidden}.TcCbqa_rowMeta{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:18px;overflow:hidden}.TcCbqa_check{color:var(--dsw-alias-label-primary);flex:0 0 15px;place-items:center;display:grid}.TcCbqa_starButton{color:var(--dsw-alias-label-tertiary);cursor:pointer;border-radius:var(--dsw-radius-sm);opacity:0;background:0 0;border:none;outline:none;flex:none;place-items:center;width:26px;height:26px;display:grid}.TcCbqa_starButton:focus-visible{outline:2px solid var(--dsw-alias-border-l3)}.TcCbqa_row:hover .TcCbqa_starButton,.TcCbqa_row:focus-within .TcCbqa_starButton{opacity:1}.TcCbqa_starButton[aria-pressed=true]{color:var(--dsw-alias-state-warn-primary);opacity:1}@media (hover:none){.TcCbqa_starButton{opacity:1}}.TcCbqa_star{flex:none}.TcCbqa_notice{color:var(--dsw-alias-label-tertiary);justify-content:space-between;align-items:flex-start;gap:8px;padding:6px 10px;font-size:12px;line-height:18px;display:flex}.TcCbqa_retry{color:inherit;font:inherit;cursor:pointer;background:0 0;border:none;flex:none;padding:0;font-weight:600;text-decoration:underline}.TcCbqa_pickerDialog.TcCbqa_pickerDialog{gap:0;width:min(680px,100%);height:min(640px,80vh);padding:0}.TcCbqa_pickerContent,.TcCbqa_pickerContent>:last-child{flex-direction:column;flex:1;min-height:0;display:flex}.TcCbqa_pickerSearch{padding:0 20px 12px}.TcCbqa_pickerSearchInput{width:100%}.TcCbqa_pickerTabs{border-bottom:.5px solid var(--dsw-alias-border-l2);overscroll-behavior-x:contain;scrollbar-width:none;flex-wrap:nowrap;gap:2px;padding:0 16px;display:flex;overflow-x:auto}.TcCbqa_pickerTabs::-webkit-scrollbar{display:none}.TcCbqa_pickerTab{color:var(--dsw-alias-label-secondary);cursor:pointer;border-radius:var(--dsw-radius-sm);white-space:nowrap;background:0 0;border:none;outline:none;flex:none;padding:6px 10px;font-size:13px;line-height:18px}.TcCbqa_pickerTab:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}.TcCbqa_pickerTab[aria-selected=true]{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover);font-weight:600}.TcCbqa_pickerTab:focus-visible{outline:2px solid var(--dsw-alias-border-l3)}.TcCbqa_pickerList{flex:1;min-height:0;padding:8px 12px;overflow-y:auto}.TcCbqa_pickerFooter{border-top:.5px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;padding:10px 20px;font-size:12px;line-height:18px;display:flex}.TcCbqa_footerHint{flex-wrap:wrap;align-items:center;gap:6px;display:flex}";
|
|
262
262
|
var ModelOptions_module_css_default = {
|
|
263
263
|
"check": "TcCbqa_check",
|
|
264
264
|
"footerHint": "TcCbqa_footerHint",
|
|
265
|
+
"modelBrowse": "TcCbqa_modelBrowse",
|
|
266
|
+
"modelCell": "TcCbqa_modelCell",
|
|
265
267
|
"notice": "TcCbqa_notice",
|
|
266
268
|
"pickerContent": "TcCbqa_pickerContent",
|
|
267
269
|
"pickerDialog": "TcCbqa_pickerDialog",
|
|
@@ -272,6 +274,11 @@ window.__ModuleLoader__.load({
|
|
|
272
274
|
"pickerSearchInput": "TcCbqa_pickerSearchInput",
|
|
273
275
|
"pickerTab": "TcCbqa_pickerTab",
|
|
274
276
|
"pickerTabs": "TcCbqa_pickerTabs",
|
|
277
|
+
"quickBadge": "TcCbqa_quickBadge",
|
|
278
|
+
"quickCheck": "TcCbqa_quickCheck",
|
|
279
|
+
"quickCopy": "TcCbqa_quickCopy",
|
|
280
|
+
"quickName": "TcCbqa_quickName",
|
|
281
|
+
"quickOption": "TcCbqa_quickOption",
|
|
275
282
|
"retry": "TcCbqa_retry",
|
|
276
283
|
"row": "TcCbqa_row",
|
|
277
284
|
"rowBadge": "TcCbqa_rowBadge",
|
|
@@ -439,14 +446,236 @@ window.__ModuleLoader__.load({
|
|
|
439
446
|
});
|
|
440
447
|
}
|
|
441
448
|
//#endregion
|
|
449
|
+
//#region src/client/effort-memory.ts
|
|
450
|
+
/** The single browser-wide storage key holding the whole memory. */
|
|
451
|
+
const EFFORTS_KEY = "dsh-model-submenu.efforts";
|
|
452
|
+
/**
|
|
453
|
+
* Read the memory, keeping only rows naming both halves and a level.
|
|
454
|
+
* @param storage - browser storage, or undefined when the browser withholds it.
|
|
455
|
+
* @returns the remembered rows; empty when unreadable.
|
|
456
|
+
*/
|
|
457
|
+
function readEfforts(storage) {
|
|
458
|
+
const raw = getItem$1(storage);
|
|
459
|
+
if (raw === null) return [];
|
|
460
|
+
let parsed;
|
|
461
|
+
try {
|
|
462
|
+
parsed = JSON.parse(raw);
|
|
463
|
+
} catch {
|
|
464
|
+
return [];
|
|
465
|
+
}
|
|
466
|
+
if (!Array.isArray(parsed)) return [];
|
|
467
|
+
return parsed.filter((row) => typeof row === "object" && row !== null && typeof row.provider === "string" && typeof row.model === "string" && typeof row.effort === "string" && row.effort !== "");
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* @param memory - the rows to search.
|
|
471
|
+
* @param provider - the provider route key.
|
|
472
|
+
* @param model - the model id inside that provider.
|
|
473
|
+
* @returns the level last chosen for that exact model, or undefined.
|
|
474
|
+
*/
|
|
475
|
+
function effortFor(memory, provider, model) {
|
|
476
|
+
return memory.find((row) => row.provider === provider && row.model === model)?.effort;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Remember one model's level, or forget it when the choice is the provider default.
|
|
480
|
+
* @param storage - browser storage, or undefined when writes are unavailable.
|
|
481
|
+
* @param provider - the provider route key.
|
|
482
|
+
* @param model - the model id inside that provider.
|
|
483
|
+
* @param effort - the chosen level, undefined meaning the provider default.
|
|
484
|
+
* @returns the memory after the change, whether or not the write landed.
|
|
485
|
+
*/
|
|
486
|
+
function rememberEffort(storage, provider, model, effort) {
|
|
487
|
+
const rest = readEfforts(storage).filter((row) => row.provider !== provider || row.model !== model);
|
|
488
|
+
const next = effort === void 0 ? rest : [...rest, {
|
|
489
|
+
provider,
|
|
490
|
+
model,
|
|
491
|
+
effort
|
|
492
|
+
}];
|
|
493
|
+
try {
|
|
494
|
+
storage?.setItem(EFFORTS_KEY, JSON.stringify(next));
|
|
495
|
+
} catch {}
|
|
496
|
+
return next;
|
|
497
|
+
}
|
|
498
|
+
function getItem$1(storage) {
|
|
499
|
+
try {
|
|
500
|
+
return storage?.getItem("dsh-model-submenu.efforts") ?? null;
|
|
501
|
+
} catch {
|
|
502
|
+
return null;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
//#endregion
|
|
506
|
+
//#region src/client/favorites.ts
|
|
507
|
+
/** The single browser-wide storage key holding the whole table. */
|
|
508
|
+
const FAVORITES_KEY = "dsh-model-submenu.favorites";
|
|
509
|
+
/** A browser can withhold access to localStorage itself. */
|
|
510
|
+
function storageOf() {
|
|
511
|
+
try {
|
|
512
|
+
return globalThis.localStorage;
|
|
513
|
+
} catch {
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Read the table, keeping only rows that name both halves.
|
|
519
|
+
* @param storage - browser storage, or undefined when the browser withholds it.
|
|
520
|
+
* @returns the stored favorites in stored order; empty when unreadable.
|
|
521
|
+
*/
|
|
522
|
+
function readFavorites(storage) {
|
|
523
|
+
const raw = getItem(storage);
|
|
524
|
+
if (raw === null) return [];
|
|
525
|
+
let parsed;
|
|
526
|
+
try {
|
|
527
|
+
parsed = JSON.parse(raw);
|
|
528
|
+
} catch {
|
|
529
|
+
return [];
|
|
530
|
+
}
|
|
531
|
+
if (!Array.isArray(parsed)) return [];
|
|
532
|
+
return parsed.filter((row) => typeof row === "object" && row !== null && typeof row.provider === "string" && typeof row.model === "string");
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Add or remove one model, writing the whole table back.
|
|
536
|
+
* @param storage - browser storage, or undefined when writes are unavailable.
|
|
537
|
+
* @param provider - the provider route key.
|
|
538
|
+
* @param model - the model id inside that provider.
|
|
539
|
+
* @returns the table after the change, whether or not the write landed.
|
|
540
|
+
*/
|
|
541
|
+
function toggleFavorite(storage, provider, model) {
|
|
542
|
+
const current = readFavorites(storage);
|
|
543
|
+
const next = isFavorite(current, provider, model) ? current.filter((row) => row.provider !== provider || row.model !== model) : [...current, {
|
|
544
|
+
provider,
|
|
545
|
+
model
|
|
546
|
+
}];
|
|
547
|
+
try {
|
|
548
|
+
storage?.setItem(FAVORITES_KEY, JSON.stringify(next));
|
|
549
|
+
} catch {}
|
|
550
|
+
return next;
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* @param favorites - the table to search.
|
|
554
|
+
* @param provider - the provider route key.
|
|
555
|
+
* @param model - the model id inside that provider.
|
|
556
|
+
* @returns whether that exact pair is favorited.
|
|
557
|
+
*/
|
|
558
|
+
function isFavorite(favorites, provider, model) {
|
|
559
|
+
return favorites.some((row) => row.provider === provider && row.model === model);
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* Stable-partition a catalog so favorited rows lead, each part keeping the
|
|
563
|
+
* catalog's own order.
|
|
564
|
+
* @param rows - the catalog in its display order.
|
|
565
|
+
* @param favorited - predicate answering whether one row is favorited.
|
|
566
|
+
* @returns a new list; the input order when nothing is favorited.
|
|
567
|
+
*/
|
|
568
|
+
function orderWithFavorites(rows, favorited) {
|
|
569
|
+
const starred = rows.filter(favorited);
|
|
570
|
+
if (starred.length === 0) return rows;
|
|
571
|
+
return [...starred, ...rows.filter((row) => !favorited(row))];
|
|
572
|
+
}
|
|
573
|
+
function getItem(storage) {
|
|
574
|
+
try {
|
|
575
|
+
return storage?.getItem("dsh-model-submenu.favorites") ?? null;
|
|
576
|
+
} catch {
|
|
577
|
+
return null;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
//#endregion
|
|
581
|
+
//#region src/client/QuickModels.tsx
|
|
582
|
+
const QUICK_MODELS_PANE = "lynn-quick-models";
|
|
583
|
+
/** The current model and available favorites, grouped like the Host's picker. */
|
|
584
|
+
function QuickModels({ locked, dismiss, reportFailure, directory, resolveText, select, t }) {
|
|
585
|
+
const state = (0, react.useSyncExternalStore)((listener) => directory.subscribe(listener), () => directory.getSnapshot());
|
|
586
|
+
const [favorites] = (0, react.useState)(() => readFavorites(storageOf()));
|
|
587
|
+
const open = (0, react.useRef)(false);
|
|
588
|
+
(0, react.useLayoutEffect)(() => {
|
|
589
|
+
open.current = true;
|
|
590
|
+
return () => {
|
|
591
|
+
open.current = false;
|
|
592
|
+
};
|
|
593
|
+
}, []);
|
|
594
|
+
const live = selectionOf(state);
|
|
595
|
+
const busy = locked || state.pending !== null;
|
|
596
|
+
const groups = state.groups.flatMap((group) => {
|
|
597
|
+
const models = group.models.filter((model) => live !== null && sameModel(live, group.id, model.id) || isFavorite(favorites, group.id, model.id));
|
|
598
|
+
return models.length === 0 ? [] : [{
|
|
599
|
+
...group,
|
|
600
|
+
models
|
|
601
|
+
}];
|
|
602
|
+
});
|
|
603
|
+
const choose = async (provider, model) => {
|
|
604
|
+
if (busy || directory.getSnapshot().pending !== null) return;
|
|
605
|
+
const remembered = effortFor(readEfforts(storageOf()), provider, model.id);
|
|
606
|
+
const selection = planModelCommit(live, provider, model.id, () => model.reasoning, remembered);
|
|
607
|
+
if (selection === null) {
|
|
608
|
+
dismiss();
|
|
609
|
+
return;
|
|
610
|
+
}
|
|
611
|
+
const result = await select(selection);
|
|
612
|
+
if (result === void 0) return;
|
|
613
|
+
if (result.ok) {
|
|
614
|
+
if (open.current) dismiss();
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
reportFailure(result.error.code === "session/writer-held" ? t("error.sessionInUse") : t("error.action", { message: `${result.error.code}: ${result.error.message}` }));
|
|
618
|
+
};
|
|
619
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
620
|
+
role: "menu",
|
|
621
|
+
"aria-label": t("picker.quick"),
|
|
622
|
+
"aria-busy": busy,
|
|
623
|
+
children: [groups.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
624
|
+
className: ModelOptions_module_css_default.notice,
|
|
625
|
+
role: "status",
|
|
626
|
+
children: t(state.status === "loading" ? "status.loading" : "status.empty")
|
|
627
|
+
}), groups.map((group) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MenuGroup, {
|
|
628
|
+
label: group.name,
|
|
629
|
+
children: group.models.map((model) => {
|
|
630
|
+
const selected = live !== null && sameModel(live, group.id, model.id);
|
|
631
|
+
const pending = state.pending !== null && sameModel(state.pending, group.id, model.id);
|
|
632
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
633
|
+
type: "button",
|
|
634
|
+
role: "menuitemradio",
|
|
635
|
+
"aria-checked": selected,
|
|
636
|
+
"aria-disabled": busy,
|
|
637
|
+
autoFocus: selected,
|
|
638
|
+
className: ModelOptions_module_css_default.quickOption,
|
|
639
|
+
title: model.name,
|
|
640
|
+
onClick: () => {
|
|
641
|
+
choose(group.id, model);
|
|
642
|
+
},
|
|
643
|
+
onKeyDown: (event) => {
|
|
644
|
+
if (event.key !== "Tab" || event.shiftKey || event.nativeEvent.isComposing) return;
|
|
645
|
+
event.preventDefault();
|
|
646
|
+
event.stopPropagation();
|
|
647
|
+
choose(group.id, model);
|
|
648
|
+
},
|
|
649
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
650
|
+
className: ModelOptions_module_css_default.quickCopy,
|
|
651
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
652
|
+
className: ModelOptions_module_css_default.quickName,
|
|
653
|
+
children: model.name
|
|
654
|
+
}), model.badge !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tag, {
|
|
655
|
+
className: ModelOptions_module_css_default.quickBadge,
|
|
656
|
+
tone: model.badge.tone,
|
|
657
|
+
children: resolveText(model.badge.text)
|
|
658
|
+
})]
|
|
659
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
660
|
+
className: ModelOptions_module_css_default.quickCheck,
|
|
661
|
+
"aria-hidden": "true",
|
|
662
|
+
children: pending ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, { state: "ongoing" }) : selected && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCheckOutlineRegular, { size: 14 })
|
|
663
|
+
})]
|
|
664
|
+
}, model.id);
|
|
665
|
+
})
|
|
666
|
+
}, group.id))]
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
//#endregion
|
|
442
670
|
//#region src/client/ModelMenuBridge.tsx
|
|
443
671
|
/**
|
|
444
|
-
* Bridge the Host's own model menu: the model cell opens
|
|
445
|
-
* picker, and the effort cell carries
|
|
672
|
+
* Bridge the Host's own model menu: the model cell opens a short list, its
|
|
673
|
+
* trailing button opens the all-provider picker, and the effort cell carries
|
|
674
|
+
* the reasoning-level slider.
|
|
446
675
|
*
|
|
447
676
|
* The Host owns the root menu's model and effort cells and opens a submenu for each.
|
|
448
|
-
* While the root pane is open, this entry redirects the first cell to
|
|
449
|
-
*
|
|
677
|
+
* While the root pane is open, this entry redirects the first cell to a detail
|
|
678
|
+
* pane and mounts the slider in the second cell.
|
|
450
679
|
*
|
|
451
680
|
* Only the model menu's own direct buttons with the expected label, value and
|
|
452
681
|
* chevron are recognized. The options slot output sits in its own wrapper,
|
|
@@ -470,10 +699,12 @@ window.__ModuleLoader__.load({
|
|
|
470
699
|
* @param props - menu state, session, catalog face, and localized copy.
|
|
471
700
|
* @returns an inert marker plus the slider while the effort cell is present.
|
|
472
701
|
*/
|
|
473
|
-
function ModelMenuBridge({ sessionId, picker, locked, dismiss, reportFailure, available, directory, select, t }) {
|
|
702
|
+
function ModelMenuBridge({ sessionId, picker, locked, dismiss, openPane, reportFailure, available, directory, select, t }) {
|
|
474
703
|
const markerRef = (0, react.useRef)(null);
|
|
475
704
|
const sliderRef = (0, react.useRef)(null);
|
|
476
705
|
const [surface, setSurface] = (0, react.useState)(null);
|
|
706
|
+
const [modelRow, setModelRow] = (0, react.useState)(null);
|
|
707
|
+
const [browseMount, setBrowseMount] = (0, react.useState)(null);
|
|
477
708
|
const [effortRow, setEffortRow] = (0, react.useState)(null);
|
|
478
709
|
const [rowLabel, setRowLabel] = (0, react.useState)(null);
|
|
479
710
|
const state = (0, react.useSyncExternalStore)((listener) => directory.subscribe(listener), () => directory.getSnapshot());
|
|
@@ -487,6 +718,7 @@ window.__ModuleLoader__.load({
|
|
|
487
718
|
const defaultIndex = declared >= 0 ? declared : 0;
|
|
488
719
|
const busy = locked || state.pending !== null;
|
|
489
720
|
const canDefault = !busy && !defaultActive;
|
|
721
|
+
const showQuickModels = available && modelRow !== null && browseMount !== null;
|
|
490
722
|
const showSlider = available && levels.length >= 2 && effortRow !== null;
|
|
491
723
|
(0, react.useLayoutEffect)(() => {
|
|
492
724
|
const nextSurface = markerRef.current?.closest("[data-model-menu][role=\"menu\"]") ?? null;
|
|
@@ -496,6 +728,33 @@ window.__ModuleLoader__.load({
|
|
|
496
728
|
const nextLabel = nextRow?.querySelector(cellLabel)?.textContent?.trim() ?? "";
|
|
497
729
|
if (nextLabel !== (rowLabel ?? "")) setRowLabel(nextLabel);
|
|
498
730
|
});
|
|
731
|
+
(0, react.useLayoutEffect)(() => {
|
|
732
|
+
const menu = markerRef.current?.closest("[data-model-menu][role=\"menu\"]");
|
|
733
|
+
const row = available && menu ? hostCell(menu, 0) : null;
|
|
734
|
+
if (row === null) {
|
|
735
|
+
setModelRow(null);
|
|
736
|
+
setBrowseMount(null);
|
|
737
|
+
return;
|
|
738
|
+
}
|
|
739
|
+
const mount = row.ownerDocument.createElement("span");
|
|
740
|
+
mount.style.display = "contents";
|
|
741
|
+
row.after(mount);
|
|
742
|
+
const previousPane = row.dataset.modelMenuPane;
|
|
743
|
+
const previousPopup = row.getAttribute("aria-haspopup");
|
|
744
|
+
row.dataset.modelMenuPane = QUICK_MODELS_PANE;
|
|
745
|
+
row.setAttribute("aria-haspopup", "menu");
|
|
746
|
+
row.classList.add(ModelOptions_module_css_default.modelCell);
|
|
747
|
+
setModelRow(row);
|
|
748
|
+
setBrowseMount(mount);
|
|
749
|
+
return () => {
|
|
750
|
+
mount.remove();
|
|
751
|
+
row.classList.remove(ModelOptions_module_css_default.modelCell);
|
|
752
|
+
if (previousPane === void 0) delete row.dataset.modelMenuPane;
|
|
753
|
+
else row.dataset.modelMenuPane = previousPane;
|
|
754
|
+
if (previousPopup === null) row.removeAttribute("aria-haspopup");
|
|
755
|
+
else row.setAttribute("aria-haspopup", previousPopup);
|
|
756
|
+
};
|
|
757
|
+
}, [available]);
|
|
499
758
|
const submit = (selection) => {
|
|
500
759
|
if (selection === null || busy || directory.getSnapshot().pending !== null) return;
|
|
501
760
|
select(selection).then((result) => {
|
|
@@ -514,11 +773,14 @@ window.__ModuleLoader__.load({
|
|
|
514
773
|
if (live === null) return;
|
|
515
774
|
submit(planEffortCommit(live, void 0));
|
|
516
775
|
};
|
|
776
|
+
const openQuickModels = () => openPane({
|
|
777
|
+
key: QUICK_MODELS_PANE,
|
|
778
|
+
title: t("picker.quick")
|
|
779
|
+
});
|
|
517
780
|
const latest = (0, react.useRef)({
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
available,
|
|
781
|
+
modelRow,
|
|
782
|
+
showQuickModels,
|
|
783
|
+
openQuickModels,
|
|
522
784
|
busy,
|
|
523
785
|
showSlider,
|
|
524
786
|
effortRow,
|
|
@@ -527,10 +789,9 @@ window.__ModuleLoader__.load({
|
|
|
527
789
|
});
|
|
528
790
|
(0, react.useLayoutEffect)(() => {
|
|
529
791
|
latest.current = {
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
available,
|
|
792
|
+
modelRow,
|
|
793
|
+
showQuickModels,
|
|
794
|
+
openQuickModels,
|
|
534
795
|
busy,
|
|
535
796
|
showSlider,
|
|
536
797
|
effortRow,
|
|
@@ -543,13 +804,11 @@ window.__ModuleLoader__.load({
|
|
|
543
804
|
const redirect = (event) => {
|
|
544
805
|
const target = event.target;
|
|
545
806
|
const request = latest.current;
|
|
546
|
-
if (!(target instanceof Node) || event.defaultPrevented
|
|
547
|
-
if (
|
|
807
|
+
if (!(target instanceof Node) || event.defaultPrevented) return;
|
|
808
|
+
if (request.showQuickModels && request.modelRow?.contains(target)) {
|
|
548
809
|
event.preventDefault();
|
|
549
810
|
event.stopPropagation();
|
|
550
|
-
if (request.busy)
|
|
551
|
-
request.dismiss();
|
|
552
|
-
request.picker.open(request.sessionId);
|
|
811
|
+
if (!request.busy) request.openQuickModels();
|
|
553
812
|
return;
|
|
554
813
|
}
|
|
555
814
|
const row = request.effortRow;
|
|
@@ -600,23 +859,41 @@ window.__ModuleLoader__.load({
|
|
|
600
859
|
canDefault,
|
|
601
860
|
t
|
|
602
861
|
]);
|
|
603
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
busy,
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
862
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
863
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
864
|
+
ref: markerRef,
|
|
865
|
+
hidden: true
|
|
866
|
+
}),
|
|
867
|
+
showQuickModels && (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
868
|
+
className: ModelOptions_module_css_default.modelBrowse,
|
|
869
|
+
type: "button",
|
|
870
|
+
role: "menuitem",
|
|
871
|
+
"aria-haspopup": "dialog",
|
|
872
|
+
"aria-label": t("picker.browseAll"),
|
|
873
|
+
title: t("picker.browseAll"),
|
|
874
|
+
disabled: busy,
|
|
875
|
+
onClick: () => {
|
|
876
|
+
if (directory.getSnapshot().pending !== null) return;
|
|
877
|
+
dismiss();
|
|
878
|
+
picker.open(sessionId);
|
|
879
|
+
},
|
|
880
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronRightOutlineRegular, { size: 12 })
|
|
881
|
+
}), browseMount),
|
|
882
|
+
showSlider && effortRow !== null && (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
883
|
+
ref: sliderRef,
|
|
884
|
+
className: ModelOptions_module_css_default.sliderCell,
|
|
885
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EffortSlider, {
|
|
886
|
+
steps: levels,
|
|
887
|
+
current: currentIndex,
|
|
888
|
+
defaultActive,
|
|
889
|
+
defaultIndex,
|
|
890
|
+
defaultLabel: t("effort.providerDefault"),
|
|
891
|
+
busy,
|
|
892
|
+
label: rowLabel !== null && rowLabel !== "" ? rowLabel : t("effort.label"),
|
|
893
|
+
onCommit: commit
|
|
894
|
+
}, JSON.stringify([current?.provider, current?.model]))
|
|
895
|
+
}), effortRow)
|
|
896
|
+
] });
|
|
620
897
|
}
|
|
621
898
|
//#endregion
|
|
622
899
|
//#region src/client/icons.tsx
|
|
@@ -705,73 +982,6 @@ window.__ModuleLoader__.load({
|
|
|
705
982
|
});
|
|
706
983
|
}
|
|
707
984
|
//#endregion
|
|
708
|
-
//#region src/client/favorites.ts
|
|
709
|
-
/** The single browser-wide storage key holding the whole table. */
|
|
710
|
-
const FAVORITES_KEY = "dsh-model-submenu.favorites";
|
|
711
|
-
/**
|
|
712
|
-
* Read the table, keeping only rows that name both halves.
|
|
713
|
-
* @param storage - browser storage, or undefined when the browser withholds it.
|
|
714
|
-
* @returns the stored favorites in stored order; empty when unreadable.
|
|
715
|
-
*/
|
|
716
|
-
function readFavorites(storage) {
|
|
717
|
-
const raw = getItem$1(storage);
|
|
718
|
-
if (raw === null) return [];
|
|
719
|
-
let parsed;
|
|
720
|
-
try {
|
|
721
|
-
parsed = JSON.parse(raw);
|
|
722
|
-
} catch {
|
|
723
|
-
return [];
|
|
724
|
-
}
|
|
725
|
-
if (!Array.isArray(parsed)) return [];
|
|
726
|
-
return parsed.filter((row) => typeof row === "object" && row !== null && typeof row.provider === "string" && typeof row.model === "string");
|
|
727
|
-
}
|
|
728
|
-
/**
|
|
729
|
-
* Add or remove one model, writing the whole table back.
|
|
730
|
-
* @param storage - browser storage, or undefined when writes are unavailable.
|
|
731
|
-
* @param provider - the provider route key.
|
|
732
|
-
* @param model - the model id inside that provider.
|
|
733
|
-
* @returns the table after the change, whether or not the write landed.
|
|
734
|
-
*/
|
|
735
|
-
function toggleFavorite(storage, provider, model) {
|
|
736
|
-
const current = readFavorites(storage);
|
|
737
|
-
const next = isFavorite(current, provider, model) ? current.filter((row) => row.provider !== provider || row.model !== model) : [...current, {
|
|
738
|
-
provider,
|
|
739
|
-
model
|
|
740
|
-
}];
|
|
741
|
-
try {
|
|
742
|
-
storage?.setItem(FAVORITES_KEY, JSON.stringify(next));
|
|
743
|
-
} catch {}
|
|
744
|
-
return next;
|
|
745
|
-
}
|
|
746
|
-
/**
|
|
747
|
-
* @param favorites - the table to search.
|
|
748
|
-
* @param provider - the provider route key.
|
|
749
|
-
* @param model - the model id inside that provider.
|
|
750
|
-
* @returns whether that exact pair is favorited.
|
|
751
|
-
*/
|
|
752
|
-
function isFavorite(favorites, provider, model) {
|
|
753
|
-
return favorites.some((row) => row.provider === provider && row.model === model);
|
|
754
|
-
}
|
|
755
|
-
/**
|
|
756
|
-
* Stable-partition a catalog so favorited rows lead, each part keeping the
|
|
757
|
-
* catalog's own order.
|
|
758
|
-
* @param rows - the catalog in its display order.
|
|
759
|
-
* @param favorited - predicate answering whether one row is favorited.
|
|
760
|
-
* @returns a new list; the input order when nothing is favorited.
|
|
761
|
-
*/
|
|
762
|
-
function orderWithFavorites(rows, favorited) {
|
|
763
|
-
const starred = rows.filter(favorited);
|
|
764
|
-
if (starred.length === 0) return rows;
|
|
765
|
-
return [...starred, ...rows.filter((row) => !favorited(row))];
|
|
766
|
-
}
|
|
767
|
-
function getItem$1(storage) {
|
|
768
|
-
try {
|
|
769
|
-
return storage?.getItem("dsh-model-submenu.favorites") ?? null;
|
|
770
|
-
} catch {
|
|
771
|
-
return null;
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
//#endregion
|
|
775
985
|
//#region src/client/model-facts.ts
|
|
776
986
|
/**
|
|
777
987
|
* The model knowledge a shipped adapter carries for its own account route.
|
|
@@ -2720,63 +2930,6 @@ window.__ModuleLoader__.load({
|
|
|
2720
2930
|
}).join(" · ");
|
|
2721
2931
|
}
|
|
2722
2932
|
//#endregion
|
|
2723
|
-
//#region src/client/effort-memory.ts
|
|
2724
|
-
/** The single browser-wide storage key holding the whole memory. */
|
|
2725
|
-
const EFFORTS_KEY = "dsh-model-submenu.efforts";
|
|
2726
|
-
/**
|
|
2727
|
-
* Read the memory, keeping only rows naming both halves and a level.
|
|
2728
|
-
* @param storage - browser storage, or undefined when the browser withholds it.
|
|
2729
|
-
* @returns the remembered rows; empty when unreadable.
|
|
2730
|
-
*/
|
|
2731
|
-
function readEfforts(storage) {
|
|
2732
|
-
const raw = getItem(storage);
|
|
2733
|
-
if (raw === null) return [];
|
|
2734
|
-
let parsed;
|
|
2735
|
-
try {
|
|
2736
|
-
parsed = JSON.parse(raw);
|
|
2737
|
-
} catch {
|
|
2738
|
-
return [];
|
|
2739
|
-
}
|
|
2740
|
-
if (!Array.isArray(parsed)) return [];
|
|
2741
|
-
return parsed.filter((row) => typeof row === "object" && row !== null && typeof row.provider === "string" && typeof row.model === "string" && typeof row.effort === "string" && row.effort !== "");
|
|
2742
|
-
}
|
|
2743
|
-
/**
|
|
2744
|
-
* @param memory - the rows to search.
|
|
2745
|
-
* @param provider - the provider route key.
|
|
2746
|
-
* @param model - the model id inside that provider.
|
|
2747
|
-
* @returns the level last chosen for that exact model, or undefined.
|
|
2748
|
-
*/
|
|
2749
|
-
function effortFor(memory, provider, model) {
|
|
2750
|
-
return memory.find((row) => row.provider === provider && row.model === model)?.effort;
|
|
2751
|
-
}
|
|
2752
|
-
/**
|
|
2753
|
-
* Remember one model's level, or forget it when the choice is the provider default.
|
|
2754
|
-
* @param storage - browser storage, or undefined when writes are unavailable.
|
|
2755
|
-
* @param provider - the provider route key.
|
|
2756
|
-
* @param model - the model id inside that provider.
|
|
2757
|
-
* @param effort - the chosen level, undefined meaning the provider default.
|
|
2758
|
-
* @returns the memory after the change, whether or not the write landed.
|
|
2759
|
-
*/
|
|
2760
|
-
function rememberEffort(storage, provider, model, effort) {
|
|
2761
|
-
const rest = readEfforts(storage).filter((row) => row.provider !== provider || row.model !== model);
|
|
2762
|
-
const next = effort === void 0 ? rest : [...rest, {
|
|
2763
|
-
provider,
|
|
2764
|
-
model,
|
|
2765
|
-
effort
|
|
2766
|
-
}];
|
|
2767
|
-
try {
|
|
2768
|
-
storage?.setItem(EFFORTS_KEY, JSON.stringify(next));
|
|
2769
|
-
} catch {}
|
|
2770
|
-
return next;
|
|
2771
|
-
}
|
|
2772
|
-
function getItem(storage) {
|
|
2773
|
-
try {
|
|
2774
|
-
return storage?.getItem("dsh-model-submenu.efforts") ?? null;
|
|
2775
|
-
} catch {
|
|
2776
|
-
return null;
|
|
2777
|
-
}
|
|
2778
|
-
}
|
|
2779
|
-
//#endregion
|
|
2780
2933
|
//#region src/client/ModelPickerHost.tsx
|
|
2781
2934
|
/**
|
|
2782
2935
|
* The composer overlay's picker view: the dialog, its catalog, and its verbs.
|
|
@@ -2893,14 +3046,6 @@ window.__ModuleLoader__.load({
|
|
|
2893
3046
|
children: t("picker.browse")
|
|
2894
3047
|
});
|
|
2895
3048
|
}
|
|
2896
|
-
/** Isolate the browser's storage so a locked-down browser reads as "no favorites". */
|
|
2897
|
-
function storageOf() {
|
|
2898
|
-
try {
|
|
2899
|
-
return globalThis.localStorage;
|
|
2900
|
-
} catch {
|
|
2901
|
-
return;
|
|
2902
|
-
}
|
|
2903
|
-
}
|
|
2904
3049
|
//#endregion
|
|
2905
3050
|
//#region src/client/picker-state.ts
|
|
2906
3051
|
/**
|
|
@@ -2995,6 +3140,8 @@ window.__ModuleLoader__.load({
|
|
|
2995
3140
|
"error.sessionInUse": "当前会话已被占用,可能是其他正在运行的 DSH 导致的(如其他 dsh web、桌面端),请退出其他正在运行的 DSH 后重试。",
|
|
2996
3141
|
"picker.title": "切换模型",
|
|
2997
3142
|
"picker.browse": "浏览模型",
|
|
3143
|
+
"picker.browseAll": "浏览全部模型",
|
|
3144
|
+
"picker.quick": "快捷切换模型",
|
|
2998
3145
|
"picker.close": "关闭",
|
|
2999
3146
|
"picker.search": "搜索模型或提供商…",
|
|
3000
3147
|
"picker.searchEmpty": "没有匹配的模型。",
|
|
@@ -3019,6 +3166,8 @@ window.__ModuleLoader__.load({
|
|
|
3019
3166
|
"error.sessionInUse": "This session is already in use, possibly by another running DSH instance (such as dsh web or the desktop app). Quit other running DSH instances and try again.",
|
|
3020
3167
|
"picker.title": "Switch model",
|
|
3021
3168
|
"picker.browse": "Browse models",
|
|
3169
|
+
"picker.browseAll": "Browse all models",
|
|
3170
|
+
"picker.quick": "Quick model selection",
|
|
3022
3171
|
"picker.close": "Close",
|
|
3023
3172
|
"picker.search": "Search models or providers…",
|
|
3024
3173
|
"picker.searchEmpty": "No matching models.",
|
|
@@ -3120,6 +3269,13 @@ window.__ModuleLoader__.load({
|
|
|
3120
3269
|
locale: NS,
|
|
3121
3270
|
inject: faceOf
|
|
3122
3271
|
}, ModelMenuBridge));
|
|
3272
|
+
scope.slots.inject("conversation.input.model.pane", () => scope.slots.register({
|
|
3273
|
+
name: "conversation.input.model.pane",
|
|
3274
|
+
key: QUICK_MODELS_PANE,
|
|
3275
|
+
registrant: "@lynn123411/dsh-model-submenu",
|
|
3276
|
+
locale: NS,
|
|
3277
|
+
inject: faceOf
|
|
3278
|
+
}, QuickModels));
|
|
3123
3279
|
scope.slots.inject("conversation.input.overlay", () => scope.slots.register({
|
|
3124
3280
|
name: "conversation.input.overlay",
|
|
3125
3281
|
id: "model-picker",
|