@mcowger/opencode-plexus 1.0.0 → 1.0.2
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 +8 -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,12 @@ function adjustBaseUrl(baseUrl, preferredApi) {
|
|
|
48
49
|
return stripped;
|
|
49
50
|
}
|
|
50
51
|
}
|
|
52
|
+
function isChatModel(model) {
|
|
53
|
+
const outputModalities = model.architecture?.output_modalities;
|
|
54
|
+
if (outputModalities !== undefined)
|
|
55
|
+
return outputModalities.includes("text");
|
|
56
|
+
return !NON_CHAT_ID_PATTERN.test(model.id);
|
|
57
|
+
}
|
|
51
58
|
var DEFAULT_MODELS_FETCH_TIMEOUT_MS = 1e4;
|
|
52
59
|
async function fetchPlexusModels(apiKey, modelsUrl, timeoutMs = DEFAULT_MODELS_FETCH_TIMEOUT_MS) {
|
|
53
60
|
const controller = new AbortController;
|
|
@@ -284,7 +291,6 @@ function buildInputModalities(model) {
|
|
|
284
291
|
const mapped = raw.map(mapModality).filter((m) => m !== null);
|
|
285
292
|
return mapped.length > 0 ? [...new Set(mapped)] : ["text"];
|
|
286
293
|
}
|
|
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
294
|
function buildOutputModalities(model) {
|
|
289
295
|
const raw = model.architecture?.output_modalities;
|
|
290
296
|
if (raw !== undefined) {
|
|
@@ -293,14 +299,12 @@ function buildOutputModalities(model) {
|
|
|
293
299
|
const mapped = raw.map(mapModality).filter((m) => m !== null);
|
|
294
300
|
return mapped.length > 0 ? [...new Set(mapped)] : ["text"];
|
|
295
301
|
}
|
|
296
|
-
if (NON_CHAT_ID_PATTERN.test(model.id))
|
|
297
|
-
return null;
|
|
298
302
|
return ["text"];
|
|
299
303
|
}
|
|
300
304
|
function buildModels(models, baseURL) {
|
|
301
305
|
const result = {};
|
|
302
306
|
for (const m of models) {
|
|
303
|
-
if (!m.id)
|
|
307
|
+
if (!m.id || !isChatModel(m))
|
|
304
308
|
continue;
|
|
305
309
|
const outputModalities = buildOutputModalities(m);
|
|
306
310
|
if (outputModalities === null)
|