@billjr99/pi-openai-compat 1.1.23 → 1.1.25
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/index.ts +13 -20
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -760,9 +760,7 @@ export default async function (pi: ExtensionAPI) {
|
|
|
760
760
|
let modelsUrl: string | undefined = tpl.modelsUrl;
|
|
761
761
|
if (key === "cloudflare_workers") {
|
|
762
762
|
const entered = await ctx.ui.input(
|
|
763
|
-
"Account ID"
|
|
764
|
-
"Your Cloudflare Account ID (find it on the Cloudflare dashboard overview page):",
|
|
765
|
-
""
|
|
763
|
+
"Account ID: your Cloudflare Account ID (find it on the Cloudflare dashboard overview page)"
|
|
766
764
|
);
|
|
767
765
|
if (entered == null) { ctx.ui.notify("Login cancelled.", "info"); return; }
|
|
768
766
|
const accountId = entered.trim();
|
|
@@ -771,27 +769,21 @@ export default async function (pi: ExtensionAPI) {
|
|
|
771
769
|
if (modelsUrl) modelsUrl = modelsUrl.replace("YOUR_ACCOUNT_ID", accountId);
|
|
772
770
|
} else if (key === "cloudflare_ai_gateway") {
|
|
773
771
|
const accountIdInput = await ctx.ui.input(
|
|
774
|
-
"Account ID"
|
|
775
|
-
"Your Cloudflare Account ID (find it on the Cloudflare dashboard overview page):",
|
|
776
|
-
""
|
|
772
|
+
"Account ID: your Cloudflare Account ID (find it on the Cloudflare dashboard overview page)"
|
|
777
773
|
);
|
|
778
774
|
if (accountIdInput == null) { ctx.ui.notify("Login cancelled.", "info"); return; }
|
|
779
775
|
const accountId = accountIdInput.trim();
|
|
780
776
|
if (!accountId) { ctx.ui.notify("Account ID cannot be empty.", "error"); return; }
|
|
781
777
|
|
|
782
778
|
const gatewayInput = await ctx.ui.input(
|
|
783
|
-
"Gateway Name"
|
|
784
|
-
"Your AI Gateway name/slug (find it under AI → AI Gateway in the Cloudflare dashboard):",
|
|
785
|
-
""
|
|
779
|
+
"Gateway Name: your AI Gateway name/slug (find it under AI → AI Gateway in the Cloudflare dashboard)"
|
|
786
780
|
);
|
|
787
781
|
if (gatewayInput == null) { ctx.ui.notify("Login cancelled.", "info"); return; }
|
|
788
782
|
const gatewaySlug = gatewayInput.trim();
|
|
789
783
|
if (!gatewaySlug) { ctx.ui.notify("Gateway name cannot be empty.", "error"); return; }
|
|
790
784
|
|
|
791
785
|
const providerInput = await ctx.ui.input(
|
|
792
|
-
"Provider"
|
|
793
|
-
"Upstream provider slug (e.g. openai, workers-ai, anthropic — must match your gateway config):",
|
|
794
|
-
"openai"
|
|
786
|
+
"Provider: upstream provider slug (e.g. openai, workers-ai, anthropic — must match your gateway config; press Enter for openai)"
|
|
795
787
|
);
|
|
796
788
|
if (providerInput == null) { ctx.ui.notify("Login cancelled.", "info"); return; }
|
|
797
789
|
const provider = providerInput.trim() || "openai";
|
|
@@ -808,10 +800,11 @@ export default async function (pi: ExtensionAPI) {
|
|
|
808
800
|
}
|
|
809
801
|
} else if (tpl.promptUrl) {
|
|
810
802
|
const defaultUrl = tpl.baseUrl;
|
|
803
|
+
// pi renders only the dialog title, so the guidance goes there.
|
|
811
804
|
const prompt = isLocalUrl(defaultUrl)
|
|
812
|
-
? `Base URL
|
|
813
|
-
: "Base URL
|
|
814
|
-
const entered = await ctx.ui.input(
|
|
805
|
+
? `Base URL: press Enter for default (${defaultUrl})`
|
|
806
|
+
: "Base URL: your endpoint (e.g. https://api.example.com/v1)";
|
|
807
|
+
const entered = await ctx.ui.input(prompt);
|
|
815
808
|
if (entered == null) { ctx.ui.notify("Login cancelled.", "info"); return; }
|
|
816
809
|
baseUrl = (entered.trim() || defaultUrl).replace(/\/+$/, "");
|
|
817
810
|
if (!baseUrl) { ctx.ui.notify("Base URL cannot be empty.", "error"); return; }
|
|
@@ -821,9 +814,9 @@ export default async function (pi: ExtensionAPI) {
|
|
|
821
814
|
let apiKey: string | null = null;
|
|
822
815
|
if (!tpl.keyless && !isLocalUrl(baseUrl)) {
|
|
823
816
|
const keyPrompt = tpl.keyHint
|
|
824
|
-
? `
|
|
825
|
-
: "
|
|
826
|
-
const entered = await ctx.ui.input(
|
|
817
|
+
? `API Key: required — get it at ${tpl.keyHint}`
|
|
818
|
+
: "API Key: leave blank if keyless";
|
|
819
|
+
const entered = await ctx.ui.input(keyPrompt);
|
|
827
820
|
if (entered == null) { ctx.ui.notify("Login cancelled.", "info"); return; }
|
|
828
821
|
apiKey = entered.trim() || null;
|
|
829
822
|
}
|
|
@@ -886,7 +879,7 @@ export default async function (pi: ExtensionAPI) {
|
|
|
886
879
|
|
|
887
880
|
ctx.ui.notify(
|
|
888
881
|
`${tpl.displayName} registered — ${models.length} model(s) added to /model.`,
|
|
889
|
-
"
|
|
882
|
+
"info"
|
|
890
883
|
);
|
|
891
884
|
},
|
|
892
885
|
});
|
|
@@ -952,7 +945,7 @@ export default async function (pi: ExtensionAPI) {
|
|
|
952
945
|
}
|
|
953
946
|
|
|
954
947
|
if (refreshed.length > 0) {
|
|
955
|
-
ctx.ui.notify(`Refreshed: ${refreshed.join(", ")}.`, "
|
|
948
|
+
ctx.ui.notify(`Refreshed: ${refreshed.join(", ")}.`, "info");
|
|
956
949
|
}
|
|
957
950
|
if (failed.length > 0) {
|
|
958
951
|
ctx.ui.notify(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@billjr99/pi-openai-compat",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.25",
|
|
4
4
|
"description": "pi-coding-agent extension: OpenAI-compatible endpoint support (OpenRouter, NVIDIA NIM, Nous Portal, Ollama, custom)",
|
|
5
5
|
"author": "Bill Mongan <https://github.com/BillJr99>",
|
|
6
6
|
"license": "MIT",
|