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.
Files changed (2) hide show
  1. package/index.js +9 -2
  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
- const current = data.current || 'default';
11
- if (!data.configs || !data.configs[current]) {
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];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ask-my-llm",
3
- "version": "1.0.9",
3
+ "version": "1.1.0",
4
4
  "description": "Oversimplified AI usage npm module",
5
5
  "main": "index.js",
6
6
  "bin": {