@mcowger/oh-my-pi-plexus 1.3.1 → 1.3.3
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/dist/extension.js +9 -3
- package/package.json +1 -1
package/dist/extension.js
CHANGED
|
@@ -108387,11 +108387,11 @@ function mapPreferredApi(raw) {
|
|
|
108387
108387
|
}
|
|
108388
108388
|
return "openai-completions";
|
|
108389
108389
|
}
|
|
108390
|
-
function adjustBaseUrl(baseUrl, preferredApi) {
|
|
108390
|
+
function adjustBaseUrl(baseUrl, preferredApi, anthropicBaseStyle = "root") {
|
|
108391
108391
|
const stripped = baseUrl.replace(/\/+$/, "");
|
|
108392
108392
|
switch (preferredApi) {
|
|
108393
108393
|
case "anthropic-messages":
|
|
108394
|
-
return stripped.endsWith("/v1") ? stripped.slice(0, -3) : stripped;
|
|
108394
|
+
return anthropicBaseStyle === "root" && stripped.endsWith("/v1") ? stripped.slice(0, -3) : stripped;
|
|
108395
108395
|
case "google-generative-ai":
|
|
108396
108396
|
return stripped.endsWith("/v1") ? `${stripped.slice(0, -3)}/v1beta` : stripped;
|
|
108397
108397
|
default:
|
|
@@ -108706,6 +108706,9 @@ function getRawBaseUrl() {
|
|
|
108706
108706
|
function getEnvApiKey() {
|
|
108707
108707
|
return resolveStringOption(process.env[ENV_API_KEY]) ?? null;
|
|
108708
108708
|
}
|
|
108709
|
+
function setEnvApiKey(apiKey) {
|
|
108710
|
+
process.env[ENV_API_KEY] = apiKey;
|
|
108711
|
+
}
|
|
108709
108712
|
function getModelsUrl() {
|
|
108710
108713
|
const raw = getRawBaseUrl();
|
|
108711
108714
|
return raw ? `${normalizeApiBase(raw)}/models` : null;
|
|
@@ -128055,7 +128058,7 @@ function descriptorToOhMyPiModel(descriptor) {
|
|
|
128055
128058
|
|
|
128056
128059
|
// src/extension.ts
|
|
128057
128060
|
var PROVIDER_NAME = "plexus";
|
|
128058
|
-
var PROVIDER_API_KEY_TEMPLATE =
|
|
128061
|
+
var PROVIDER_API_KEY_TEMPLATE = ENV_API_KEY;
|
|
128059
128062
|
var PLEXUS_CREDENTIAL_EXPIRES_AT = 253402300799000;
|
|
128060
128063
|
var currentModels = [];
|
|
128061
128064
|
function plexusExtension(pi) {
|
|
@@ -128083,6 +128086,7 @@ function plexusExtension(pi) {
|
|
|
128083
128086
|
log("session_start: no auth configured, skipping refresh");
|
|
128084
128087
|
return;
|
|
128085
128088
|
}
|
|
128089
|
+
setEnvApiKey(apiKey);
|
|
128086
128090
|
await doRefresh(pi, apiKey, ctx);
|
|
128087
128091
|
});
|
|
128088
128092
|
pi.registerCommand("plexus", {
|
|
@@ -128135,6 +128139,7 @@ function createPlexusLoginProvider(pi) {
|
|
|
128135
128139
|
if (!apiKey)
|
|
128136
128140
|
throw new Error("Plexus API key is required.");
|
|
128137
128141
|
await saveBaseUrl(baseUrl);
|
|
128142
|
+
setEnvApiKey(apiKey);
|
|
128138
128143
|
callbacks.onProgress?.("Refreshing Plexus models...");
|
|
128139
128144
|
await doRefresh(pi, apiKey, null);
|
|
128140
128145
|
return {
|
|
@@ -128165,6 +128170,7 @@ async function handleRefresh(pi, ctx) {
|
|
|
128165
128170
|
ctx.ui.notify("No Plexus API key configured. Run /login plexus first.", "error");
|
|
128166
128171
|
return;
|
|
128167
128172
|
}
|
|
128173
|
+
setEnvApiKey(apiKey);
|
|
128168
128174
|
ctx.ui.notify("Refreshing Plexus models\u2026", "info");
|
|
128169
128175
|
await doRefresh(pi, apiKey, ctx);
|
|
128170
128176
|
}
|