dsh-metaontic-image 0.0.1 → 0.0.2

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/cordis.patch.yml CHANGED
@@ -2,4 +2,6 @@
2
2
  - id: dsh-metaontic-image
3
3
  name: dsh-metaontic-image
4
4
  config:
5
- provider: google
5
+ provider: openai-compat
6
+ openaiCompatLabel: MetaonticAI
7
+ openaiCompatBaseURL: https://ai.bileego.com/v1
package/lib/client.js CHANGED
@@ -222,6 +222,8 @@ window.__ModuleLoader__.load({
222
222
  const official = url.protocol === "https:" && !url.port && !url.search && !url.hash && url.pathname.replace(/\/+$/, "") === "/v1";
223
223
  if (official && (url.hostname === "api.siliconflow.cn" || url.hostname === "api.siliconflow.com")) return "siliconflowJson";
224
224
  if (official && url.hostname === "api-inference.modelscope.cn") return "modelscopeAsync";
225
+ const models = [config.openaiCompatModel, config.openaiCompatEditModel].map((model) => model?.trim() ?? "").filter((model) => model.length > 0);
226
+ if (official && url.hostname === "ai.bileego.com" && models.length > 0 && models.every((model) => /seedream/i.test(model))) return "newapiAsync";
225
227
  } catch {}
226
228
  const contract = officialContract(config, "edit");
227
229
  if (contract === "sensenova") return "jsonImageUrlArray";
@@ -309,6 +311,10 @@ window.__ModuleLoader__.load({
309
311
  "grok-sub",
310
312
  "google-sub"
311
313
  ];
314
+ const SELECTABLE_IMAGE_PROVIDERS = ["openai-compat", "seedream"];
315
+ function isSelectableImageProvider(provider) {
316
+ return provider === "openai-compat" || provider === "seedream";
317
+ }
312
318
  /**
313
319
  * Providers that generate through a logged-in subscription account instead
314
320
  * of an API key. They use no credential reference and never join the
@@ -342,7 +348,7 @@ window.__ModuleLoader__.load({
342
348
  }
343
349
  const DEFAULT_OPENAI_COMPAT_CHANNEL_ID = "default";
344
350
  function openAICompatKeyRef(channelId) {
345
- return channelId === "default" ? OPENAI_COMPAT_API_KEY_ENV : `${OPENAI_COMPAT_API_KEY_ENV}_${channelId.replace(/[^A-Za-z0-9]/g, "_").toUpperCase()}`;
351
+ return channelId === "default" ? OPENAI_COMPAT_API_KEY_ENV : `DSH_IMAGE_GEN_OPENAI_COMPAT_KEY_${channelId.replace(/[^A-Za-z0-9]/g, "_").toUpperCase()}`;
346
352
  }
347
353
  /** The legacy flat fields remain the first channel; additional entries are fully independent. */
348
354
  function resolveOpenAICompatChannels(source) {
@@ -426,7 +432,7 @@ window.__ModuleLoader__.load({
426
432
  * OPENAI_API_KEY so an official key and a relay key can coexist without
427
433
  * overwriting each other.
428
434
  */
429
- const OPENAI_COMPAT_API_KEY_ENV = "DSH_IMAGE_GEN_OPENAI_COMPAT_KEY";
435
+ const OPENAI_COMPAT_API_KEY_ENV = "DSH_METAONTIC_AI_API_KEY";
430
436
  /** The credential reference each cloud provider's API key is stored under. */
431
437
  const CLOUD_CREDENTIAL_REFS = {
432
438
  google: GOOGLE_API_KEY_ENV,
@@ -498,7 +504,26 @@ window.__ModuleLoader__.load({
498
504
  /** Default model names. */
499
505
  const DEFAULT_GOOGLE_MODEL = "gemini-3.1-flash-image";
500
506
  const DEFAULT_OPENAI_MODEL = "gpt-image-2.6-flare";
501
- const DEFAULT_SEEDREAM_MODEL = "doubao-seedream-5-0-pro-260628";
507
+ /** Seedream models exposed by the plugin's Volcengine driver. */
508
+ const SEEDREAM_MODEL_OPTIONS = [{
509
+ value: "doubao-seedream-5-0-pro-260628",
510
+ label: "Seedream 5.0 Pro"
511
+ }, {
512
+ value: "doubao-seedream-5-5-261028",
513
+ label: "Seedream 5.5"
514
+ }];
515
+ SEEDREAM_MODEL_OPTIONS.map((option) => option.value);
516
+ const DEFAULT_SEEDREAM_MODEL = SEEDREAM_MODEL_OPTIONS[0].value;
517
+ /** Seedream choices for pickers; keep a saved custom endpoint id selectable too. */
518
+ function seedreamModelOptions(current) {
519
+ const options = SEEDREAM_MODEL_OPTIONS.map((option) => ({ ...option }));
520
+ const value = current?.trim();
521
+ if (value !== void 0 && value.length > 0 && !options.some((option) => option.value === value)) options.unshift({
522
+ value,
523
+ label: value
524
+ });
525
+ return options;
526
+ }
502
527
  /**
503
528
  * Seedream models Volcano Ark retires on 2026-11-24 (batch 10), mapped to the
504
529
  * model that takes their requests. A saved settings value naming one of them
@@ -118635,6 +118660,7 @@ img.ProseMirror-separator {
118635
118660
  }
118636
118661
  /** The host labels Studio providers in Chinese; channel names the user typed pass through. */
118637
118662
  function studioProfileLabel(profile, lang) {
118663
+ if (profile.provider === "seedream" && profile.label === "火山引擎") return lang === "en" ? "Volcengine" : profile.label;
118638
118664
  if (profile.channel !== void 0) return localizeChannelLabel(profile.label, lang);
118639
118665
  return lang === "en" ? PROVIDER_ENGLISH_NAMES[profile.provider] : profile.label;
118640
118666
  }
@@ -119320,9 +119346,17 @@ img.ProseMirror-separator {
119320
119346
  signal: signal ?? null,
119321
119347
  credentials: "same-origin"
119322
119348
  });
119323
- const payload = await readStudioBody(response);
119349
+ const responseBody = await readStudioBody(response);
119324
119350
  if (signal?.aborted) return;
119325
- if (!response.ok || !("providers" in payload)) throw new Error("error" in payload && payload.error ? payload.error : "Studio unavailable");
119351
+ if (!response.ok || !("providers" in responseBody)) throw new Error("error" in responseBody && responseBody.error ? responseBody.error : "Studio unavailable");
119352
+ const providers = responseBody.providers.filter((profile) => isSelectableImageProvider(profile.provider) && (profile.provider !== "openai-compat" || profile.channel === "default")).map((profile) => ({
119353
+ ...profile,
119354
+ label: profile.provider === "openai-compat" ? "MetaonticAI" : "火山引擎"
119355
+ }));
119356
+ const payload = {
119357
+ ...responseBody,
119358
+ providers
119359
+ };
119326
119360
  setConfig(payload);
119327
119361
  if (silent) {
119328
119362
  const { provider: currentProvider, channel: currentChannel, model: currentModel } = formStateRef.current;
@@ -128045,16 +128079,16 @@ img.ProseMirror-separator {
128045
128079
  settingsLoading: "正在加载图像生成设置,请稍候。",
128046
128080
  settingsRemote: "当前连接不支持保存到宿主,请在 DSH 本机页面修改设置。",
128047
128081
  settingsUnavailable: "宿主尚未提供图像生成设置,请检查插件是否已启用及其加载日志。",
128048
- settingsIncompatible: "当前加载的设置库不支持保存。请将插件所在环境的 @deepseek-ai/schemastery 更新到 3.18.4 或兼容的 3.x 版本,并重启 DSH。",
128082
+ settingsIncompatible: "当前加载的设置库不支持保存。请将插件所在环境的 @deepseek-ai/schemastery 更新到 3.19.0 或兼容的 3.x 版本,并重启 DSH。",
128049
128083
  providerGoogle: "Google Gemini",
128050
128084
  providerOpenAI: "OpenAI",
128051
- providerOpenAICompat: "OpenAI 兼容(中转站)",
128085
+ providerOpenAICompat: "MetaonticAI",
128052
128086
  addCompatChannel: "新增 OpenAI 兼容渠道",
128053
128087
  channelName: "渠道名称",
128054
128088
  channelNameRequired: "请填写渠道名称。",
128055
128089
  removeChannel: "删除渠道",
128056
128090
  removeChannelConfirm: "确定删除“{label}”吗?该渠道的配置将被移除。",
128057
- providerSeedream: "字节 Seedream",
128091
+ providerSeedream: "火山引擎",
128058
128092
  providerDashScope: "阿里 DashScope (通义万相 / Qwen)",
128059
128093
  providerXAI: "xAI Grok Imagine",
128060
128094
  providerZhipu: "智谱 GLM-Image",
@@ -128129,6 +128163,8 @@ img.ProseMirror-separator {
128129
128163
  editFormatJsonImageUrlArray: "JSON images 数组(商汤等中转)",
128130
128164
  editFormatFormReferenceImages: "multipart + reference_images JSON 数组(base64)",
128131
128165
  editFormatModelScopeHint: "魔搭 ModelScope 官方地址,已自动识别:文生图和图生图都要等魔搭排队出图,最长约 5 分钟。",
128166
+ editFormatNewApiAsync: "New API 异步任务(MetaonticAI / Seedream)",
128167
+ editFormatNewApiHint: "MetaonticAI 地址已自动识别:文生图和图生图都提交 /tasks/doubao,再轮询任务并读取图片产物;单张最长约 15 分钟。",
128132
128168
  editFormatHint: "商汤、通义、硅基流动已确认的官方接口自动使用对应 JSON 格式;其他中转按接口文档选择。文生图不受影响。",
128133
128169
  editExtra: "附加 JSON 字段",
128134
128170
  editExtraPlaceholder: "{\"watermark\": false, \"prompt_extend\": true}",
@@ -128164,6 +128200,7 @@ img.ProseMirror-separator {
128164
128200
  endpointHintComfyUI: "正在运行且 DSH Host 可以访问的 ComfyUI 地址,默认使用本机 8188 端口。",
128165
128201
  model: "模型",
128166
128202
  defaultModel: "默认模型",
128203
+ modelRequired: "请选择或填写生图模型。",
128167
128204
  availableModels: "工作台可选模型",
128168
128205
  availableModelsHint: "勾选后可在工作台切换。手动输入的默认模型会自动加入列表,且不可移除。",
128169
128206
  defaultModelTag: "默认",
@@ -128197,6 +128234,7 @@ img.ProseMirror-separator {
128197
128234
  getTldrawLicense: "获取许可证 ↗",
128198
128235
  fetchModels: "拉取模型",
128199
128236
  fetchingModels: "拉取中…",
128237
+ selectMetaonticModel: "拉取后选择生图模型,或手动输入模型 ID",
128200
128238
  fetchModelsHint: "点击「拉取模型」用当前 Key 获取可用生图模型列表;也可手动输入。",
128201
128239
  modelsFound: "找到 {n} 个生图模型,点击模型框选择",
128202
128240
  modelsNone: "未筛出生图模型,可手动输入模型名",
@@ -128241,16 +128279,16 @@ img.ProseMirror-separator {
128241
128279
  settingsLoading: "Settings are loading; please wait.",
128242
128280
  settingsRemote: "This connection cannot save settings to the host. Edit them from the local DSH page.",
128243
128281
  settingsUnavailable: "The host has not provided image generation settings. Check that the plugin is enabled and review its load logs.",
128244
- settingsIncompatible: "The loaded settings library cannot save these settings. Update @deepseek-ai/schemastery in the plugin environment to 3.18.4 or a compatible 3.x version, then restart DSH.",
128282
+ settingsIncompatible: "The loaded settings library cannot save these settings. Update @deepseek-ai/schemastery in the plugin environment to 3.19.0 or a compatible 3.x version, then restart DSH.",
128245
128283
  providerGoogle: "Google Gemini",
128246
128284
  providerOpenAI: "OpenAI",
128247
- providerOpenAICompat: "OpenAI Compatible (relay)",
128285
+ providerOpenAICompat: "MetaonticAI",
128248
128286
  addCompatChannel: "Add OpenAI-compatible channel",
128249
128287
  channelName: "Channel name",
128250
128288
  channelNameRequired: "Enter a channel name.",
128251
128289
  removeChannel: "Remove channel",
128252
128290
  removeChannelConfirm: "Remove \"{label}\"? Its channel configuration will be deleted.",
128253
- providerSeedream: "ByteDance Seedream",
128291
+ providerSeedream: "Volcengine",
128254
128292
  providerDashScope: "Aliyun DashScope (Wanx / Qwen)",
128255
128293
  providerXAI: "xAI Grok Imagine",
128256
128294
  providerZhipu: "Zhipu GLM-Image",
@@ -128325,6 +128363,8 @@ img.ProseMirror-separator {
128325
128363
  editFormatJsonImageUrlArray: "JSON images array (SenseNova etc.)",
128326
128364
  editFormatFormReferenceImages: "Multipart with a reference_images JSON array (base64)",
128327
128365
  editFormatModelScopeHint: "ModelScope official address, detected automatically: generation and editing wait for ModelScope to finish the job, up to about 5 minutes.",
128366
+ editFormatNewApiAsync: "New API async task (MetaonticAI / Seedream)",
128367
+ editFormatNewApiHint: "The MetaonticAI endpoint is detected automatically: generation and editing submit to /tasks/doubao, poll the task, then read its image artifacts. A single request may take up to 15 minutes.",
128328
128368
  editFormatHint: "Recognized official SenseNova, Qwen and SiliconFlow endpoints automatically use their JSON edit contracts. Choose other relay formats according to their documentation. Text-to-image is unaffected.",
128329
128369
  editExtra: "Extra JSON fields",
128330
128370
  editExtraPlaceholder: "{\"watermark\": false, \"prompt_extend\": true}",
@@ -128360,6 +128400,7 @@ img.ProseMirror-separator {
128360
128400
  endpointHintComfyUI: "A running ComfyUI server reachable by the DSH Host; the default points to port 8188 on this computer.",
128361
128401
  model: "Model",
128362
128402
  defaultModel: "Default model",
128403
+ modelRequired: "Select or enter an image model.",
128363
128404
  availableModels: "Models available in Studio",
128364
128405
  availableModelsHint: "Selected models can be switched in Studio. A manually entered default is added automatically and cannot be removed.",
128365
128406
  defaultModelTag: "Default",
@@ -128393,6 +128434,7 @@ img.ProseMirror-separator {
128393
128434
  getTldrawLicense: "Get a license ↗",
128394
128435
  fetchModels: "Fetch models",
128395
128436
  fetchingModels: "Fetching…",
128437
+ selectMetaonticModel: "Fetch and select an image model, or enter its ID",
128396
128438
  fetchModelsHint: "Click \"Fetch models\" to list image-capable models with the stored key; manual input still works.",
128397
128439
  modelsFound: "{n} image models found; open the model field to pick one",
128398
128440
  modelsNone: "No image models found; type the model name manually",
@@ -131762,8 +131804,8 @@ body[data-ds-dark-theme] .dsh-ig-workbench{--ig-danger:#f08c8c;--ig-warn:#e5b76a
131762
131804
  zh: {
131763
131805
  google: "Gemini",
131764
131806
  openai: "OpenAI",
131765
- "openai-compat": "OpenAI 兼容",
131766
- seedream: "Seedream",
131807
+ "openai-compat": "MetaonticAI",
131808
+ seedream: "火山引擎",
131767
131809
  dashscope: "DashScope",
131768
131810
  xai: "Grok",
131769
131811
  zhipu: "智谱 GLM",
@@ -131775,8 +131817,8 @@ body[data-ds-dark-theme] .dsh-ig-workbench{--ig-danger:#f08c8c;--ig-warn:#e5b76a
131775
131817
  en: {
131776
131818
  google: "Gemini",
131777
131819
  openai: "OpenAI",
131778
- "openai-compat": "OpenAI Compatible",
131779
- seedream: "Seedream",
131820
+ "openai-compat": "MetaonticAI",
131821
+ seedream: "Volcengine",
131780
131822
  dashscope: "DashScope",
131781
131823
  xai: "Grok",
131782
131824
  zhipu: "Zhipu GLM",
@@ -132023,8 +132065,9 @@ body[data-ds-dark-theme] .dsh-ig-workbench{--ig-danger:#f08c8c;--ig-warn:#e5b76a
132023
132065
  };
132024
132066
  }, [open, keyTick]);
132025
132067
  const t = (keyName) => (lang === "en" ? PILL_DICT.en : PILL_DICT.zh)[keyName];
132026
- const current = snapshot.value?.provider ?? "google";
132027
- const currentChannel = current === "openai-compat" ? resolveOpenAICompatChannel(snapshot.value ?? {}) : void 0;
132068
+ const savedProvider = snapshot.value?.provider;
132069
+ const current = isSelectableImageProvider(savedProvider) ? savedProvider : "openai-compat";
132070
+ const currentChannel = current === "openai-compat" ? resolveOpenAICompatChannel(snapshot.value ?? {}, "default") : void 0;
132028
132071
  const writable = snapshot.writable;
132029
132072
  (0, react.useEffect)(() => {
132030
132073
  if (!open) {
@@ -132141,10 +132184,13 @@ body[data-ds-dark-theme] .dsh-ig-workbench{--ig-danger:#f08c8c;--ig-warn:#e5b76a
132141
132184
  return dot === "configured" ? "ready" : dot === "missing" ? "missing" : "unknown";
132142
132185
  };
132143
132186
  const isActive = (provider, channelId) => provider === current && (provider !== "openai-compat" || currentChannel?.id === channelId);
132144
- const menuEntries = IMAGE_PROVIDERS.flatMap((provider) => provider === "openai-compat" ? resolveOpenAICompatChannels(snapshot.value ?? {}).map((channel) => ({
132187
+ const menuEntries = SELECTABLE_IMAGE_PROVIDERS.flatMap((provider) => provider === "openai-compat" ? [{
132145
132188
  provider,
132146
- channel
132147
- })) : [{ provider }]).filter((entry) => pillEntryVisible(readiness(entry.provider, entry.channel?.id), isActive(entry.provider, entry.channel?.id))).sort((a, b) => Number(readiness(b.provider, b.channel?.id) === "ready") - Number(readiness(a.provider, a.channel?.id) === "ready"));
132189
+ channel: {
132190
+ ...resolveOpenAICompatChannel(snapshot.value ?? {}, "default"),
132191
+ label: "MetaonticAI"
132192
+ }
132193
+ }] : [{ provider }]).filter((entry) => pillEntryVisible(readiness(entry.provider, entry.channel?.id), isActive(entry.provider, entry.channel?.id))).sort((a, b) => Number(readiness(b.provider, b.channel?.id) === "ready") - Number(readiness(a.provider, a.channel?.id) === "ready"));
132148
132194
  const anyReady = menuEntries.some((entry) => readiness(entry.provider, entry.channel?.id) === "ready");
132149
132195
  return (0, react_jsx_runtime.jsxs)("div", {
132150
132196
  className: "dsh-ig-pill-root",
@@ -132189,7 +132235,7 @@ body[data-ds-dark-theme] .dsh-ig-workbench{--ig-danger:#f08c8c;--ig-warn:#e5b76a
132189
132235
  }),
132190
132236
  (0, react_jsx_runtime.jsx)("span", {
132191
132237
  className: "dsh-ig-pill-provider",
132192
- children: pillButtonLabel(current, PILL_PROVIDER_LABELS[lang][current], snapshot.value, currentChannel === void 0 ? void 0 : localizeChannelLabel(currentChannel.label, lang))
132238
+ children: pillButtonLabel(current, PILL_PROVIDER_LABELS[lang][current], snapshot.value, currentChannel === void 0 ? void 0 : "MetaonticAI")
132193
132239
  }),
132194
132240
  (0, react_jsx_runtime.jsx)("span", {
132195
132241
  className: `dsh-ig-pill-caret${open ? " dsh-ig-pill-caret-open" : ""}`,
@@ -132506,7 +132552,7 @@ body[data-ds-dark-theme] .dsh-ig-workbench{--ig-danger:#f08c8c;--ig-warn:#e5b76a
132506
132552
  }
132507
132553
  //#endregion
132508
132554
  //#region lib/types/client/index.js
132509
- console.info(`[dsh-metaontic-image] canvas bundle 2026-11-29T23:36:35.642Z`);
132555
+ console.info(`[dsh-metaontic-image] canvas bundle 2026-12-01T23:41:37.767Z`);
132510
132556
  /** Right-sidebar tab-type registration id (DSH 0.1.5 `sidebarRightTabs`). */
132511
132557
  const SIDEBAR_STUDIO_TAB_ID = "dsh-metaontic-image/studio";
132512
132558
  /** The tab kind: a page type opened by kind, recognizing no resource address. */
@@ -132875,29 +132921,42 @@ body[data-ds-dark-theme] .dsh-ig-workbench{--ig-danger:#f08c8c;--ig-warn:#e5b76a
132875
132921
  }
132876
132922
  /** Persisted or selected edit-format value → row state; unknown values fall back to standard multipart. */
132877
132923
  function parseEditFormat(value) {
132878
- return value === "jsonImageUrlArray" || value === "formReferenceImages" || value === "siliconflowJson" || value === "modelscopeAsync" ? value : "multipart";
132924
+ return value === "jsonImageUrlArray" || value === "formReferenceImages" || value === "siliconflowJson" || value === "modelscopeAsync" || value === "newapiAsync" ? value : "multipart";
132879
132925
  }
132880
132926
  function compatChannelRowKey(channelId) {
132881
132927
  return `openai-compat:${channelId}`;
132882
132928
  }
132929
+ /** MetaonticAI's Seedream models are offered before the live model list arrives. */
132930
+ function metaonticModelOptions(baseURL) {
132931
+ try {
132932
+ return new URL(baseURL).hostname === "ai.bileego.com" ? seedreamModelOptions().map((option) => option.value) : [];
132933
+ } catch {
132934
+ return [];
132935
+ }
132936
+ }
132883
132937
  function compatRowFields(channel) {
132938
+ const baseURL = channel.baseURL.trim() || (channel.id === "default" ? "https://ai.bileego.com/v1" : "");
132939
+ const seededModels = metaonticModelOptions(baseURL);
132940
+ const model = channel.model.trim() || seededModels[0] || "";
132941
+ const models = resolveOpenAICompatModels({
132942
+ openaiCompatModel: model,
132943
+ openaiCompatModels: channel.models !== void 0 && channel.models.length > 0 ? channel.models : seededModels
132944
+ });
132884
132945
  return {
132885
132946
  label: channel.label,
132886
- model: channel.model,
132887
- models: resolveOpenAICompatModels({
132888
- openaiCompatModel: channel.model,
132889
- openaiCompatModels: channel.models ?? []
132890
- }),
132947
+ model,
132948
+ models,
132891
132949
  supportsGif: channel.supportsGif === true,
132892
132950
  editModel: channel.editModel ?? "",
132893
- baseURL: channel.baseURL,
132951
+ baseURL,
132894
132952
  editFormat: parseEditFormat(channel.editFormat),
132895
132953
  editExtraText: editExtraTextOf(channel.editExtra),
132896
132954
  sizeTableText: editExtraTextOf(channel.sizes),
132897
132955
  generationQuality: channel.quality ?? "",
132898
132956
  qualityOptionsText: (channel.qualityOptions !== void 0 && channel.qualityOptions.length > 0 ? channel.qualityOptions : DEFAULT_COMPAT_QUALITIES).join(", "),
132899
132957
  generateExtraText: editExtraTextOf(channel.extraBody),
132900
- editSizeMode: channel.editSizeMode === "selected" ? "selected" : "auto"
132958
+ editSizeMode: channel.editSizeMode === "selected" ? "selected" : "auto",
132959
+ modelOptions: seededModels
132901
132960
  };
132902
132961
  }
132903
132962
  /** Build one row per provider from persisted settings, including ComfyUI extras. */
@@ -132918,7 +132977,8 @@ body[data-ds-dark-theme] .dsh-ig-workbench{--ig-danger:#f08c8c;--ig-warn:#e5b76a
132918
132977
  ...provider === "seedream" ? {
132919
132978
  outputFormat: value?.seedreamOutputFormat === "png" ? "png" : "jpeg",
132920
132979
  watermark: value?.seedreamWatermark !== false,
132921
- background: value?.seedreamBackground === "transparent" ? "transparent" : "opaque"
132980
+ background: value?.seedreamBackground === "transparent" ? "transparent" : "opaque",
132981
+ modelOptions: seedreamModelOptions().map((option) => option.value)
132922
132982
  } : {}
132923
132983
  };
132924
132984
  for (const channel of resolveOpenAICompatChannels(value ?? {}).slice(1)) rows[compatChannelRowKey(channel.id)] = {
@@ -132928,6 +132988,9 @@ body[data-ds-dark-theme] .dsh-ig-workbench{--ig-danger:#f08c8c;--ig-warn:#e5b76a
132928
132988
  return rows;
132929
132989
  }
132930
132990
  /** Edit each provider independently, pick an explicit default, and verify keys inline. */
132991
+ function displayedProvider(provider) {
132992
+ return isSelectableImageProvider(provider) ? provider : "openai-compat";
132993
+ }
132931
132994
  function ImageGenerationSettingsCard(props) {
132932
132995
  const [open] = (0, react.useState)(true);
132933
132996
  const [snapshot, setSnapshot] = (0, react.useState)(() => props.scope.getSnapshot());
@@ -132935,7 +132998,7 @@ body[data-ds-dark-theme] .dsh-ig-workbench{--ig-danger:#f08c8c;--ig-warn:#e5b76a
132935
132998
  const state = settingsState(snapshot, health);
132936
132999
  const settingsWritable = state === "ready";
132937
133000
  const [lang, setLang] = (0, react.useState)(() => props.locale?.getSnapshot?.()?.active?.startsWith("en") ? "en" : "zh");
132938
- const [defaultProvider, setDefaultProvider] = (0, react.useState)(() => props.scope.getSnapshot().value?.provider ?? "google");
133001
+ const [defaultProvider, setDefaultProvider] = (0, react.useState)(() => displayedProvider(props.scope.getSnapshot().value?.provider));
132939
133002
  const [providerMessage, setProviderMessage] = (0, react.useState)("");
132940
133003
  const [providerMessageIsError, setProviderMessageIsError] = (0, react.useState)(false);
132941
133004
  const [cloudTimeoutSeconds, setCloudTimeoutSeconds] = (0, react.useState)(() => (props.scope.getSnapshot().value?.cloudTimeoutMs ?? 15e4) / 1e3);
@@ -133165,7 +133228,7 @@ body[data-ds-dark-theme] .dsh-ig-workbench{--ig-danger:#f08c8c;--ig-warn:#e5b76a
133165
133228
  };
133166
133229
  (0, react.useEffect)(() => {
133167
133230
  const value = snapshot.value;
133168
- setDefaultProvider(value?.provider ?? "google");
133231
+ setDefaultProvider(displayedProvider(value?.provider));
133169
133232
  setCloudTimeoutSeconds((value?.cloudTimeoutMs ?? 15e4) / 1e3);
133170
133233
  setSaveToWorkspace(value?.saveToWorkspace ?? true);
133171
133234
  setWorkspaceFolder(value?.workspaceFolder ?? "dsh-metaontic-image");
@@ -133189,7 +133252,8 @@ body[data-ds-dark-theme] .dsh-ig-workbench{--ig-danger:#f08c8c;--ig-warn:#e5b76a
133189
133252
  ...provider === "seedream" ? {
133190
133253
  outputFormat: value?.seedreamOutputFormat === "png" ? "png" : "jpeg",
133191
133254
  watermark: value?.seedreamWatermark !== false,
133192
- background: value?.seedreamBackground === "transparent" ? "transparent" : "opaque"
133255
+ background: value?.seedreamBackground === "transparent" ? "transparent" : "opaque",
133256
+ modelOptions: [.../* @__PURE__ */ new Set([...seedreamModelOptions().map((option) => option.value), ...current[provider].modelOptions])]
133193
133257
  } : {}
133194
133258
  };
133195
133259
  for (const channel of resolveOpenAICompatChannels(value ?? {}).slice(1)) {
@@ -133284,7 +133348,7 @@ body[data-ds-dark-theme] .dsh-ig-workbench{--ig-danger:#f08c8c;--ig-warn:#e5b76a
133284
133348
  setProviderMessage("");
133285
133349
  setProviderMessageIsError(false);
133286
133350
  saveSetting("provider", provider).catch((cause) => {
133287
- setDefaultProvider(snapshot.value?.provider ?? "google");
133351
+ setDefaultProvider(displayedProvider(snapshot.value?.provider));
133288
133352
  setProviderMessage(cause instanceof Error ? cause.message : String(cause));
133289
133353
  setProviderMessageIsError(true);
133290
133354
  });
@@ -133356,6 +133420,7 @@ body[data-ds-dark-theme] .dsh-ig-workbench{--ig-danger:#f08c8c;--ig-warn:#e5b76a
133356
133420
  const sizeTable = provider === "openai" || provider === "openai-compat" ? parseSizeTable(row.sizeTableText, t("sizeTableInvalid")) : {};
133357
133421
  const generateExtra = provider === "openai-compat" ? parseExtraFields(row.generateExtraText, t("editExtraInvalid")) : {};
133358
133422
  if (provider === "openai") for (const tiers of Object.values(sizeTable)) for (const size of Object.values(tiers)) validateOfficialSize(row.model, size);
133423
+ if (provider === "openai-compat" && row.model.trim().length === 0 && metaonticModelOptions(row.baseURL).length > 0) throw new Error(t("modelRequired"));
133359
133424
  await saveSetting(modelFieldOf(provider), row.model);
133360
133425
  await saveSetting(baseURLFieldOf(provider), row.baseURL);
133361
133426
  if (provider === "google") await saveSetting("googleNative", row.googleNative);
@@ -133409,66 +133474,6 @@ body[data-ds-dark-theme] .dsh-ig-workbench{--ig-danger:#f08c8c;--ig-warn:#e5b76a
133409
133474
  updateRow(target, { saving: false });
133410
133475
  }
133411
133476
  };
133412
- const addCompatChannel = () => {
133413
- const id = `channel-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 7)}`;
133414
- const channel = {
133415
- id,
133416
- label: `OpenAI 兼容 ${compatChannels.length + 2}`,
133417
- keyRef: openAICompatKeyRef(id),
133418
- baseURL: "",
133419
- model: "",
133420
- models: [],
133421
- qualityOptions: [...DEFAULT_COMPAT_QUALITIES]
133422
- };
133423
- setCompatChannels((current) => [...current, channel]);
133424
- setRows((current) => ({
133425
- ...current,
133426
- [compatChannelRowKey(id)]: {
133427
- ...emptyProviderRow(),
133428
- ...compatRowFields(channel),
133429
- expanded: true
133430
- }
133431
- }));
133432
- };
133433
- const removeCompatChannel = async (channel) => {
133434
- if (!window.confirm(t("removeChannelConfirm", { label: channel.label }))) return;
133435
- const target = compatChannelRowKey(channel.id);
133436
- if (!(snapshot.value?.openaiCompatChannels?.some((entry) => entry.id === channel.id) === true)) {
133437
- setCompatChannels((current) => current.filter((entry) => entry.id !== channel.id));
133438
- setRows((current) => {
133439
- const next = { ...current };
133440
- delete next[target];
133441
- return next;
133442
- });
133443
- return;
133444
- }
133445
- let removed = false;
133446
- updateRow(target, {
133447
- saving: true,
133448
- message: "",
133449
- messageIsError: false
133450
- });
133451
- try {
133452
- const nextChannels = compatChannels.filter((entry) => entry.id !== channel.id);
133453
- await saveSetting("openaiCompatChannels", nextChannels);
133454
- if (snapshot.value?.openaiCompatActiveChannel === channel.id) await saveSetting("openaiCompatActiveChannel", "default");
133455
- removed = true;
133456
- setCompatChannels(nextChannels);
133457
- setRows((current) => {
133458
- const next = { ...current };
133459
- delete next[target];
133460
- return next;
133461
- });
133462
- } catch (cause) {
133463
- updateRow(target, {
133464
- message: cause instanceof Error ? cause.message : String(cause),
133465
- messageIsError: true
133466
- });
133467
- } finally {
133468
- if (!removed) updateRow(target, { saving: false });
133469
- }
133470
- };
133471
- /** These actions use host settings, so drafts must be saved before making a request. */
133472
133477
  const providerActionBlockMessage = (provider, channel) => {
133473
133478
  const target = channel === void 0 ? provider : compatChannelRowKey(channel.id);
133474
133479
  const row = rows[target];
@@ -133550,10 +133555,20 @@ body[data-ds-dark-theme] .dsh-ig-workbench{--ig-danger:#f08c8c;--ig-warn:#e5b76a
133550
133555
  const payload = await response.json();
133551
133556
  if (payload.ok && Array.isArray(payload.models)) {
133552
133557
  const models = payload.models.filter((id) => typeof id === "string");
133553
- updateRow(target, {
133554
- modelOptions: models,
133555
- modelFetchMessage: models.length > 0 ? t("modelsFound", { n: String(models.length) }) : t("modelsNone"),
133556
- modelFetchIsError: models.length === 0
133558
+ setRows((current) => {
133559
+ const existing = current[target];
133560
+ const seededModels = provider === "seedream" || metaonticModelOptions(existing.baseURL).length > 0 ? seedreamModelOptions().map((option) => option.value) : [];
133561
+ const modelOptions = [.../* @__PURE__ */ new Set([...seededModels, ...models])];
133562
+ return {
133563
+ ...current,
133564
+ [target]: {
133565
+ ...existing,
133566
+ modelOptions,
133567
+ ...provider === "openai-compat" && models.length === 1 && !existing.model.trim() ? { model: models[0] } : {},
133568
+ modelFetchMessage: models.length > 0 ? t("modelsFound", { n: String(models.length) }) : t("modelsNone"),
133569
+ modelFetchIsError: models.length === 0
133570
+ }
133571
+ };
133557
133572
  });
133558
133573
  } else if (payload.reason === "missing-key") updateRow(target, {
133559
133574
  modelFetchMessage: t("badgeMissing"),
@@ -133977,6 +133992,7 @@ body[data-ds-dark-theme] .dsh-ig-workbench{--ig-danger:#f08c8c;--ig-warn:#e5b76a
133977
133992
  },
133978
133993
  list: modelListId,
133979
133994
  required: provider !== "openai-compat",
133995
+ placeholder: provider === "openai-compat" ? t("selectMetaonticModel") : void 0,
133980
133996
  disabled: !settingsWritable
133981
133997
  }),
133982
133998
  (0, react_jsx_runtime.jsx)("datalist", {
@@ -134130,12 +134146,16 @@ body[data-ds-dark-theme] .dsh-ig-workbench{--ig-danger:#f08c8c;--ig-warn:#e5b76a
134130
134146
  (0, react_jsx_runtime.jsx)("option", {
134131
134147
  value: "siliconflowJson",
134132
134148
  children: t("editFormatSiliconFlow")
134149
+ }),
134150
+ (0, react_jsx_runtime.jsx)("option", {
134151
+ value: "newapiAsync",
134152
+ children: t("editFormatNewApiAsync")
134133
134153
  })
134134
134154
  ]
134135
134155
  }),
134136
134156
  (0, react_jsx_runtime.jsx)("span", {
134137
134157
  className: "dsh-ig-hint",
134138
- children: t(editFormat === "siliconflowJson" ? "editFormatSiliconFlowHint" : editFormat === "modelscopeAsync" ? "editFormatModelScopeHint" : "editFormatHint")
134158
+ children: t(editFormat === "siliconflowJson" ? "editFormatSiliconFlowHint" : editFormat === "modelscopeAsync" ? "editFormatModelScopeHint" : editFormat === "newapiAsync" ? "editFormatNewApiHint" : "editFormatHint")
134139
134159
  })
134140
134160
  ]
134141
134161
  }) : null,
@@ -134308,7 +134328,7 @@ body[data-ds-dark-theme] .dsh-ig-workbench{--ig-danger:#f08c8c;--ig-warn:#e5b76a
134308
134328
  ]
134309
134329
  })
134310
134330
  ] }) : null,
134311
- provider === "openai-compat" && (editFormat === "jsonImageUrlArray" || editFormat === "qwenJson" || editFormat === "siliconflowJson" || editFormat === "modelscopeAsync") ? (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [editFormat === "jsonImageUrlArray" ? (0, react_jsx_runtime.jsxs)("label", {
134331
+ provider === "openai-compat" && (editFormat === "jsonImageUrlArray" || editFormat === "qwenJson" || editFormat === "siliconflowJson" || editFormat === "modelscopeAsync" || editFormat === "newapiAsync") ? (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [editFormat === "jsonImageUrlArray" ? (0, react_jsx_runtime.jsxs)("label", {
134312
134332
  className: "dsh-ig-field",
134313
134333
  children: [(0, react_jsx_runtime.jsx)("span", {
134314
134334
  className: "dsh-ig-label",
@@ -134692,12 +134712,12 @@ body[data-ds-dark-theme] .dsh-ig-workbench{--ig-danger:#f08c8c;--ig-warn:#e5b76a
134692
134712
  const renderProviderRow = (provider) => {
134693
134713
  const row = rows[provider];
134694
134714
  const badge = badgeOf(provider);
134695
- const label = provider === "openai-compat" && row.label.trim().length > 0 ? row.label.trim() : providerLabels[provider];
134715
+ const label = providerLabels[provider];
134696
134716
  return (0, react_jsx_runtime.jsxs)("div", {
134697
134717
  className: "dsh-ig-provider-row",
134698
- children: [(0, react_jsx_runtime.jsxs)("div", {
134718
+ children: [(0, react_jsx_runtime.jsx)("div", {
134699
134719
  className: "dsh-ig-provider-head-row",
134700
- children: [(0, react_jsx_runtime.jsxs)("button", {
134720
+ children: (0, react_jsx_runtime.jsxs)("button", {
134701
134721
  type: "button",
134702
134722
  className: "dsh-ig-provider-head",
134703
134723
  "aria-expanded": row.expanded,
@@ -134733,82 +134753,10 @@ body[data-ds-dark-theme] .dsh-ig-workbench{--ig-danger:#f08c8c;--ig-warn:#e5b76a
134733
134753
  })
134734
134754
  })
134735
134755
  ]
134736
- }), provider === "openai-compat" ? (0, react_jsx_runtime.jsx)("button", {
134737
- type: "button",
134738
- className: "dsh-ig-btn-secondary dsh-ig-channel-add",
134739
- title: t("addCompatChannel"),
134740
- "aria-label": t("addCompatChannel"),
134741
- onClick: addCompatChannel,
134742
- disabled: !settingsWritable,
134743
- children: (0, react_jsx_runtime.jsx)("svg", {
134744
- viewBox: "0 0 16 16",
134745
- fill: "none",
134746
- stroke: "currentColor",
134747
- strokeWidth: "1.6",
134748
- strokeLinecap: "round",
134749
- "aria-hidden": "true",
134750
- children: (0, react_jsx_runtime.jsx)("path", { d: "M8 3v10M3 8h10" })
134751
- })
134752
- }) : null]
134756
+ })
134753
134757
  }), row.expanded ? provider === "comfyui" ? renderComfyUIBody() : isSubscriptionProvider(provider) ? renderSubscriptionBody(provider) : renderCloudBody(provider) : null]
134754
134758
  }, provider);
134755
134759
  };
134756
- const renderCompatChannelRow = (channel) => {
134757
- const target = compatChannelRowKey(channel.id);
134758
- const row = rows[target];
134759
- const badge = badgeOf("openai-compat", channel);
134760
- return (0, react_jsx_runtime.jsxs)("div", {
134761
- className: "dsh-ig-provider-row dsh-ig-compat-channel-row",
134762
- children: [(0, react_jsx_runtime.jsxs)("div", {
134763
- className: "dsh-ig-provider-head-row",
134764
- children: [(0, react_jsx_runtime.jsxs)("button", {
134765
- type: "button",
134766
- className: "dsh-ig-provider-head",
134767
- "aria-expanded": row.expanded,
134768
- onClick: () => {
134769
- updateRow(target, { expanded: !row.expanded });
134770
- },
134771
- children: [
134772
- (0, react_jsx_runtime.jsx)("span", {
134773
- className: "dsh-ig-provider-name",
134774
- children: localizeChannelLabel(channel.label, lang === "en" ? "en" : "zh")
134775
- }),
134776
- (0, react_jsx_runtime.jsxs)("span", {
134777
- className: badge.className,
134778
- title: badge.text,
134779
- children: [(0, react_jsx_runtime.jsx)("span", {
134780
- className: "dsh-ig-badge-dot",
134781
- "aria-hidden": "true"
134782
- }), badge.text]
134783
- }),
134784
- (0, react_jsx_runtime.jsx)("span", {
134785
- className: `dsh-ig-provider-chevron ${row.expanded ? "dsh-ig-provider-chevron-open" : ""}`,
134786
- "aria-hidden": "true",
134787
- children: (0, react_jsx_runtime.jsx)("svg", {
134788
- width: "12",
134789
- height: "12",
134790
- viewBox: "0 0 16 16",
134791
- fill: "none",
134792
- stroke: "currentColor",
134793
- strokeWidth: "2",
134794
- strokeLinecap: "round",
134795
- strokeLinejoin: "round",
134796
- children: (0, react_jsx_runtime.jsx)("path", { d: "M4 6l4 4 4-4" })
134797
- })
134798
- })
134799
- ]
134800
- }), (0, react_jsx_runtime.jsx)("button", {
134801
- type: "button",
134802
- className: "dsh-ig-btn-secondary dsh-ig-btn-danger",
134803
- disabled: row.saving || !settingsWritable,
134804
- onClick: () => {
134805
- removeCompatChannel(channel);
134806
- },
134807
- children: t("removeChannel")
134808
- })]
134809
- }), row.expanded ? renderCloudBody("openai-compat", channel) : null]
134810
- }, target);
134811
- };
134812
134760
  return (0, react_jsx_runtime.jsxs)("li", {
134813
134761
  className: "dsh-ig-card",
134814
134762
  children: [(0, react_jsx_runtime.jsx)("div", {
@@ -134842,7 +134790,7 @@ body[data-ds-dark-theme] .dsh-ig-workbench{--ig-danger:#f08c8c;--ig-warn:#e5b76a
134842
134790
  className: "dsh-ig-radios",
134843
134791
  role: "radiogroup",
134844
134792
  "aria-label": t("defaultProvider"),
134845
- children: IMAGE_PROVIDERS.map((provider) => (0, react_jsx_runtime.jsxs)("label", {
134793
+ children: SELECTABLE_IMAGE_PROVIDERS.map((provider) => (0, react_jsx_runtime.jsxs)("label", {
134846
134794
  className: `dsh-ig-radio${defaultProvider === provider ? " dsh-ig-radio-checked" : ""}`,
134847
134795
  children: [(0, react_jsx_runtime.jsx)("input", {
134848
134796
  type: "radio",
@@ -134905,7 +134853,7 @@ body[data-ds-dark-theme] .dsh-ig-workbench{--ig-danger:#f08c8c;--ig-warn:#e5b76a
134905
134853
  }),
134906
134854
  (0, react_jsx_runtime.jsx)("div", {
134907
134855
  className: "dsh-ig-providers",
134908
- children: IMAGE_PROVIDERS.flatMap((provider) => [renderProviderRow(provider), ...provider === "openai-compat" ? compatChannels.map((channel) => renderCompatChannelRow(channel)) : []])
134856
+ children: SELECTABLE_IMAGE_PROVIDERS.map(renderProviderRow)
134909
134857
  }),
134910
134858
  (0, react_jsx_runtime.jsxs)("div", {
134911
134859
  className: "dsh-ig-section",