dsh-vidi 0.6.0 → 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 +130 -24
  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
@@ -34616,8 +34671,12 @@ const vendorOf = (p) => p.vendor ?? p.id;
34616
34671
  */
34617
34672
  function recommended(models, fallback) {
34618
34673
  const ver = (n) => Number(/(\d+(?:\.\d+)?)/.exec(n)?.[1] ?? 0);
34619
- const picks = models.filter((m) => /flash|mini|turbo|\bair\b|-air|lite|haiku/i.test(`${m.model} ${m.name}`) && !/embed|tts|audio|image|vision-preview|realtime/i.test(m.model)).sort((a, b) => ver(b.model) - ver(a.model)).slice(0, 2).map((m) => m.model);
34620
- if (fallback && models.some((m) => m.model === fallback)) picks.unshift(fallback);
34674
+ const tier = /(^|[-_\s./])(flash|mini|turbo|air|lite|haiku)($|[-_\s./\d])/i;
34675
+ const usable = models.filter((m) => !/embed|tts|audio|image-|realtime|rerank/i.test(m.model));
34676
+ const fast = usable.filter((m) => tier.test(m.model) || tier.test(m.name));
34677
+ const v = (m) => ver(m.name) || ver(m.model);
34678
+ const picks = (fast.length ? fast : usable).slice().sort((a, b) => v(b) - v(a)).slice(0, fast.length ? 2 : 1).map((m) => m.model);
34679
+ if (fallback && models.some((m) => m.model === fallback) && !picks.includes(fallback)) picks.unshift(fallback);
34621
34680
  return new Set(picks);
34622
34681
  }
34623
34682
  const engineLabel = (t, id) => {
@@ -34688,6 +34747,22 @@ function Settings(props) {
34688
34747
  id: m.provider,
34689
34748
  name: m.providerName
34690
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
+ };
34691
34766
  const sees = !!models?.models.find((x) => modelKey(x) === modelKey(current))?.image;
34692
34767
  const saveKey = async (value) => {
34693
34768
  if (!cur) return;
@@ -34743,8 +34818,7 @@ function Settings(props) {
34743
34818
  options: vendors.map((p) => ({
34744
34819
  value: vendorOf(p),
34745
34820
  label: vendorName(vendorOf(p)),
34746
- hint: p.ready ? void 0 : t(p.online ? "set.engine.noKey" : "set.engine.notInstalled"),
34747
- 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")
34748
34822
  }))
34749
34823
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Pick, {
34750
34824
  value: engine,
@@ -34832,47 +34906,59 @@ function Settings(props) {
34832
34906
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
34833
34907
  className: "duo",
34834
34908
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Pick, {
34835
- value: current?.provider ?? "",
34909
+ value: shownMaker,
34836
34910
  placeholder: "…",
34837
- onChange: (v) => {
34838
- const list = (models?.models ?? []).filter((m) => m.provider === v);
34839
- const rec = recommended(list, models?.fallback?.provider === v ? models.fallback.model : void 0);
34840
- const pick = list.find((m) => rec.has(m.model)) ?? list[0];
34841
- if (pick) chooseModel(modelKey(pick));
34842
- },
34843
- options: providersOf.map((p) => ({
34844
- value: p.id,
34845
- label: p.name
34846
- }))
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
+ }))]
34847
34921
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Pick, {
34848
- value: modelKey(current),
34849
- placeholder: "…",
34922
+ value: makerUnset ? "" : modelKey(current),
34923
+ placeholder: makerUnset ? "—" : "…",
34924
+ disabled: makerUnset,
34850
34925
  onChange: chooseModel,
34851
34926
  options: (() => {
34852
- const listed = (models?.models ?? []).filter((m) => m.provider === current?.provider);
34853
- 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) ? [{
34854
34930
  provider: current.provider,
34855
34931
  providerName: current.provider,
34856
34932
  model: current.model,
34857
34933
  name: current.model,
34858
34934
  image: false
34859
34935
  }, ...listed] : listed;
34860
- const rec = recommended(list, models?.fallback?.provider === current?.provider ? models?.fallback?.model : void 0);
34861
- const tag = (m) => [modelKey(m) === modelKey(models?.fallback) ? t("set.model.dshDefault") : "", m.image ? t("set.model.image") : ""].filter(Boolean).join(" · ") || void 0;
34862
- 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) => ({
34863
34945
  value: modelKey(m),
34864
34946
  label: m.name,
34865
34947
  hint: tag(m),
34866
34948
  group: t("set.recommended")
34867
- })), ...list.filter((m) => !rec.has(m.model)).map((m) => ({
34949
+ })), ...list.filter((m) => !top.includes(m)).map((m) => ({
34868
34950
  value: modelKey(m),
34869
34951
  label: m.name,
34870
34952
  hint: tag(m),
34871
- group: rec.size ? t("set.allModels") : void 0
34953
+ group: top.length ? several ? m.providerName : t("set.allModels") : void 0
34872
34954
  }))];
34873
34955
  })()
34874
34956
  })]
34875
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
+ }),
34876
34962
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
34877
34963
  className: "hint",
34878
34964
  children: t(sees ? "set.model.sees" : "set.model.text")
@@ -36924,6 +37010,16 @@ const en = {
36924
37010
  "engine.openai-translate": "OpenAI live translation",
36925
37011
  "set.engine.intl": "Online",
36926
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)",
36927
37023
  "set.allModels": "All models",
36928
37024
  "set.model.dshDefault": "DSH default",
36929
37025
  "engine.note.openai-translate": "listens and translates",
@@ -37283,6 +37379,16 @@ const zh = {
37283
37379
  "engine.openai-translate": "OpenAI 实时翻译",
37284
37380
  "set.engine.intl": "在线 · 海外",
37285
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)",
37286
37392
  "set.allModels": "全部模型",
37287
37393
  "set.model.dshDefault": "DSH 默认",
37288
37394
  "engine.note.openai-translate": "边听边翻",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-vidi",
3
- "version": "0.6.0",
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",