Skip to content

Commit

Permalink
refactor: ♻️ optimize modelAliases processing logic
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed Dec 13, 2024
1 parent bad8797 commit b902feb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/cli/src/nodehost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ export class NodeHost implements RuntimeHost {
async readConfig(): Promise<HostConfiguration> {
const config = await resolveGlobalConfiguration(this.dotEnvPath)
const { envFile, modelAliases } = config
if (modelAliases)
for (const kv of Object.entries(modelAliases))
this.setModelAlias("config", kv[0], kv[1])
if (existsSync(envFile)) {
if (resolve(envFile) !== resolve(DOT_ENV_FILENAME))
logVerbose(`.env: loading ${envFile}`)
Expand All @@ -216,9 +219,6 @@ export class NodeHost implements RuntimeHost {
if (res.error) throw res.error
}
await parseDefaultsFromEnv(process.env)
if (modelAliases)
for (const kv of Object.entries(modelAliases))
this.setModelAlias("config", kv[0], kv[1])
return config
}

Expand Down

0 comments on commit b902feb

Please sign in to comment.