agent-loft 0.2.130 → 0.2.132
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/agents/codex/driver.ts +1 -0
- package/src/core/types.ts +1 -0
- package/web/css/composer.css +18 -2
- package/web/css/overlay.css +155 -17
- package/web/lib/dom.js +1 -0
- package/web/views/composer-models.js +304 -0
- package/web/views/composer.js +3 -2
- package/web/views/conv-actions.js +4 -125
- package/web/views/topbar.js +23 -7
package/package.json
CHANGED
|
@@ -265,6 +265,7 @@ export class CodexDriver implements AgentDriver {
|
|
|
265
265
|
...(m.supportedReasoningEfforts?.length
|
|
266
266
|
? { efforts: m.supportedReasoningEfforts.map((e) => e.reasoningEffort) }
|
|
267
267
|
: {}),
|
|
268
|
+
...(m.defaultReasoningEffort ? { defaultEffort: m.defaultReasoningEffort } : {}),
|
|
268
269
|
...(fast ? { fastMode: { description: fast.description } } : {}),
|
|
269
270
|
...(m.isDefault ? { isDefault: true } : {}),
|
|
270
271
|
};
|
package/src/core/types.ts
CHANGED
package/web/css/composer.css
CHANGED
|
@@ -138,6 +138,7 @@ button.ctx-item:hover {
|
|
|
138
138
|
display: inline-flex;
|
|
139
139
|
align-items: center;
|
|
140
140
|
gap: 5px;
|
|
141
|
+
min-width: 0;
|
|
141
142
|
max-width: min(260px, 45vw);
|
|
142
143
|
height: 32px;
|
|
143
144
|
padding: 0 10px;
|
|
@@ -145,19 +146,34 @@ button.ctx-item:hover {
|
|
|
145
146
|
font-size: 14px;
|
|
146
147
|
color: var(--fg);
|
|
147
148
|
white-space: nowrap;
|
|
149
|
+
transition: background-color 140ms ease;
|
|
148
150
|
}
|
|
149
151
|
|
|
150
|
-
.model-pill:hover
|
|
152
|
+
.model-pill:hover,
|
|
153
|
+
.model-pill[aria-expanded="true"] {
|
|
151
154
|
background: var(--bg-hover);
|
|
152
155
|
}
|
|
153
156
|
|
|
157
|
+
|
|
158
|
+
.model-pill .picker-prompt { display: none; }
|
|
159
|
+
.model-slot[data-picker="effort"] .model-pill > :not(.picker-prompt) { display: none; }
|
|
160
|
+
.model-slot[data-picker="effort"] .picker-prompt { display: inline; color: var(--fg-faint); }
|
|
161
|
+
.model-pill .fast-mark {
|
|
162
|
+
display: inline-flex;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.model-pill .fast-mark svg {
|
|
166
|
+
color: var(--fg);
|
|
167
|
+
fill: currentColor;
|
|
168
|
+
}
|
|
169
|
+
|
|
154
170
|
.model-pill .model-name {
|
|
155
171
|
overflow: hidden;
|
|
156
172
|
text-overflow: ellipsis;
|
|
157
173
|
}
|
|
158
174
|
|
|
159
175
|
.model-pill .sub {
|
|
160
|
-
color: var(--fg-
|
|
176
|
+
color: var(--fg-soft);
|
|
161
177
|
flex-shrink: 0;
|
|
162
178
|
}
|
|
163
179
|
|
package/web/css/overlay.css
CHANGED
|
@@ -459,29 +459,167 @@ button.list-item:hover {
|
|
|
459
459
|
height: 18px;
|
|
460
460
|
}
|
|
461
461
|
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
padding:
|
|
467
|
-
|
|
468
|
-
|
|
462
|
+
/* 输入框的强度滑杆与模型列表共用一个锚点。 */
|
|
463
|
+
.model-pop {
|
|
464
|
+
width: 256px;
|
|
465
|
+
min-width: 0;
|
|
466
|
+
padding: 0;
|
|
467
|
+
border-radius: 16px;
|
|
468
|
+
background: var(--bg-input);
|
|
469
|
+
box-shadow: 0 6px 18px color-mix(in srgb, var(--fg) 9%, transparent);
|
|
470
|
+
transform-origin: bottom right;
|
|
471
|
+
animation: picker-open 140ms ease-out;
|
|
469
472
|
}
|
|
470
473
|
|
|
471
|
-
.
|
|
472
|
-
|
|
474
|
+
.model-pop[data-view="effort"] {
|
|
475
|
+
padding: 6px 12px 8px;
|
|
476
|
+
overflow: visible;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
.effort-header {
|
|
480
|
+
position: relative;
|
|
481
|
+
display: grid;
|
|
482
|
+
padding: 3px 26px 0;
|
|
483
|
+
text-align: center;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
.effort-value { color: var(--fg); font-size: 14px; font-weight: 600; line-height: 20px; }
|
|
487
|
+
.effort-center { min-width: 0; }
|
|
488
|
+
.model-pop .picker-model-link {
|
|
489
|
+
display: inline-flex;
|
|
490
|
+
align-items: center;
|
|
473
491
|
justify-content: center;
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
492
|
+
max-width: 100%;
|
|
493
|
+
gap: 1px;
|
|
494
|
+
padding: 0 3px;
|
|
477
495
|
color: var(--fg-soft);
|
|
496
|
+
font-size: 12px;
|
|
497
|
+
line-height: 18px;
|
|
478
498
|
}
|
|
499
|
+
.effort-value { display: block; }
|
|
500
|
+
.picker-model-link > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
501
|
+
.picker-model-link svg { width: 11px; height: 11px; transform: rotate(180deg); }
|
|
479
502
|
|
|
480
|
-
.
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
503
|
+
.model-pop .picker-icon {
|
|
504
|
+
position: absolute;
|
|
505
|
+
top: 0;
|
|
506
|
+
display: grid;
|
|
507
|
+
place-items: center;
|
|
508
|
+
width: 28px;
|
|
509
|
+
height: 28px;
|
|
510
|
+
border-radius: 8px;
|
|
511
|
+
padding: 0;
|
|
512
|
+
color: var(--fg-faint);
|
|
513
|
+
}
|
|
514
|
+
.picker-icon svg { width: 15px; height: 15px; }
|
|
515
|
+
.picker-fast { left: -8px; }
|
|
516
|
+
.picker-reset { right: -8px; }
|
|
517
|
+
.model-pop .picker-fast[aria-checked="true"] { color: var(--fg); }
|
|
518
|
+
.picker-fast[aria-checked="true"] svg { fill: currentColor; }
|
|
519
|
+
.picker-tip {
|
|
520
|
+
position: absolute;
|
|
521
|
+
z-index: 1;
|
|
522
|
+
bottom: calc(100% + 5px);
|
|
523
|
+
left: max(50%, calc(42px - var(--picker-left)));
|
|
524
|
+
transform: translate(-50%, 3px);
|
|
525
|
+
opacity: 0;
|
|
526
|
+
visibility: hidden;
|
|
527
|
+
pointer-events: none;
|
|
528
|
+
padding: 6px 12px;
|
|
529
|
+
border-radius: 14px;
|
|
530
|
+
background: #1c1d1f;
|
|
531
|
+
color: #bdbec0;
|
|
532
|
+
font-size: 12px;
|
|
533
|
+
line-height: 17px;
|
|
534
|
+
text-align: left;
|
|
535
|
+
white-space: nowrap;
|
|
536
|
+
box-shadow: 0 4px 14px #0002;
|
|
537
|
+
transition: opacity 100ms, transform 100ms, visibility 100ms;
|
|
538
|
+
}
|
|
539
|
+
.picker-tip strong { display: block; color: white; font-weight: 500; }
|
|
540
|
+
@media (hover: hover) {
|
|
541
|
+
.picker-fast:hover .picker-tip { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
|
|
542
|
+
}
|
|
543
|
+
.picker-fast:focus-visible .picker-tip { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
|
|
544
|
+
|
|
545
|
+
.effort-slider {
|
|
546
|
+
position: relative;
|
|
547
|
+
display: grid;
|
|
548
|
+
align-items: center;
|
|
549
|
+
height: 36px;
|
|
550
|
+
margin-top: 7px;
|
|
551
|
+
touch-action: none;
|
|
552
|
+
user-select: none;
|
|
553
|
+
overflow: clip;
|
|
554
|
+
overflow-clip-margin: 3px;
|
|
555
|
+
cursor: pointer;
|
|
556
|
+
}
|
|
557
|
+
.effort-slider::before {
|
|
558
|
+
content: "";
|
|
559
|
+
position: absolute;
|
|
560
|
+
inset: 6px 0;
|
|
561
|
+
border-radius: 99px;
|
|
562
|
+
background: color-mix(in srgb, var(--fg) 10%, var(--bg-input));
|
|
563
|
+
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fg) 6%, transparent);
|
|
564
|
+
}
|
|
565
|
+
.effort-lane { position: relative; height: 24px; margin: 0 13px; pointer-events: none; }
|
|
566
|
+
.effort-fill {
|
|
567
|
+
position: absolute;
|
|
568
|
+
inset: 0 auto 0 -13px;
|
|
569
|
+
width: calc(13px + var(--position));
|
|
570
|
+
border-radius: 99px 0 0 99px;
|
|
571
|
+
background: var(--fg);
|
|
572
|
+
transition: width 150ms cubic-bezier(.2,.85,.25,1);
|
|
573
|
+
}
|
|
574
|
+
.effort-lane i {
|
|
575
|
+
position: absolute;
|
|
576
|
+
top: 50%;
|
|
577
|
+
width: 4px;
|
|
578
|
+
height: 4px;
|
|
579
|
+
transform: translate(-50%, -50%);
|
|
580
|
+
border-radius: 50%;
|
|
581
|
+
background: color-mix(in srgb, var(--fg) 24%, transparent);
|
|
582
|
+
}
|
|
583
|
+
.effort-lane i.passed { background: color-mix(in srgb, var(--bg) 55%, transparent); }
|
|
584
|
+
.effort-handle {
|
|
585
|
+
position: absolute;
|
|
586
|
+
inset: 0;
|
|
587
|
+
transform: translateX(var(--position));
|
|
588
|
+
transition: transform 150ms cubic-bezier(.2,.85,.25,1);
|
|
589
|
+
}
|
|
590
|
+
.effort-handle::after {
|
|
591
|
+
content: "";
|
|
592
|
+
position: absolute;
|
|
593
|
+
top: 50%;
|
|
594
|
+
width: 27px;
|
|
595
|
+
height: 27px;
|
|
596
|
+
transform: translate(-50%, -50%);
|
|
597
|
+
border-radius: 50%;
|
|
598
|
+
background: var(--bg-input);
|
|
599
|
+
border: 1px solid color-mix(in srgb, var(--fg) 22%, var(--bg-input));
|
|
600
|
+
box-shadow: 0 1px 3px #0002;
|
|
601
|
+
}
|
|
602
|
+
.effort-slider.dragging { cursor: grabbing; }
|
|
603
|
+
.effort-slider.dragging :is(.effort-handle, .effort-fill) { transition: none; }
|
|
604
|
+
|
|
605
|
+
.model-pop[data-view="models"] { padding: 5px; }
|
|
606
|
+
.model-pop .pop-head { padding: 3px 7px; font-weight: 500; }
|
|
607
|
+
.picker-options { min-height: 0; max-height: 300px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
|
|
608
|
+
.model-pop .picker-option { width: 100%; padding: 4px 7px; min-height: 29px; line-height: 20px; justify-content: space-between; }
|
|
609
|
+
.picker-option svg { width: 15px; height: 15px; }
|
|
610
|
+
.model-pop :is(button, [role="slider"]):focus-visible,
|
|
611
|
+
.model-pill:focus-visible { outline: 2px solid var(--fg); outline-offset: -2px; border-radius: 8px; }
|
|
612
|
+
|
|
613
|
+
@keyframes picker-open {
|
|
614
|
+
from { opacity: 0; transform: translateY(3px) scale(.985); }
|
|
615
|
+
}
|
|
616
|
+
@media (pointer: coarse) {
|
|
617
|
+
.effort-slider { height: 44px; }
|
|
618
|
+
.effort-slider::before { inset-block: 10px; }
|
|
619
|
+
.model-pop .picker-option { min-height: 40px; }
|
|
620
|
+
}
|
|
621
|
+
@media (prefers-reduced-motion: reduce) {
|
|
622
|
+
.model-pop, .model-pop *, .model-pill { animation: none; transition: none; }
|
|
485
623
|
}
|
|
486
624
|
|
|
487
625
|
.popover .pop-loading,
|
package/web/lib/dom.js
CHANGED
|
@@ -27,6 +27,7 @@ export function fill(el, ...kids) {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export const ICON = {
|
|
30
|
+
bolt: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="m13.5 2-10 12H11l-.5 8 10-13H13z"/></svg>',
|
|
30
31
|
shield: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3 5 6v5c0 4.4 2.9 8.3 7 10 4.1-1.7 7-5.6 7-10V6Z"/></svg>',
|
|
31
32
|
menu: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M4 6h16M4 12h16M4 18h16"/></svg>',
|
|
32
33
|
edit: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"/><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"/></svg>',
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { api } from "../lib/api.js";
|
|
2
|
+
import { fill, h, icon } from "../lib/dom.js";
|
|
3
|
+
import { closeMenu, placePopover, showPopover } from "../lib/overlay.js";
|
|
4
|
+
import { S, ui } from "../state.js";
|
|
5
|
+
import { doAction } from "./conv-actions.js";
|
|
6
|
+
import { findExpert } from "./experts.js";
|
|
7
|
+
import { agentCatalog, catalogDefaults, catalogLoaded, draftPick, effortLabel, composerModelLabel, modelName, renderContext, saveDraftPick, visibleModels } from "./topbar.js";
|
|
8
|
+
|
|
9
|
+
export async function openModelPicker(view = "effort", catalog) {
|
|
10
|
+
const anchor = ui.modelSlot;
|
|
11
|
+
if (!anchor) return;
|
|
12
|
+
if (ui.menu?.dataset.for === "model") return closeMenu();
|
|
13
|
+
const key = S.current;
|
|
14
|
+
const expertId = S.draftExpert;
|
|
15
|
+
const conv = S.convs.get(key);
|
|
16
|
+
const agent = conv?.agent ?? S.draftAgent;
|
|
17
|
+
const pop = showPopover(anchor);
|
|
18
|
+
pop.dataset.for = "model";
|
|
19
|
+
pop.matchesContext = () => S.current === key && (!!key || (S.draftExpert === expertId && S.draftAgent === agent));
|
|
20
|
+
pop.classList.add("model-pop");
|
|
21
|
+
pop.setAttribute("role", "dialog");
|
|
22
|
+
pop.setAttribute("aria-label", "模型设置");
|
|
23
|
+
const trigger = () => anchor.querySelector("button");
|
|
24
|
+
trigger()?.setAttribute("aria-expanded", "true");
|
|
25
|
+
const position = () => {
|
|
26
|
+
pop.style.maxHeight = `min(480px, ${Math.max(0, anchor.getBoundingClientRect().top - 16)}px)`;
|
|
27
|
+
placePopover(pop, anchor);
|
|
28
|
+
pop.style.setProperty("--picker-left", pop.style.left);
|
|
29
|
+
};
|
|
30
|
+
window.addEventListener("resize", position);
|
|
31
|
+
window.visualViewport?.addEventListener("resize", position);
|
|
32
|
+
pop.onMenuClose = () => {
|
|
33
|
+
delete anchor.dataset.picker;
|
|
34
|
+
trigger()?.setAttribute("aria-expanded", "false");
|
|
35
|
+
window.removeEventListener("resize", position);
|
|
36
|
+
window.visualViewport?.removeEventListener("resize", position);
|
|
37
|
+
if (pop.contains(document.activeElement)) trigger()?.focus({ preventScroll: true });
|
|
38
|
+
};
|
|
39
|
+
let models, current, currentEffort, fastModel;
|
|
40
|
+
let effortSupported, configuredEffort;
|
|
41
|
+
let provisional = false;
|
|
42
|
+
function render(data) {
|
|
43
|
+
const focus = !pop.dataset.view || pop.contains(document.activeElement);
|
|
44
|
+
({ models, current, currentEffort, fastModel, effortSupported = true } = data);
|
|
45
|
+
current ||= (models.find((m) => m.isDefault) ?? models.find((m) => m.id === "default"))?.id;
|
|
46
|
+
currentEffort ||= catalogDefaults.get(agent)?.effort;
|
|
47
|
+
configuredEffort = [findExpert(conv ? (conv.expert?.id ?? agent) : expertId)?.effort, catalogDefaults.get(agent)?.effort];
|
|
48
|
+
if (view === "model" || !supportsControls()) showModels(focus);
|
|
49
|
+
else showEffort(focus);
|
|
50
|
+
}
|
|
51
|
+
const selectedModel = () => {
|
|
52
|
+
const exact = models.find((m) => m.id === current);
|
|
53
|
+
if (exact) return exact;
|
|
54
|
+
const name = modelName(agent, current);
|
|
55
|
+
return models.find((m) => m.id !== "default" && (m.label || m.id) === name);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
let busy = false;
|
|
59
|
+
async function save(kind, value) {
|
|
60
|
+
if (!pop.matchesContext()) return false;
|
|
61
|
+
if (conv) {
|
|
62
|
+
const res = await doAction(kind, value, {}, { quiet: true });
|
|
63
|
+
if (!res) return false;
|
|
64
|
+
fastModel = res.info.fastModel;
|
|
65
|
+
currentEffort = res.info.runtimeEffort ?? res.info.effort ?? currentEffort;
|
|
66
|
+
} else {
|
|
67
|
+
const pick = draftPick();
|
|
68
|
+
if (kind === "fastModel") S.draftFastModel = value || null;
|
|
69
|
+
else {
|
|
70
|
+
if (kind === "model") {
|
|
71
|
+
if (S.draftFastModel !== value) S.draftFastModel = null;
|
|
72
|
+
const supported = models.find((m) => m.id === value)?.efforts;
|
|
73
|
+
if (pick.effort && !supported?.includes(pick.effort)) delete pick.effort;
|
|
74
|
+
currentEffort = pick.effort || configuredEffort.find(Boolean);
|
|
75
|
+
}
|
|
76
|
+
pick[kind] = value;
|
|
77
|
+
saveDraftPick();
|
|
78
|
+
}
|
|
79
|
+
fastModel = S.draftFastModel;
|
|
80
|
+
renderContext();
|
|
81
|
+
}
|
|
82
|
+
if (kind === "effort") currentEffort = value;
|
|
83
|
+
if (kind === "model") current = value;
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function setView(name) {
|
|
88
|
+
anchor.dataset.picker = pop.dataset.view = name;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function showModels(focus) {
|
|
92
|
+
setView("models");
|
|
93
|
+
const selected = selectedModel();
|
|
94
|
+
const list = h("div", { class: "picker-options", "aria-label": "选择模型", role: "group" });
|
|
95
|
+
const shown = visibleModels(agent, models);
|
|
96
|
+
for (const m of shown) {
|
|
97
|
+
list.append(h("button", {
|
|
98
|
+
class: "picker-option", "aria-pressed": String(m === selected),
|
|
99
|
+
onclick: async () => {
|
|
100
|
+
if (busy) return;
|
|
101
|
+
busy = true;
|
|
102
|
+
const ok = (!provisional && m === selected) || await save("model", m.id);
|
|
103
|
+
busy = false;
|
|
104
|
+
if (ok && ui.menu === pop) {
|
|
105
|
+
if (supportsControls()) showEffort(true);
|
|
106
|
+
else closeMenu();
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
}, composerModelLabel(agent, m.label || m.id), m === selected ? icon("check") : null));
|
|
110
|
+
}
|
|
111
|
+
list.onkeydown = (e) => {
|
|
112
|
+
const option = e.target;
|
|
113
|
+
const to = { ArrowDown: option.nextElementSibling, ArrowUp: option.previousElementSibling,
|
|
114
|
+
Home: list.firstElementChild, End: list.lastElementChild };
|
|
115
|
+
if (Object.hasOwn(to, e.key)) { e.preventDefault(); to[e.key]?.focus(); }
|
|
116
|
+
};
|
|
117
|
+
fill(pop, h("div", { class: "pop-head" }, "选择模型"), list);
|
|
118
|
+
if (!shown.length) fill(list, h("div", { class: "pop-error" }, "暂无可选模型"));
|
|
119
|
+
position();
|
|
120
|
+
const active = list.querySelector('[aria-pressed="true"]') ?? list.querySelector("button");
|
|
121
|
+
active?.scrollIntoView({ block: "nearest" });
|
|
122
|
+
if (focus) active?.focus({ preventScroll: true });
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function supportedEfforts() {
|
|
126
|
+
const m = selectedModel() ?? models.find((m) => m.efforts?.length);
|
|
127
|
+
return effortSupported ? m?.efforts ?? [] : [];
|
|
128
|
+
}
|
|
129
|
+
function supportsControls() { return supportedEfforts().length || selectedModel()?.fastMode; }
|
|
130
|
+
|
|
131
|
+
function showEffort(focus) {
|
|
132
|
+
setView("effort");
|
|
133
|
+
const model = selectedModel();
|
|
134
|
+
const levels = supportedEfforts();
|
|
135
|
+
if (!levels.length) anchor.dataset.picker = "model";
|
|
136
|
+
const fallback = [...configuredEffort, model?.defaultEffort].find((v) => levels.includes(v));
|
|
137
|
+
const initial = levels.includes(currentEffort) ? currentEffort : fallback;
|
|
138
|
+
const resetTo = fallback ?? initial;
|
|
139
|
+
const title = h("strong", { class: "effort-value" }, initial ? effortLabel(initial) : "默认");
|
|
140
|
+
const name = h("button", {
|
|
141
|
+
class: "picker-model-link", "aria-label": "选择模型", onclick: () => { if (!busy) showModels(true); },
|
|
142
|
+
}, h("span", {}, composerModelLabel(agent, modelName(agent, current) || "选择模型")), icon("back"));
|
|
143
|
+
const reset = h("button", {
|
|
144
|
+
class: "picker-icon picker-reset", title: fallback ? "恢复默认思考程度" : "还原打开时的思考程度",
|
|
145
|
+
onclick: () => slider?.select(resetTo),
|
|
146
|
+
}, icon("undo"));
|
|
147
|
+
let nextEffort;
|
|
148
|
+
let slider;
|
|
149
|
+
async function commit(value) {
|
|
150
|
+
nextEffort = value;
|
|
151
|
+
if (busy) return;
|
|
152
|
+
busy = true;
|
|
153
|
+
while (nextEffort && pop.matchesContext()) {
|
|
154
|
+
const next = nextEffort;
|
|
155
|
+
nextEffort = undefined;
|
|
156
|
+
if (next !== currentEffort && !await save("effort", next) && !nextEffort) slider.restore(currentEffort ?? initial);
|
|
157
|
+
}
|
|
158
|
+
busy = false;
|
|
159
|
+
}
|
|
160
|
+
if (levels.length) slider = effortSlider(levels, initial, (value) => {
|
|
161
|
+
title.textContent = value ? effortLabel(value) : "默认";
|
|
162
|
+
reset.disabled = !resetTo || value === resetTo;
|
|
163
|
+
}, commit);
|
|
164
|
+
|
|
165
|
+
let fast;
|
|
166
|
+
if (model?.fastMode) {
|
|
167
|
+
const speed = model.fastMode.description?.match(/(\d+(?:\.\d+)?)\s*[x×]/i)?.[1];
|
|
168
|
+
fast = h("button", {
|
|
169
|
+
class: "picker-icon picker-fast", role: "switch", "aria-label": "快速模式",
|
|
170
|
+
"aria-checked": String(fastModel === model.id), "aria-describedby": "picker-fast-tip",
|
|
171
|
+
onclick: async () => {
|
|
172
|
+
if (busy) return;
|
|
173
|
+
busy = true;
|
|
174
|
+
const ok = await save("fastModel", fastModel === model.id ? "" : model.id);
|
|
175
|
+
busy = false;
|
|
176
|
+
if (ok) fast.setAttribute("aria-checked", String(fastModel === model.id));
|
|
177
|
+
if (nextEffort) void commit(nextEffort);
|
|
178
|
+
},
|
|
179
|
+
}, icon("bolt"), h("span", { class: "picker-tip", role: "tooltip", id: "picker-fast-tip" },
|
|
180
|
+
speed ? h("strong", {}, `${speed} 倍速度`) : null, h("span", {}, "用量更多")));
|
|
181
|
+
}
|
|
182
|
+
fill(pop, h("div", { class: "effort-header" }, fast,
|
|
183
|
+
h("div", { class: "effort-center" }, levels.length ? title : null, name),
|
|
184
|
+
resetTo ? reset : null), slider?.el);
|
|
185
|
+
position();
|
|
186
|
+
if (focus) (slider?.el ?? name).focus({ preventScroll: true });
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const isOpen = () => ui.menu === pop && pop.matchesContext();
|
|
190
|
+
const cached = catalogLoaded.get(agent);
|
|
191
|
+
let interacted = false;
|
|
192
|
+
if (conv && catalog && cached) return render(catalog);
|
|
193
|
+
if (conv && cached?.length) {
|
|
194
|
+
provisional = true;
|
|
195
|
+
render({
|
|
196
|
+
models: cached,
|
|
197
|
+
current: conv.runtimeModel ?? conv.model ?? catalogDefaults.get(agent)?.model,
|
|
198
|
+
currentEffort: conv.runtimeEffort ?? conv.effort,
|
|
199
|
+
fastModel: conv.fastModel,
|
|
200
|
+
effortSupported: S.agents.find((a) => a.id === agent)?.capabilities?.effort,
|
|
201
|
+
});
|
|
202
|
+
// 一旦开始操作,保留这次打开的控件与选择,避免迟到的响应打断点击或拖动。
|
|
203
|
+
const markInteraction = () => { interacted = true; };
|
|
204
|
+
for (const event of ["pointerdown", "keydown", "click"]) {
|
|
205
|
+
pop.addEventListener(event, markInteraction, { capture: true, once: true });
|
|
206
|
+
}
|
|
207
|
+
} else {
|
|
208
|
+
fill(pop, h("div", { class: "pop-loading", role: "status", "aria-label": "正在读取模型" }, h("span", { class: "spinner" })));
|
|
209
|
+
position();
|
|
210
|
+
}
|
|
211
|
+
try {
|
|
212
|
+
if (conv) {
|
|
213
|
+
const [data] = await Promise.all([
|
|
214
|
+
catalog ?? api(`/api/conversations/${encodeURIComponent(key)}/models`),
|
|
215
|
+
cached ?? agentCatalog(agent).catch(() => []),
|
|
216
|
+
]);
|
|
217
|
+
if (isOpen() && !interacted) {
|
|
218
|
+
provisional = false;
|
|
219
|
+
render(data);
|
|
220
|
+
}
|
|
221
|
+
} else {
|
|
222
|
+
const models = await agentCatalog(agent);
|
|
223
|
+
if (!isOpen()) return;
|
|
224
|
+
const expert = findExpert(expertId);
|
|
225
|
+
render({
|
|
226
|
+
models,
|
|
227
|
+
current: draftPick().model || expert?.model || catalogDefaults.get(agent)?.model,
|
|
228
|
+
currentEffort: draftPick().effort || expert?.effort,
|
|
229
|
+
fastModel: S.draftFastModel,
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
} catch (err) {
|
|
233
|
+
if (isOpen() && !provisional) fill(pop, h("div", { class: "pop-error", role: "alert" }, err.message));
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/** 拖动时按连续坐标绘制,释放时吸附到最近档位并保存。 */
|
|
238
|
+
function effortSlider(levels, initial, preview, commit) {
|
|
239
|
+
const last = levels.length - 1;
|
|
240
|
+
const lane = h("span", { class: "effort-lane", "aria-hidden": "true" },
|
|
241
|
+
h("span", { class: "effort-fill" }),
|
|
242
|
+
levels.map((_, i) => h("i", { style: { left: `${last ? i / last * 100 : 0}%` } })),
|
|
243
|
+
h("span", { class: "effort-handle" }));
|
|
244
|
+
const el = h("div", {
|
|
245
|
+
class: "effort-slider", role: "slider", tabindex: "0", "aria-label": "思考程度",
|
|
246
|
+
"aria-valuemin": "0", "aria-valuemax": last, "aria-disabled": String(!last),
|
|
247
|
+
}, lane);
|
|
248
|
+
const ticks = lane.querySelectorAll("i");
|
|
249
|
+
let value = initial;
|
|
250
|
+
let index = Math.max(0, levels.indexOf(value));
|
|
251
|
+
let drag;
|
|
252
|
+
function draw(position, label = levels[Math.round(position)]) {
|
|
253
|
+
index = Math.round(position);
|
|
254
|
+
ticks.forEach((tick, i) => tick.classList.toggle("passed", i < position));
|
|
255
|
+
lane.style.setProperty("--position", `${last ? position / last * 100 : 0}%`);
|
|
256
|
+
el.setAttribute("aria-valuenow", String(index));
|
|
257
|
+
el.setAttribute("aria-valuetext", label ? effortLabel(label) : "默认");
|
|
258
|
+
preview(label);
|
|
259
|
+
}
|
|
260
|
+
function restore(saved) {
|
|
261
|
+
value = saved;
|
|
262
|
+
if (!drag) draw(Math.max(0, levels.indexOf(value)), value ?? null);
|
|
263
|
+
}
|
|
264
|
+
function select(next) {
|
|
265
|
+
restore(next);
|
|
266
|
+
void commit(next);
|
|
267
|
+
}
|
|
268
|
+
function move(e) {
|
|
269
|
+
const fraction = (e.clientX - drag.left - drag.offset) / drag.width;
|
|
270
|
+
draw(Math.max(0, Math.min(1, fraction)) * last);
|
|
271
|
+
}
|
|
272
|
+
el.onpointerdown = (e) => {
|
|
273
|
+
if (drag || !last || e.button !== 0) return;
|
|
274
|
+
const { left, width } = lane.getBoundingClientRect();
|
|
275
|
+
const offset = e.clientX - (left + width * index / last);
|
|
276
|
+
drag = { id: e.pointerId, left, width, offset: Math.abs(offset) < 13 ? offset : 0 };
|
|
277
|
+
el.setPointerCapture(e.pointerId);
|
|
278
|
+
el.classList.add("dragging");
|
|
279
|
+
move(e);
|
|
280
|
+
};
|
|
281
|
+
el.onpointermove = (e) => { if (drag?.id === e.pointerId) move(e); };
|
|
282
|
+
el.onpointerup = (e) => {
|
|
283
|
+
if (drag?.id !== e.pointerId) return;
|
|
284
|
+
move(e);
|
|
285
|
+
drag = null;
|
|
286
|
+
el.classList.remove("dragging");
|
|
287
|
+
select(levels[index]);
|
|
288
|
+
};
|
|
289
|
+
el.onlostpointercapture = el.onpointercancel = () => {
|
|
290
|
+
if (!drag) return;
|
|
291
|
+
drag = null;
|
|
292
|
+
el.classList.remove("dragging");
|
|
293
|
+
restore(value);
|
|
294
|
+
};
|
|
295
|
+
el.onkeydown = (e) => {
|
|
296
|
+
if (drag || !last) return;
|
|
297
|
+
const steps = { ArrowRight: index + 1, ArrowUp: index + 1, ArrowLeft: index - 1, ArrowDown: index - 1, Home: 0, End: last };
|
|
298
|
+
if (!Object.hasOwn(steps, e.key)) return;
|
|
299
|
+
e.preventDefault();
|
|
300
|
+
select(levels[Math.max(0, Math.min(last, steps[e.key]))]);
|
|
301
|
+
};
|
|
302
|
+
restore(initial);
|
|
303
|
+
return { el, restore, select };
|
|
304
|
+
}
|
package/web/views/composer.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { openModelPicker } from "./composer-models.js";
|
|
1
2
|
import { fill, h, icon, ICON, isTouch, toast } from "../lib/dom.js";
|
|
2
3
|
import { api } from "../lib/api.js";
|
|
3
4
|
import { desktop, S, ui } from "../state.js";
|
|
@@ -10,7 +11,7 @@ import { renderTodos } from "./todos.js";
|
|
|
10
11
|
import { cancelVoice, SpeechRec, toggleVoice } from "./voice.js";
|
|
11
12
|
import { callButton, canCall } from "./voice-call.js";
|
|
12
13
|
import { closeSlashMenu, commandUsage, oneLine, slashKeydown, updateSlashMenu } from "./slash.js";
|
|
13
|
-
import { doAction,
|
|
14
|
+
import { doAction, openSessions } from "./conv-actions.js";
|
|
14
15
|
|
|
15
16
|
// ---------- 输入框 ----------
|
|
16
17
|
|
|
@@ -385,7 +386,7 @@ async function showCommandReply(text, reply, info) {
|
|
|
385
386
|
await openSessions(reply.allDirs);
|
|
386
387
|
return;
|
|
387
388
|
case "models":
|
|
388
|
-
await openModelPicker();
|
|
389
|
+
await openModelPicker(head === "effort" ? "effort" : "model", reply);
|
|
389
390
|
return;
|
|
390
391
|
case "agents":
|
|
391
392
|
note(
|
|
@@ -3,16 +3,16 @@ import { api } from "../lib/api.js";
|
|
|
3
3
|
import { relTime } from "../lib/time.js";
|
|
4
4
|
import { S, ui } from "../state.js";
|
|
5
5
|
import { agentLabel, convTitle, forgetProject, renderSidebar } from "./sidebar.js";
|
|
6
|
-
import {
|
|
6
|
+
import { baseName, renderContext, renderTopbar } from "./topbar.js";
|
|
7
7
|
import { closeMenu, confirmDialog, modal, placePopover, showPopover } from "../lib/overlay.js";
|
|
8
8
|
import { newDraft, openConversation, renderEmpty } from "./messages.js";
|
|
9
|
-
import {
|
|
9
|
+
import { setDraftExpert } from "./experts.js";
|
|
10
10
|
import { preloadCommands } from "./slash.js";
|
|
11
11
|
import { FULL_WARNING, PERMISSIONS, permissionsUpTo, PLAN_INFO } from "../lib/permission.js";
|
|
12
12
|
|
|
13
13
|
// ---------- 会话操作 ----------
|
|
14
14
|
|
|
15
|
-
export async function doAction(action, value, extra = {}) {
|
|
15
|
+
export async function doAction(action, value, extra = {}, { quiet = false } = {}) {
|
|
16
16
|
if (!S.current) return;
|
|
17
17
|
try {
|
|
18
18
|
const res = await api(`/api/conversations/${encodeURIComponent(S.current)}/action`, {
|
|
@@ -21,7 +21,7 @@ export async function doAction(action, value, extra = {}) {
|
|
|
21
21
|
});
|
|
22
22
|
S.convs.set(res.info.key, res.info);
|
|
23
23
|
renderTopbar();
|
|
24
|
-
toast(res.text);
|
|
24
|
+
if (!quiet) toast(res.text);
|
|
25
25
|
if (["new", "fork", "resume", "agent", "cd"].includes(action)) await openConversation(res.info.key);
|
|
26
26
|
return res;
|
|
27
27
|
} catch (err) {
|
|
@@ -78,127 +78,6 @@ export function switchAgent(id) {
|
|
|
78
78
|
renderEmpty();
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
/** 模型 / 思考程度选择:已有会话直接切,新对话先记下,发第一条消息时带过去 */
|
|
82
|
-
export async function openModelPicker(anchor = ui.modelSlot) {
|
|
83
|
-
if (!anchor) return;
|
|
84
|
-
if (ui.menu?.dataset.for === "model") return closeMenu();
|
|
85
|
-
const pop = showPopover(anchor);
|
|
86
|
-
pop.dataset.for = "model";
|
|
87
|
-
pop.classList.add("model-pop");
|
|
88
|
-
fill(pop, h("div", { class: "pop-loading" }, h("span", { class: "spinner" })));
|
|
89
|
-
placePopover(pop, anchor);
|
|
90
|
-
|
|
91
|
-
const conv = S.current ? S.convs.get(S.current) : null;
|
|
92
|
-
let models;
|
|
93
|
-
let current;
|
|
94
|
-
let currentEffort;
|
|
95
|
-
let fastModel;
|
|
96
|
-
let effortSupported = true;
|
|
97
|
-
try {
|
|
98
|
-
if (conv) {
|
|
99
|
-
// 顺便把这个 agent 的默认模型 / 显示名准备好(缓存过就不会再请求)
|
|
100
|
-
const [data] = await Promise.all([
|
|
101
|
-
api(`/api/conversations/${encodeURIComponent(S.current)}/models`),
|
|
102
|
-
agentCatalog(conv.agent).catch(() => []),
|
|
103
|
-
]);
|
|
104
|
-
({ models, current, currentEffort, effortSupported, fastModel } = data);
|
|
105
|
-
} else {
|
|
106
|
-
models = await agentCatalog(S.draftAgent);
|
|
107
|
-
const pick = draftPick();
|
|
108
|
-
current = pick.model || findExpert(S.draftExpert)?.model || catalogDefaults.get(S.draftAgent)?.model;
|
|
109
|
-
fastModel = S.draftFastModel;
|
|
110
|
-
currentEffort = pick.effort;
|
|
111
|
-
}
|
|
112
|
-
} catch (err) {
|
|
113
|
-
if (ui.menu === pop) fill(pop, h("div", { class: "pop-error" }, err.message));
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
if (ui.menu !== pop) return;
|
|
117
|
-
current ||= (models.find((m) => m.isDefault) ?? models.find((m) => m.id === "default"))?.id;
|
|
118
|
-
|
|
119
|
-
const choose = async (kind, value) => {
|
|
120
|
-
if (conv) {
|
|
121
|
-
pop.inert = true;
|
|
122
|
-
const res = await doAction(kind, value);
|
|
123
|
-
pop.inert = false;
|
|
124
|
-
if (!res || ui.menu !== pop) return;
|
|
125
|
-
fastModel = res.info.fastModel;
|
|
126
|
-
} else {
|
|
127
|
-
if (kind === "fastModel") {
|
|
128
|
-
S.draftFastModel = value || null;
|
|
129
|
-
} else {
|
|
130
|
-
if (kind === "model" && value !== S.draftFastModel) S.draftFastModel = null;
|
|
131
|
-
draftPick()[kind] = value;
|
|
132
|
-
saveDraftPick();
|
|
133
|
-
}
|
|
134
|
-
fastModel = S.draftFastModel;
|
|
135
|
-
renderContext();
|
|
136
|
-
}
|
|
137
|
-
if (kind === "model") current = value;
|
|
138
|
-
if (kind === "effort") currentEffort = value;
|
|
139
|
-
if (kind === "effort") closeMenu();
|
|
140
|
-
else if (ui.menu === pop) render();
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
const agent = conv ? conv.agent : S.draftAgent;
|
|
144
|
-
// 当前值可能是别名、完整名或空(默认):先按 id 对,对不上再按显示名对,只勾一项
|
|
145
|
-
const currentItem = (list) => {
|
|
146
|
-
const byId = list.find((m) => m.id === current);
|
|
147
|
-
if (byId) return byId;
|
|
148
|
-
const name = modelName(agent, current);
|
|
149
|
-
return list.find((m) => m.id !== "default" && (m.label || m.id) === name) ?? null;
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
function render() {
|
|
153
|
-
const shown = visibleModels(agent, models);
|
|
154
|
-
const on = currentItem(shown);
|
|
155
|
-
const selected = on ?? currentItem(models);
|
|
156
|
-
const fast = selected?.fastMode;
|
|
157
|
-
const fastOn = !!fast && fastModel === selected.id;
|
|
158
|
-
const speed = fast?.description?.match(/(\d+(?:\.\d+)?)\s*[x×]/i)?.[1];
|
|
159
|
-
const efforts = selected?.efforts ?? models.find((m) => m.efforts?.length)?.efforts ?? [];
|
|
160
|
-
if (!currentEffort) currentEffort = catalogDefaults.get(agent)?.effort;
|
|
161
|
-
fill(
|
|
162
|
-
pop,
|
|
163
|
-
h("div", { class: "pop-head" }, "模型"),
|
|
164
|
-
shown.map((m) =>
|
|
165
|
-
h(
|
|
166
|
-
"button",
|
|
167
|
-
{ class: `pop-item${m === on ? " on" : ""}`, onclick: () => void choose("model", m.id) },
|
|
168
|
-
h("span", { class: "grow" }, h("span", { class: "t" }, m.label || m.id), m.description ? h("span", { class: "s" }, m.description) : null),
|
|
169
|
-
m === on ? h("span", { class: "check" }, "✓") : null,
|
|
170
|
-
),
|
|
171
|
-
),
|
|
172
|
-
effortSupported && efforts.length
|
|
173
|
-
? [
|
|
174
|
-
h("div", { class: "sep" }),
|
|
175
|
-
h("div", { class: "pop-head" }, "思考程度"),
|
|
176
|
-
h(
|
|
177
|
-
"div",
|
|
178
|
-
{ class: "effort-seg" },
|
|
179
|
-
efforts.map((e) => h("button", { class: e === currentEffort ? "on" : "", onclick: () => void choose("effort", e) }, e)),
|
|
180
|
-
),
|
|
181
|
-
]
|
|
182
|
-
: null,
|
|
183
|
-
fast ? [
|
|
184
|
-
h("div", { class: "sep" }),
|
|
185
|
-
h("button", {
|
|
186
|
-
class: "pop-item", role: "switch", "aria-checked": String(fastOn),
|
|
187
|
-
onclick: () => void choose("fastModel", fastOn ? "" : selected.id),
|
|
188
|
-
},
|
|
189
|
-
h("span", { class: "grow" },
|
|
190
|
-
h("span", { class: "t" }, "⚡ 快速模式"),
|
|
191
|
-
h("span", { class: "s", title: fast.description }, speed ? `${speed} 倍生成速度,用量更多` : "用量更多"),
|
|
192
|
-
),
|
|
193
|
-
h("span", { class: "switch", "aria-hidden": "true" }, h("span", { class: "slider" })),
|
|
194
|
-
),
|
|
195
|
-
] : null,
|
|
196
|
-
);
|
|
197
|
-
placePopover(pop, anchor);
|
|
198
|
-
}
|
|
199
|
-
render();
|
|
200
|
-
}
|
|
201
|
-
|
|
202
81
|
/**
|
|
203
82
|
* 权限级别 + 计划模式开关:已有对话直接切,新对话先记下,建好对话后带过去。
|
|
204
83
|
* max、current、agent、plan 由输入框上的按钮算好传进来(自动判断只有 Claude 有)
|
package/web/views/topbar.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { openModelPicker } from "./composer-models.js";
|
|
1
2
|
import { fill, h, icon, ICON, toast } from "../lib/dom.js";
|
|
2
3
|
import { api } from "../lib/api.js";
|
|
3
4
|
import { relTime } from "../lib/time.js";
|
|
@@ -7,7 +8,7 @@ import { convExpert, expertChoices, expertIcon, findExpert } from "./experts.js"
|
|
|
7
8
|
import { closeMenu, modal, placePopover, showMenu, showPopover, submenuButton } from "../lib/overlay.js";
|
|
8
9
|
import { openConversation } from "./messages.js";
|
|
9
10
|
import { openSchedule } from "./schedule.js";
|
|
10
|
-
import { changeCwd, deleteConv, doAction, forkConversation, handoffConversation,
|
|
11
|
+
import { changeCwd, deleteConv, doAction, forkConversation, handoffConversation, openPermissionPicker, renameConv, switchAgent } from "./conv-actions.js";
|
|
11
12
|
import { capOfAccess, defaultPermissionFor, minPermission, permissionsUpTo, PERMISSIONS } from "../lib/permission.js";
|
|
12
13
|
import { canSeeChanges, syncWorkspace, toggleWorkspace, workspaceButtons, workspaceStats } from "./workspace-entry.js";
|
|
13
14
|
import { syncCall } from "./voice-call.js";
|
|
@@ -374,6 +375,14 @@ export function modelName(agent, id) {
|
|
|
374
375
|
return id;
|
|
375
376
|
}
|
|
376
377
|
|
|
378
|
+
const effortLabels = new Map(Object.entries({
|
|
379
|
+
off: "关闭", none: "无", minimal: "最低", low: "低", medium: "中", high: "高", xhigh: "超高", max: "最大", ultra: "极高",
|
|
380
|
+
}));
|
|
381
|
+
export const effortLabel = (value) => effortLabels.get(value) ?? value;
|
|
382
|
+
|
|
383
|
+
export const composerModelLabel = (agent, name) => agent === "codex"
|
|
384
|
+
? name.replace(/^(gpt-[\d.]+)-(sol|astra|terra|luna)$/i, "$1 $2") : name;
|
|
385
|
+
|
|
377
386
|
/** 输入框上方的上下文条(目录 / agent)和输入框里的模型按钮 */
|
|
378
387
|
export function renderContext() {
|
|
379
388
|
if (!ui.ctxBar) return;
|
|
@@ -415,8 +424,12 @@ export function renderContext() {
|
|
|
415
424
|
const fastModel = c ? c.fastModel : S.draftFastModel;
|
|
416
425
|
fastOn = !!fastModel && fastModel === effectiveId;
|
|
417
426
|
model = modelName(modelAgent, id) ?? (catalogLoaded.has(modelAgent) ? "选择模型" : "…");
|
|
418
|
-
|
|
427
|
+
const selected = catalogLoaded.get(modelAgent)?.find((m) => m.id === effectiveId);
|
|
428
|
+
effort = (c ? (c.runtimeEffort ?? c.effort) : (pick.effort ?? (draft?.effort || undefined))) ?? defaults.effort ?? selected?.defaultEffort;
|
|
429
|
+
if (selected && !selected.efforts?.includes(effort)) effort = undefined;
|
|
419
430
|
}
|
|
431
|
+
const picker = ui.menu?.dataset.for === "model" ? ui.menu : null;
|
|
432
|
+
if (picker && !picker.matchesContext()) closeMenu();
|
|
420
433
|
renderCtxRing();
|
|
421
434
|
renderPermission(c, expert);
|
|
422
435
|
fill(
|
|
@@ -424,11 +437,14 @@ export function renderContext() {
|
|
|
424
437
|
model
|
|
425
438
|
? h(
|
|
426
439
|
"button",
|
|
427
|
-
{
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
icon("
|
|
440
|
+
{
|
|
441
|
+
class: "model-pill", title: "切换模型和思考程度", "aria-haspopup": "dialog",
|
|
442
|
+
"aria-expanded": String(ui.menu?.dataset.for === "model"), onclick: () => void openModelPicker(),
|
|
443
|
+
},
|
|
444
|
+
fastOn ? h("span", { class: "fast-mark", role: "img", "aria-label": "快速模式已开启" }, icon("bolt")) : null,
|
|
445
|
+
h("span", { class: "model-name" }, composerModelLabel(modelAgent, model)),
|
|
446
|
+
effort ? h("span", { class: "sub", title: effort }, effortLabel(effort)) : null,
|
|
447
|
+
h("span", { class: "picker-prompt" }, "选择推理强度"),
|
|
432
448
|
)
|
|
433
449
|
: null,
|
|
434
450
|
);
|