omp-config-crypt 0.9.2 → 0.9.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/package.json +1 -1
- package/src/provider-store.js +15 -4
package/package.json
CHANGED
package/src/provider-store.js
CHANGED
|
@@ -231,10 +231,20 @@ export function ensureLocalExtension(ompDir) {
|
|
|
231
231
|
*/
|
|
232
232
|
export function parseYamlModels(str) {
|
|
233
233
|
if (!str || typeof str !== "string") return {};
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
234
|
+
// Prefer the yaml package: handles flow-style (braces) and block-list values
|
|
235
|
+
// (e.g. `input:` followed by `- text` lines) the line parser cannot.
|
|
236
|
+
const parsed = normalizeProviderInputs(parseFlowYamlModels(str));
|
|
237
|
+
if (Object.keys(parsed).length) return parsed;
|
|
238
|
+
return normalizeProviderInputs(parseBlockYamlModels(str));
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function normalizeProviderInputs(providers) {
|
|
242
|
+
for (const cfg of Object.values(providers || {})) {
|
|
243
|
+
for (const model of cfg?.models || []) {
|
|
244
|
+
if (typeof model.input === "string" && model.input) model.input = [model.input];
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return providers;
|
|
238
248
|
}
|
|
239
249
|
|
|
240
250
|
function parseFlowYamlModels(str) {
|
|
@@ -608,6 +618,7 @@ function scanBlockSource(text) {
|
|
|
608
618
|
if (section === "models" || section === "model" || section === "compat") {
|
|
609
619
|
if (indent === 6 && trimmed.startsWith("- ") && field === "id") { section = "model"; continue; }
|
|
610
620
|
if (indent === 8 && MODEL_FIELDS.has(field)) { section = field === "compat" ? "compat" : "model"; continue; }
|
|
621
|
+
if (section === "model" && indent === 10 && trimmed.startsWith("- ")) continue;
|
|
611
622
|
if (indent === 10 && section === "compat" && /^[A-Za-z0-9_-]+:\s*\S/.test(trimmed)) continue;
|
|
612
623
|
}
|
|
613
624
|
unsupported(`${provider || "root"}.${field}`);
|