@zhiman_innies/innies-codex 0.122.23 → 0.122.24
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/bin/innies-config.js +8 -65
- package/package.json +3 -3
package/bin/innies-config.js
CHANGED
|
@@ -154,7 +154,7 @@ function shouldReplaceLegacyCatalog(catalog) {
|
|
|
154
154
|
|
|
155
155
|
function ensureInniesConfig(configPath, catalogPath, state) {
|
|
156
156
|
if (!fs.existsSync(configPath)) {
|
|
157
|
-
fs.writeFileSync(configPath, defaultInniesConfig(catalogPath,
|
|
157
|
+
fs.writeFileSync(configPath, defaultInniesConfig(catalogPath, managedDefaultModel()));
|
|
158
158
|
return defaultInniesState();
|
|
159
159
|
}
|
|
160
160
|
|
|
@@ -183,12 +183,12 @@ function defaultInniesConfig(catalogPath, managedDefault) {
|
|
|
183
183
|
|
|
184
184
|
function normalizeInniesConfig(contents, catalogPath, state) {
|
|
185
185
|
if (contents.trim() === "") {
|
|
186
|
-
return defaultInniesConfig(catalogPath,
|
|
186
|
+
return defaultInniesConfig(catalogPath, managedDefaultModel());
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
const isUserSelected =
|
|
190
190
|
state.model_selection_state === MODEL_SELECTION_STATES.USER_SELECTED;
|
|
191
|
-
const managedDefault = isUserSelected ? null :
|
|
191
|
+
const managedDefault = isUserSelected ? null : managedDefaultModel();
|
|
192
192
|
const managedSettings = managedDefault
|
|
193
193
|
? ROOT_MANAGED_SETTINGS
|
|
194
194
|
: ROOT_CATALOG_ONLY_SETTINGS;
|
|
@@ -327,68 +327,11 @@ function stripManagedRootSettings(contents, managedSettings = ROOT_MANAGED_SETTI
|
|
|
327
327
|
return stripped.replace(/\n{3,}/g, "\n\n");
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
-
function
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
};
|
|
336
|
-
}
|
|
337
|
-
if (hasDashscopeAuth(contents ?? "")) {
|
|
338
|
-
return {
|
|
339
|
-
provider: "dashscope",
|
|
340
|
-
model: DASHSCOPE_MODEL,
|
|
341
|
-
};
|
|
342
|
-
}
|
|
343
|
-
return null;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
function hasZhiman35bApiKey() {
|
|
347
|
-
return (process.env.ZHIMAN_35B_API_KEY ?? "").trim() !== "";
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
function hasZhiman35bAuth(contents) {
|
|
351
|
-
return hasZhiman35bApiKey() || zhiman35bProviderBlock(contents ?? "").some((line) =>
|
|
352
|
-
/^\s*experimental_bearer_token\s*=\s*"[^"]+"\s*$/.test(line),
|
|
353
|
-
);
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
function hasDashscopeApiKey() {
|
|
357
|
-
return (process.env.DASHSCOPE_API_KEY ?? "").trim() !== "";
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
function hasDashscopeAuth(contents) {
|
|
361
|
-
return hasDashscopeApiKey() || dashscopeProviderBlock(contents).some((line) =>
|
|
362
|
-
/^\s*experimental_bearer_token\s*=\s*"[^"]+"\s*$/.test(line),
|
|
363
|
-
);
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
function zhiman35bProviderBlock(contents) {
|
|
367
|
-
return providerBlock(contents, ZHIMAN_35B_PROVIDER_HEADER);
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
function dashscopeProviderBlock(contents) {
|
|
371
|
-
return providerBlock(contents, DASHSCOPE_PROVIDER_HEADER);
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
function providerBlock(contents, providerHeader) {
|
|
375
|
-
const lines = contents.split(/\r?\n/);
|
|
376
|
-
const providerLines = [];
|
|
377
|
-
let inProviderBlock = false;
|
|
378
|
-
|
|
379
|
-
for (const line of lines) {
|
|
380
|
-
const trimmed = line.trim();
|
|
381
|
-
const isSectionHeader = /^\[[^\]]+\]$/.test(trimmed);
|
|
382
|
-
if (isSectionHeader) {
|
|
383
|
-
inProviderBlock = trimmed === providerHeader;
|
|
384
|
-
continue;
|
|
385
|
-
}
|
|
386
|
-
if (inProviderBlock) {
|
|
387
|
-
providerLines.push(line);
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
return providerLines;
|
|
330
|
+
function managedDefaultModel() {
|
|
331
|
+
return {
|
|
332
|
+
provider: DEFAULT_PROVIDER,
|
|
333
|
+
model: DEFAULT_MODEL,
|
|
334
|
+
};
|
|
392
335
|
}
|
|
393
336
|
|
|
394
337
|
function normalizeManagedProviderBlocks(contents) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhiman_innies/innies-codex",
|
|
3
|
-
"version": "0.122.
|
|
3
|
+
"version": "0.122.24",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"bin": {
|
|
6
6
|
"innies": "bin/innies.js"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"postinstall": "node bin/innies-init.js"
|
|
24
24
|
},
|
|
25
25
|
"optionalDependencies": {
|
|
26
|
-
"@zhiman_innies/innies-codex-darwin-x64": "0.122.
|
|
27
|
-
"@zhiman_innies/innies-codex-darwin-arm64": "0.122.
|
|
26
|
+
"@zhiman_innies/innies-codex-darwin-x64": "0.122.24-darwin-x64",
|
|
27
|
+
"@zhiman_innies/innies-codex-darwin-arm64": "0.122.24-darwin-arm64"
|
|
28
28
|
}
|
|
29
29
|
}
|