protocol-proxy 1.1.0 → 1.1.1
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/package.json +1 -1
- package/public/app.js +21 -0
package/package.json
CHANGED
package/public/app.js
CHANGED
|
@@ -481,6 +481,27 @@ function openModal(id = null) {
|
|
|
481
481
|
if (t.providerUrl && !findProviderByUrl(t.providerUrl)) {
|
|
482
482
|
addProvider(getProviderDisplayName(t.providerUrl), t.providerUrl);
|
|
483
483
|
}
|
|
484
|
+
|
|
485
|
+
// 迁移旧模型数据:从按代理ID存储 → 按供应商URL存储
|
|
486
|
+
if (t.providerUrl) {
|
|
487
|
+
const existingByProvider = loadModelsByProvider(t.providerUrl);
|
|
488
|
+
if (existingByProvider.length === 0) {
|
|
489
|
+
// 优先用服务端的模型列表
|
|
490
|
+
let modelsToMigrate = Array.isArray(t.models) ? t.models.filter(Boolean) : [];
|
|
491
|
+
// 兼容旧版 localStorage(按代理ID存储)
|
|
492
|
+
if (modelsToMigrate.length === 0) {
|
|
493
|
+
const legacyKey = `protocol-proxy-models-${id}`;
|
|
494
|
+
try {
|
|
495
|
+
const legacy = JSON.parse(localStorage.getItem(legacyKey));
|
|
496
|
+
if (Array.isArray(legacy)) modelsToMigrate = legacy;
|
|
497
|
+
} catch {}
|
|
498
|
+
}
|
|
499
|
+
if (modelsToMigrate.length > 0) {
|
|
500
|
+
saveModelsByProvider(t.providerUrl, modelsToMigrate);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
484
505
|
selectProvider(t.providerUrl || '');
|
|
485
506
|
selectModel(t.defaultModel || '');
|
|
486
507
|
} else {
|