dsh-audiogen 0.1.0 → 0.2.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/lib/client.js CHANGED
@@ -18,6 +18,8 @@ window.__ModuleLoader__.load({
18
18
  const GENERATE_API = "/api/dsh-audiogen/generate";
19
19
  /** Host-mediated built-in provider catalog (channels the user can instantiate). */
20
20
  const PRESETS_API = "/api/dsh-audiogen/presets";
21
+ /** Host-mediated model/voice discovery endpoint. */
22
+ const MODEL_API = { discover: "/api/dsh-audiogen/models/discover" };
21
23
  /** Host-persisted generation history routes. */
22
24
  const HISTORY_API = {
23
25
  list: "/api/dsh-audiogen/history/list",
@@ -140,7 +142,7 @@ window.__ModuleLoader__.load({
140
142
  "channel.apiKey": "API 密钥",
141
143
  "channel.apiKeyHint": "留空则保持当前密钥;输入新值可更换。",
142
144
  "channel.models": "模型 / 音色(每行一个:别名=上游ID)",
143
- "channel.modelsHint": "例如 tts-1=tts-1 或 Rachel=21m00Tcm4TlvDq8ikWAM",
145
+ "channel.modelsHint": "每行格式:别名=上游ID,可加 @分类(tts/music/sfx/voice_design/voice_clone);例如 tts-1=tts-1 @tts 或 Rachel=21m00Tcm4TlvDq8ikWAM @tts",
144
146
  "channel.default": "设为默认",
145
147
  "channel.cancel": "取消",
146
148
  "channel.save": "保存渠道",
@@ -203,7 +205,7 @@ window.__ModuleLoader__.load({
203
205
  "channel.apiKey": "API key",
204
206
  "channel.apiKeyHint": "Leave blank to keep the current key.",
205
207
  "channel.models": "Models / voices (one per line: alias=upstreamId)",
206
- "channel.modelsHint": "e.g. tts-1=tts-1 or Rachel=21m00Tcm4TlvDq8ikWAM",
208
+ "channel.modelsHint": "One per line: alias=upstreamId, optional @category (tts/music/sfx/voice_design/voice_clone); e.g. tts-1=tts-1 @tts or Rachel=21m00Tcm4TlvDq8ikWAM @tts",
207
209
  "channel.default": "Set default",
208
210
  "channel.cancel": "Cancel",
209
211
  "channel.save": "Save channel",
@@ -438,9 +440,17 @@ window.__ModuleLoader__.load({
438
440
  const defaultId = config?.defaultChannelId !== void 0 && channels.some((channel) => channel.id === config.defaultChannelId) ? config.defaultChannelId : channels[0].id;
439
441
  const ordered = [defaultId, ...channels.filter((channel) => channel.id !== defaultId).map((channel) => channel.id)];
440
442
  const models = [];
443
+ const seen = /* @__PURE__ */ new Set();
441
444
  for (const id of ordered) {
442
445
  const channel = channels.find((candidate) => candidate.id === id);
443
- for (const model of channel.models) if (model.alias !== "" && !models.includes(model.alias)) models.push(model.alias);
446
+ for (const model of channel.models) {
447
+ if (model.alias === "" || seen.has(model.alias)) continue;
448
+ seen.add(model.alias);
449
+ models.push({
450
+ alias: model.alias,
451
+ ...model.category === void 0 ? {} : { category: model.category }
452
+ });
453
+ }
444
454
  }
445
455
  return models.length > 0 ? {
446
456
  models,
@@ -462,33 +472,33 @@ window.__ModuleLoader__.load({
462
472
  document.head.appendChild(tag);
463
473
  }
464
474
  var audio_panel_module_css_default = {
465
- "download": "Oo1fpq_download",
466
- "input": "Oo1fpq_input",
467
- "history": "Oo1fpq_history",
468
- "result": "Oo1fpq_result",
469
- "historyPrompt": "Oo1fpq_historyPrompt",
470
- "audioList": "Oo1fpq_audioList",
475
+ "historyItem": "Oo1fpq_historyItem",
471
476
  "form": "Oo1fpq_form",
477
+ "label": "Oo1fpq_label",
472
478
  "textarea": "Oo1fpq_textarea",
473
- "historyMeta": "Oo1fpq_historyMeta",
474
- "title": "Oo1fpq_title",
475
- "hint": "Oo1fpq_hint",
476
- "historyAudio": "Oo1fpq_historyAudio",
477
- "historyTitle": "Oo1fpq_historyTitle",
478
479
  "header": "Oo1fpq_header",
479
- "audio": "Oo1fpq_audio",
480
- "label": "Oo1fpq_label",
481
480
  "empty": "Oo1fpq_empty",
482
- "generate": "Oo1fpq_generate",
483
- "audioCard": "Oo1fpq_audioCard",
484
- "layout": "Oo1fpq_layout",
481
+ "audio": "Oo1fpq_audio",
482
+ "result": "Oo1fpq_result",
483
+ "input": "Oo1fpq_input",
484
+ "panel": "Oo1fpq_panel",
485
+ "modeButton": "Oo1fpq_modeButton",
486
+ "hint": "Oo1fpq_hint",
487
+ "audioList": "Oo1fpq_audioList",
488
+ "history": "Oo1fpq_history",
489
+ "historyTitle": "Oo1fpq_historyTitle",
490
+ "title": "Oo1fpq_title",
485
491
  "select": "Oo1fpq_select",
486
- "historyEmpty": "Oo1fpq_historyEmpty",
487
- "historyItem": "Oo1fpq_historyItem",
488
492
  "error": "Oo1fpq_error",
489
- "modeButton": "Oo1fpq_modeButton",
490
- "panel": "Oo1fpq_panel",
491
- "modeRow": "Oo1fpq_modeRow"
493
+ "historyEmpty": "Oo1fpq_historyEmpty",
494
+ "audioCard": "Oo1fpq_audioCard",
495
+ "layout": "Oo1fpq_layout",
496
+ "modeRow": "Oo1fpq_modeRow",
497
+ "historyMeta": "Oo1fpq_historyMeta",
498
+ "generate": "Oo1fpq_generate",
499
+ "historyAudio": "Oo1fpq_historyAudio",
500
+ "download": "Oo1fpq_download",
501
+ "historyPrompt": "Oo1fpq_historyPrompt"
492
502
  };
493
503
  //#endregion
494
504
  //#region src/client/AudioGenPanel.tsx
@@ -546,9 +556,10 @@ window.__ModuleLoader__.load({
546
556
  const [error, setError] = (0, react.useState)(null);
547
557
  const [outputs, setOutputs] = (0, react.useState)([]);
548
558
  const { entries, reload, clear } = useHistory();
559
+ const visibleModels = (0, react.useMemo)(() => modelOptions.models.filter((entry) => entry.category === void 0 || entry.category === "tts" && mode === "tts" || entry.category === mode).map((entry) => entry.alias), [modelOptions.models, mode]);
549
560
  (0, react.useEffect)(() => {
550
- if (modelOptions.models.length > 0 && !modelOptions.models.includes(model)) setModel(modelOptions.models[0]);
551
- }, [modelOptions.models, model]);
561
+ if (visibleModels.length > 0 && !visibleModels.includes(model)) setModel(visibleModels[0]);
562
+ }, [visibleModels, model]);
552
563
  const submit = async () => {
553
564
  if (prompt.trim() === "") {
554
565
  setError(tt("prompt.required"));
@@ -559,7 +570,7 @@ window.__ModuleLoader__.load({
559
570
  try {
560
571
  const response = await api.generate({
561
572
  mode,
562
- model: (model || modelOptions.models[0]) ?? "",
573
+ model: (model || visibleModels[0]) ?? "",
563
574
  prompt: prompt.trim(),
564
575
  ...voice.trim() !== "" ? { voice: voice.trim() } : {},
565
576
  ...speed.trim() !== "" ? { speed: Number(speed) } : {},
@@ -629,10 +640,10 @@ window.__ModuleLoader__.load({
629
640
  className: audio_panel_module_css_default.select,
630
641
  value: model,
631
642
  onChange: (event) => setModel(event.target.value),
632
- children: [modelOptions.models.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
643
+ children: [visibleModels.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
633
644
  value: "",
634
- children: "(请在设置中添加)"
635
- }) : null, modelOptions.models.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
645
+ children: "(当前模式暂无可用模型)"
646
+ }) : null, visibleModels.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
636
647
  value: item,
637
648
  children: item
638
649
  }, item))]
@@ -710,7 +721,7 @@ window.__ModuleLoader__.load({
710
721
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
711
722
  type: "button",
712
723
  className: audio_panel_module_css_default.generate,
713
- disabled: loading || !connected,
724
+ disabled: loading || !connected || visibleModels.length === 0,
714
725
  onClick: () => void submit(),
715
726
  children: loading ? tt("generating") : tt("generate")
716
727
  })
@@ -808,167 +819,167 @@ window.__ModuleLoader__.load({
808
819
  document.head.appendChild(tag);
809
820
  }
810
821
  var panel_module_css_default = {
811
- "galleryBadge": "rwa6qG_galleryBadge",
812
- "taskTrayChevron": "rwa6qG_taskTrayChevron",
813
- "referenceImage": "rwa6qG_referenceImage",
814
- "galleryClear": "rwa6qG_galleryClear",
815
- "canvasEmptyIcon": "rwa6qG_canvasEmptyIcon",
816
- "lightboxScaleFrame": "rwa6qG_lightboxScaleFrame",
817
- "lightboxNav": "rwa6qG_lightboxNav",
822
+ "optionGrid": "rwa6qG_optionGrid",
823
+ "lightboxCopy": "rwa6qG_lightboxCopy",
824
+ "galleryBulkButton": "rwa6qG_galleryBulkButton",
825
+ "canvas": "rwa6qG_canvas",
826
+ "historyClear": "rwa6qG_historyClear",
827
+ "gallerySort": "rwa6qG_gallerySort",
828
+ "lightboxActions": "rwa6qG_lightboxActions",
829
+ "promptCount": "rwa6qG_promptCount",
818
830
  "reference": "rwa6qG_reference",
819
- "modelLabel": "rwa6qG_modelLabel",
820
- "optionRow": "rwa6qG_optionRow",
821
- "templatesButton": "rwa6qG_templatesButton",
822
- "view": "rwa6qG_view",
823
- "gallerySelectMode": "rwa6qG_gallerySelectMode",
824
- "configScroll": "rwa6qG_configScroll",
825
- "modePill": "rwa6qG_modePill",
826
- "galleryTagFilter": "rwa6qG_galleryTagFilter",
827
- "galleryRemove": "rwa6qG_galleryRemove",
831
+ "galleryWorkspace": "rwa6qG_galleryWorkspace",
832
+ "galleryTagFilterList": "rwa6qG_galleryTagFilterList",
828
833
  "gallerySearch": "rwa6qG_gallerySearch",
829
- "connectionStatus": "rwa6qG_connectionStatus",
834
+ "zoomHint": "rwa6qG_zoomHint",
835
+ "paramGroup": "rwa6qG_paramGroup",
836
+ "modelWrap": "rwa6qG_modelWrap",
837
+ "comparisonFullscreen": "rwa6qG_comparisonFullscreen",
838
+ "studio": "rwa6qG_studio",
839
+ "lightboxClose": "rwa6qG_lightboxClose",
840
+ "lightboxCaptionRow": "rwa6qG_lightboxCaptionRow",
841
+ "historyInfo": "rwa6qG_historyInfo",
842
+ "generateInner": "rwa6qG_generateInner",
830
843
  "bigSpinner": "rwa6qG_bigSpinner",
831
- "referenceActions": "rwa6qG_referenceActions",
832
- "lightboxImage": "rwa6qG_lightboxImage",
833
- "historyActions": "rwa6qG_historyActions",
834
- "galleryViewToggle": "rwa6qG_galleryViewToggle",
835
- "connectionDot": "rwa6qG_connectionDot",
836
- "githubLink": "rwa6qG_githubLink",
837
- "updateActions": "rwa6qG_updateActions",
838
- "panel": "rwa6qG_panel",
839
- "grid": "rwa6qG_grid",
840
- "galleryMasonry": "rwa6qG_galleryMasonry",
841
- "updateBanner": "rwa6qG_updateBanner",
842
- "entry": "rwa6qG_entry",
843
- "taskTray": "rwa6qG_taskTray",
844
- "galleryBulkButton": "rwa6qG_galleryBulkButton",
845
- "canvasHistoryTag": "rwa6qG_canvasHistoryTag",
846
- "promptCount": "rwa6qG_promptCount",
844
+ "galleryTagEditor": "rwa6qG_galleryTagEditor",
845
+ "hiddenFile": "rwa6qG_hiddenFile",
846
+ "templatesButton": "rwa6qG_templatesButton",
847
+ "lightboxZoomLevel": "rwa6qG_lightboxZoomLevel",
848
+ "canvasBody": "rwa6qG_canvasBody",
849
+ "lightboxStage": "rwa6qG_lightboxStage",
850
+ "download": "rwa6qG_download",
851
+ "galleryCardFooter": "rwa6qG_galleryCardFooter",
852
+ "canvasError": "rwa6qG_canvasError",
853
+ "lightboxMeta": "rwa6qG_lightboxMeta",
854
+ "image": "rwa6qG_image",
855
+ "historyList": "rwa6qG_historyList",
856
+ "modelMenuItem": "rwa6qG_modelMenuItem",
857
+ "optionPill": "rwa6qG_optionPill",
858
+ "canvasMeta": "rwa6qG_canvasMeta",
859
+ "galleryFilter": "rwa6qG_galleryFilter",
847
860
  "lightboxFigure": "rwa6qG_lightboxFigure",
848
- "taskStatus": "rwa6qG_taskStatus",
861
+ "compareToggle": "rwa6qG_compareToggle",
862
+ "entry": "rwa6qG_entry",
863
+ "paramLabel": "rwa6qG_paramLabel",
864
+ "galleryClear": "rwa6qG_galleryClear",
865
+ "historyMeta": "rwa6qG_historyMeta",
866
+ "taskPrompt": "rwa6qG_taskPrompt",
867
+ "modeRow": "rwa6qG_modeRow",
868
+ "githubLink": "rwa6qG_githubLink",
849
869
  "lightboxCaption": "rwa6qG_lightboxCaption",
850
- "canvasMeta": "rwa6qG_canvasMeta",
851
- "compareModelChoices": "rwa6qG_compareModelChoices",
852
- "comparisonFullscreenGrid": "rwa6qG_comparisonFullscreenGrid",
853
- "historyPrompt": "rwa6qG_historyPrompt",
854
- "panelTitle": "rwa6qG_panelTitle",
855
- "historyMain": "rwa6qG_historyMain",
856
- "studio": "rwa6qG_studio",
857
- "panelHeading": "rwa6qG_panelHeading",
858
- "prompt": "rwa6qG_prompt",
859
- "dshImageGenSpin": "rwa6qG_dshImageGenSpin",
860
- "taskTrayClose": "rwa6qG_taskTrayClose",
861
- "lightboxActions": "rwa6qG_lightboxActions",
862
- "gallerySelectionClear": "rwa6qG_gallerySelectionClear",
870
+ "galleryFilterNote": "rwa6qG_galleryFilterNote",
871
+ "galleryViewToggle": "rwa6qG_galleryViewToggle",
872
+ "comparisonImageButton": "rwa6qG_comparisonImageButton",
873
+ "taskTrayCount": "rwa6qG_taskTrayCount",
874
+ "taskStatus": "rwa6qG_taskStatus",
875
+ "view": "rwa6qG_view",
876
+ "lightboxTools": "rwa6qG_lightboxTools",
877
+ "comparisonBoard": "rwa6qG_comparisonBoard",
863
878
  "gallerySelect": "rwa6qG_gallerySelect",
864
- "galleryCardInfo": "rwa6qG_galleryCardInfo",
865
- "galleryCount": "rwa6qG_galleryCount",
866
- "galleryTagInput": "rwa6qG_galleryTagInput",
867
- "config": "rwa6qG_config",
868
- "galleryFilterCount": "rwa6qG_galleryFilterCount",
869
- "galleryRatioList": "rwa6qG_galleryRatioList",
870
- "configGuide": "rwa6qG_configGuide",
871
- "historyFilters": "rwa6qG_historyFilters",
872
- "galleryTags": "rwa6qG_galleryTags",
873
- "modelMenuItem": "rwa6qG_modelMenuItem",
879
+ "canvasEmptyIcon": "rwa6qG_canvasEmptyIcon",
880
+ "galleryAdd": "rwa6qG_galleryAdd",
881
+ "modelSelect": "rwa6qG_modelSelect",
874
882
  "uploadHint": "rwa6qG_uploadHint",
875
- "gallerySort": "rwa6qG_gallerySort",
876
- "galleryImage": "rwa6qG_galleryImage",
877
- "taskRows": "rwa6qG_taskRows",
878
- "taskTrayHeader": "rwa6qG_taskTrayHeader",
879
- "paramHint": "rwa6qG_paramHint",
883
+ "galleryFilterCount": "rwa6qG_galleryFilterCount",
884
+ "updateActions": "rwa6qG_updateActions",
885
+ "config": "rwa6qG_config",
886
+ "lightboxDownload": "rwa6qG_lightboxDownload",
887
+ "lightboxNav": "rwa6qG_lightboxNav",
888
+ "historyEmpty": "rwa6qG_historyEmpty",
889
+ "galleryToolbar": "rwa6qG_galleryToolbar",
890
+ "galleryHeading": "rwa6qG_galleryHeading",
891
+ "comparisonFullscreenGrid": "rwa6qG_comparisonFullscreenGrid",
892
+ "taskTrayChevron": "rwa6qG_taskTrayChevron",
893
+ "galleryTagEdit": "rwa6qG_galleryTagEdit",
894
+ "updateRelease": "rwa6qG_updateRelease",
895
+ "updateText": "rwa6qG_updateText",
896
+ "historyThumbPlaceholder": "rwa6qG_historyThumbPlaceholder",
897
+ "panel": "rwa6qG_panel",
880
898
  "imageCard": "rwa6qG_imageCard",
881
- "download": "rwa6qG_download",
882
- "historyHeader": "rwa6qG_historyHeader",
883
- "taskPrompt": "rwa6qG_taskPrompt",
884
- "canvasError": "rwa6qG_canvasError",
885
- "modeRow": "rwa6qG_modeRow",
886
- "paramGroup": "rwa6qG_paramGroup",
887
- "galleryFilter": "rwa6qG_galleryFilter",
888
- "galleryTagFilterList": "rwa6qG_galleryTagFilterList",
889
- "lightboxEdit": "rwa6qG_lightboxEdit",
890
- "history": "rwa6qG_history",
891
- "historyClear": "rwa6qG_historyClear",
892
- "generateInner": "rwa6qG_generateInner",
893
- "lightboxMeta": "rwa6qG_lightboxMeta",
894
- "galleryFilterHeading": "rwa6qG_galleryFilterHeading",
899
+ "galleryBadge": "rwa6qG_galleryBadge",
900
+ "paramHint": "rwa6qG_paramHint",
901
+ "configScroll": "rwa6qG_configScroll",
902
+ "modePill": "rwa6qG_modePill",
903
+ "historyFilters": "rwa6qG_historyFilters",
904
+ "panelTitle": "rwa6qG_panelTitle",
895
905
  "entryLabel": "rwa6qG_entryLabel",
896
- "compareToggle": "rwa6qG_compareToggle",
897
- "uploadIcon": "rwa6qG_uploadIcon",
906
+ "footer": "rwa6qG_footer",
907
+ "imageCaption": "rwa6qG_imageCaption",
908
+ "panelHeading": "rwa6qG_panelHeading",
909
+ "compareModelChoices": "rwa6qG_compareModelChoices",
910
+ "compareControl": "rwa6qG_compareControl",
911
+ "historySearch": "rwa6qG_historySearch",
912
+ "galleryCard": "rwa6qG_galleryCard",
913
+ "uploadBox": "rwa6qG_uploadBox",
898
914
  "galleryAvatar": "rwa6qG_galleryAvatar",
899
- "galleryImageButton": "rwa6qG_galleryImageButton",
900
- "modelMenuList": "rwa6qG_modelMenuList",
901
- "historyThumb": "rwa6qG_historyThumb",
902
- "lightboxZoomLevel": "rwa6qG_lightboxZoomLevel",
903
- "canvas": "rwa6qG_canvas",
904
- "taskRow": "rwa6qG_taskRow",
905
- "canvasState": "rwa6qG_canvasState",
915
+ "taskTray": "rwa6qG_taskTray",
916
+ "historyItem": "rwa6qG_historyItem",
917
+ "promptFooter": "rwa6qG_promptFooter",
906
918
  "canvasStateTitle": "rwa6qG_canvasStateTitle",
907
- "canvasStateHint": "rwa6qG_canvasStateHint",
919
+ "lightboxTool": "rwa6qG_lightboxTool",
920
+ "galleryFilterDivider": "rwa6qG_galleryFilterDivider",
921
+ "historyActions": "rwa6qG_historyActions",
922
+ "modelMenuList": "rwa6qG_modelMenuList",
923
+ "historyPrompt": "rwa6qG_historyPrompt",
924
+ "taskRows": "rwa6qG_taskRows",
925
+ "configGuideBody": "rwa6qG_configGuideBody",
926
+ "grid": "rwa6qG_grid",
927
+ "modelLabel": "rwa6qG_modelLabel",
928
+ "uploadIcon": "rwa6qG_uploadIcon",
908
929
  "galleryToast": "rwa6qG_galleryToast",
909
- "galleryRatio": "rwa6qG_galleryRatio",
910
- "historyInfo": "rwa6qG_historyInfo",
911
- "card": "rwa6qG_card",
930
+ "updateBanner": "rwa6qG_updateBanner",
931
+ "lightboxIndex": "rwa6qG_lightboxIndex",
932
+ "lightboxEdit": "rwa6qG_lightboxEdit",
933
+ "lightboxScaleFrame": "rwa6qG_lightboxScaleFrame",
912
934
  "enhanceButton": "rwa6qG_enhanceButton",
913
- "updateText": "rwa6qG_updateText",
914
- "historyThumbPlaceholder": "rwa6qG_historyThumbPlaceholder",
915
- "galleryHeading": "rwa6qG_galleryHeading",
916
- "galleryTagEditor": "rwa6qG_galleryTagEditor",
917
- "modelSelect": "rwa6qG_modelSelect",
918
- "promptFooter": "rwa6qG_promptFooter",
919
- "zoomHint": "rwa6qG_zoomHint",
920
- "lightboxClose": "rwa6qG_lightboxClose",
921
- "historyMeta": "rwa6qG_historyMeta",
922
- "galleryWorkspace": "rwa6qG_galleryWorkspace",
923
- "footer": "rwa6qG_footer",
924
- "updateRelease": "rwa6qG_updateRelease",
925
- "optionPill": "rwa6qG_optionPill",
926
- "historyList": "rwa6qG_historyList",
935
+ "galleryFilterHeading": "rwa6qG_galleryFilterHeading",
936
+ "referenceImage": "rwa6qG_referenceImage",
937
+ "galleryRatio": "rwa6qG_galleryRatio",
938
+ "galleryCount": "rwa6qG_galleryCount",
939
+ "galleryTags": "rwa6qG_galleryTags",
940
+ "optionRow": "rwa6qG_optionRow",
941
+ "taskTrayHeader": "rwa6qG_taskTrayHeader",
942
+ "galleryRemove": "rwa6qG_galleryRemove",
927
943
  "generateButton": "rwa6qG_generateButton",
928
- "galleryFilterDivider": "rwa6qG_galleryFilterDivider",
929
- "galleryFilters": "rwa6qG_galleryFilters",
930
- "historyEmpty": "rwa6qG_historyEmpty",
931
- "canvasBody": "rwa6qG_canvasBody",
932
- "galleryToolbar": "rwa6qG_galleryToolbar",
933
944
  "historyTitle": "rwa6qG_historyTitle",
934
- "image": "rwa6qG_image",
935
- "lightboxTool": "rwa6qG_lightboxTool",
945
+ "historyThumb": "rwa6qG_historyThumb",
936
946
  "gallerySelectionBar": "rwa6qG_gallerySelectionBar",
937
- "galleryCard": "rwa6qG_galleryCard",
938
- "entryIcon": "rwa6qG_entryIcon",
939
- "lightbox": "rwa6qG_lightbox",
940
- "optionGrid": "rwa6qG_optionGrid",
941
- "lightboxTools": "rwa6qG_lightboxTools",
942
- "lightboxIndex": "rwa6qG_lightboxIndex",
943
- "panelHeader": "rwa6qG_panelHeader",
944
947
  "spinner": "rwa6qG_spinner",
945
- "lightboxStage": "rwa6qG_lightboxStage",
946
- "galleryFilterNote": "rwa6qG_galleryFilterNote",
947
- "dshImageGenToastIn": "rwa6qG_dshImageGenToastIn",
948
- "comparisonGrid": "rwa6qG_comparisonGrid",
949
- "historyItem": "rwa6qG_historyItem",
950
- "lightboxCaptionRow": "rwa6qG_lightboxCaptionRow",
948
+ "historyHeader": "rwa6qG_historyHeader",
951
949
  "modelMenu": "rwa6qG_modelMenu",
952
- "paramLabel": "rwa6qG_paramLabel",
950
+ "history": "rwa6qG_history",
951
+ "canvasHistoryTag": "rwa6qG_canvasHistoryTag",
952
+ "galleryCardInfo": "rwa6qG_galleryCardInfo",
953
+ "historyAction": "rwa6qG_historyAction",
954
+ "galleryImageButton": "rwa6qG_galleryImageButton",
953
955
  "taskTrayToggle": "rwa6qG_taskTrayToggle",
954
- "uploadBox": "rwa6qG_uploadBox",
955
- "configGuideBody": "rwa6qG_configGuideBody",
956
- "hiddenFile": "rwa6qG_hiddenFile",
957
- "lightboxCopy": "rwa6qG_lightboxCopy",
958
- "galleryAdd": "rwa6qG_galleryAdd",
959
- "imageCaption": "rwa6qG_imageCaption",
960
- "historySearch": "rwa6qG_historySearch",
961
- "lightboxDownload": "rwa6qG_lightboxDownload",
956
+ "prompt": "rwa6qG_prompt",
957
+ "comparisonGrid": "rwa6qG_comparisonGrid",
958
+ "canvasState": "rwa6qG_canvasState",
962
959
  "galleryToolbarActions": "rwa6qG_galleryToolbarActions",
963
- "taskTrayCount": "rwa6qG_taskTrayCount",
964
- "comparisonFullscreen": "rwa6qG_comparisonFullscreen",
965
- "galleryTagEdit": "rwa6qG_galleryTagEdit",
966
- "comparisonImageButton": "rwa6qG_comparisonImageButton",
967
- "compareControl": "rwa6qG_compareControl",
968
- "historyAction": "rwa6qG_historyAction",
969
- "comparisonBoard": "rwa6qG_comparisonBoard",
970
- "modelWrap": "rwa6qG_modelWrap",
971
- "galleryCardFooter": "rwa6qG_galleryCardFooter"
960
+ "connectionStatus": "rwa6qG_connectionStatus",
961
+ "entryIcon": "rwa6qG_entryIcon",
962
+ "galleryImage": "rwa6qG_galleryImage",
963
+ "taskRow": "rwa6qG_taskRow",
964
+ "lightboxImage": "rwa6qG_lightboxImage",
965
+ "galleryRatioList": "rwa6qG_galleryRatioList",
966
+ "gallerySelectionClear": "rwa6qG_gallerySelectionClear",
967
+ "historyMain": "rwa6qG_historyMain",
968
+ "card": "rwa6qG_card",
969
+ "dshImageGenSpin": "rwa6qG_dshImageGenSpin",
970
+ "dshImageGenToastIn": "rwa6qG_dshImageGenToastIn",
971
+ "galleryTagFilter": "rwa6qG_galleryTagFilter",
972
+ "galleryMasonry": "rwa6qG_galleryMasonry",
973
+ "taskTrayClose": "rwa6qG_taskTrayClose",
974
+ "configGuide": "rwa6qG_configGuide",
975
+ "galleryFilters": "rwa6qG_galleryFilters",
976
+ "gallerySelectMode": "rwa6qG_gallerySelectMode",
977
+ "canvasStateHint": "rwa6qG_canvasStateHint",
978
+ "galleryTagInput": "rwa6qG_galleryTagInput",
979
+ "lightbox": "rwa6qG_lightbox",
980
+ "connectionDot": "rwa6qG_connectionDot",
981
+ "panelHeader": "rwa6qG_panelHeader",
982
+ "referenceActions": "rwa6qG_referenceActions"
972
983
  };
973
984
  //#endregion
974
985
  //#region src/client/mount.tsx
@@ -1408,7 +1419,8 @@ window.__ModuleLoader__.load({
1408
1419
  function stripChannel(channel) {
1409
1420
  const models = channel.models.map((model) => ({
1410
1421
  alias: model.alias.trim(),
1411
- id: model.id.trim() === "" ? model.alias.trim() : model.id.trim()
1422
+ id: model.id.trim() === "" ? model.alias.trim() : model.id.trim(),
1423
+ ...model.category === void 0 ? {} : { category: model.category }
1412
1424
  })).filter((model) => model.alias !== "");
1413
1425
  return {
1414
1426
  id: channel.id,
@@ -1624,97 +1636,97 @@ window.__ModuleLoader__.load({
1624
1636
  document.head.appendChild(tag);
1625
1637
  }
1626
1638
  var settings_card_module_css_default = {
1627
- "channelDotWarn": "zmjoSq_channelDotWarn",
1628
- "badge": "zmjoSq_badge",
1629
- "invalid": "zmjoSq_invalid",
1630
- "footer": "zmjoSq_footer",
1631
- "channelAdd": "zmjoSq_channelAdd",
1639
+ "modelFetch": "zmjoSq_modelFetch",
1640
+ "channelHost": "zmjoSq_channelHost",
1641
+ "channelEmpty": "zmjoSq_channelEmpty",
1642
+ "notExposed": "zmjoSq_notExposed",
1643
+ "modelChip": "zmjoSq_modelChip",
1632
1644
  "editorClose": "zmjoSq_editorClose",
1633
- "modelRowRemove": "zmjoSq_modelRowRemove",
1645
+ "versionValue": "zmjoSq_versionValue",
1646
+ "editorTools": "zmjoSq_editorTools",
1634
1647
  "inlineDisclosure": "zmjoSq_inlineDisclosure",
1635
- "channelName": "zmjoSq_channelName",
1636
- "field": "zmjoSq_field",
1637
- "reset": "zmjoSq_reset",
1638
- "chevronOpen": "zmjoSq_chevronOpen",
1639
- "textarea": "zmjoSq_textarea",
1640
- "notExposed": "zmjoSq_notExposed",
1641
- "sectionHeader": "zmjoSq_sectionHeader",
1642
- "optionalContent": "zmjoSq_optionalContent",
1648
+ "channelAdd": "zmjoSq_channelAdd",
1649
+ "modelRow": "zmjoSq_modelRow",
1643
1650
  "channelAddRow": "zmjoSq_channelAddRow",
1644
- "channelEmpty": "zmjoSq_channelEmpty",
1645
- "channelDanger": "zmjoSq_channelDanger",
1646
- "editorField": "zmjoSq_editorField",
1647
- "chevron": "zmjoSq_chevron",
1648
- "sectionHint": "zmjoSq_sectionHint",
1649
- "modelCandidateList": "zmjoSq_modelCandidateList",
1650
- "save": "zmjoSq_save",
1651
- "header": "zmjoSq_header",
1652
- "addModel": "zmjoSq_addModel",
1653
- "name": "zmjoSq_name",
1654
- "discard": "zmjoSq_discard",
1655
- "editorHeader": "zmjoSq_editorHeader",
1656
- "channelMain": "zmjoSq_channelMain",
1657
- "detectOk": "zmjoSq_detectOk",
1658
- "presetMeta": "zmjoSq_presetMeta",
1659
- "channelBadge": "zmjoSq_channelBadge",
1660
- "channelMeta": "zmjoSq_channelMeta",
1661
- "versionValue": "zmjoSq_versionValue",
1662
- "label": "zmjoSq_label",
1663
1651
  "presetRow": "zmjoSq_presetRow",
1664
- "modelSummary": "zmjoSq_modelSummary",
1665
- "input": "zmjoSq_input",
1666
- "readOnly": "zmjoSq_readOnly",
1667
- "channelList": "zmjoSq_channelList",
1668
- "channelSection": "zmjoSq_channelSection",
1669
- "modelFetchRow": "zmjoSq_modelFetchRow",
1670
- "body": "zmjoSq_body",
1671
- "card": "zmjoSq_card",
1652
+ "editorDivider": "zmjoSq_editorDivider",
1653
+ "presetInline": "zmjoSq_presetInline",
1654
+ "sectionTitle": "zmjoSq_sectionTitle",
1672
1655
  "head": "zmjoSq_head",
1673
- "modelRows": "zmjoSq_modelRows",
1674
- "presetInlineHeader": "zmjoSq_presetInlineHeader",
1675
- "modelArrow": "zmjoSq_modelArrow",
1676
1656
  "presetList": "zmjoSq_presetList",
1657
+ "presetName": "zmjoSq_presetName",
1658
+ "pending": "zmjoSq_pending",
1659
+ "body": "zmjoSq_body",
1660
+ "manualModelRow": "zmjoSq_manualModelRow",
1661
+ "modelChoices": "zmjoSq_modelChoices",
1662
+ "footer": "zmjoSq_footer",
1663
+ "inputInvalid": "zmjoSq_inputInvalid",
1664
+ "readOnly": "zmjoSq_readOnly",
1665
+ "textarea": "zmjoSq_textarea",
1666
+ "header": "zmjoSq_header",
1667
+ "presetHint": "zmjoSq_presetHint",
1677
1668
  "versionRow": "zmjoSq_versionRow",
1669
+ "editorField": "zmjoSq_editorField",
1670
+ "presetInlineHeader": "zmjoSq_presetInlineHeader",
1671
+ "chevron": "zmjoSq_chevron",
1672
+ "editorFooter": "zmjoSq_editorFooter",
1673
+ "channelList": "zmjoSq_channelList",
1674
+ "badge": "zmjoSq_badge",
1678
1675
  "failed": "zmjoSq_failed",
1679
- "description": "zmjoSq_description",
1680
- "modelRow": "zmjoSq_modelRow",
1681
- "inputInvalid": "zmjoSq_inputInvalid",
1682
- "modelRowInputs": "zmjoSq_modelRowInputs",
1676
+ "save": "zmjoSq_save",
1683
1677
  "channelAction": "zmjoSq_channelAction",
1678
+ "channelRow": "zmjoSq_channelRow",
1679
+ "input": "zmjoSq_input",
1680
+ "card": "zmjoSq_card",
1681
+ "discard": "zmjoSq_discard",
1682
+ "channelMeta": "zmjoSq_channelMeta",
1683
+ "textareaInvalid": "zmjoSq_textareaInvalid",
1684
+ "hint": "zmjoSq_hint",
1685
+ "editorHeader": "zmjoSq_editorHeader",
1686
+ "modelSection": "zmjoSq_modelSection",
1687
+ "description": "zmjoSq_description",
1688
+ "detectOk": "zmjoSq_detectOk",
1689
+ "select": "zmjoSq_select",
1690
+ "sectionHeader": "zmjoSq_sectionHeader",
1691
+ "sectionDivider": "zmjoSq_sectionDivider",
1684
1692
  "channelDotReady": "zmjoSq_channelDotReady",
1693
+ "channelName": "zmjoSq_channelName",
1685
1694
  "editorSectionHeader": "zmjoSq_editorSectionHeader",
1695
+ "editorBackdrop": "zmjoSq_editorBackdrop",
1686
1696
  "modelCandidateLabel": "zmjoSq_modelCandidateLabel",
1687
- "modelChip": "zmjoSq_modelChip",
1688
- "editorFooter": "zmjoSq_editorFooter",
1689
- "presetHint": "zmjoSq_presetHint",
1690
- "sectionTitle": "zmjoSq_sectionTitle",
1691
- "versionLabel": "zmjoSq_versionLabel",
1692
- "hint": "zmjoSq_hint",
1693
- "badges": "zmjoSq_badges",
1694
- "textareaInvalid": "zmjoSq_textareaInvalid",
1695
- "sectionDivider": "zmjoSq_sectionDivider",
1696
- "modelCandidate": "zmjoSq_modelCandidate",
1697
- "modelRowBadges": "zmjoSq_modelRowBadges",
1698
- "channelHost": "zmjoSq_channelHost",
1699
- "pending": "zmjoSq_pending",
1700
1697
  "disclosure": "zmjoSq_disclosure",
1701
- "modelChoices": "zmjoSq_modelChoices",
1702
- "presetName": "zmjoSq_presetName",
1703
- "headText": "zmjoSq_headText",
1698
+ "channelMain": "zmjoSq_channelMain",
1699
+ "modelSummary": "zmjoSq_modelSummary",
1700
+ "modelRowRemove": "zmjoSq_modelRowRemove",
1701
+ "channelDanger": "zmjoSq_channelDanger",
1702
+ "deleteConfirmText": "zmjoSq_deleteConfirmText",
1703
+ "editorPanel": "zmjoSq_editorPanel",
1704
+ "modelCandidate": "zmjoSq_modelCandidate",
1704
1705
  "spacer": "zmjoSq_spacer",
1705
- "manualModelRow": "zmjoSq_manualModelRow",
1706
- "editorTools": "zmjoSq_editorTools",
1707
- "editorBackdrop": "zmjoSq_editorBackdrop",
1708
- "channelRow": "zmjoSq_channelRow",
1706
+ "name": "zmjoSq_name",
1707
+ "modelRowInputs": "zmjoSq_modelRowInputs",
1708
+ "badges": "zmjoSq_badges",
1709
+ "headText": "zmjoSq_headText",
1710
+ "modelRowBadges": "zmjoSq_modelRowBadges",
1711
+ "versionLabel": "zmjoSq_versionLabel",
1712
+ "optionalContent": "zmjoSq_optionalContent",
1713
+ "modelArrow": "zmjoSq_modelArrow",
1714
+ "channelDotWarn": "zmjoSq_channelDotWarn",
1715
+ "presetMeta": "zmjoSq_presetMeta",
1716
+ "reset": "zmjoSq_reset",
1717
+ "chevronOpen": "zmjoSq_chevronOpen",
1718
+ "label": "zmjoSq_label",
1719
+ "field": "zmjoSq_field",
1720
+ "modelFetchRow": "zmjoSq_modelFetchRow",
1721
+ "modelCandidateList": "zmjoSq_modelCandidateList",
1722
+ "sectionHint": "zmjoSq_sectionHint",
1723
+ "addModel": "zmjoSq_addModel",
1709
1724
  "modelBadge": "zmjoSq_modelBadge",
1725
+ "channelBadge": "zmjoSq_channelBadge",
1726
+ "modelRows": "zmjoSq_modelRows",
1710
1727
  "channelControls": "zmjoSq_channelControls",
1711
- "presetInline": "zmjoSq_presetInline",
1712
- "modelFetch": "zmjoSq_modelFetch",
1713
- "select": "zmjoSq_select",
1714
- "deleteConfirmText": "zmjoSq_deleteConfirmText",
1715
- "editorPanel": "zmjoSq_editorPanel",
1716
- "editorDivider": "zmjoSq_editorDivider",
1717
- "modelSection": "zmjoSq_modelSection"
1728
+ "channelSection": "zmjoSq_channelSection",
1729
+ "invalid": "zmjoSq_invalid"
1718
1730
  };
1719
1731
  //#endregion
1720
1732
  //#region src/client/SettingsCard.tsx
@@ -1781,18 +1793,20 @@ window.__ModuleLoader__.load({
1781
1793
  };
1782
1794
  }
1783
1795
  function modelsToText(models) {
1784
- return models.map((model) => `${model.alias}=${model.id}`).join("\n");
1796
+ return models.map((model) => `${model.alias}=${model.id}${model.category === void 0 ? "" : ` @${model.category}`}`).join("\n");
1785
1797
  }
1786
1798
  function textToModels(text) {
1787
1799
  return text.split(/\n|,/).map((line) => line.trim()).filter(Boolean).map((line) => {
1788
- const eq = line.indexOf("=");
1789
- if (eq < 0) return {
1790
- alias: line,
1791
- id: line
1792
- };
1800
+ const at = line.lastIndexOf(" @");
1801
+ const category = at >= 0 ? line.slice(at + 2).trim() : void 0;
1802
+ const body = at >= 0 ? line.slice(0, at).trim() : line;
1803
+ const eq = body.indexOf("=");
1804
+ const alias = eq >= 0 ? body.slice(0, eq).trim() : body.trim();
1805
+ const id = eq >= 0 ? body.slice(eq + 1).trim() : alias;
1793
1806
  return {
1794
- alias: line.slice(0, eq).trim(),
1795
- id: line.slice(eq + 1).trim()
1807
+ alias,
1808
+ id: id === "" ? alias : id,
1809
+ ...category === void 0 || category === "" ? {} : { category }
1796
1810
  };
1797
1811
  }).filter((model) => model.alias !== "");
1798
1812
  }
@@ -1805,6 +1819,8 @@ window.__ModuleLoader__.load({
1805
1819
  const [presets, setPresets] = (0, react.useState)([]);
1806
1820
  const [presetError, setPresetError] = (0, react.useState)(null);
1807
1821
  const [confirmDeleteId, setConfirmDeleteId] = (0, react.useState)(null);
1822
+ const [discovering, setDiscovering] = (0, react.useState)(false);
1823
+ const [discoverError, setDiscoverError] = (0, react.useState)(null);
1808
1824
  const [editName, setEditName] = (0, react.useState)("");
1809
1825
  const [editUrl, setEditUrl] = (0, react.useState)("");
1810
1826
  const [editKey, setEditKey] = (0, react.useState)("");
@@ -1839,6 +1855,30 @@ window.__ModuleLoader__.load({
1839
1855
  if (editDefault) props.channels.setDefaultChannel(editingId);
1840
1856
  setEditingId(null);
1841
1857
  };
1858
+ const discoverModels = async () => {
1859
+ if (editingId === null) return;
1860
+ setDiscovering(true);
1861
+ setDiscoverError(null);
1862
+ try {
1863
+ channels.find((channel) => channel.id === editingId);
1864
+ const response = await fetch(MODEL_API.discover, {
1865
+ method: "POST",
1866
+ headers: { "content-type": "application/json" },
1867
+ body: JSON.stringify({
1868
+ channelId: editingId,
1869
+ ...editUrl.trim() !== "" ? { apiUrl: editUrl.trim() } : {},
1870
+ ...editKey.trim() !== "" ? { apiKey: editKey.trim() } : {}
1871
+ })
1872
+ });
1873
+ const body = await response.json();
1874
+ if (body.ok !== true || body.models === void 0) throw new Error(body.message ?? `HTTP ${response.status}`);
1875
+ setEditModels(modelsToText([...body.models, ...textToModels(editModels).filter((existingModel) => !body.models.some((model) => model.id === existingModel.id))]));
1876
+ } catch (error) {
1877
+ setDiscoverError(error instanceof Error ? error.message : String(error));
1878
+ } finally {
1879
+ setDiscovering(false);
1880
+ }
1881
+ };
1842
1882
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
1843
1883
  className: settings_card_module_css_default.card,
1844
1884
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
@@ -2141,7 +2181,21 @@ window.__ModuleLoader__.load({
2141
2181
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2142
2182
  className: settings_card_module_css_default.sectionHint,
2143
2183
  children: t("channel.modelsHint")
2144
- })
2184
+ }),
2185
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2186
+ className: settings_card_module_css_default.channelAddRow,
2187
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2188
+ type: "button",
2189
+ className: settings_card_module_css_default.channelAdd,
2190
+ disabled: discovering || !state.writable,
2191
+ onClick: () => void discoverModels(),
2192
+ children: discovering ? "获取中…" : "获取可用模型"
2193
+ })
2194
+ }),
2195
+ discoverError !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2196
+ className: settings_card_module_css_default.failed,
2197
+ children: discoverError
2198
+ }) : null
2145
2199
  ]
2146
2200
  }),
2147
2201
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
@@ -2262,17 +2316,17 @@ window.__ModuleLoader__.load({
2262
2316
  document.head.appendChild(tag);
2263
2317
  }
2264
2318
  var audio_toolview_module_css_default = {
2265
- "error": "_7K1QKa_error",
2266
- "audio": "_7K1QKa_audio",
2267
- "download": "_7K1QKa_download",
2268
- "audioRow": "_7K1QKa_audioRow",
2269
2319
  "empty": "_7K1QKa_empty",
2270
- "status": "_7K1QKa_status",
2271
- "audios": "_7K1QKa_audios",
2272
2320
  "root": "_7K1QKa_root",
2321
+ "message": "_7K1QKa_message",
2322
+ "audio": "_7K1QKa_audio",
2323
+ "audios": "_7K1QKa_audios",
2324
+ "status": "_7K1QKa_status",
2325
+ "audioRow": "_7K1QKa_audioRow",
2326
+ "download": "_7K1QKa_download",
2273
2327
  "icon": "_7K1QKa_icon",
2274
2328
  "header": "_7K1QKa_header",
2275
- "message": "_7K1QKa_message"
2329
+ "error": "_7K1QKa_error"
2276
2330
  };
2277
2331
  //#endregion
2278
2332
  //#region src/client/audio-toolview.tsx