ask-my-llm 1.0.9 → 1.1.0
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/index.js +9 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -7,8 +7,15 @@ const CONFIG_PATH = path.join(process.env.HOME || process.env.USERPROFILE, '.ask
|
|
|
7
7
|
function loadConfig() {
|
|
8
8
|
try {
|
|
9
9
|
const data = JSON.parse(fs.readFileSync(CONFIG_PATH, 'utf8'));
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
|
|
11
|
+
// Old format: direct baseApi, apiKey, model
|
|
12
|
+
if (!data.configs) {
|
|
13
|
+
return data;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// New format with configs
|
|
17
|
+
const current = data.current || Object.keys(data.configs)[0];
|
|
18
|
+
if (!data.configs[current]) {
|
|
12
19
|
throw new Error('No config found. Run `npx ask-my-llm` first.');
|
|
13
20
|
}
|
|
14
21
|
return data.configs[current];
|