summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config/mod.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/config/mod.rs b/src/config/mod.rs
index eeffc87..a243a83 100644
--- a/src/config/mod.rs
+++ b/src/config/mod.rs
@@ -1517,15 +1517,16 @@ impl Config {
}
fn setup_model(&mut self) -> Result<()> {
- let model_id = if self.model_id.is_empty() {
+ let mut model_id = match env::var(get_env_name("model")) {
+ Ok(v) => v,
+ Err(_) => self.model_id.clone(),
+ };
+ if model_id.is_empty() {
let models = list_chat_models(self);
if models.is_empty() {
bail!("No available model");
}
-
- models[0].id()
- } else {
- self.model_id.clone()
+ model_id = models[0].id()
};
self.set_model(&model_id)?;
self.model_id = model_id;