@mcowger/opencode-plexus 1.1.1 → 1.1.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 +11 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -103,13 +103,23 @@ function fallbackDir() {
|
|
|
103
103
|
function getDir() {
|
|
104
104
|
return fallbackDir();
|
|
105
105
|
}
|
|
106
|
+
function filterCachedModels(models) {
|
|
107
|
+
return Object.fromEntries(Object.entries(models).filter(([, model]) => isChatModel({
|
|
108
|
+
id: model.id,
|
|
109
|
+
name: model.name,
|
|
110
|
+
architecture: {
|
|
111
|
+
input_modalities: model.modalities.input,
|
|
112
|
+
output_modalities: model.modalities.output
|
|
113
|
+
}
|
|
114
|
+
})));
|
|
115
|
+
}
|
|
106
116
|
async function readCachedModels(_client) {
|
|
107
117
|
try {
|
|
108
118
|
const dir = getDir();
|
|
109
119
|
const content = await readFile(join(dir, CACHE_FILE), "utf8");
|
|
110
120
|
const parsed = JSON.parse(content);
|
|
111
121
|
if (parsed && typeof parsed.models === "object" && !Array.isArray(parsed.models)) {
|
|
112
|
-
return parsed.models;
|
|
122
|
+
return filterCachedModels(parsed.models);
|
|
113
123
|
}
|
|
114
124
|
return null;
|
|
115
125
|
} catch {
|