From 6914f23313fc4455da94e4f1ba89e3e85487fcef Mon Sep 17 00:00:00 2001 From: MrLetsplay Date: Thu, 1 Feb 2024 22:42:35 +0100 Subject: [PATCH] Update api, Remove index.html --- index.html | 18 ------------------ src/api.rs | 7 +++---- 2 files changed, 3 insertions(+), 22 deletions(-) delete mode 100644 index.html diff --git a/index.html b/index.html deleted file mode 100644 index a5c14a3..0000000 --- a/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - Tour - Iced - - - - - - - diff --git a/src/api.rs b/src/api.rs index 12dc0b2..15dc777 100644 --- a/src/api.rs +++ b/src/api.rs @@ -5,8 +5,6 @@ use tokio_stream::wrappers::LinesStream; use tokio_stream::{Stream, StreamExt}; use tokio_util::io::StreamReader; -const API_URL: &'static str = "http://localhost:11434"; - pub struct OllamaAPI { api_url: &'static str, client: Client, @@ -16,9 +14,10 @@ pub struct OllamaAPI { pub struct OllamaChat<'a> { #[serde(skip_serializing)] api: &'a OllamaAPI, - model: String, #[serde(skip_serializing)] history_size: u32, + + model: String, messages: Vec, } @@ -63,7 +62,7 @@ impl OllamaAPI { let request = self .client - .post(String::from(API_URL) + "/api/chat") + .post(String::from(self.api_url) + "/api/chat") .body(serde_json::to_string(&chat)?) .build()?; let stream = self