dsh-thinking-levels 0.4.0 → 0.6.0
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/CHANGELOG.ja.md +89 -0
- package/CHANGELOG.ko.md +89 -0
- package/CHANGELOG.md +89 -0
- package/INSTALL.ja.md +163 -0
- package/INSTALL.ko.md +163 -0
- package/INSTALL.md +163 -0
- package/INSTALL.zh.md +163 -0
- package/LICENSE +21 -0
- package/README.ja.md +168 -0
- package/README.ko.md +168 -0
- package/README.md +195 -108
- package/README.zh.md +174 -108
- package/lib/client.js +1142 -93
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +35 -3
- package/lib/index.js +225 -23
- package/lib/takeover-sync.d.ts +98 -0
- package/lib/takeover-sync.js +131 -0
- package/lib/thinking-level.d.ts +106 -16
- package/lib/thinking-level.js +126 -13
- package/package.json +88 -79
package/lib/client.js
CHANGED
|
@@ -7,40 +7,216 @@ window.__ModuleLoader__.load({
|
|
|
7
7
|
let react = require("react");
|
|
8
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
9
|
//#region src/client/locales.ts
|
|
10
|
-
/** `thinking-levels` client dictionaries. */
|
|
10
|
+
/** `thinking-levels` client dictionaries (zh / en / ja / ko). */
|
|
11
11
|
/** Dictionary namespace owned by this plugin. */
|
|
12
12
|
const NS = "thinking-levels";
|
|
13
13
|
/** Simplified Chinese dictionary (the key-set source of truth). */
|
|
14
14
|
const zh = {
|
|
15
15
|
"card.title": "思考档位",
|
|
16
|
-
"card.description": "在模型选择器中可选 Auto(mask):按工具调用历史自动在 low / high / max 间调度后提交 API
|
|
16
|
+
"card.description": "在模型选择器中可选 Auto(mask):按工具调用历史自动在 low / high / max 间调度后提交 API。此处配置默认档位、调度边界与模型能力(档位 → 网关线上值映射)。",
|
|
17
17
|
"card.level": "默认档位",
|
|
18
18
|
"card.level.off": "off — 关闭思考(仅手动,永不自动选择)",
|
|
19
|
+
"card.level.on": "on — 开启思考(仅 toggle 型模型;只发 enable_thinking,不发 effort)",
|
|
20
|
+
"card.level.minimal": "minimal — 最低(极轻任务)",
|
|
19
21
|
"card.level.low": "low — 低(简单任务,廉价轮保持廉价)",
|
|
22
|
+
"card.level.medium": "medium — 中",
|
|
20
23
|
"card.level.high": "high — 高(官方默认)",
|
|
24
|
+
"card.level.xhigh": "xhigh — 特高",
|
|
21
25
|
"card.level.max": "max — 最大(重任务)",
|
|
22
26
|
"card.level.auto": "auto — 按工具历史自动调度(默认)",
|
|
23
27
|
"card.enabled": "启用",
|
|
24
28
|
"card.allowDowngrade": "允许降档(auto 可降至 low)",
|
|
25
29
|
"card.allowUpgrade": "允许升档(auto 可升至 max)",
|
|
26
30
|
"card.unavailable": "设置命名空间不可用:请确认 dsh-thinking-levels 已装配进 profile。",
|
|
27
|
-
"card.readonly": "只读"
|
|
31
|
+
"card.readonly": "只读",
|
|
32
|
+
"card.capabilities": "模型能力(llm-pi-ai 自定义提供方)",
|
|
33
|
+
"card.capabilities.hint": "直接读写 llm-pi-ai 配置:勾选档位并填写发送给网关的线上值(例如 high → ultra);off 留空表示不发送。视觉决定图片输入;思考开关决定 enable_thinking 置位;thinkingFormat 决定 wire 序列化格式。",
|
|
34
|
+
"card.capabilities.empty": "短路名单(llm-openai-completions)中没有 provider,或名单内 provider 未在 llm-pi-ai 配置模型。请先在「设置 → 模型」添加提供方与模型,并把要编辑的自定义网关加入短路名单。",
|
|
35
|
+
"card.capabilities.unavailable": "llm-pi-ai 设置命名空间不可用。",
|
|
36
|
+
"card.capabilities.none": "(无模型)",
|
|
37
|
+
"card.capabilities.search": "搜索模型(名称或 ID)…",
|
|
38
|
+
"card.capabilities.noMatches": "没有匹配的模型",
|
|
39
|
+
"card.capabilities.quickSettings": "一键设置",
|
|
40
|
+
"card.capabilities.presetOfficial": "应用到全部:Off / High / Max(官方 DeepSeek 风格)",
|
|
41
|
+
"card.capabilities.presetGeneric": "应用到全部:Off / Low / Medium / High(通用)",
|
|
42
|
+
"card.capabilities.vendor": "提供方",
|
|
43
|
+
"card.capabilities.takeover": "短路接管",
|
|
44
|
+
"card.capabilities.notTakenOver": "未启用短路接管:该 provider 由 pi-ai 原生服务。开启「短路接管」后才能编辑此处的思考/effort 配置。",
|
|
45
|
+
"card.capabilities.expandProvider": "展开提供方",
|
|
46
|
+
"card.capabilities.collapseProvider": "收起提供方",
|
|
47
|
+
"card.capabilities.openModelSettings": "打开模型设置",
|
|
48
|
+
"card.capabilities.closeModelSettings": "收起模型设置",
|
|
49
|
+
"card.capabilities.vision": "视觉模型",
|
|
50
|
+
"card.capabilities.thinking": "思考模型",
|
|
51
|
+
"card.capabilities.supportsEffort": "支持 think effort",
|
|
52
|
+
"card.capabilities.efforts": "思考档位(勾选后填写线上值)",
|
|
53
|
+
"card.capabilities.wirePlaceholder": "线上值,如 ultra",
|
|
54
|
+
"card.capabilities.offPlaceholder": "留空 = 不发送",
|
|
55
|
+
"card.capabilities.atLeastThinking": "至少需要一个思考档位(off 除外)",
|
|
56
|
+
"card.capabilities.applyLevel": "应用此档位",
|
|
57
|
+
"card.capabilities.restoreDefault": "恢复默认档位",
|
|
58
|
+
"card.capabilities.unsaved": "未保存",
|
|
59
|
+
"card.capabilities.saveChanges": "保存更改",
|
|
60
|
+
"card.capabilities.saved": "已保存",
|
|
61
|
+
"card.capabilities.thinkingFormat": "思考格式",
|
|
62
|
+
"card.capabilities.thinkingFormat.inherit": "继承",
|
|
63
|
+
"card.capabilities.failed": "保存失败:配置被拒绝或冲突,请检查值。"
|
|
28
64
|
};
|
|
29
65
|
/** English dictionary (keys mirror zh). */
|
|
30
66
|
const en = {
|
|
31
67
|
"card.title": "Thinking Levels",
|
|
32
|
-
"card.description": "Pick Auto in the model selector: the plugin schedules low / high / max per tool round before submitting the API effort. Here you configure the default level and
|
|
68
|
+
"card.description": "Pick Auto in the model selector: the plugin schedules low / high / max per tool round before submitting the API effort. Here you configure the default level, scheduler bounds, and per-model capabilities (level → gateway wire value mapping).",
|
|
33
69
|
"card.level": "Default level",
|
|
34
70
|
"card.level.off": "off — disable thinking (manual only, never auto-picked)",
|
|
71
|
+
"card.level.on": "on — enable thinking (toggle-only models only; sends enable_thinking, never an effort)",
|
|
72
|
+
"card.level.minimal": "minimal — least (very light tasks)",
|
|
35
73
|
"card.level.low": "low — cheap rounds stay cheap",
|
|
74
|
+
"card.level.medium": "medium — medium",
|
|
36
75
|
"card.level.high": "high — the official default",
|
|
76
|
+
"card.level.xhigh": "xhigh — extra high",
|
|
37
77
|
"card.level.max": "max — heavy work",
|
|
38
78
|
"card.level.auto": "auto — schedule from tool history (default)",
|
|
39
79
|
"card.enabled": "Enabled",
|
|
40
80
|
"card.allowDowngrade": "Allow downgrade (auto may drop to low)",
|
|
41
81
|
"card.allowUpgrade": "Allow upgrade (auto may lift to max)",
|
|
42
82
|
"card.unavailable": "Settings namespace unavailable: make sure dsh-thinking-levels is assembled into this profile.",
|
|
43
|
-
"card.readonly": "Read-only"
|
|
83
|
+
"card.readonly": "Read-only",
|
|
84
|
+
"card.capabilities": "Model capabilities (llm-pi-ai custom providers)",
|
|
85
|
+
"card.capabilities.hint": "Reads and writes the llm-pi-ai config directly: tick a level and enter the exact value sent to the gateway (e.g. high → ultra); leaving off empty means “do not send”. Vision gates image input; the thinking toggle drives enable_thinking; thinkingFormat picks the wire serialization.",
|
|
86
|
+
"card.capabilities.empty": "No provider is in the takeover list (llm-openai-completions), or the listed providers have no models configured in llm-pi-ai. Add a provider and models under Settings → Models first, and put the custom gateway you want to edit into the takeover list.",
|
|
87
|
+
"card.capabilities.unavailable": "The llm-pi-ai settings namespace is unavailable.",
|
|
88
|
+
"card.capabilities.none": "(no models)",
|
|
89
|
+
"card.capabilities.search": "Search models by name or ID…",
|
|
90
|
+
"card.capabilities.noMatches": "No matching models",
|
|
91
|
+
"card.capabilities.quickSettings": "Quick settings",
|
|
92
|
+
"card.capabilities.presetOfficial": "Apply to all: Off / High / Max (official DeepSeek style)",
|
|
93
|
+
"card.capabilities.presetGeneric": "Apply to all: Off / Low / Medium / High (generic)",
|
|
94
|
+
"card.capabilities.vendor": "Provider",
|
|
95
|
+
"card.capabilities.takeover": "Short-circuit takeover",
|
|
96
|
+
"card.capabilities.notTakenOver": "Takeover is off: this provider is served by pi-ai natively. Enable \"Short-circuit takeover\" to edit its thinking/effort configuration here.",
|
|
97
|
+
"card.capabilities.expandProvider": "Expand provider",
|
|
98
|
+
"card.capabilities.collapseProvider": "Collapse provider",
|
|
99
|
+
"card.capabilities.openModelSettings": "Open model settings",
|
|
100
|
+
"card.capabilities.closeModelSettings": "Collapse model settings",
|
|
101
|
+
"card.capabilities.vision": "Vision model",
|
|
102
|
+
"card.capabilities.thinking": "Thinking model",
|
|
103
|
+
"card.capabilities.supportsEffort": "Supports think effort",
|
|
104
|
+
"card.capabilities.efforts": "Thinking effort levels (tick, then enter the wire value)",
|
|
105
|
+
"card.capabilities.wirePlaceholder": "Wire value, e.g. ultra",
|
|
106
|
+
"card.capabilities.offPlaceholder": "Empty = do not send",
|
|
107
|
+
"card.capabilities.atLeastThinking": "Select at least one thinking level (other than off)",
|
|
108
|
+
"card.capabilities.applyLevel": "Apply levels",
|
|
109
|
+
"card.capabilities.restoreDefault": "Restore defaults",
|
|
110
|
+
"card.capabilities.unsaved": "Unsaved",
|
|
111
|
+
"card.capabilities.saveChanges": "Save changes",
|
|
112
|
+
"card.capabilities.saved": "Saved",
|
|
113
|
+
"card.capabilities.thinkingFormat": "Thinking format",
|
|
114
|
+
"card.capabilities.thinkingFormat.inherit": "Inherit",
|
|
115
|
+
"card.capabilities.failed": "Save failed: the value was rejected or conflicted. Check it."
|
|
116
|
+
};
|
|
117
|
+
/** Japanese dictionary (keys mirror zh). */
|
|
118
|
+
const ja = {
|
|
119
|
+
"card.title": "思考レベル",
|
|
120
|
+
"card.description": "モデルセレクターで Auto(マスク)を選択すると、ツール呼び出し履歴から low / high / max を自動スケジュールして API に送信します。ここでは既定レベル、スケジューラーの境界、モデル能力(レベル → ゲートウェイ送信値のマッピング)を設定します。",
|
|
121
|
+
"card.level": "既定レベル",
|
|
122
|
+
"card.level.off": "off — 思考を無効化(手動のみ、自動選択はされません)",
|
|
123
|
+
"card.level.on": "on — 思考を有効化(トグルのみのモデル向け。enable_thinking のみ送信、effort は送信しません)",
|
|
124
|
+
"card.level.minimal": "minimal — 最小(非常に軽いタスク)",
|
|
125
|
+
"card.level.low": "low — 低(軽いラウンドは軽いまま)",
|
|
126
|
+
"card.level.medium": "medium — 中",
|
|
127
|
+
"card.level.high": "high — 高(公式既定値)",
|
|
128
|
+
"card.level.xhigh": "xhigh — 特高",
|
|
129
|
+
"card.level.max": "max — 最大(重いタスク)",
|
|
130
|
+
"card.level.auto": "auto — ツール履歴から自動スケジュール(既定)",
|
|
131
|
+
"card.enabled": "有効",
|
|
132
|
+
"card.allowDowngrade": "降格を許可(auto は low まで下げられる)",
|
|
133
|
+
"card.allowUpgrade": "昇格を許可(auto は max まで上げられる)",
|
|
134
|
+
"card.unavailable": "設定名前空間が利用できません:dsh-thinking-levels が profile に組み込まれているか確認してください。",
|
|
135
|
+
"card.readonly": "読み取り専用",
|
|
136
|
+
"card.capabilities": "モデル能力(llm-pi-ai カスタムプロバイダー)",
|
|
137
|
+
"card.capabilities.hint": "llm-pi-ai 設定を直接読み書きします:レベルにチェックを入れ、ゲートウェイに送信する値を入力(例:high → ultra)。off を空欄にすると送信しません。視覚は画像入力を決定、思考トグルは enable_thinking を制御、thinkingFormat は wire シリアライズ形式を選択します。",
|
|
138
|
+
"card.capabilities.empty": "引き継ぎリスト(llm-openai-completions)にプロバイダーがないか、リスト内プロバイダーに llm-pi-ai のモデル設定がありません。先に「設定 → モデル」でプロバイダーとモデルを追加し、編集したいカスタムゲートウェイを引き継ぎリストに入れてください。",
|
|
139
|
+
"card.capabilities.unavailable": "llm-pi-ai の設定名前空間が利用できません。",
|
|
140
|
+
"card.capabilities.none": "(モデルなし)",
|
|
141
|
+
"card.capabilities.search": "モデル名または ID で検索…",
|
|
142
|
+
"card.capabilities.noMatches": "一致するモデルがありません",
|
|
143
|
+
"card.capabilities.quickSettings": "クイック設定",
|
|
144
|
+
"card.capabilities.presetOfficial": "すべてに適用:Off / High / Max(公式 DeepSeek 形式)",
|
|
145
|
+
"card.capabilities.presetGeneric": "すべてに適用:Off / Low / Medium / High(汎用)",
|
|
146
|
+
"card.capabilities.vendor": "プロバイダー",
|
|
147
|
+
"card.capabilities.takeover": "ショートサーキット引き継ぎ",
|
|
148
|
+
"card.capabilities.notTakenOver": "引き継ぎが無効です:このプロバイダーは pi-ai がネイティブに提供します。「ショートサーキット引き継ぎ」を有効にしてから、ここで思考/effort 設定を編集してください。",
|
|
149
|
+
"card.capabilities.expandProvider": "プロバイダーを展開",
|
|
150
|
+
"card.capabilities.collapseProvider": "プロバイダーを折りたたむ",
|
|
151
|
+
"card.capabilities.openModelSettings": "モデル設定を開く",
|
|
152
|
+
"card.capabilities.closeModelSettings": "モデル設定を折りたたむ",
|
|
153
|
+
"card.capabilities.vision": "視覚モデル",
|
|
154
|
+
"card.capabilities.thinking": "思考モデル",
|
|
155
|
+
"card.capabilities.supportsEffort": "think effort をサポート",
|
|
156
|
+
"card.capabilities.efforts": "思考レベル(チェック後、送信値を入力)",
|
|
157
|
+
"card.capabilities.wirePlaceholder": "送信値(例:ultra)",
|
|
158
|
+
"card.capabilities.offPlaceholder": "空欄 = 送信しない",
|
|
159
|
+
"card.capabilities.atLeastThinking": "思考レベルを 1 つ以上選択してください(off 以外)",
|
|
160
|
+
"card.capabilities.applyLevel": "レベルを適用",
|
|
161
|
+
"card.capabilities.restoreDefault": "既定値に戻す",
|
|
162
|
+
"card.capabilities.unsaved": "未保存",
|
|
163
|
+
"card.capabilities.saveChanges": "変更を保存",
|
|
164
|
+
"card.capabilities.saved": "保存済み",
|
|
165
|
+
"card.capabilities.thinkingFormat": "思考形式",
|
|
166
|
+
"card.capabilities.thinkingFormat.inherit": "継承",
|
|
167
|
+
"card.capabilities.failed": "保存に失敗しました:値が拒否されたか競合しています。確認してください。"
|
|
168
|
+
};
|
|
169
|
+
/** Korean dictionary (keys mirror zh). */
|
|
170
|
+
const ko = {
|
|
171
|
+
"card.title": "사고 수준",
|
|
172
|
+
"card.description": "모델 선택기에서 Auto(마스크)를 선택하면 도구 호출 기록을 기반으로 low / high / max 를 자동 스케줄링하여 API에 제출합니다. 여기서 기본 수준, 스케줄러 경계, 모델 기능(수준 → 게이트웨이 전송 값 매핑)을 구성합니다.",
|
|
173
|
+
"card.level": "기본 수준",
|
|
174
|
+
"card.level.off": "off — 사고 비활성화(수동 전용, 자동 선택 안 됨)",
|
|
175
|
+
"card.level.on": "on — 사고 활성화(토글 전용 모델용. enable_thinking만 전송, effort는 전송하지 않음)",
|
|
176
|
+
"card.level.minimal": "minimal — 최소(매우 가벼운 작업)",
|
|
177
|
+
"card.level.low": "low — 낮음(가벼운 라운드는 가볍게 유지)",
|
|
178
|
+
"card.level.medium": "medium — 중간",
|
|
179
|
+
"card.level.high": "high — 높음(공식 기본값)",
|
|
180
|
+
"card.level.xhigh": "xhigh — 특별히 높음",
|
|
181
|
+
"card.level.max": "max — 최대(무거운 작업)",
|
|
182
|
+
"card.level.auto": "auto — 도구 기록에서 자동 스케줄링(기본값)",
|
|
183
|
+
"card.enabled": "활성화",
|
|
184
|
+
"card.allowDowngrade": "다운그레이드 허용(auto가 low까지 내릴 수 있음)",
|
|
185
|
+
"card.allowUpgrade": "업그레이드 허용(auto가 max까지 올릴 수 있음)",
|
|
186
|
+
"card.unavailable": "설정 네임스페이스를 사용할 수 없습니다: dsh-thinking-levels가 이 profile에 조립되었는지 확인하세요.",
|
|
187
|
+
"card.readonly": "읽기 전용",
|
|
188
|
+
"card.capabilities": "모델 기능(llm-pi-ai 사용자 지정 제공자)",
|
|
189
|
+
"card.capabilities.hint": "llm-pi-ai 설정을 직접 읽고 씁니다: 수준을 체크하고 게이트웨이에 보낼 값을 입력(예: high → ultra). off를 비워 두면 전송하지 않습니다. 시각은 이미지 입력을 결정하고, 사고 토글은 enable_thinking을 제어하며, thinkingFormat은 wire 직렬화 형식을 선택합니다.",
|
|
190
|
+
"card.capabilities.empty": "인계 목록(llm-openai-completions)에 제공자가 없거나, 목록 내 제공자에 llm-pi-ai 모델 설정이 없습니다. 먼저 「설정 → 모델」에서 제공자와 모델을 추가하고, 편집할 사용자 지정 게이트웨이를 인계 목록에 넣으세요.",
|
|
191
|
+
"card.capabilities.unavailable": "llm-pi-ai 설정 네임스페이스를 사용할 수 없습니다.",
|
|
192
|
+
"card.capabilities.none": "(모델 없음)",
|
|
193
|
+
"card.capabilities.search": "모델 이름 또는 ID로 검색…",
|
|
194
|
+
"card.capabilities.noMatches": "일치하는 모델이 없습니다",
|
|
195
|
+
"card.capabilities.quickSettings": "빠른 설정",
|
|
196
|
+
"card.capabilities.presetOfficial": "전체에 적용: Off / High / Max(공식 DeepSeek 방식)",
|
|
197
|
+
"card.capabilities.presetGeneric": "전체에 적용: Off / Low / Medium / High(일반 방식)",
|
|
198
|
+
"card.capabilities.vendor": "제공자",
|
|
199
|
+
"card.capabilities.takeover": "단락 인계",
|
|
200
|
+
"card.capabilities.notTakenOver": "인계가 꺼져 있습니다: 이 제공자는 pi-ai가 기본 제공합니다. 「단락 인계」를 켠 후 여기서 사고/effort 구성을 편집하세요.",
|
|
201
|
+
"card.capabilities.expandProvider": "제공자 펼치기",
|
|
202
|
+
"card.capabilities.collapseProvider": "제공자 접기",
|
|
203
|
+
"card.capabilities.openModelSettings": "모델 설정 열기",
|
|
204
|
+
"card.capabilities.closeModelSettings": "모델 설정 접기",
|
|
205
|
+
"card.capabilities.vision": "시각 모델",
|
|
206
|
+
"card.capabilities.thinking": "사고 모델",
|
|
207
|
+
"card.capabilities.supportsEffort": "think effort 지원",
|
|
208
|
+
"card.capabilities.efforts": "사고 수준(체크 후 전송 값 입력)",
|
|
209
|
+
"card.capabilities.wirePlaceholder": "전송 값(예: ultra)",
|
|
210
|
+
"card.capabilities.offPlaceholder": "비워 둠 = 전송하지 않음",
|
|
211
|
+
"card.capabilities.atLeastThinking": "사고 수준을 하나 이상 선택하세요(off 제외)",
|
|
212
|
+
"card.capabilities.applyLevel": "수준 적용",
|
|
213
|
+
"card.capabilities.restoreDefault": "기본값 복원",
|
|
214
|
+
"card.capabilities.unsaved": "저장되지 않음",
|
|
215
|
+
"card.capabilities.saveChanges": "변경 사항 저장",
|
|
216
|
+
"card.capabilities.saved": "저장됨",
|
|
217
|
+
"card.capabilities.thinkingFormat": "사고 형식",
|
|
218
|
+
"card.capabilities.thinkingFormat.inherit": "상속",
|
|
219
|
+
"card.capabilities.failed": "저장 실패: 값이 거부되었거나 충돌합니다. 확인하세요."
|
|
44
220
|
};
|
|
45
221
|
//#endregion
|
|
46
222
|
//#region src/client/card.tsx
|
|
@@ -49,25 +225,82 @@ window.__ModuleLoader__.load({
|
|
|
49
225
|
* dsh-thinking-levels plugin.
|
|
50
226
|
*
|
|
51
227
|
* The card binds the `thinking-levels` settings namespace through the
|
|
52
|
-
* `settingsScope` cordis service and renders its
|
|
53
|
-
* (off / low / high / max / auto) plus the
|
|
54
|
-
* change commits immediately through the scope (no
|
|
55
|
-
* is read per model request, so a committed change
|
|
56
|
-
* without a restart.
|
|
228
|
+
* `settingsScope` cordis service and renders its fields: the level picker
|
|
229
|
+
* (off / on / minimal / low / medium / high / xhigh / max / auto) plus the
|
|
230
|
+
* scheduler toggles. Every change commits immediately through the scope (no
|
|
231
|
+
* staged form): the decision is read per model request, so a committed change
|
|
232
|
+
* applies to the next request without a restart.
|
|
57
233
|
*
|
|
58
|
-
*
|
|
234
|
+
* Below the scheduler rows, a "model capabilities" block edits the
|
|
235
|
+
* `llm-pi-ai` namespace directly (read + write through the same settings
|
|
236
|
+
* transport), borrowing dsh-thinking-effort's presentation: providers group
|
|
237
|
+
* their models, each model row shows capability badges and expands into a
|
|
238
|
+
* per-level editor where a level is ticked and its gateway wire value entered
|
|
239
|
+
* (e.g. `high` → `ultra`); `off` left empty means "do not send". A search box
|
|
240
|
+
* filters models and one-click presets apply official/generic level sets to
|
|
241
|
+
* every thinking model.
|
|
242
|
+
*
|
|
243
|
+
* Kept dependency-free beyond react: the scopes are subscribed with
|
|
59
244
|
* `useSyncExternalStore`, and the controls are plain HTML so the client bundle
|
|
60
245
|
* needs no CSS modules and no primitives value import.
|
|
61
246
|
*/
|
|
62
|
-
/** The
|
|
247
|
+
/** The user-facing levels, in picker order: eight standard levels plus the auto scheduler sentinel. */
|
|
63
248
|
const EFFORT_OPTIONS = [
|
|
64
249
|
"off",
|
|
250
|
+
"on",
|
|
251
|
+
"minimal",
|
|
65
252
|
"low",
|
|
253
|
+
"medium",
|
|
66
254
|
"high",
|
|
255
|
+
"xhigh",
|
|
67
256
|
"max",
|
|
68
257
|
"auto"
|
|
69
258
|
];
|
|
70
|
-
/**
|
|
259
|
+
/**
|
|
260
|
+
* The levels the capability editor offers. This is the llm-pi-ai
|
|
261
|
+
* `reasoningEfforts` table-key space — pi-ai's fixed seven levels (schema
|
|
262
|
+
* rejects any other key). `on` (the enable-thinking toggle) is a selector /
|
|
263
|
+
* injection-level concept, expressed here by the `off` + `high` pair
|
|
264
|
+
* (enable_thinking false/true), so it has no table key of its own.
|
|
265
|
+
*/
|
|
266
|
+
const CAPABILITY_LEVELS = [
|
|
267
|
+
"off",
|
|
268
|
+
"minimal",
|
|
269
|
+
"low",
|
|
270
|
+
"medium",
|
|
271
|
+
"high",
|
|
272
|
+
"xhigh",
|
|
273
|
+
"max"
|
|
274
|
+
];
|
|
275
|
+
/** One-click presets, mirroring dsh-thinking-effort: official DeepSeek style and a generic set. */
|
|
276
|
+
const PRESETS = [{
|
|
277
|
+
key: "official",
|
|
278
|
+
levels: {
|
|
279
|
+
off: null,
|
|
280
|
+
high: "high",
|
|
281
|
+
max: "max"
|
|
282
|
+
}
|
|
283
|
+
}, {
|
|
284
|
+
key: "generic",
|
|
285
|
+
levels: {
|
|
286
|
+
off: null,
|
|
287
|
+
low: "low",
|
|
288
|
+
medium: "medium",
|
|
289
|
+
high: "high"
|
|
290
|
+
}
|
|
291
|
+
}];
|
|
292
|
+
/** The wire thinking formats offered (llm-pi-ai's nameable set, incl. qwen-chat-template). */
|
|
293
|
+
const THINKING_FORMATS = [
|
|
294
|
+
"openai",
|
|
295
|
+
"deepseek",
|
|
296
|
+
"openrouter",
|
|
297
|
+
"together",
|
|
298
|
+
"zai",
|
|
299
|
+
"qwen",
|
|
300
|
+
"qwen-chat-template",
|
|
301
|
+
"string-thinking",
|
|
302
|
+
"ant-ling"
|
|
303
|
+
];
|
|
71
304
|
const rowStyle = {
|
|
72
305
|
display: "flex",
|
|
73
306
|
alignItems: "center",
|
|
@@ -89,101 +322,911 @@ window.__ModuleLoader__.load({
|
|
|
89
322
|
padding: "3px 8px",
|
|
90
323
|
fontSize: "13px"
|
|
91
324
|
};
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
325
|
+
const sectionStyle = {
|
|
326
|
+
marginTop: "14px",
|
|
327
|
+
paddingTop: "12px",
|
|
328
|
+
borderTop: "1px solid var(--dsw-alias-border-l2)"
|
|
329
|
+
};
|
|
330
|
+
const fieldStyle = {
|
|
331
|
+
display: "flex",
|
|
332
|
+
flexDirection: "column",
|
|
333
|
+
gap: "4px"
|
|
334
|
+
};
|
|
335
|
+
const fieldLabelStyle = {
|
|
336
|
+
margin: 0,
|
|
337
|
+
fontSize: "12px",
|
|
338
|
+
lineHeight: "18px",
|
|
339
|
+
color: "var(--dsw-alias-label-tertiary)"
|
|
340
|
+
};
|
|
341
|
+
const hintStyle = {
|
|
342
|
+
margin: "6px 0 0",
|
|
343
|
+
fontSize: "12px",
|
|
344
|
+
lineHeight: "18px",
|
|
345
|
+
color: "var(--dsw-alias-label-tertiary)"
|
|
346
|
+
};
|
|
347
|
+
/** Provider group shell: an outlined row grouping its models. */
|
|
348
|
+
const providerStyle = {
|
|
349
|
+
border: "1px solid var(--dsw-alias-border-l2)",
|
|
350
|
+
borderRadius: "8px",
|
|
351
|
+
margin: "8px 0 0",
|
|
352
|
+
overflow: "hidden"
|
|
353
|
+
};
|
|
354
|
+
const providerHeadStyle = {
|
|
355
|
+
display: "flex",
|
|
356
|
+
alignItems: "center",
|
|
357
|
+
gap: "8px",
|
|
358
|
+
padding: "7px 10px",
|
|
359
|
+
background: "var(--dsw-alias-bg-layer-2, rgba(127,127,127,0.06))"
|
|
360
|
+
};
|
|
361
|
+
const providerNameStyle = {
|
|
362
|
+
margin: 0,
|
|
363
|
+
flex: "1 1 auto",
|
|
364
|
+
minWidth: 0,
|
|
365
|
+
fontFamily: "var(--ds-font-family-code, monospace)",
|
|
366
|
+
fontSize: "12px",
|
|
367
|
+
lineHeight: "18px",
|
|
368
|
+
fontWeight: 600,
|
|
369
|
+
color: "var(--dsw-alias-label-primary)",
|
|
370
|
+
overflowWrap: "anywhere"
|
|
371
|
+
};
|
|
372
|
+
const providerBadgeStyle = {
|
|
373
|
+
margin: 0,
|
|
374
|
+
fontSize: "10px",
|
|
375
|
+
lineHeight: "16px",
|
|
376
|
+
color: "var(--dsw-alias-label-tertiary)",
|
|
377
|
+
border: "1px solid var(--dsw-alias-border-l2)",
|
|
378
|
+
borderRadius: "4px",
|
|
379
|
+
padding: "0 5px",
|
|
380
|
+
whiteSpace: "nowrap"
|
|
381
|
+
};
|
|
382
|
+
const iconButtonStyle = {
|
|
383
|
+
background: "none",
|
|
384
|
+
border: "none",
|
|
385
|
+
color: "var(--dsw-alias-label-tertiary)",
|
|
386
|
+
cursor: "pointer",
|
|
387
|
+
padding: "2px 4px",
|
|
388
|
+
display: "inline-flex",
|
|
389
|
+
alignItems: "center"
|
|
390
|
+
};
|
|
391
|
+
/** One model row inside a provider group. */
|
|
392
|
+
const modelRowStyle = {
|
|
393
|
+
display: "flex",
|
|
394
|
+
alignItems: "center",
|
|
395
|
+
gap: "8px",
|
|
396
|
+
padding: "7px 10px",
|
|
397
|
+
borderTop: "1px solid var(--dsw-alias-border-l2)"
|
|
398
|
+
};
|
|
399
|
+
const modelIdStyle = {
|
|
400
|
+
margin: 0,
|
|
401
|
+
flex: "1 1 auto",
|
|
402
|
+
minWidth: 0,
|
|
403
|
+
fontFamily: "var(--ds-font-family-code, monospace)",
|
|
404
|
+
fontSize: "12px",
|
|
405
|
+
lineHeight: "18px",
|
|
406
|
+
color: "var(--dsw-alias-label-secondary)",
|
|
407
|
+
overflowWrap: "anywhere"
|
|
408
|
+
};
|
|
409
|
+
/** Capability badge chips (text / image / context). */
|
|
410
|
+
const badgeStyle = {
|
|
411
|
+
fontSize: "10px",
|
|
412
|
+
lineHeight: "16px",
|
|
413
|
+
color: "var(--dsw-alias-label-tertiary)",
|
|
414
|
+
border: "1px solid var(--dsw-alias-border-l2)",
|
|
415
|
+
borderRadius: "4px",
|
|
416
|
+
padding: "0 5px",
|
|
417
|
+
whiteSpace: "nowrap"
|
|
418
|
+
};
|
|
419
|
+
/** The per-level editor grid: one row per level with a toggle, a label and a wire input. */
|
|
420
|
+
const levelRowStyle = {
|
|
421
|
+
display: "grid",
|
|
422
|
+
gridTemplateColumns: "auto 92px minmax(0, 1fr)",
|
|
423
|
+
alignItems: "center",
|
|
424
|
+
gap: "8px",
|
|
425
|
+
padding: "4px 0",
|
|
426
|
+
fontSize: "13px"
|
|
427
|
+
};
|
|
428
|
+
const levelNameStyle = {
|
|
429
|
+
margin: 0,
|
|
430
|
+
fontSize: "12px",
|
|
431
|
+
lineHeight: "18px",
|
|
432
|
+
color: "var(--dsw-alias-label-secondary)"
|
|
433
|
+
};
|
|
434
|
+
const wireInputStyle = {
|
|
435
|
+
background: "var(--dsw-alias-bg-surface, #fff)",
|
|
436
|
+
color: "var(--dsw-alias-label-primary)",
|
|
437
|
+
border: "1px solid var(--dsw-alias-border-l2)",
|
|
438
|
+
borderRadius: "4px",
|
|
439
|
+
padding: "3px 8px",
|
|
440
|
+
fontSize: "12px",
|
|
441
|
+
width: "100%",
|
|
442
|
+
boxSizing: "border-box"
|
|
443
|
+
};
|
|
444
|
+
/** A row's `reasoningEfforts` as stored in the user layer. */
|
|
445
|
+
function effortsOf(model) {
|
|
446
|
+
const value = model["reasoningEfforts"];
|
|
447
|
+
if (value === false) return false;
|
|
448
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value)) return value;
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Build a `reasoningEfforts` table from a level→wire draft. `off` maps to
|
|
452
|
+
* `null` (omit the reasoning option → enable_thinking false) unless the user
|
|
453
|
+
* typed a wire value; every other ticked level keeps its typed wire value.
|
|
454
|
+
* pi-ai rejects a table offering nothing beyond `off`, so a selection of only
|
|
455
|
+
* `off` falls back to the default `high` level.
|
|
456
|
+
*/
|
|
457
|
+
function effortTableOf(draft) {
|
|
458
|
+
const table = {};
|
|
459
|
+
for (const level of CAPABILITY_LEVELS) {
|
|
460
|
+
const wire = draft[level];
|
|
461
|
+
if (wire === void 0 || wire === null) continue;
|
|
462
|
+
const trimmed = typeof wire === "string" ? wire.trim() : "";
|
|
463
|
+
if (level === "off") table[level] = trimmed === "" ? null : trimmed;
|
|
464
|
+
else if (trimmed !== "") table[level] = trimmed;
|
|
465
|
+
}
|
|
466
|
+
if (Object.keys(table).length === 0 || Object.keys(table).every((level) => table[level] === null)) return {
|
|
467
|
+
...table,
|
|
468
|
+
high: "high"
|
|
469
|
+
};
|
|
470
|
+
return table;
|
|
471
|
+
}
|
|
472
|
+
/** The `compat.thinkingFormat` a row declares, or `undefined` when it declares none. */
|
|
473
|
+
function formatOf(model) {
|
|
474
|
+
const compat = model["compat"];
|
|
475
|
+
if (typeof compat !== "object" || compat === null || Array.isArray(compat)) return void 0;
|
|
476
|
+
const format = compat["thinkingFormat"];
|
|
477
|
+
return typeof format === "string" ? format : void 0;
|
|
478
|
+
}
|
|
479
|
+
/** Whether a row declares `compat.supportsReasoningEffort` (the wire sends reasoning_effort). */
|
|
480
|
+
function supportsEffortOf(model) {
|
|
481
|
+
const compat = model["compat"];
|
|
482
|
+
if (typeof compat !== "object" || compat === null || Array.isArray(compat)) return false;
|
|
483
|
+
return compat["supportsReasoningEffort"] === true;
|
|
484
|
+
}
|
|
485
|
+
/** Patch one row's `compat` object, merging rather than replacing sibling fields. */
|
|
486
|
+
function patchCompat(row, patch) {
|
|
487
|
+
const compat = typeof row["compat"] === "object" && row["compat"] !== null && !Array.isArray(row["compat"]) ? { ...row["compat"] } : {};
|
|
488
|
+
patch(compat);
|
|
489
|
+
if (Object.keys(compat).length === 0) delete row["compat"];
|
|
490
|
+
else row["compat"] = compat;
|
|
491
|
+
}
|
|
492
|
+
/** The user-layer `providers` value of the llm-pi-ai namespace, when present. */
|
|
493
|
+
function providersOf(snapshot) {
|
|
494
|
+
if (typeof snapshot !== "object" || snapshot === null) return {};
|
|
495
|
+
const user = snapshot.user;
|
|
496
|
+
if (typeof user !== "object" || user === null || Array.isArray(user)) return {};
|
|
497
|
+
const providers = user["providers"];
|
|
498
|
+
return typeof providers === "object" && providers !== null && !Array.isArray(providers) ? providers : {};
|
|
499
|
+
}
|
|
500
|
+
/** The provider ids the openai-completions adapter is set up to serve. */
|
|
501
|
+
function takeoverListOf(snapshot) {
|
|
502
|
+
if (typeof snapshot !== "object" || snapshot === null) return [];
|
|
503
|
+
const value = snapshot.value;
|
|
504
|
+
if (typeof value !== "object" || value === null) return [];
|
|
505
|
+
const section = value;
|
|
506
|
+
if (section.enabled !== true || !Array.isArray(section.providers)) return [];
|
|
507
|
+
return section.providers.filter((id) => typeof id === "string");
|
|
508
|
+
}
|
|
509
|
+
/** Flatten the user-layer providers into capability entries (models arrays only). */
|
|
510
|
+
function entriesOf(providers) {
|
|
511
|
+
return Object.entries(providers).flatMap(([providerId, profile]) => {
|
|
512
|
+
const models = profile["models"];
|
|
513
|
+
if (!Array.isArray(models)) return [];
|
|
514
|
+
return models.map((model, index) => ({
|
|
515
|
+
providerId,
|
|
516
|
+
index,
|
|
517
|
+
model: typeof model === "object" && model !== null && !Array.isArray(model) ? model : {},
|
|
518
|
+
modelId: typeof model === "object" && model !== null && typeof model["id"] === "string" ? model["id"] : `#${index + 1}`
|
|
519
|
+
}));
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
/** Human-readable capability summary of one entry (input modalities + declared context window). */
|
|
523
|
+
function summaryOf(entry) {
|
|
524
|
+
const input = entry.model["input"];
|
|
525
|
+
const text = !Array.isArray(input) || input.length === 0 || input.includes("text");
|
|
526
|
+
const image = Array.isArray(input) && input.includes("image");
|
|
527
|
+
const contextWindow = entry.model["contextWindow"];
|
|
528
|
+
let context = null;
|
|
529
|
+
if (typeof contextWindow === "number" && Number.isFinite(contextWindow) && contextWindow > 0) context = contextWindow >= 1024 ? `${Math.round(contextWindow / 1024)}K` : String(contextWindow);
|
|
530
|
+
return {
|
|
531
|
+
text,
|
|
532
|
+
image,
|
|
533
|
+
context
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
/** A tiny inline chevron icon (no CSS modules). */
|
|
537
|
+
function ChevronIcon({ open }) {
|
|
538
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
539
|
+
width: "12",
|
|
540
|
+
height: "12",
|
|
541
|
+
viewBox: "0 0 16 16",
|
|
542
|
+
"aria-hidden": true,
|
|
543
|
+
style: {
|
|
544
|
+
transform: open ? "rotate(180deg)" : "none",
|
|
545
|
+
transition: "transform 0.16s"
|
|
546
|
+
},
|
|
547
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
548
|
+
d: "M4 6l4 4 4-4",
|
|
549
|
+
fill: "none",
|
|
550
|
+
stroke: "currentColor",
|
|
551
|
+
strokeWidth: "1.5",
|
|
552
|
+
strokeLinecap: "round",
|
|
553
|
+
strokeLinejoin: "round"
|
|
554
|
+
})
|
|
108
555
|
});
|
|
109
556
|
}
|
|
110
557
|
/**
|
|
111
|
-
* The
|
|
112
|
-
*
|
|
558
|
+
* The llm-pi-ai model-capability editor block (dsh-thinking-effort style:
|
|
559
|
+
* provider groups, model rows with badges, per-level wire editors, search and
|
|
560
|
+
* one-click presets).
|
|
561
|
+
* @param scope - the `llm-pi-ai` namespace scope.
|
|
562
|
+
* @param t - copy lookup.
|
|
563
|
+
* @param readonly - whether writes are forbidden.
|
|
564
|
+
* @returns the capabilities block, or a placeholder when nothing is configured.
|
|
113
565
|
*/
|
|
114
|
-
function
|
|
566
|
+
function ModelCapabilities(props) {
|
|
567
|
+
const { scope, takeoverScope, t, readonly } = props;
|
|
115
568
|
const snapshot = (0, react.useSyncExternalStore)((listener) => scope.subscribe(listener), () => scope.getSnapshot());
|
|
569
|
+
const takeover = (0, react.useSyncExternalStore)((listener) => takeoverScope.subscribe(listener), () => takeoverScope.getSnapshot());
|
|
116
570
|
const unavailable = snapshot.status === "unavailable";
|
|
117
|
-
const
|
|
118
|
-
const
|
|
119
|
-
const
|
|
571
|
+
const providers = snapshot.status === "ready" ? providersOf(snapshot) : {};
|
|
572
|
+
const takeoverList = takeover.status === "ready" ? takeoverListOf(takeover) : [];
|
|
573
|
+
const allEntries = entriesOf(providers);
|
|
574
|
+
const [query, setQuery] = (0, react.useState)("");
|
|
575
|
+
const [expandedProviders, setExpandedProviders] = (0, react.useState)({});
|
|
576
|
+
const [expandedModels, setExpandedModels] = (0, react.useState)({});
|
|
577
|
+
const [drafts, setDrafts] = (0, react.useState)({});
|
|
578
|
+
const [busy, setBusy] = (0, react.useState)(false);
|
|
579
|
+
const entryKey = (entry) => `${entry.providerId}\u0000${entry.index}`;
|
|
580
|
+
/** Commit one patch over the user-layer providers. */
|
|
581
|
+
const commitProviders = (mutate) => {
|
|
582
|
+
if (snapshot.status !== "ready" || readonly) return;
|
|
583
|
+
setBusy(true);
|
|
584
|
+
scope.set("providers", mutate(structuredClone(providers))).then(() => {
|
|
585
|
+
setBusy(false);
|
|
586
|
+
}).catch(() => {
|
|
587
|
+
setBusy(false);
|
|
588
|
+
});
|
|
589
|
+
};
|
|
590
|
+
/** Toggle whether the openai-completions adapter takes over one provider. */
|
|
591
|
+
const toggleTakeover = (providerId) => {
|
|
592
|
+
if (takeover.status !== "ready" || readonly) return;
|
|
593
|
+
const current = takeoverListOf(takeover);
|
|
594
|
+
const next = current.includes(providerId) ? current.filter((id) => id !== providerId) : [...current, providerId];
|
|
595
|
+
setBusy(true);
|
|
596
|
+
takeoverScope.set("providers", next).then(() => takeoverScope.set("enabled", next.length > 0)).then(() => {
|
|
597
|
+
setBusy(false);
|
|
598
|
+
}).catch(() => {
|
|
599
|
+
setBusy(false);
|
|
600
|
+
});
|
|
601
|
+
};
|
|
602
|
+
/** Patch one model row of one provider. */
|
|
603
|
+
const patchModel = (providerId, index, patch) => {
|
|
604
|
+
commitProviders((current) => {
|
|
605
|
+
const profile = current[providerId];
|
|
606
|
+
if (profile === void 0 || !Array.isArray(profile.models)) return current;
|
|
607
|
+
const model = profile.models[index];
|
|
608
|
+
if (typeof model !== "object" || model === null) return current;
|
|
609
|
+
patch(model);
|
|
610
|
+
return current;
|
|
611
|
+
});
|
|
612
|
+
};
|
|
613
|
+
/** Toggle whether a model is a thinking model (reasoningEfforts table vs false). */
|
|
614
|
+
const toggleThinking = (entry, next) => {
|
|
615
|
+
patchModel(entry.providerId, entry.index, (row) => {
|
|
616
|
+
if (next) row["reasoningEfforts"] = supportsEffortOf(row) ? effortTableOf({ high: "high" }) : {
|
|
617
|
+
off: null,
|
|
618
|
+
high: "high"
|
|
619
|
+
};
|
|
620
|
+
else row["reasoningEfforts"] = false;
|
|
621
|
+
});
|
|
622
|
+
};
|
|
623
|
+
/** Toggle whether a model accepts reasoning_effort levels. */
|
|
624
|
+
const toggleEffortCapable = (entry, next) => {
|
|
625
|
+
patchModel(entry.providerId, entry.index, (row) => {
|
|
626
|
+
patchCompat(row, (compat) => {
|
|
627
|
+
compat["supportsReasoningEffort"] = next;
|
|
628
|
+
});
|
|
629
|
+
});
|
|
630
|
+
};
|
|
631
|
+
/** Apply one model's wire draft as its `reasoningEfforts` table. */
|
|
632
|
+
const applyDraft = (entry) => {
|
|
633
|
+
const key = entryKey(entry);
|
|
634
|
+
const draft = drafts[key];
|
|
635
|
+
if (draft === void 0) return;
|
|
636
|
+
const table = effortTableOf(draft);
|
|
637
|
+
patchModel(entry.providerId, entry.index, (row) => {
|
|
638
|
+
row["reasoningEfforts"] = table;
|
|
639
|
+
const extended = Object.keys(table).some((level) => level !== "off" && level !== "on" && level !== "high");
|
|
640
|
+
if (supportsEffortOf(row) || extended) patchCompat(row, (compat) => {
|
|
641
|
+
compat["supportsReasoningEffort"] = true;
|
|
642
|
+
});
|
|
643
|
+
});
|
|
644
|
+
};
|
|
645
|
+
/** Reset a model's draft to its persisted table (or the default high set). */
|
|
646
|
+
const resetDraft = (entry) => {
|
|
647
|
+
const key = entryKey(entry);
|
|
648
|
+
setDrafts((current) => {
|
|
649
|
+
const next = { ...current };
|
|
650
|
+
const table = effortsOf(entry.model);
|
|
651
|
+
if (typeof table === "object" && table !== null) next[key] = Object.fromEntries(CAPABILITY_LEVELS.map((level) => [level, table[level] === void 0 ? null : table[level] === null ? "" : String(table[level])]));
|
|
652
|
+
else next[key] = {
|
|
653
|
+
off: "",
|
|
654
|
+
high: "high"
|
|
655
|
+
};
|
|
656
|
+
return next;
|
|
657
|
+
});
|
|
658
|
+
};
|
|
659
|
+
/** Seed a model's draft when it is first expanded. */
|
|
660
|
+
const ensureDraft = (entry) => {
|
|
661
|
+
const key = entryKey(entry);
|
|
662
|
+
setDrafts((current) => {
|
|
663
|
+
if (current[key] !== void 0) return current;
|
|
664
|
+
const next = { ...current };
|
|
665
|
+
const table = effortsOf(entry.model);
|
|
666
|
+
if (typeof table === "object" && table !== null) next[key] = Object.fromEntries(CAPABILITY_LEVELS.map((level) => [level, table[level] === void 0 ? null : table[level] === null ? "" : String(table[level])]));
|
|
667
|
+
else next[key] = {
|
|
668
|
+
off: "",
|
|
669
|
+
high: "high"
|
|
670
|
+
};
|
|
671
|
+
return next;
|
|
672
|
+
});
|
|
673
|
+
};
|
|
674
|
+
/** Apply a one-click preset to every thinking model. */
|
|
675
|
+
const applyPreset = (levels) => {
|
|
676
|
+
commitProviders((current) => {
|
|
677
|
+
for (const entry of entriesOf(current)) {
|
|
678
|
+
const profile = current[entry.providerId];
|
|
679
|
+
if (profile === void 0 || !Array.isArray(profile.models)) continue;
|
|
680
|
+
const model = profile.models[entry.index];
|
|
681
|
+
if (typeof model !== "object" || model === null) continue;
|
|
682
|
+
const row = model;
|
|
683
|
+
if (effortsOf(row) === void 0) continue;
|
|
684
|
+
row["reasoningEfforts"] = levels;
|
|
685
|
+
}
|
|
686
|
+
return current;
|
|
687
|
+
});
|
|
688
|
+
};
|
|
120
689
|
if (unavailable) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
121
|
-
style:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
|
|
690
|
+
style: sectionStyle,
|
|
691
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
692
|
+
style: hintStyle,
|
|
693
|
+
children: t("card.capabilities.unavailable")
|
|
694
|
+
})
|
|
695
|
+
});
|
|
696
|
+
if (allEntries.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
697
|
+
style: sectionStyle,
|
|
698
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
699
|
+
style: fieldLabelStyle,
|
|
700
|
+
children: t("card.capabilities")
|
|
701
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
702
|
+
style: hintStyle,
|
|
703
|
+
children: t("card.capabilities.empty")
|
|
704
|
+
})]
|
|
127
705
|
});
|
|
706
|
+
const needle = query.trim().toLowerCase();
|
|
707
|
+
const visible = needle === "" ? allEntries : allEntries.filter((entry) => entry.modelId.toLowerCase().includes(needle) || entry.providerId.toLowerCase().includes(needle));
|
|
708
|
+
const providerIds = [...new Set(visible.map((entry) => entry.providerId))];
|
|
128
709
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
129
|
-
style:
|
|
710
|
+
style: sectionStyle,
|
|
130
711
|
children: [
|
|
131
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
132
|
-
style:
|
|
133
|
-
children:
|
|
134
|
-
htmlFor: "plugin-config-thinking-levels-level",
|
|
135
|
-
style: labelStyle,
|
|
136
|
-
children: t("card.level")
|
|
137
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
|
|
138
|
-
id: "plugin-config-thinking-levels-level",
|
|
139
|
-
value: level,
|
|
140
|
-
disabled: readonly,
|
|
141
|
-
style: controlStyle,
|
|
142
|
-
onChange: (event) => {
|
|
143
|
-
scope.set("level", event.currentTarget.value);
|
|
144
|
-
},
|
|
145
|
-
children: EFFORT_OPTIONS.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
146
|
-
value: option,
|
|
147
|
-
children: t(`card.level.${option}`)
|
|
148
|
-
}, option))
|
|
149
|
-
})]
|
|
712
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
713
|
+
style: fieldLabelStyle,
|
|
714
|
+
children: t("card.capabilities")
|
|
150
715
|
}),
|
|
151
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
checked: value.enabled ?? true,
|
|
155
|
-
disabled: readonly,
|
|
156
|
-
onChange: (next) => {
|
|
157
|
-
scope.set("enabled", next);
|
|
158
|
-
}
|
|
716
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
717
|
+
style: hintStyle,
|
|
718
|
+
children: t("card.capabilities.hint")
|
|
159
719
|
}),
|
|
160
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
720
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
721
|
+
style: {
|
|
722
|
+
display: "flex",
|
|
723
|
+
gap: "8px",
|
|
724
|
+
flexWrap: "wrap",
|
|
725
|
+
alignItems: "center",
|
|
726
|
+
margin: "8px 0 2px"
|
|
727
|
+
},
|
|
728
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
729
|
+
type: "text",
|
|
730
|
+
value: query,
|
|
731
|
+
placeholder: t("card.capabilities.search"),
|
|
732
|
+
disabled: readonly || busy,
|
|
733
|
+
style: {
|
|
734
|
+
...controlStyle,
|
|
735
|
+
flex: "1 1 160px",
|
|
736
|
+
minWidth: "140px"
|
|
737
|
+
},
|
|
738
|
+
onChange: (event) => setQuery(event.currentTarget.value)
|
|
739
|
+
}), PRESETS.map((preset) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
740
|
+
type: "button",
|
|
741
|
+
disabled: readonly || busy,
|
|
742
|
+
onClick: () => applyPreset(preset.levels),
|
|
743
|
+
style: {
|
|
744
|
+
...controlStyle,
|
|
745
|
+
cursor: readonly || busy ? "default" : "pointer",
|
|
746
|
+
opacity: readonly || busy ? .5 : 1
|
|
747
|
+
},
|
|
748
|
+
children: t(`card.capabilities.preset${preset.key === "official" ? "Official" : "Generic"}`)
|
|
749
|
+
}, preset.key))]
|
|
168
750
|
}),
|
|
169
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
751
|
+
visible.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
752
|
+
style: hintStyle,
|
|
753
|
+
children: t("card.capabilities.noMatches")
|
|
754
|
+
}) : providerIds.map((providerId) => {
|
|
755
|
+
const providerEntries = visible.filter((entry) => entry.providerId === providerId);
|
|
756
|
+
const providerOpen = expandedProviders[providerId] === true || needle !== "";
|
|
757
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
758
|
+
style: providerStyle,
|
|
759
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
760
|
+
style: providerHeadStyle,
|
|
761
|
+
children: [
|
|
762
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
763
|
+
type: "button",
|
|
764
|
+
"aria-expanded": providerOpen,
|
|
765
|
+
disabled: readonly || busy,
|
|
766
|
+
onClick: () => setExpandedProviders((current) => ({
|
|
767
|
+
...current,
|
|
768
|
+
[providerId]: current[providerId] !== true
|
|
769
|
+
})),
|
|
770
|
+
style: {
|
|
771
|
+
...iconButtonStyle,
|
|
772
|
+
cursor: readonly || busy ? "default" : "pointer"
|
|
773
|
+
},
|
|
774
|
+
title: providerOpen ? t("card.capabilities.collapseProvider") : t("card.capabilities.expandProvider"),
|
|
775
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChevronIcon, { open: providerOpen })
|
|
776
|
+
}),
|
|
777
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
778
|
+
style: providerNameStyle,
|
|
779
|
+
children: providerId
|
|
780
|
+
}),
|
|
781
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
782
|
+
style: {
|
|
783
|
+
display: "inline-flex",
|
|
784
|
+
alignItems: "center",
|
|
785
|
+
gap: "5px",
|
|
786
|
+
fontSize: "11px",
|
|
787
|
+
whiteSpace: "nowrap",
|
|
788
|
+
color: "var(--dsw-alias-label-secondary)"
|
|
789
|
+
},
|
|
790
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
791
|
+
type: "checkbox",
|
|
792
|
+
checked: takeoverList.includes(providerId),
|
|
793
|
+
disabled: readonly || busy,
|
|
794
|
+
onChange: () => toggleTakeover(providerId)
|
|
795
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("card.capabilities.takeover") })]
|
|
796
|
+
}),
|
|
797
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
798
|
+
style: providerBadgeStyle,
|
|
799
|
+
children: providerEntries.length
|
|
800
|
+
})
|
|
801
|
+
]
|
|
802
|
+
}), providerOpen ? takeoverList.includes(providerId) ? providerEntries.map((entry) => {
|
|
803
|
+
const key = entryKey(entry);
|
|
804
|
+
const modelOpen = expandedModels[key] === true;
|
|
805
|
+
const thinking = typeof effortsOf(entry.model) === "object";
|
|
806
|
+
const supportsEffort = supportsEffortOf(entry.model);
|
|
807
|
+
const meta = summaryOf(entry);
|
|
808
|
+
const format = formatOf(entry.model);
|
|
809
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
810
|
+
style: modelRowStyle,
|
|
811
|
+
children: [
|
|
812
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
813
|
+
type: "button",
|
|
814
|
+
"aria-expanded": modelOpen,
|
|
815
|
+
disabled: readonly || busy,
|
|
816
|
+
onClick: () => {
|
|
817
|
+
const next = expandedModels[key] !== true;
|
|
818
|
+
setExpandedModels((current) => ({
|
|
819
|
+
...current,
|
|
820
|
+
[key]: next
|
|
821
|
+
}));
|
|
822
|
+
if (next) ensureDraft(entry);
|
|
823
|
+
},
|
|
824
|
+
style: {
|
|
825
|
+
...iconButtonStyle,
|
|
826
|
+
cursor: readonly || busy ? "default" : "pointer"
|
|
827
|
+
},
|
|
828
|
+
title: modelOpen ? t("card.capabilities.closeModelSettings") : t("card.capabilities.openModelSettings"),
|
|
829
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChevronIcon, { open: modelOpen })
|
|
830
|
+
}),
|
|
831
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
832
|
+
style: modelIdStyle,
|
|
833
|
+
children: entry.modelId
|
|
834
|
+
}),
|
|
835
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
836
|
+
style: badgeStyle,
|
|
837
|
+
title: "text",
|
|
838
|
+
children: meta.text ? "T" : "–"
|
|
839
|
+
}),
|
|
840
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
841
|
+
style: badgeStyle,
|
|
842
|
+
title: "image",
|
|
843
|
+
children: meta.image ? "IMG" : "–"
|
|
844
|
+
}),
|
|
845
|
+
meta.context !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
846
|
+
style: badgeStyle,
|
|
847
|
+
children: meta.context
|
|
848
|
+
}),
|
|
849
|
+
thinking && !supportsEffort && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
850
|
+
style: badgeStyle,
|
|
851
|
+
children: "On/Off"
|
|
852
|
+
})
|
|
853
|
+
]
|
|
854
|
+
}), modelOpen ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
855
|
+
style: {
|
|
856
|
+
padding: "4px 10px 10px",
|
|
857
|
+
borderTop: "1px solid var(--dsw-alias-border-l2)"
|
|
858
|
+
},
|
|
859
|
+
children: [
|
|
860
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
861
|
+
style: {
|
|
862
|
+
display: "flex",
|
|
863
|
+
gap: "16px",
|
|
864
|
+
flexWrap: "wrap",
|
|
865
|
+
margin: "2px 0 8px"
|
|
866
|
+
},
|
|
867
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
868
|
+
style: {
|
|
869
|
+
display: "inline-flex",
|
|
870
|
+
alignItems: "center",
|
|
871
|
+
gap: "6px",
|
|
872
|
+
fontSize: "12px"
|
|
873
|
+
},
|
|
874
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
875
|
+
type: "checkbox",
|
|
876
|
+
checked: thinking,
|
|
877
|
+
disabled: readonly || busy,
|
|
878
|
+
onChange: (event) => toggleThinking(entry, event.currentTarget.checked)
|
|
879
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("card.capabilities.thinking") })]
|
|
880
|
+
}), thinking ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
881
|
+
style: {
|
|
882
|
+
display: "inline-flex",
|
|
883
|
+
alignItems: "center",
|
|
884
|
+
gap: "6px",
|
|
885
|
+
fontSize: "12px"
|
|
886
|
+
},
|
|
887
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
888
|
+
type: "checkbox",
|
|
889
|
+
checked: supportsEffort,
|
|
890
|
+
disabled: readonly || busy,
|
|
891
|
+
onChange: (event) => toggleEffortCapable(entry, event.currentTarget.checked)
|
|
892
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("card.capabilities.supportsEffort") })]
|
|
893
|
+
}) : null]
|
|
894
|
+
}),
|
|
895
|
+
thinking && supportsEffort ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
896
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
897
|
+
style: fieldLabelStyle,
|
|
898
|
+
children: t("card.capabilities.efforts")
|
|
899
|
+
}),
|
|
900
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
901
|
+
style: { margin: "4px 0 6px" },
|
|
902
|
+
children: CAPABILITY_LEVELS.map((level) => {
|
|
903
|
+
const wire = drafts[key]?.[level];
|
|
904
|
+
const on = wire !== void 0 && wire !== null;
|
|
905
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
906
|
+
style: levelRowStyle,
|
|
907
|
+
children: [
|
|
908
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
909
|
+
style: {
|
|
910
|
+
display: "inline-flex",
|
|
911
|
+
alignItems: "center",
|
|
912
|
+
gap: "6px",
|
|
913
|
+
fontSize: "12px"
|
|
914
|
+
},
|
|
915
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
916
|
+
type: "checkbox",
|
|
917
|
+
checked: on,
|
|
918
|
+
disabled: readonly || busy,
|
|
919
|
+
onChange: (event) => {
|
|
920
|
+
const checked = event.currentTarget.checked;
|
|
921
|
+
setDrafts((current) => {
|
|
922
|
+
const draft = { ...current[key] ?? {} };
|
|
923
|
+
draft[level] = checked ? level === "off" ? "" : level : null;
|
|
924
|
+
return {
|
|
925
|
+
...current,
|
|
926
|
+
[key]: draft
|
|
927
|
+
};
|
|
928
|
+
});
|
|
929
|
+
}
|
|
930
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: level })]
|
|
931
|
+
}),
|
|
932
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
933
|
+
style: levelNameStyle,
|
|
934
|
+
children: level === "off" ? t("card.capabilities.offPlaceholder") : "→"
|
|
935
|
+
}),
|
|
936
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
937
|
+
type: "text",
|
|
938
|
+
value: wire ?? "",
|
|
939
|
+
disabled: readonly || busy || !on,
|
|
940
|
+
placeholder: t("card.capabilities.wirePlaceholder"),
|
|
941
|
+
style: wireInputStyle,
|
|
942
|
+
onChange: (event) => {
|
|
943
|
+
setDrafts((current) => {
|
|
944
|
+
const draft = { ...current[key] ?? {} };
|
|
945
|
+
draft[level] = event.currentTarget.value;
|
|
946
|
+
return {
|
|
947
|
+
...current,
|
|
948
|
+
[key]: draft
|
|
949
|
+
};
|
|
950
|
+
});
|
|
951
|
+
}
|
|
952
|
+
})
|
|
953
|
+
]
|
|
954
|
+
}, level);
|
|
955
|
+
})
|
|
956
|
+
}),
|
|
957
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
958
|
+
style: {
|
|
959
|
+
display: "flex",
|
|
960
|
+
gap: "8px",
|
|
961
|
+
flexWrap: "wrap"
|
|
962
|
+
},
|
|
963
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
964
|
+
type: "button",
|
|
965
|
+
disabled: readonly || busy,
|
|
966
|
+
onClick: () => applyDraft(entry),
|
|
967
|
+
style: {
|
|
968
|
+
...controlStyle,
|
|
969
|
+
cursor: readonly || busy ? "default" : "pointer",
|
|
970
|
+
opacity: readonly || busy ? .5 : 1
|
|
971
|
+
},
|
|
972
|
+
children: t("card.capabilities.applyLevel")
|
|
973
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
974
|
+
type: "button",
|
|
975
|
+
disabled: readonly || busy,
|
|
976
|
+
onClick: () => resetDraft(entry),
|
|
977
|
+
style: {
|
|
978
|
+
...controlStyle,
|
|
979
|
+
cursor: readonly || busy ? "default" : "pointer",
|
|
980
|
+
opacity: readonly || busy ? .5 : 1
|
|
981
|
+
},
|
|
982
|
+
children: t("card.capabilities.restoreDefault")
|
|
983
|
+
})]
|
|
984
|
+
})
|
|
985
|
+
] }) : null,
|
|
986
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
987
|
+
style: {
|
|
988
|
+
display: "flex",
|
|
989
|
+
gap: "16px",
|
|
990
|
+
flexWrap: "wrap",
|
|
991
|
+
marginTop: "10px"
|
|
992
|
+
},
|
|
993
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
994
|
+
style: {
|
|
995
|
+
display: "inline-flex",
|
|
996
|
+
alignItems: "center",
|
|
997
|
+
gap: "6px",
|
|
998
|
+
fontSize: "12px"
|
|
999
|
+
},
|
|
1000
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1001
|
+
type: "checkbox",
|
|
1002
|
+
checked: meta.image,
|
|
1003
|
+
disabled: readonly || busy,
|
|
1004
|
+
onChange: (event) => {
|
|
1005
|
+
patchModel(entry.providerId, entry.index, (row) => {
|
|
1006
|
+
row["input"] = event.currentTarget.checked ? ["text", "image"] : ["text"];
|
|
1007
|
+
});
|
|
1008
|
+
}
|
|
1009
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("card.capabilities.vision") })]
|
|
1010
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
1011
|
+
style: fieldStyle,
|
|
1012
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1013
|
+
style: fieldLabelStyle,
|
|
1014
|
+
children: t("card.capabilities.thinkingFormat")
|
|
1015
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
|
|
1016
|
+
style: controlStyle,
|
|
1017
|
+
value: format ?? "inherit",
|
|
1018
|
+
disabled: readonly || busy,
|
|
1019
|
+
onChange: (event) => {
|
|
1020
|
+
const next = event.currentTarget.value;
|
|
1021
|
+
patchModel(entry.providerId, entry.index, (row) => {
|
|
1022
|
+
patchCompat(row, (compat) => {
|
|
1023
|
+
if (next === "inherit") delete compat["thinkingFormat"];
|
|
1024
|
+
else compat["thinkingFormat"] = next;
|
|
1025
|
+
});
|
|
1026
|
+
});
|
|
1027
|
+
},
|
|
1028
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
1029
|
+
value: "inherit",
|
|
1030
|
+
children: t("card.capabilities.thinkingFormat.inherit")
|
|
1031
|
+
}), THINKING_FORMATS.map((formatOption) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
1032
|
+
value: formatOption,
|
|
1033
|
+
children: formatOption
|
|
1034
|
+
}, formatOption))]
|
|
1035
|
+
})]
|
|
1036
|
+
})]
|
|
1037
|
+
})
|
|
1038
|
+
]
|
|
1039
|
+
}) : null] }, key);
|
|
1040
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1041
|
+
style: {
|
|
1042
|
+
...hintStyle,
|
|
1043
|
+
padding: "8px 10px"
|
|
1044
|
+
},
|
|
1045
|
+
children: t("card.capabilities.notTakenOver")
|
|
1046
|
+
}) : null]
|
|
1047
|
+
}, providerId);
|
|
177
1048
|
}),
|
|
178
|
-
|
|
1049
|
+
readonly ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1050
|
+
style: hintStyle,
|
|
1051
|
+
children: t("card.readonly")
|
|
1052
|
+
}) : null
|
|
1053
|
+
]
|
|
1054
|
+
});
|
|
1055
|
+
}
|
|
1056
|
+
/**
|
|
1057
|
+
* The card body, wrapped in a disclosure shell like every peer settings card:
|
|
1058
|
+
* a header (name + description + chevron) that toggles the body, collapsed by
|
|
1059
|
+
* default so the plugin tab stays a tidy list of drawers.
|
|
1060
|
+
* @param props - locale copy and the injected scopes.
|
|
1061
|
+
*/
|
|
1062
|
+
function ThinkingLevelsCard({ t, scope, piAiScope, takeoverScope }) {
|
|
1063
|
+
const [open, setOpen] = (0, react.useState)(false);
|
|
1064
|
+
const snapshot = (0, react.useSyncExternalStore)((listener) => scope.subscribe(listener), () => scope.getSnapshot());
|
|
1065
|
+
const unavailable = snapshot.status === "unavailable";
|
|
1066
|
+
const readonly = unavailable || !snapshot.writable;
|
|
1067
|
+
const value = snapshot.value ?? {};
|
|
1068
|
+
const level = EFFORT_OPTIONS.includes(value.level) ? value.level : "auto";
|
|
1069
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1070
|
+
style: {
|
|
1071
|
+
border: "1px solid var(--dsw-alias-border-l2, rgba(127,127,127,0.35))",
|
|
1072
|
+
background: "var(--dsw-alias-bg-layer-3, rgba(127,127,127,0.05))",
|
|
1073
|
+
borderRadius: "12px",
|
|
1074
|
+
transition: "border-color 0.16s, background 0.16s"
|
|
1075
|
+
},
|
|
1076
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1077
|
+
type: "button",
|
|
1078
|
+
"aria-expanded": open,
|
|
1079
|
+
style: {
|
|
1080
|
+
appearance: "none",
|
|
1081
|
+
width: "100%",
|
|
1082
|
+
font: "inherit",
|
|
1083
|
+
color: "inherit",
|
|
1084
|
+
textAlign: "left",
|
|
1085
|
+
cursor: "pointer",
|
|
1086
|
+
background: "none",
|
|
1087
|
+
border: 0,
|
|
1088
|
+
borderRadius: "12px",
|
|
1089
|
+
display: "flex",
|
|
1090
|
+
alignItems: "center",
|
|
1091
|
+
gap: "12px",
|
|
1092
|
+
padding: "14px 16px"
|
|
1093
|
+
},
|
|
1094
|
+
onClick: () => {
|
|
1095
|
+
setOpen((current) => !current);
|
|
1096
|
+
},
|
|
1097
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
179
1098
|
style: {
|
|
180
|
-
|
|
181
|
-
|
|
1099
|
+
flex: "1 1 0%",
|
|
1100
|
+
minWidth: 0
|
|
1101
|
+
},
|
|
1102
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1103
|
+
style: {
|
|
1104
|
+
fontSize: "14px",
|
|
1105
|
+
fontWeight: 600,
|
|
1106
|
+
color: "var(--dsw-alias-label-primary)"
|
|
1107
|
+
},
|
|
1108
|
+
children: t("card.title")
|
|
1109
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1110
|
+
style: {
|
|
1111
|
+
color: "var(--dsw-alias-label-tertiary, rgba(127,127,127,0.8))",
|
|
1112
|
+
fontSize: "13px",
|
|
1113
|
+
lineHeight: 1.5
|
|
1114
|
+
},
|
|
1115
|
+
children: t("card.description")
|
|
1116
|
+
})]
|
|
1117
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
1118
|
+
width: "16",
|
|
1119
|
+
height: "16",
|
|
1120
|
+
viewBox: "0 0 16 16",
|
|
1121
|
+
"aria-hidden": true,
|
|
1122
|
+
style: {
|
|
1123
|
+
color: "var(--dsw-alias-label-tertiary, rgba(127,127,127,0.8))",
|
|
1124
|
+
flex: "0 0 auto",
|
|
1125
|
+
transition: "transform 0.16s",
|
|
1126
|
+
transform: open ? "rotate(180deg)" : "none"
|
|
1127
|
+
},
|
|
1128
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
1129
|
+
d: "M4 6l4 4 4-4",
|
|
1130
|
+
fill: "none",
|
|
1131
|
+
stroke: "currentColor",
|
|
1132
|
+
strokeWidth: "1.5",
|
|
1133
|
+
strokeLinecap: "round",
|
|
1134
|
+
strokeLinejoin: "round"
|
|
1135
|
+
})
|
|
1136
|
+
})]
|
|
1137
|
+
}), open ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1138
|
+
style: { padding: "12px 16px" },
|
|
1139
|
+
children: unavailable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1140
|
+
style: {
|
|
1141
|
+
fontSize: "13px",
|
|
182
1142
|
color: "var(--dsw-alias-label-tertiary)"
|
|
183
1143
|
},
|
|
184
|
-
children: t("card.
|
|
185
|
-
})
|
|
186
|
-
|
|
1144
|
+
children: t("card.unavailable")
|
|
1145
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
1146
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1147
|
+
style: rowStyle,
|
|
1148
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
1149
|
+
htmlFor: "plugin-config-thinking-levels-level",
|
|
1150
|
+
style: labelStyle,
|
|
1151
|
+
children: t("card.level")
|
|
1152
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
|
|
1153
|
+
id: "plugin-config-thinking-levels-level",
|
|
1154
|
+
value: level,
|
|
1155
|
+
disabled: readonly,
|
|
1156
|
+
style: controlStyle,
|
|
1157
|
+
onChange: (event) => {
|
|
1158
|
+
scope.set("level", event.currentTarget.value);
|
|
1159
|
+
},
|
|
1160
|
+
children: EFFORT_OPTIONS.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
1161
|
+
value: option,
|
|
1162
|
+
children: t(`card.level.${option}`)
|
|
1163
|
+
}, option))
|
|
1164
|
+
})]
|
|
1165
|
+
}),
|
|
1166
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1167
|
+
style: rowStyle,
|
|
1168
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
1169
|
+
htmlFor: "plugin-config-thinking-levels-enabled",
|
|
1170
|
+
style: labelStyle,
|
|
1171
|
+
children: t("card.enabled")
|
|
1172
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1173
|
+
id: "plugin-config-thinking-levels-enabled",
|
|
1174
|
+
type: "checkbox",
|
|
1175
|
+
checked: value.enabled ?? true,
|
|
1176
|
+
disabled: readonly,
|
|
1177
|
+
onChange: (event) => {
|
|
1178
|
+
scope.set("enabled", event.currentTarget.checked);
|
|
1179
|
+
}
|
|
1180
|
+
})]
|
|
1181
|
+
}),
|
|
1182
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1183
|
+
style: rowStyle,
|
|
1184
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
1185
|
+
htmlFor: "plugin-config-thinking-levels-downgrade",
|
|
1186
|
+
style: labelStyle,
|
|
1187
|
+
children: t("card.allowDowngrade")
|
|
1188
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1189
|
+
id: "plugin-config-thinking-levels-downgrade",
|
|
1190
|
+
type: "checkbox",
|
|
1191
|
+
checked: value.allowDowngrade ?? true,
|
|
1192
|
+
disabled: readonly || value.level !== "auto",
|
|
1193
|
+
onChange: (event) => {
|
|
1194
|
+
scope.set("allowDowngrade", event.currentTarget.checked);
|
|
1195
|
+
}
|
|
1196
|
+
})]
|
|
1197
|
+
}),
|
|
1198
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1199
|
+
style: rowStyle,
|
|
1200
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
1201
|
+
htmlFor: "plugin-config-thinking-levels-upgrade",
|
|
1202
|
+
style: labelStyle,
|
|
1203
|
+
children: t("card.allowUpgrade")
|
|
1204
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1205
|
+
id: "plugin-config-thinking-levels-upgrade",
|
|
1206
|
+
type: "checkbox",
|
|
1207
|
+
checked: value.allowUpgrade ?? false,
|
|
1208
|
+
disabled: readonly || value.level !== "auto",
|
|
1209
|
+
onChange: (event) => {
|
|
1210
|
+
scope.set("allowUpgrade", event.currentTarget.checked);
|
|
1211
|
+
}
|
|
1212
|
+
})]
|
|
1213
|
+
}),
|
|
1214
|
+
!snapshot.writable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1215
|
+
style: {
|
|
1216
|
+
margin: "8px 0 0",
|
|
1217
|
+
fontSize: "12px",
|
|
1218
|
+
color: "var(--dsw-alias-label-tertiary)"
|
|
1219
|
+
},
|
|
1220
|
+
children: t("card.readonly")
|
|
1221
|
+
}),
|
|
1222
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModelCapabilities, {
|
|
1223
|
+
scope: piAiScope,
|
|
1224
|
+
takeoverScope,
|
|
1225
|
+
t,
|
|
1226
|
+
readonly
|
|
1227
|
+
})
|
|
1228
|
+
] })
|
|
1229
|
+
}) : null]
|
|
187
1230
|
});
|
|
188
1231
|
}
|
|
189
1232
|
//#endregion
|
|
@@ -203,7 +1246,9 @@ window.__ModuleLoader__.load({
|
|
|
203
1246
|
function apply(ctx) {
|
|
204
1247
|
ctx.effect(() => ctx.locale.register(NS, {
|
|
205
1248
|
zh,
|
|
206
|
-
en
|
|
1249
|
+
en,
|
|
1250
|
+
ja,
|
|
1251
|
+
ko
|
|
207
1252
|
}), "dsh-thinking-levels: dictionaries");
|
|
208
1253
|
ctx.slots.inject("settings.plugin.item", function* () {
|
|
209
1254
|
yield ctx.slots.register({
|
|
@@ -212,7 +1257,11 @@ window.__ModuleLoader__.load({
|
|
|
212
1257
|
key: THINKING_LEVELS_NS,
|
|
213
1258
|
locale: NS,
|
|
214
1259
|
inject: () => {
|
|
215
|
-
return {
|
|
1260
|
+
return {
|
|
1261
|
+
scope: ctx.settingsScope.bind({ namespace: THINKING_LEVELS_NS }),
|
|
1262
|
+
piAiScope: ctx.settingsScope.bind({ namespace: "llm-pi-ai" }),
|
|
1263
|
+
takeoverScope: ctx.settingsScope.bind({ namespace: "llm-openai-completions" })
|
|
1264
|
+
};
|
|
216
1265
|
}
|
|
217
1266
|
}, ThinkingLevelsCard);
|
|
218
1267
|
});
|