dsh-vidi 0.6.1 → 0.6.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.
Files changed (2) hide show
  1. package/lib/client.js +124 -22
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -34609,6 +34609,61 @@ function RestreamPanel(props) {
34609
34609
  // src/client/Settings.tsx
34610
34610
  /** Who runs a speech engine (engines of one vendor share its key). */
34611
34611
  const vendorOf = (p) => p.vendor ?? p.id;
34612
+ /** The usual model makers, listed first whether or not they are set up in DSH yet (ids and names are matched loosely). */
34613
+ const MAKERS = [
34614
+ {
34615
+ id: "deepseek",
34616
+ label: "DeepSeek",
34617
+ re: /deepseek/
34618
+ },
34619
+ {
34620
+ id: "openai",
34621
+ label: "OpenAI",
34622
+ re: /openai|chatgpt/
34623
+ },
34624
+ {
34625
+ id: "anthropic",
34626
+ label: "Anthropic",
34627
+ re: /anthropic|claude/
34628
+ },
34629
+ {
34630
+ id: "google",
34631
+ label: "Google",
34632
+ re: /google|gemini/
34633
+ },
34634
+ {
34635
+ id: "qwen",
34636
+ label: "Qwen",
34637
+ re: /qwen|dashscope|aliyun|bailian|tongyi/
34638
+ },
34639
+ {
34640
+ id: "glm",
34641
+ label: "GLM",
34642
+ re: /\bglm|zhipu|bigmodel|z\.ai/
34643
+ },
34644
+ {
34645
+ id: "kimi",
34646
+ label: "Kimi",
34647
+ re: /kimi|moonshot/
34648
+ },
34649
+ {
34650
+ id: "doubao",
34651
+ label: "Doubao",
34652
+ re: /doubao|volc|\bark\b/
34653
+ },
34654
+ {
34655
+ id: "minimax",
34656
+ label: "MiniMax",
34657
+ re: /minimax/
34658
+ },
34659
+ {
34660
+ id: "xai",
34661
+ label: "xAI",
34662
+ re: /\bxai\b|x\.ai|grok/
34663
+ }
34664
+ ];
34665
+ /** Which maker a DSH model provider belongs to; providers of no listed maker stand on their own. */
34666
+ const makerOf = (provider, name) => MAKERS.find((m) => m.re.test(`${provider} ${name}`.toLowerCase()))?.id ?? `p:${provider}`;
34612
34667
  /**
34613
34668
  * Subtitle models worth suggesting first: the fast, cheap tier of each family
34614
34669
  * (flash / mini / turbo / air / lite / haiku), newest first, and the one DSH
@@ -34692,6 +34747,22 @@ function Settings(props) {
34692
34747
  id: m.provider,
34693
34748
  name: m.providerName
34694
34749
  }])]).values()];
34750
+ const makerProviders = (maker) => providersOf.filter((p) => maker.startsWith("p:") ? `p:${p.id}` === maker : makerOf(p.id, p.name) === maker).map((p) => p.id);
34751
+ const [makerPick, setMakerPick] = (0, react.useState)(null);
34752
+ const shownMaker = makerPick ?? (current ? makerOf(current.provider, providersOf.find((p) => p.id === current.provider)?.name ?? "") : "deepseek");
34753
+ const makerUnset = makerProviders(shownMaker).length === 0;
34754
+ const chooseMaker = (maker) => {
34755
+ const ids = makerProviders(maker);
34756
+ if (!ids.length) {
34757
+ setMakerPick(maker);
34758
+ return;
34759
+ }
34760
+ setMakerPick(null);
34761
+ const list = (models?.models ?? []).filter((m) => ids.includes(m.provider));
34762
+ const rec = recommended(list, models?.fallback && ids.includes(models.fallback.provider) ? models.fallback.model : void 0);
34763
+ const pick = list.find((m) => rec.has(m.model)) ?? list[0];
34764
+ if (pick) chooseModel(modelKey(pick));
34765
+ };
34695
34766
  const sees = !!models?.models.find((x) => modelKey(x) === modelKey(current))?.image;
34696
34767
  const saveKey = async (value) => {
34697
34768
  if (!cur) return;
@@ -34747,8 +34818,7 @@ function Settings(props) {
34747
34818
  options: vendors.map((p) => ({
34748
34819
  value: vendorOf(p),
34749
34820
  label: vendorName(vendorOf(p)),
34750
- hint: p.ready ? void 0 : t(p.online ? "set.engine.noKey" : "set.engine.notInstalled"),
34751
- group: p.online ? t(p.region === "cn" ? "set.engine.cn" : "set.engine.intl") : void 0
34821
+ hint: p.ready ? void 0 : t(p.online ? "set.engine.noKey" : "set.engine.notInstalled")
34752
34822
  }))
34753
34823
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Pick, {
34754
34824
  value: engine,
@@ -34836,47 +34906,59 @@ function Settings(props) {
34836
34906
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
34837
34907
  className: "duo",
34838
34908
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Pick, {
34839
- value: current?.provider ?? "",
34909
+ value: shownMaker,
34840
34910
  placeholder: "…",
34841
- onChange: (v) => {
34842
- const list = (models?.models ?? []).filter((m) => m.provider === v);
34843
- const rec = recommended(list, models?.fallback?.provider === v ? models.fallback.model : void 0);
34844
- const pick = list.find((m) => rec.has(m.model)) ?? list[0];
34845
- if (pick) chooseModel(modelKey(pick));
34846
- },
34847
- options: providersOf.map((p) => ({
34848
- value: p.id,
34849
- label: p.name
34850
- }))
34911
+ onChange: chooseMaker,
34912
+ options: [...MAKERS.map((m) => ({
34913
+ value: m.id,
34914
+ label: t(`maker.${m.id}`) !== `maker.${m.id}` ? t(`maker.${m.id}`) : m.label,
34915
+ hint: makerProviders(m.id).length ? void 0 : t("set.model.notSet")
34916
+ })), ...providersOf.filter((p) => makerOf(p.id, p.name).startsWith("p:")).map((p) => ({
34917
+ value: `p:${p.id}`,
34918
+ label: p.name,
34919
+ group: t("set.others")
34920
+ }))]
34851
34921
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Pick, {
34852
- value: modelKey(current),
34853
- placeholder: "…",
34922
+ value: makerUnset ? "" : modelKey(current),
34923
+ placeholder: makerUnset ? "—" : "…",
34924
+ disabled: makerUnset,
34854
34925
  onChange: chooseModel,
34855
34926
  options: (() => {
34856
- const listed = (models?.models ?? []).filter((m) => m.provider === current?.provider);
34857
- const list = current && !listed.some((m) => m.model === current.model) ? [{
34927
+ const ids = makerProviders(shownMaker);
34928
+ const listed = (models?.models ?? []).filter((m) => ids.includes(m.provider));
34929
+ const list = current && ids.includes(current.provider) && !listed.some((m) => m.provider === current.provider && m.model === current.model) ? [{
34858
34930
  provider: current.provider,
34859
34931
  providerName: current.provider,
34860
34932
  model: current.model,
34861
34933
  name: current.model,
34862
34934
  image: false
34863
34935
  }, ...listed] : listed;
34864
- const rec = recommended(list, models?.fallback?.provider === current?.provider ? models?.fallback?.model : void 0);
34865
- const tag = (m) => [modelKey(m) === modelKey(models?.fallback) ? t("set.model.dshDefault") : "", m.image ? t("set.model.image") : ""].filter(Boolean).join(" · ") || void 0;
34866
- return [...list.filter((m) => rec.has(m.model)).map((m) => ({
34936
+ const rec = recommended(list, models?.fallback && ids.includes(models.fallback.provider) ? models.fallback.model : void 0);
34937
+ const several = ids.length > 1;
34938
+ const tag = (m) => [
34939
+ several ? m.providerName : "",
34940
+ modelKey(m) === modelKey(models?.fallback) ? t("set.model.dshDefault") : "",
34941
+ m.image ? t("set.model.image") : ""
34942
+ ].filter(Boolean).join(" · ") || void 0;
34943
+ const top = list.filter((m) => rec.has(m.model));
34944
+ return [...top.map((m) => ({
34867
34945
  value: modelKey(m),
34868
34946
  label: m.name,
34869
34947
  hint: tag(m),
34870
34948
  group: t("set.recommended")
34871
- })), ...list.filter((m) => !rec.has(m.model)).map((m) => ({
34949
+ })), ...list.filter((m) => !top.includes(m)).map((m) => ({
34872
34950
  value: modelKey(m),
34873
34951
  label: m.name,
34874
34952
  hint: tag(m),
34875
- group: rec.size ? t("set.allModels") : void 0
34953
+ group: top.length ? several ? m.providerName : t("set.allModels") : void 0
34876
34954
  }))];
34877
34955
  })()
34878
34956
  })]
34879
34957
  }),
34958
+ makerUnset && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
34959
+ className: "hint",
34960
+ children: t("set.model.addInDsh").replace("{v}", MAKERS.find((m) => m.id === shownMaker)?.label ?? shownMaker)
34961
+ }),
34880
34962
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
34881
34963
  className: "hint",
34882
34964
  children: t(sees ? "set.model.sees" : "set.model.text")
@@ -36928,6 +37010,16 @@ const en = {
36928
37010
  "engine.openai-translate": "OpenAI live translation",
36929
37011
  "set.engine.intl": "Online",
36930
37012
  "set.recommended": "Recommended",
37013
+ "set.others": "Other",
37014
+ "set.model.notSet": "not set up",
37015
+ "set.model.addInDsh": "{v} is not set up in DSH yet. Add it under DSH Settings → Models; it shows up here right after.",
37016
+ "maker.qwen": "Qwen (Alibaba)",
37017
+ "maker.glm": "GLM (Zhipu)",
37018
+ "maker.kimi": "Kimi (Moonshot)",
37019
+ "maker.doubao": "Doubao (ByteDance)",
37020
+ "maker.xai": "xAI (Grok)",
37021
+ "maker.anthropic": "Anthropic (Claude)",
37022
+ "maker.google": "Google (Gemini)",
36931
37023
  "set.allModels": "All models",
36932
37024
  "set.model.dshDefault": "DSH default",
36933
37025
  "engine.note.openai-translate": "listens and translates",
@@ -37287,6 +37379,16 @@ const zh = {
37287
37379
  "engine.openai-translate": "OpenAI 实时翻译",
37288
37380
  "set.engine.intl": "在线 · 海外",
37289
37381
  "set.recommended": "推荐",
37382
+ "set.others": "其他",
37383
+ "set.model.notSet": "未配置",
37384
+ "set.model.addInDsh": "还没在 DSH 里配置 {v}。到 DSH 设置 → 模型 里添加,加好后这里就能选。",
37385
+ "maker.qwen": "通义千问",
37386
+ "maker.glm": "智谱 GLM",
37387
+ "maker.kimi": "Kimi",
37388
+ "maker.doubao": "豆包",
37389
+ "maker.xai": "xAI(Grok)",
37390
+ "maker.anthropic": "Anthropic(Claude)",
37391
+ "maker.google": "Google(Gemini)",
37290
37392
  "set.allModels": "全部模型",
37291
37393
  "set.model.dshDefault": "DSH 默认",
37292
37394
  "engine.note.openai-translate": "边听边翻",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-vidi",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "A video tool for DeepSeek Harness: watch live streams, videos and podcasts with real-time subtitles in any language, then clip and download",
5
5
  "type": "module",
6
6
  "license": "PolyForm-Noncommercial-1.0.0",