Skip to content

Commit a487e7f

Browse files
committed
fix " error in Ollama host [skip ci]
1 parent 333844f commit a487e7f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/config/ollama.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ impl OllamaConfig {
3838
///
3939
/// If not found, defaults to `DEFAULT_OLLAMA_HOST` and `DEFAULT_OLLAMA_PORT`.
4040
pub fn new() -> Self {
41-
let host = std::env::var("OLLAMA_HOST").unwrap_or(DEFAULT_OLLAMA_HOST.to_string());
41+
let host = std::env::var("OLLAMA_HOST")
42+
.map(|h| h.trim_matches('"').to_string())
43+
.unwrap_or(DEFAULT_OLLAMA_HOST.to_string());
4244
let port = std::env::var("OLLAMA_PORT")
4345
.and_then(|port_str| port_str.parse().map_err(|_| std::env::VarError::NotPresent))
4446
.unwrap_or(DEFAULT_OLLAMA_PORT);
@@ -66,7 +68,7 @@ impl OllamaConfig {
6668
if self.auto_pull { "on" } else { "off" }
6769
);
6870

69-
let ollama = Ollama::new(self.host.trim_matches('"'), self.port);
71+
let ollama = Ollama::new(&self.host, self.port);
7072

7173
// the list of required models is those given in DKN_MODELS and the hardcoded ones
7274
let mut required_models = self.hardcoded_models.clone();

0 commit comments

Comments
 (0)