@mcowger/opencode-plexus 1.0.1 → 1.0.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/index.js +11 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ var PLACEHOLDER_MODEL_ID = "plexus-unconfigured";
|
|
|
16
16
|
|
|
17
17
|
// ../plexus-models/src/convert.ts
|
|
18
18
|
var REASONING_PARAMS = new Set(["reasoning", "include_reasoning", "reasoning_effort"]);
|
|
19
|
+
var NON_CHAT_ID_PATTERN = /embedding|embed|tts|whisper|image-[0-9]|image\b.*gen|diffusion|dall-e|stable-diff|sdxl|dream/i;
|
|
19
20
|
var API_DIALECT_MAP = {
|
|
20
21
|
chat_completions: "openai-completions",
|
|
21
22
|
"openai-completions": "openai-completions",
|
|
@@ -48,6 +49,15 @@ function adjustBaseUrl(baseUrl, preferredApi) {
|
|
|
48
49
|
return stripped;
|
|
49
50
|
}
|
|
50
51
|
}
|
|
52
|
+
function isChatModel(model) {
|
|
53
|
+
const inputModalities = model.architecture?.input_modalities;
|
|
54
|
+
if (inputModalities !== undefined && !inputModalities.includes("text"))
|
|
55
|
+
return false;
|
|
56
|
+
const outputModalities = model.architecture?.output_modalities;
|
|
57
|
+
if (outputModalities !== undefined)
|
|
58
|
+
return outputModalities.includes("text");
|
|
59
|
+
return !NON_CHAT_ID_PATTERN.test(model.id);
|
|
60
|
+
}
|
|
51
61
|
var DEFAULT_MODELS_FETCH_TIMEOUT_MS = 1e4;
|
|
52
62
|
async function fetchPlexusModels(apiKey, modelsUrl, timeoutMs = DEFAULT_MODELS_FETCH_TIMEOUT_MS) {
|
|
53
63
|
const controller = new AbortController;
|
|
@@ -284,7 +294,6 @@ function buildInputModalities(model) {
|
|
|
284
294
|
const mapped = raw.map(mapModality).filter((m) => m !== null);
|
|
285
295
|
return mapped.length > 0 ? [...new Set(mapped)] : ["text"];
|
|
286
296
|
}
|
|
287
|
-
var NON_CHAT_ID_PATTERN = /embedding|embed|tts|whisper|image-[0-9]|image\b.*gen|diffusion|dall-e|stable-diff|sdxl|dream/i;
|
|
288
297
|
function buildOutputModalities(model) {
|
|
289
298
|
const raw = model.architecture?.output_modalities;
|
|
290
299
|
if (raw !== undefined) {
|
|
@@ -293,14 +302,12 @@ function buildOutputModalities(model) {
|
|
|
293
302
|
const mapped = raw.map(mapModality).filter((m) => m !== null);
|
|
294
303
|
return mapped.length > 0 ? [...new Set(mapped)] : ["text"];
|
|
295
304
|
}
|
|
296
|
-
if (NON_CHAT_ID_PATTERN.test(model.id))
|
|
297
|
-
return null;
|
|
298
305
|
return ["text"];
|
|
299
306
|
}
|
|
300
307
|
function buildModels(models, baseURL) {
|
|
301
308
|
const result = {};
|
|
302
309
|
for (const m of models) {
|
|
303
|
-
if (!m.id)
|
|
310
|
+
if (!m.id || !isChatModel(m))
|
|
304
311
|
continue;
|
|
305
312
|
const outputModalities = buildOutputModalities(m);
|
|
306
313
|
if (outputModalities === null)
|