dsh-plugin-litellm-bridge 2.0.7 → 2.0.8
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.
|
@@ -582,6 +582,29 @@ window.__ModuleLoader__.load({
|
|
|
582
582
|
}
|
|
583
583
|
}, [draft, pid]);
|
|
584
584
|
|
|
585
|
+
// 模型池按供应商分组,供下拉与"添加"列表使用
|
|
586
|
+
//
|
|
587
|
+
// 【React #310 血案】这个 useMemo 原来写在下面两个提前 return **之后**:
|
|
588
|
+
// if (!draft) return ...; ← 首次渲染 draft=null,从这里返回
|
|
589
|
+
// if (!prof) return ...;
|
|
590
|
+
// const byProvider = useMemo(...) ← 首次渲染根本执行不到
|
|
591
|
+
// 第二次渲染(routes/get 返回后 draft 有值)才执行到这一行,
|
|
592
|
+
// hooks 数量从 N 变成 N+1 → React 抛
|
|
593
|
+
// "Rendered more hooks than during the previous render."(#310)
|
|
594
|
+
// 表现:点「路由配置」→ 整页空白。
|
|
595
|
+
//
|
|
596
|
+
// 规则:**所有 hooks 必须写在任何条件 return 之前**,保证每次渲染
|
|
597
|
+
// 执行完全一样多的 hooks。所以把它移到这里。
|
|
598
|
+
const byProvider = useMemo(() => {
|
|
599
|
+
const m = new Map();
|
|
600
|
+
for (const x of pool.models || []) {
|
|
601
|
+
const key = x.provider || '未知供应商';
|
|
602
|
+
if (!m.has(key)) m.set(key, []);
|
|
603
|
+
m.get(key).push(x);
|
|
604
|
+
}
|
|
605
|
+
return [...m.entries()];
|
|
606
|
+
}, [pool.models]);
|
|
607
|
+
|
|
585
608
|
// 加载失败时给出可读原因 + 重试,而不是无限「加载中…」
|
|
586
609
|
if (!draft) {
|
|
587
610
|
return h('div', null,
|
|
@@ -700,17 +723,6 @@ window.__ModuleLoader__.load({
|
|
|
700
723
|
setBusy(false);
|
|
701
724
|
};
|
|
702
725
|
|
|
703
|
-
// 模型池按供应商分组,供下拉与"添加"列表使用
|
|
704
|
-
const byProvider = useMemo(() => {
|
|
705
|
-
const m = new Map();
|
|
706
|
-
for (const x of pool.models || []) {
|
|
707
|
-
const key = x.provider || '未知供应商';
|
|
708
|
-
if (!m.has(key)) m.set(key, []);
|
|
709
|
-
m.get(key).push(x);
|
|
710
|
-
}
|
|
711
|
-
return [...m.entries()];
|
|
712
|
-
}, [pool.models]);
|
|
713
|
-
|
|
714
726
|
const allIds = (pool.models || []).map((x) => x.id);
|
|
715
727
|
|
|
716
728
|
return h('div', null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-litellm-bridge",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8",
|
|
4
4
|
"description": "LiteLLM gateway bridge for DSH: assemble root / coder / research fallback chains from the DSH model pool and hand the order to a LiteLLM gateway that executes retries and fallbacks. The plugin performs no routing itself.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|