dsh-magpie-connect 0.7.4 → 0.8.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/README.md +18 -0
- package/dsh.plugin.json +1 -1
- package/lib/client.js +360 -49
- package/lib/index.js +883 -9
- package/lib/index.js.map +4 -4
- package/lib/types/config.d.ts +14 -1
- package/lib/types/index.d.ts +21 -2
- package/lib/types/search.d.ts +142 -0
- package/lib/types/settings.d.ts +36 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
- **模型自动同步** — 网关列出的模型全部进入 DSH 模型选择器,想显示哪些由你决定。
|
|
14
14
|
- **图片识别** — 网关声明支持图片的模型可以直接发图。
|
|
15
15
|
- **思考档位** — 网关支持的思考档位(含 `none`、`ultra`)原样出现在选择器里。
|
|
16
|
+
- **网页搜索切换** — 注册为 DSH 的独立搜索提供方(复用已保存的网关地址与 API Key),在设置页一键切换 DSH 的 `web_search` 到 Magpie;默认沿用 Magpie 自身的代搜模型或 Search API 配置(无需在资源库开启 MCP 路由),也支持指定 Magpie 模型(Messages API)并随时在页面切换,无需手改 `cordis.patch.yml`。
|
|
16
17
|
- **路由浮窗** — 输入框右侧的 Magpie 图标,桌面悬停(手机端点按)即显示网关路由的压缩视图:当前会话最近一次请求走了哪条路由、命中/避开了哪些账号/模型及耗时;无会话时回退显示整份 trace 里最新的一条路由。数据由插件在 Host 侧用已保存的 Key 读取(`/api/magpie-trace`,聚合网关的 `/v1/magpie/usage/requests`、`/v1/magpie/quotas`、`/v1/magpie/concurrency` 与 Web 的 `/api/gateway/trace`),浏览器不接触 Key;账号持有人只以首字符形式出现在页面上。
|
|
17
18
|
- **完整路由组详情(可选)** — 在设置页填入 Magpie Web Key 后,浮窗会从 Magpie Web 的完整 trace 读取当前会话的路由组、嵌套子路由组(如 `Hy4 auto/hy4free`、`GPT-6 Luna auto/gpt-6-luna`)、候选账号、逐次尝试、限流/失效原因与恢复时间,并通过 Host 同源代理显示供应商图标;Web Key 仅保存在 Host 的 `settings.json`(文件权限 `0600`),设置页不回显。未配置或 Web Key 失效时自动回退到简化视图。
|
|
18
19
|
|
|
@@ -85,9 +86,22 @@ Key 无效、网关不通)不会清空本地目录,避免把选择器误清
|
|
|
85
86
|
> 弹窗查的是**你当前填的地址和 Key**(哪怕还没保存),所以换网关是一趟的事。
|
|
86
87
|
> 连不上也不会卡住——失败原因会显示在列表下方,已列出的行仍然可以操作。
|
|
87
88
|
|
|
89
|
+
### 第三步:切换网页搜索到 Magpie(可选)
|
|
90
|
+
|
|
91
|
+
插件会通过 DSH 的 `ctx.web.registerSearchProvider` 注册一个独立的 Magpie 搜索提供方(复用上方已保存的 API 地址与 Key,不覆盖 DSH 内置的 `web-search-deepseek` 配置)。
|
|
92
|
+
|
|
93
|
+
在 **设置 → Magpie 网关 → 网页搜索** 中可以:
|
|
94
|
+
|
|
95
|
+
- 勾选 **将 DSH 网页搜索切换到 Magpie** — 实时更新 DSH 的 `web.searchProvider`,无需手动编辑 `cordis.patch.yml`(取消勾选即可恢复 DSH 自动选择;与 DSH 内置「插件 → 内置插件配置 → 网页搜索与获取」双向同步)。
|
|
96
|
+
- 选择 **搜索方式**:
|
|
97
|
+
- **跟随 Magpie 网关搜索设置(默认)** — 通过网关内置 `{gatewayBase}/mcp/magpie/web-search` 直接沿用 Magpie 自身的代搜模型或 Search API 配置,无需在 Magpie 资源库开启 MCP 路由,也无需额外指定模型。
|
|
98
|
+
- **指定 Magpie 模型(Messages API)** — 请求 `{baseUrl}/messages` 并附带 `web_search_20250305` 工具,可直接从网关模型列表中随时切换搜索模型,或手动填写自定义模型 ID。
|
|
99
|
+
- 点击 **测试搜索** — 立即验证当前搜索方式与模型是否可用。
|
|
100
|
+
|
|
88
101
|
### 什么时候需要保存
|
|
89
102
|
|
|
90
103
|
- **地址和 Key**:点「保存」才生效。
|
|
104
|
+
- **网页搜索**:开关即时生效,切换搜索方式或模型后点「保存搜索设置」即可生效。
|
|
91
105
|
- **模型增删**:**自动保存**,不用点任何按钮。
|
|
92
106
|
|
|
93
107
|
## 常见问题
|
|
@@ -173,6 +187,10 @@ Key 无效、网关不通)不会清空本地目录,避免把选择器误清
|
|
|
173
187
|
| `timeoutMs` | `300000` | 单次请求的总超时(毫秒)。 |
|
|
174
188
|
| `firstEventTimeoutMs` | `90000` | 等待首个上游事件的超时(毫秒)。 |
|
|
175
189
|
| `idleTimeoutMs` | `60000` | 上游事件之间的静默超时(毫秒)。 |
|
|
190
|
+
| `searchMode` | `'mcp'` | 网页搜索方式:`'mcp'` 沿用 Magpie 自身的代搜模型或 Search API(内置 `/mcp/magpie/web-search`,无需开启资源库 MCP 路由),`'model'` 通过 `/messages` 调用指定模型搜索。 |
|
|
191
|
+
| `searchModel` | `''` | `'model'` 搜索模式下使用的 Magpie 模型 ID。 |
|
|
192
|
+
| `searchMaxUses` | `5` | `'model'` 搜索模式下单次请求最大 `web_search` 使用次数(1–20)。 |
|
|
193
|
+
| `searchTimeoutMs` | `120000` | 单次网页搜索请求的总超时(毫秒)。 |
|
|
176
194
|
|
|
177
195
|
优先级:设置页 > `cordis.patch.yml` > 默认值。设置页只覆盖你保存过的字段。
|
|
178
196
|
|
package/dsh.plugin.json
CHANGED
package/lib/client.js
CHANGED
|
@@ -171,6 +171,11 @@ var EN = {
|
|
|
171
171
|
"trace.phase.upstream": "at the vendor",
|
|
172
172
|
"trace.phase.redact": "masking",
|
|
173
173
|
enhancements: "Interface enhancements",
|
|
174
|
+
/** Collapsed-card state summary shown left of the chevron. */
|
|
175
|
+
statusOn: "On",
|
|
176
|
+
statusOff: "Off",
|
|
177
|
+
statusUnavailable: "Unavailable",
|
|
178
|
+
statusUnset: "Not set up",
|
|
174
179
|
webKeyHint: "Optional; required by the interface-enhancement API. Get it from the magpie config file or its start-up log.",
|
|
175
180
|
webKeySave: "Save Web Key",
|
|
176
181
|
webKeySaved: "Saved \u2014 routing details and logos are now available.",
|
|
@@ -179,7 +184,35 @@ var EN = {
|
|
|
179
184
|
composerIcon: "Show routing icon in the input box",
|
|
180
185
|
composerIconHint: "The Magpie mark at the input box\u2019s right edge that opens the routing popover on hover (tap on mobile).",
|
|
181
186
|
composerIconSaved: "Saved \u2014 applies the next time the page opens.",
|
|
182
|
-
composerIconFailed: "Could not save: {message}"
|
|
187
|
+
composerIconFailed: "Could not save: {message}",
|
|
188
|
+
webSearch: "Web search",
|
|
189
|
+
webSearchIntro: "Route DSH web_search requests through the Magpie gateway using the API URL and key above.",
|
|
190
|
+
webSearchToggle: "Use Magpie for DSH web search",
|
|
191
|
+
webSearchActiveHint: "Active: DSH web_search now runs through Magpie.",
|
|
192
|
+
webSearchInactiveHint: "Off: DSH uses its default search provider. Turn on to switch web_search to Magpie.",
|
|
193
|
+
webSearchOtherProviderHint: 'Off: DSH currently uses "{provider}". Turn on to switch web_search to Magpie.',
|
|
194
|
+
webSearchNeedsCredentials: "Save the API URL and API key above before enabling Magpie web search.",
|
|
195
|
+
webSearchNeedsModel: "Select or enter a search model below before enabling Magpie web search.",
|
|
196
|
+
webSearchUnavailable: "DSH web search service is not loaded in this profile.",
|
|
197
|
+
webSearchManualSwitchHint: "Registered as a DSH web search provider. Select Magpie under Plugins \u2192 Built-in plugin settings \u2192 Web search and fetch.",
|
|
198
|
+
webSearchMode: "Search mode",
|
|
199
|
+
webSearchModeMcp: "Follow Magpie gateway search settings (default)",
|
|
200
|
+
webSearchModeModel: "Specific Magpie model (Messages API)",
|
|
201
|
+
webSearchModeMcpHint: "Uses Magpie\u2019s built-in /mcp/magpie/web-search endpoint to follow your configured searcher or Search APIs directly \u2014 no need to enable MCP routes in Magpie\u2019s Library, and no extra chat turn.",
|
|
202
|
+
webSearchModeModelHint: "Calls {baseUrl}/messages with the web_search_20250305 tool using the model below \u2014 switch models anytime without editing cordis.patch.yml.",
|
|
203
|
+
webSearchModel: "Search model",
|
|
204
|
+
webSearchModelPlaceholder: "Select a search model\u2026",
|
|
205
|
+
webSearchModelCustomOption: "Custom model ID\u2026",
|
|
206
|
+
webSearchModelCustomPlaceholder: "Enter a Magpie model ID (e.g. codex/gpt-5.4-mini)",
|
|
207
|
+
webSearchSave: "Save search settings",
|
|
208
|
+
webSearchSaved: "Search settings saved \u2014 applies immediately.",
|
|
209
|
+
webSearchSwitchedOn: "Switched DSH web search to Magpie.",
|
|
210
|
+
webSearchSwitchedOff: "Restored DSH web search to automatic selection.",
|
|
211
|
+
webSearchTest: "Test search",
|
|
212
|
+
webSearchTesting: "Searching\u2026",
|
|
213
|
+
webSearchTestOk: "Search OK: {count} sources returned.",
|
|
214
|
+
webSearchTestOkContent: "Search OK: answer received.",
|
|
215
|
+
webSearchFailed: "Search setting failed: {message}"
|
|
183
216
|
};
|
|
184
217
|
var ZH = {
|
|
185
218
|
nav: "Magpie \u7F51\u5173",
|
|
@@ -317,6 +350,11 @@ var ZH = {
|
|
|
317
350
|
"trace.phase.upstream": "\u4F9B\u5E94\u5546\u5904\u7406\u4E2D",
|
|
318
351
|
"trace.phase.redact": "\u8131\u654F\u4E2D",
|
|
319
352
|
enhancements: "\u754C\u9762\u589E\u5F3A",
|
|
353
|
+
/** 折叠卡片标题右侧的状态摘要。 */
|
|
354
|
+
statusOn: "\u5DF2\u5F00\u542F",
|
|
355
|
+
statusOff: "\u5DF2\u5173\u95ED",
|
|
356
|
+
statusUnavailable: "\u4E0D\u53EF\u7528",
|
|
357
|
+
statusUnset: "\u672A\u914D\u7F6E",
|
|
320
358
|
webKeyHint: "\u53EF\u9009\uFF1B\u754C\u9762\u589E\u5F3A API \u9700\u8981\u8BBE\u7F6E\uFF0C\u53EF\u4EE5\u4ECE magpie \u914D\u7F6E\u6587\u4EF6\u6216\u542F\u52A8 log \u4E2D\u83B7\u53D6\u3002",
|
|
321
359
|
webKeySave: "\u4FDD\u5B58 Web Key",
|
|
322
360
|
webKeySaved: "\u5DF2\u4FDD\u5B58\u2014\u2014\u8DEF\u7531\u8BE6\u60C5\u4E0E logo \u5DF2\u542F\u7528\u3002",
|
|
@@ -325,7 +363,35 @@ var ZH = {
|
|
|
325
363
|
composerIcon: "\u5728\u8F93\u5165\u6846\u663E\u793A\u8DEF\u7531\u56FE\u6807",
|
|
326
364
|
composerIconHint: "\u8F93\u5165\u6846\u53F3\u4FA7\u7684 Magpie \u56FE\u6807\uFF1A\u684C\u9762\u60AC\u505C\u3001\u624B\u673A\u70B9\u6309\u5373\u53EF\u67E5\u770B\u7F51\u5173\u8DEF\u7531\u8FD0\u884C\u60C5\u51B5\u3002",
|
|
327
365
|
composerIconSaved: "\u5DF2\u4FDD\u5B58\u2014\u2014\u4E0B\u6B21\u6253\u5F00\u9875\u9762\u65F6\u751F\u6548\u3002",
|
|
328
|
-
composerIconFailed: "\u4FDD\u5B58\u5931\u8D25\uFF1A{message}"
|
|
366
|
+
composerIconFailed: "\u4FDD\u5B58\u5931\u8D25\uFF1A{message}",
|
|
367
|
+
webSearch: "\u7F51\u9875\u641C\u7D22",
|
|
368
|
+
webSearchIntro: "\u590D\u7528\u4E0A\u65B9\u7684 API \u5730\u5740\u4E0E Key\uFF0C\u5C06 DSH \u7684\u7F51\u9875\u641C\u7D22\u8BF7\u6C42\uFF08web_search\uFF09\u5207\u6362\u5230 Magpie \u7F51\u5173\u3002",
|
|
369
|
+
webSearchToggle: "\u5C06 DSH \u7F51\u9875\u641C\u7D22\u5207\u6362\u5230 Magpie",
|
|
370
|
+
webSearchActiveHint: "\u5DF2\u542F\u7528\uFF1ADSH \u7684\u7F51\u9875\u641C\u7D22\u8BF7\u6C42\u5F53\u524D\u7531 Magpie \u7F51\u5173\u5904\u7406\u3002",
|
|
371
|
+
webSearchInactiveHint: "\u672A\u542F\u7528\uFF1ADSH \u5F53\u524D\u4F7F\u7528\u9ED8\u8BA4\u641C\u7D22\u63D0\u4F9B\u65B9\uFF0C\u5F00\u542F\u540E\u7ACB\u5373\u5207\u6362\u81F3 Magpie\u3002",
|
|
372
|
+
webSearchOtherProviderHint: "\u672A\u542F\u7528\uFF1ADSH \u5F53\u524D\u4F7F\u7528\u300C{provider}\u300D\uFF0C\u5F00\u542F\u540E\u5C06\u5207\u6362\u81F3 Magpie\u3002",
|
|
373
|
+
webSearchNeedsCredentials: "\u8BF7\u5148\u5728\u4E0A\u65B9\u4FDD\u5B58 API \u5730\u5740\u4E0E API Key\uFF0C\u518D\u542F\u7528 Magpie \u7F51\u9875\u641C\u7D22\u3002",
|
|
374
|
+
webSearchNeedsModel: "\u8BF7\u5148\u5728\u4E0B\u65B9\u9009\u62E9\u6216\u586B\u5199\u641C\u7D22\u6A21\u578B\uFF0C\u518D\u542F\u7528 Magpie \u7F51\u9875\u641C\u7D22\u3002",
|
|
375
|
+
webSearchUnavailable: "\u5F53\u524D DSH \u73AF\u5883\u672A\u52A0\u8F7D\u7F51\u9875\u641C\u7D22\u670D\u52A1\u3002",
|
|
376
|
+
webSearchManualSwitchHint: "\u5DF2\u6CE8\u518C\u4E3A DSH \u641C\u7D22\u63D0\u4F9B\u65B9\uFF0C\u8BF7\u524D\u5F80\u300C\u63D2\u4EF6 \u2192 \u5185\u7F6E\u63D2\u4EF6\u914D\u7F6E \u2192 \u7F51\u9875\u641C\u7D22\u4E0E\u83B7\u53D6\u300D\u4E2D\u9009\u62E9 Magpie\u3002",
|
|
377
|
+
webSearchMode: "\u641C\u7D22\u65B9\u5F0F",
|
|
378
|
+
webSearchModeMcp: "\u8DDF\u968F Magpie \u7F51\u5173\u641C\u7D22\u8BBE\u7F6E\uFF08\u9ED8\u8BA4\uFF09",
|
|
379
|
+
webSearchModeModel: "\u6307\u5B9A Magpie \u6A21\u578B\uFF08Messages API\uFF09",
|
|
380
|
+
webSearchModeMcpHint: "\u901A\u8FC7\u5185\u7F6E /mcp/magpie/web-search \u76F4\u63A5\u6CBF\u7528 Magpie \u7684\u4EE3\u641C\u6A21\u578B\u6216 Search API \u914D\u7F6E\uFF0C\u65E0\u9700\u5728\u8D44\u6E90\u5E93\u5F00\u542F MCP \u8DEF\u7531\uFF0C\u4E5F\u4E0D\u989D\u5916\u6D88\u8017\u5BF9\u8BDD\u8F6E\u6B21\u3002",
|
|
381
|
+
webSearchModeModelHint: "\u901A\u8FC7 {baseUrl}/messages \u9644\u5E26 web_search_20250305 \u5DE5\u5177\u8C03\u7528\u6240\u9009\u6A21\u578B\u641C\u7D22\uFF0C\u53EF\u968F\u65F6\u5207\u6362\u6A21\u578B\uFF0C\u65E0\u9700\u624B\u6539 cordis.patch.yml\u3002",
|
|
382
|
+
webSearchModel: "\u641C\u7D22\u6A21\u578B",
|
|
383
|
+
webSearchModelPlaceholder: "\u8BF7\u9009\u62E9\u641C\u7D22\u6A21\u578B\u2026",
|
|
384
|
+
webSearchModelCustomOption: "\u81EA\u5B9A\u4E49\u6A21\u578B ID\u2026",
|
|
385
|
+
webSearchModelCustomPlaceholder: "\u8F93\u5165 Magpie \u6A21\u578B ID\uFF08\u4F8B\u5982 codex/gpt-5.4-mini\uFF09",
|
|
386
|
+
webSearchSave: "\u4FDD\u5B58\u641C\u7D22\u8BBE\u7F6E",
|
|
387
|
+
webSearchSaved: "\u641C\u7D22\u8BBE\u7F6E\u5DF2\u4FDD\u5B58\u5E76\u7ACB\u5373\u751F\u6548\u3002",
|
|
388
|
+
webSearchSwitchedOn: "\u5DF2\u5C06 DSH \u7F51\u9875\u641C\u7D22\u5207\u6362\u5230 Magpie\u3002",
|
|
389
|
+
webSearchSwitchedOff: "\u5DF2\u6062\u590D DSH \u9ED8\u8BA4\u7F51\u9875\u641C\u7D22\u9009\u62E9\u3002",
|
|
390
|
+
webSearchTest: "\u6D4B\u8BD5\u641C\u7D22",
|
|
391
|
+
webSearchTesting: "\u641C\u7D22\u4E2D\u2026",
|
|
392
|
+
webSearchTestOk: "\u641C\u7D22\u6B63\u5E38\uFF0C\u8FD4\u56DE {count} \u6761\u6765\u6E90\u3002",
|
|
393
|
+
webSearchTestOkContent: "\u641C\u7D22\u6B63\u5E38\uFF0C\u5DF2\u8FD4\u56DE\u6458\u8981\u7ED3\u679C\u3002",
|
|
394
|
+
webSearchFailed: "\u64CD\u4F5C\u5931\u8D25\uFF1A{message}"
|
|
329
395
|
};
|
|
330
396
|
var localeRuntime;
|
|
331
397
|
function setLocaleRuntime(runtime) {
|
|
@@ -777,7 +843,8 @@ function shouldRetryPending(snapshot2, attempts, limit = PENDING_RETRY_LIMIT) {
|
|
|
777
843
|
|
|
778
844
|
// src/client/page.tsx
|
|
779
845
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
780
|
-
var PLUGIN_VERSION = "0.
|
|
846
|
+
var PLUGIN_VERSION = "0.8.0";
|
|
847
|
+
var CUSTOM_SEARCH_MODEL = "__custom__";
|
|
781
848
|
var REPO_URL = "https://github.com/bitxeno/dsh-magpie-connect";
|
|
782
849
|
var css2 = {
|
|
783
850
|
section: { display: "flex", flexDirection: "column", gap: 16, maxWidth: 780, paddingBottom: 32 },
|
|
@@ -812,6 +879,18 @@ var css2 = {
|
|
|
812
879
|
row: { display: "flex", alignItems: "center", gap: 8, flexWrap: "wrap" },
|
|
813
880
|
field: { display: "flex", flexDirection: "column", gap: 8 },
|
|
814
881
|
label: { fontSize: 13, fontWeight: 500, color: "var(--dsw-alias-label-secondary)" },
|
|
882
|
+
select: {
|
|
883
|
+
width: "100%",
|
|
884
|
+
height: 36,
|
|
885
|
+
padding: "0 10px",
|
|
886
|
+
border: "1px solid var(--dsw-alias-border-l2)",
|
|
887
|
+
borderRadius: 8,
|
|
888
|
+
background: "var(--dsw-alias-bg-layer-1)",
|
|
889
|
+
color: "var(--dsw-alias-label-primary)",
|
|
890
|
+
fontSize: 13,
|
|
891
|
+
lineHeight: "20px",
|
|
892
|
+
boxSizing: "border-box"
|
|
893
|
+
},
|
|
815
894
|
hint: { margin: 0, fontSize: 13, lineHeight: "20px", color: "var(--dsw-alias-label-tertiary)" },
|
|
816
895
|
error: { margin: 0, whiteSpace: "pre-wrap", color: "var(--dsw-alias-label-error, var(--dsw-alias-state-danger-label))" },
|
|
817
896
|
ok: { margin: 0, fontSize: 13, lineHeight: "20px", color: "var(--dsw-alias-state-success-label, var(--dsw-alias-label-primary))" },
|
|
@@ -821,7 +900,11 @@ var css2 = {
|
|
|
821
900
|
switchLabel: { fontSize: 14, lineHeight: "20px", color: "var(--dsw-alias-label-primary)" },
|
|
822
901
|
switchHint: { fontSize: 12, lineHeight: "17px", color: "var(--dsw-alias-label-tertiary)" },
|
|
823
902
|
collapseHead: { display: "flex", alignItems: "center", gap: 8, width: "100%", padding: 0, border: 0, background: "transparent", cursor: "pointer", textAlign: "left" },
|
|
824
|
-
|
|
903
|
+
/** Status + chevron grouped at the right edge, so a card without a status still pins its chevron. */
|
|
904
|
+
collapseMeta: { display: "inline-flex", alignItems: "center", gap: 8, marginLeft: "auto", flex: "none" },
|
|
905
|
+
collapseStatus: { fontSize: 12, lineHeight: "17px", whiteSpace: "nowrap", color: "var(--dsw-alias-label-tertiary)" },
|
|
906
|
+
collapseStatusOn: { color: "var(--dsw-alias-state-success-label, var(--dsw-alias-label-secondary))" },
|
|
907
|
+
collapseChevron: { flex: "none", color: "var(--dsw-alias-label-tertiary)", transition: "transform 0.16s", display: "inline-flex" },
|
|
825
908
|
collapseChevronOpen: { transform: "rotate(180deg)" },
|
|
826
909
|
collapseBody: { display: "flex", flexDirection: "column", gap: 14 }
|
|
827
910
|
};
|
|
@@ -863,6 +946,21 @@ async function saveShowComposerIcon(show) {
|
|
|
863
946
|
async function saveWebKey(webKey) {
|
|
864
947
|
return await request("/api/magpie-settings", "POST", { webKey });
|
|
865
948
|
}
|
|
949
|
+
async function saveSearchSettings(payload) {
|
|
950
|
+
return await request("/api/magpie-settings", "POST", payload);
|
|
951
|
+
}
|
|
952
|
+
function CollapsibleCard({ title, status, statusOn, open, onToggle, children }) {
|
|
953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { ...css2.card, gap: open ? 14 : 0 }, children: [
|
|
954
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("button", { type: "button", "aria-expanded": open, onClick: onToggle, style: css2.collapseHead, children: [
|
|
955
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h3", { style: css2.cardTitle, children: title }),
|
|
956
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { style: css2.collapseMeta, children: [
|
|
957
|
+
status === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { ...css2.collapseStatus, ...statusOn === true ? css2.collapseStatusOn : {} }, children: status }),
|
|
958
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { ...css2.collapseChevron, ...open ? css2.collapseChevronOpen : {} }, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { width: 14, height: 14, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", focusable: "false", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M4 6l4 4 4-4" }) }) })
|
|
959
|
+
] })
|
|
960
|
+
] }),
|
|
961
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: css2.collapseBody, children }) : null
|
|
962
|
+
] });
|
|
963
|
+
}
|
|
866
964
|
function MagpieSettings() {
|
|
867
965
|
useLocaleRevision();
|
|
868
966
|
const [baseUrl, setBaseUrl] = (0, import_react3.useState)("");
|
|
@@ -884,7 +982,19 @@ function MagpieSettings() {
|
|
|
884
982
|
const [webKeyStatus, setWebKeyStatus] = (0, import_react3.useState)("idle");
|
|
885
983
|
const [webKeyError, setWebKeyError] = (0, import_react3.useState)(void 0);
|
|
886
984
|
const [enhancementsOpen, setEnhancementsOpen] = (0, import_react3.useState)(false);
|
|
985
|
+
const [searchOpen, setSearchOpen] = (0, import_react3.useState)(false);
|
|
986
|
+
const [searchMode, setSearchMode] = (0, import_react3.useState)("mcp");
|
|
987
|
+
const [searchModel, setSearchModel] = (0, import_react3.useState)("");
|
|
988
|
+
const [searchCustomModel, setSearchCustomModel] = (0, import_react3.useState)(false);
|
|
989
|
+
const [searchActive, setSearchActive] = (0, import_react3.useState)(false);
|
|
990
|
+
const [searchRegistered, setSearchRegistered] = (0, import_react3.useState)(false);
|
|
991
|
+
const [searchSwitchable, setSearchSwitchable] = (0, import_react3.useState)(false);
|
|
992
|
+
const [activeSearchProvider, setActiveSearchProvider] = (0, import_react3.useState)(void 0);
|
|
993
|
+
const [searchBusy, setSearchBusy] = (0, import_react3.useState)("idle");
|
|
994
|
+
const [searchNotice, setSearchNotice] = (0, import_react3.useState)(void 0);
|
|
995
|
+
const [searchError, setSearchError] = (0, import_react3.useState)(void 0);
|
|
887
996
|
const credentialsDirty = (0, import_react3.useRef)(false);
|
|
997
|
+
const searchDirty = (0, import_react3.useRef)(false);
|
|
888
998
|
const modelsQueue = (0, import_react3.useRef)(
|
|
889
999
|
createWriteQueue((next) => saveEnabledModels(next), (outcome) => {
|
|
890
1000
|
if (outcome.ok) {
|
|
@@ -924,6 +1034,17 @@ function MagpieSettings() {
|
|
|
924
1034
|
setHasWebKey(settings.hasWebKey === true);
|
|
925
1035
|
setEnabled(settings.enabledModels);
|
|
926
1036
|
setShowComposerIcon(settings.showComposerIcon !== false);
|
|
1037
|
+
if (!searchDirty.current) {
|
|
1038
|
+
const mode = settings.searchMode === "model" ? "model" : "mcp";
|
|
1039
|
+
const model = settings.searchModel ?? "";
|
|
1040
|
+
setSearchMode(mode);
|
|
1041
|
+
setSearchModel(model);
|
|
1042
|
+
setSearchCustomModel(false);
|
|
1043
|
+
}
|
|
1044
|
+
setSearchActive(settings.searchActive === true);
|
|
1045
|
+
setSearchRegistered(settings.searchRegistered === true);
|
|
1046
|
+
setSearchSwitchable(settings.searchSwitchable === true);
|
|
1047
|
+
setActiveSearchProvider(settings.activeSearchProvider);
|
|
927
1048
|
setModels(listed);
|
|
928
1049
|
setLoaded(true);
|
|
929
1050
|
if (shouldRetryPending(snapshot2, attempts)) {
|
|
@@ -986,6 +1107,73 @@ function MagpieSettings() {
|
|
|
986
1107
|
}
|
|
987
1108
|
);
|
|
988
1109
|
};
|
|
1110
|
+
const syncSearchState = (saved) => {
|
|
1111
|
+
const mode = saved.searchMode === "model" ? "model" : "mcp";
|
|
1112
|
+
const model = saved.searchModel ?? "";
|
|
1113
|
+
setSearchMode(mode);
|
|
1114
|
+
setSearchModel(model);
|
|
1115
|
+
setSearchActive(saved.searchActive === true);
|
|
1116
|
+
setSearchRegistered(saved.searchRegistered === true);
|
|
1117
|
+
setSearchSwitchable(saved.searchSwitchable === true);
|
|
1118
|
+
setActiveSearchProvider(saved.activeSearchProvider);
|
|
1119
|
+
};
|
|
1120
|
+
const toggleSearchActive = (nextActive) => {
|
|
1121
|
+
setSearchBusy("saving");
|
|
1122
|
+
setSearchError(void 0);
|
|
1123
|
+
setSearchNotice(void 0);
|
|
1124
|
+
const payload = nextActive ? { searchMode, searchModel: searchModel.trim(), searchActive: true } : { searchActive: false };
|
|
1125
|
+
saveSearchSettings(payload).then(
|
|
1126
|
+
(saved) => {
|
|
1127
|
+
searchDirty.current = false;
|
|
1128
|
+
syncSearchState(saved);
|
|
1129
|
+
setSearchNotice(text(nextActive ? "webSearchSwitchedOn" : "webSearchSwitchedOff"));
|
|
1130
|
+
},
|
|
1131
|
+
(cause) => {
|
|
1132
|
+
setSearchError(text("webSearchFailed", { message: cause instanceof Error ? cause.message : String(cause) }));
|
|
1133
|
+
}
|
|
1134
|
+
).finally(() => {
|
|
1135
|
+
setSearchBusy("idle");
|
|
1136
|
+
});
|
|
1137
|
+
};
|
|
1138
|
+
const commitSearchSettings = () => {
|
|
1139
|
+
setSearchBusy("saving");
|
|
1140
|
+
setSearchError(void 0);
|
|
1141
|
+
setSearchNotice(void 0);
|
|
1142
|
+
saveSearchSettings({ searchMode, searchModel: searchModel.trim() }).then(
|
|
1143
|
+
(saved) => {
|
|
1144
|
+
searchDirty.current = false;
|
|
1145
|
+
syncSearchState(saved);
|
|
1146
|
+
setSearchNotice(text("webSearchSaved"));
|
|
1147
|
+
},
|
|
1148
|
+
(cause) => {
|
|
1149
|
+
setSearchError(text("webSearchFailed", { message: cause instanceof Error ? cause.message : String(cause) }));
|
|
1150
|
+
}
|
|
1151
|
+
).finally(() => {
|
|
1152
|
+
setSearchBusy("idle");
|
|
1153
|
+
});
|
|
1154
|
+
};
|
|
1155
|
+
const testSearch = () => {
|
|
1156
|
+
setSearchBusy("testing");
|
|
1157
|
+
setSearchError(void 0);
|
|
1158
|
+
setSearchNotice(void 0);
|
|
1159
|
+
void (async () => {
|
|
1160
|
+
try {
|
|
1161
|
+
const result = await request("/api/magpie-search-test", "POST", {
|
|
1162
|
+
baseUrl,
|
|
1163
|
+
...apiKey.trim() === "" ? {} : { apiKey },
|
|
1164
|
+
searchMode,
|
|
1165
|
+
searchModel: searchModel.trim()
|
|
1166
|
+
});
|
|
1167
|
+
setSearchNotice(
|
|
1168
|
+
result.count === 0 && result.hasContent === true ? text("webSearchTestOkContent") : text("webSearchTestOk", { count: result.count })
|
|
1169
|
+
);
|
|
1170
|
+
} catch (cause) {
|
|
1171
|
+
setSearchError(cause instanceof Error ? cause.message : String(cause));
|
|
1172
|
+
} finally {
|
|
1173
|
+
setSearchBusy("idle");
|
|
1174
|
+
}
|
|
1175
|
+
})();
|
|
1176
|
+
};
|
|
989
1177
|
const save = async () => {
|
|
990
1178
|
setBusy("saving");
|
|
991
1179
|
setError(void 0);
|
|
@@ -999,6 +1187,10 @@ function MagpieSettings() {
|
|
|
999
1187
|
setBaseUrl(saved.baseUrl);
|
|
1000
1188
|
setHasApiKey(saved.hasApiKey);
|
|
1001
1189
|
setHasWebKey(saved.hasWebKey);
|
|
1190
|
+
setSearchActive(saved.searchActive === true);
|
|
1191
|
+
setSearchRegistered(saved.searchRegistered === true);
|
|
1192
|
+
setSearchSwitchable(saved.searchSwitchable === true);
|
|
1193
|
+
setActiveSearchProvider(saved.activeSearchProvider);
|
|
1002
1194
|
setApiKey("");
|
|
1003
1195
|
setEnabled(saved.enabledModels);
|
|
1004
1196
|
await refreshModels();
|
|
@@ -1024,6 +1216,15 @@ function MagpieSettings() {
|
|
|
1024
1216
|
};
|
|
1025
1217
|
const working = busy !== "idle";
|
|
1026
1218
|
const incomplete = baseUrl.trim() === "" || !hasApiKey && apiKey.trim() === "";
|
|
1219
|
+
const searchWorking = searchBusy !== "idle";
|
|
1220
|
+
const searchNeedsModel = searchMode === "model" && searchModel.trim() === "";
|
|
1221
|
+
const searchReadyToEnable = hasApiKey && baseUrl.trim() !== "" && !searchNeedsModel;
|
|
1222
|
+
const knownSearchModel = searchModel !== "" && models.some((row) => row.id === searchModel);
|
|
1223
|
+
const showCustomModelInput = searchCustomModel || searchModel !== "" && !knownSearchModel;
|
|
1224
|
+
const modelSelectValue = showCustomModelInput ? CUSTOM_SEARCH_MODEL : searchModel;
|
|
1225
|
+
const searchToggleHint = !searchRegistered ? text("webSearchUnavailable") : !searchSwitchable ? text("webSearchManualSwitchHint") : searchActive ? text("webSearchActiveHint") : !hasApiKey || baseUrl.trim() === "" ? text("webSearchNeedsCredentials") : searchNeedsModel ? text("webSearchNeedsModel") : activeSearchProvider !== void 0 ? text("webSearchOtherProviderHint", { provider: activeSearchProvider }) : text("webSearchInactiveHint");
|
|
1226
|
+
const searchStatus = !loaded ? void 0 : !searchRegistered ? { text: text("statusUnavailable") } : searchActive ? { text: text("statusOn"), on: true } : { text: text("statusOff") };
|
|
1227
|
+
const enhancementsStatus = !loaded ? void 0 : !hasWebKey ? { text: text("statusUnset") } : showComposerIcon ? { text: text("statusOn"), on: true } : { text: text("statusOff") };
|
|
1027
1228
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { style: css2.section, children: [
|
|
1028
1229
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("header", { style: css2.header, children: [
|
|
1029
1230
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: css2.brand, children: [
|
|
@@ -1074,51 +1275,161 @@ function MagpieSettings() {
|
|
|
1074
1275
|
notice === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { style: css2.ok, children: notice }),
|
|
1075
1276
|
loaded && incomplete ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { style: css2.hint, children: text("notConfigured") }) : null
|
|
1076
1277
|
] }),
|
|
1077
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1278
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1279
|
+
CollapsibleCard,
|
|
1280
|
+
{
|
|
1281
|
+
title: text("webSearch"),
|
|
1282
|
+
status: searchStatus?.text,
|
|
1283
|
+
statusOn: searchStatus?.on,
|
|
1284
|
+
open: searchOpen,
|
|
1285
|
+
onToggle: () => setSearchOpen((open) => !open),
|
|
1286
|
+
children: [
|
|
1287
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { style: css2.hint, children: text("webSearchIntro") }),
|
|
1288
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { style: css2.switchRow, children: [
|
|
1289
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1290
|
+
"input",
|
|
1291
|
+
{
|
|
1292
|
+
type: "checkbox",
|
|
1293
|
+
style: css2.switchBox,
|
|
1294
|
+
checked: searchActive,
|
|
1295
|
+
disabled: !loaded || working || searchWorking || !searchRegistered || !searchSwitchable || !searchActive && !searchReadyToEnable,
|
|
1296
|
+
onChange: (event) => toggleSearchActive(event.currentTarget.checked)
|
|
1297
|
+
}
|
|
1298
|
+
),
|
|
1299
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { style: css2.switchText, children: [
|
|
1300
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: css2.switchLabel, children: text("webSearchToggle") }),
|
|
1301
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: css2.switchHint, children: searchToggleHint })
|
|
1302
|
+
] })
|
|
1303
|
+
] }),
|
|
1304
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: css2.field, children: [
|
|
1305
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: css2.label, children: text("webSearchMode") }),
|
|
1306
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1307
|
+
"select",
|
|
1308
|
+
{
|
|
1309
|
+
style: css2.select,
|
|
1310
|
+
value: searchMode,
|
|
1311
|
+
disabled: !loaded || working || searchWorking,
|
|
1312
|
+
onChange: (event) => {
|
|
1313
|
+
searchDirty.current = true;
|
|
1314
|
+
setSearchError(void 0);
|
|
1315
|
+
setSearchNotice(void 0);
|
|
1316
|
+
setSearchMode(event.currentTarget.value === "model" ? "model" : "mcp");
|
|
1317
|
+
},
|
|
1318
|
+
children: [
|
|
1319
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "mcp", children: text("webSearchModeMcp") }),
|
|
1320
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "model", children: text("webSearchModeModel") })
|
|
1321
|
+
]
|
|
1322
|
+
}
|
|
1323
|
+
),
|
|
1324
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { style: css2.hint, children: searchMode === "mcp" ? text("webSearchModeMcpHint") : text("webSearchModeModelHint", { baseUrl: baseUrl.trim().replace(/\/+$/, "") || "http://127.0.0.1:3425/v1" }) })
|
|
1325
|
+
] }),
|
|
1326
|
+
searchMode === "model" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: css2.field, children: [
|
|
1327
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: css2.label, children: text("webSearchModel") }),
|
|
1328
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1329
|
+
"select",
|
|
1330
|
+
{
|
|
1331
|
+
style: css2.select,
|
|
1332
|
+
value: modelSelectValue,
|
|
1333
|
+
disabled: !loaded || working || searchWorking,
|
|
1334
|
+
onChange: (event) => {
|
|
1335
|
+
const picked = event.currentTarget.value;
|
|
1336
|
+
searchDirty.current = true;
|
|
1337
|
+
setSearchError(void 0);
|
|
1338
|
+
setSearchNotice(void 0);
|
|
1339
|
+
if (picked === CUSTOM_SEARCH_MODEL) {
|
|
1340
|
+
setSearchCustomModel(true);
|
|
1341
|
+
return;
|
|
1342
|
+
}
|
|
1343
|
+
setSearchCustomModel(false);
|
|
1344
|
+
setSearchModel(picked);
|
|
1345
|
+
},
|
|
1346
|
+
children: [
|
|
1347
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "", children: text("webSearchModelPlaceholder") }),
|
|
1348
|
+
models.map((row) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: row.id, children: row.displayName }, row.id)),
|
|
1349
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: CUSTOM_SEARCH_MODEL, children: text("webSearchModelCustomOption") })
|
|
1350
|
+
]
|
|
1351
|
+
}
|
|
1352
|
+
),
|
|
1353
|
+
showCustomModelInput ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1354
|
+
import_dsh_client_ui_primitives2.Input,
|
|
1355
|
+
{
|
|
1356
|
+
value: searchModel,
|
|
1357
|
+
placeholder: text("webSearchModelCustomPlaceholder"),
|
|
1358
|
+
disabled: !loaded || working || searchWorking,
|
|
1359
|
+
onChange: (event) => {
|
|
1360
|
+
searchDirty.current = true;
|
|
1361
|
+
setSearchError(void 0);
|
|
1362
|
+
setSearchNotice(void 0);
|
|
1363
|
+
setSearchModel(event.currentTarget.value);
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
) : null
|
|
1367
|
+
] }) : null,
|
|
1368
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: css2.row, children: [
|
|
1369
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1370
|
+
import_dsh_client_ui_primitives2.Button,
|
|
1371
|
+
{
|
|
1372
|
+
variant: "outline",
|
|
1373
|
+
disabled: !loaded || working || searchWorking || searchNeedsModel,
|
|
1374
|
+
onClick: () => commitSearchSettings(),
|
|
1375
|
+
children: searchBusy === "saving" ? text("saving") : text("webSearchSave")
|
|
1376
|
+
}
|
|
1377
|
+
),
|
|
1378
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1379
|
+
import_dsh_client_ui_primitives2.Button,
|
|
1380
|
+
{
|
|
1381
|
+
variant: "outline",
|
|
1382
|
+
disabled: !loaded || working || searchWorking || incomplete || searchNeedsModel,
|
|
1383
|
+
onClick: () => testSearch(),
|
|
1384
|
+
children: searchBusy === "testing" ? text("webSearchTesting") : text("webSearchTest")
|
|
1385
|
+
}
|
|
1386
|
+
)
|
|
1387
|
+
] }),
|
|
1388
|
+
searchError === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { role: "alert", style: css2.error, children: searchError }),
|
|
1389
|
+
searchNotice === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { style: css2.ok, children: searchNotice })
|
|
1390
|
+
]
|
|
1391
|
+
}
|
|
1392
|
+
),
|
|
1393
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1394
|
+
CollapsibleCard,
|
|
1395
|
+
{
|
|
1396
|
+
title: text("enhancements"),
|
|
1397
|
+
status: enhancementsStatus?.text,
|
|
1398
|
+
statusOn: enhancementsStatus?.on,
|
|
1399
|
+
open: enhancementsOpen,
|
|
1400
|
+
onToggle: () => setEnhancementsOpen((open) => !open),
|
|
1401
|
+
children: [
|
|
1402
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: css2.field, children: [
|
|
1403
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: css2.label, children: text("webKey") }),
|
|
1404
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives2.Input, { type: "password", value: webKey, placeholder: text(hasWebKey ? "webKeySavedPlaceholder" : "webKeyPlaceholder"), disabled: working || webKeyStatus === "saving", onChange: (event) => setWebKey(event.currentTarget.value) }),
|
|
1405
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { style: css2.hint, children: text("webKeyHint") })
|
|
1406
|
+
] }),
|
|
1407
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { style: css2.switchRow, children: [
|
|
1408
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1409
|
+
"input",
|
|
1410
|
+
{
|
|
1411
|
+
type: "checkbox",
|
|
1412
|
+
style: css2.switchBox,
|
|
1413
|
+
checked: showComposerIcon,
|
|
1414
|
+
disabled: iconStatus === "saving" || !hasWebKey,
|
|
1415
|
+
onChange: (event) => applyShowComposerIcon(event.currentTarget.checked)
|
|
1416
|
+
}
|
|
1417
|
+
),
|
|
1418
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { style: css2.switchText, children: [
|
|
1419
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: css2.switchLabel, children: text("composerIcon") }),
|
|
1420
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: css2.switchHint, children: hasWebKey ? text("composerIconHint") : text("composerIconNeedsWebKey") })
|
|
1421
|
+
] })
|
|
1422
|
+
] }),
|
|
1423
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: css2.row, children: [
|
|
1424
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives2.Button, { variant: "outline", disabled: working || webKeyStatus === "saving" || webKey.trim() === "", onClick: () => applyWebKey(), children: webKeyStatus === "saving" ? text("saving") : text("save") }),
|
|
1425
|
+
webKeyStatus === "saved" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: css2.ok, children: text("webKeySaved") }) : null
|
|
1426
|
+
] }),
|
|
1427
|
+
iconStatus === "saved" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { style: css2.ok, children: text("composerIconSaved") }) : null,
|
|
1428
|
+
webKeyError === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { role: "alert", style: css2.error, children: text("composerIconFailed", { message: webKeyError }) }),
|
|
1429
|
+
iconError === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { role: "alert", style: css2.error, children: text("composerIconFailed", { message: iconError }) })
|
|
1430
|
+
]
|
|
1431
|
+
}
|
|
1432
|
+
),
|
|
1122
1433
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1123
1434
|
ModelListEditor,
|
|
1124
1435
|
{
|