Skip to content

Commit 47eec10

Browse files
committed
chore: support .env in local dev env
1 parent 3415e0b commit 47eec10

2 files changed

Lines changed: 15 additions & 11 deletions

File tree

src/config/constants.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const VIEWPORT_EXPANSION = -1
88
// models
99

1010
// 🥇 GPT-4.1 (best so far)
11-
export const DEFAULT_MODEL_NAME: string = 'gpt-41-mini-0414-global' // baseline 🌟
11+
// export const DEFAULT_MODEL_NAME: string = 'gpt-41-mini-0414-global' // baseline 🌟
1212
// export const DEFAULT_MODEL_NAME: string = 'gpt-41-0414-global' // unnecessary
1313

1414
// 🤞 qwen (tool call format often irregular)
@@ -32,15 +32,19 @@ export const DEFAULT_MODEL_NAME: string = 'gpt-41-mini-0414-global' // baseline
3232
// @todo need a special client for gemini
3333
// export const DEFAULT_MODEL_NAME: string = 'gemini-2.5-pro-06-17'
3434

35-
// export const DEFAULT_MODEL_NAME: string = import.meta.env.OPEN_ROUTER_MODEL!
35+
// Dev environment: use .env config if available, otherwise fallback to defaults
36+
export const DEFAULT_MODEL_NAME: string =
37+
import.meta.env.DEV && import.meta.env.LLM_MODEL_NAME
38+
? import.meta.env.LLM_MODEL_NAME
39+
: 'gpt-41-mini-0414-global'
3640

37-
// ak
38-
export const DEFAULT_API_KEY: string = 'not-needed'
39-
// export const DEFAULT_API_KEY: string = import.meta.env.OPEN_ROUTER_KEY!
41+
export const DEFAULT_API_KEY: string =
42+
import.meta.env.DEV && import.meta.env.LLM_API_KEY ? import.meta.env.LLM_API_KEY : 'not-needed'
4043

41-
// base url
42-
export const DEFAULT_BASE_URL: string = 'http://localhost:3000/api/agent'
43-
// export const DEFAULT_BASE_URL: string = import.meta.env.OPEN_ROUTER_BASE_URL!
44+
export const DEFAULT_BASE_URL: string =
45+
import.meta.env.DEV && import.meta.env.LLM_BASE_URL
46+
? import.meta.env.LLM_BASE_URL
47+
: 'http://localhost:3000/api/agent'
4448

4549
// internal
4650

vite.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ export default defineConfig({
2020
},
2121
},
2222
define: {
23-
'import.meta.env.OPEN_ROUTER_MODEL': JSON.stringify(process.env.OPEN_ROUTER_MODEL),
24-
'import.meta.env.OPEN_ROUTER_KEY': JSON.stringify(process.env.OPEN_ROUTER_KEY),
25-
'import.meta.env.OPEN_ROUTER_BASE_URL': JSON.stringify(process.env.OPEN_ROUTER_BASE_URL),
23+
'import.meta.env.LLM_MODEL_NAME': JSON.stringify(process.env.LLM_MODEL_NAME),
24+
'import.meta.env.LLM_API_KEY': JSON.stringify(process.env.LLM_API_KEY),
25+
'import.meta.env.LLM_BASE_URL': JSON.stringify(process.env.LLM_BASE_URL),
2626
},
2727
})

0 commit comments

Comments
 (0)