@madgagarin/pi-agentrouter 1.0.2 → 1.0.4
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/README.md +1 -1
- package/index.ts +4 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# pi-agentrouter
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@madgagarin/pi-agentrouter)
|
|
4
4
|
[](LICENSE)
|
package/index.ts
CHANGED
|
@@ -27,16 +27,11 @@ export function saveConfig(cfg: AgentRouterConfig): void {
|
|
|
27
27
|
}
|
|
28
28
|
fs.writeFileSync(CONFIG_FILE, JSON.stringify(cfg, null, 2), "utf-8");
|
|
29
29
|
} catch {}
|
|
30
|
+
}
|
|
31
|
+
|
|
30
32
|
export function normalizeApiKey(key?: string): string {
|
|
31
33
|
if (!key) return "";
|
|
32
|
-
|
|
33
|
-
if (clean.toLowerCase().startsWith("bearer ")) {
|
|
34
|
-
clean = clean.slice(7).trim();
|
|
35
|
-
}
|
|
36
|
-
if (clean.startsWith("sk-")) {
|
|
37
|
-
clean = clean.slice(3).trim();
|
|
38
|
-
}
|
|
39
|
-
return clean;
|
|
34
|
+
return key.trim().replace(/^["']|["']$/g, "").trim();
|
|
40
35
|
}
|
|
41
36
|
|
|
42
37
|
const initialConfig = loadConfig();
|
|
@@ -220,7 +215,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
220
215
|
currentApiKey = cleanKey;
|
|
221
216
|
saveConfig({ apiKey: cleanKey, minIntervalMs });
|
|
222
217
|
registerAgentRouterProviders(cleanKey);
|
|
223
|
-
ctx.ui.notify("AgentRouter API key updated
|
|
218
|
+
ctx.ui.notify("AgentRouter API key updated successfully for all models.", "info");
|
|
224
219
|
return;
|
|
225
220
|
}
|
|
226
221
|
|
package/package.json
CHANGED