Update api, Remove index.html

This commit is contained in:
MrLetsplay 2024-02-01 22:42:35 +01:00
parent adec57e1b0
commit 6914f23313
Signed by: mr
SSH Key Fingerprint: SHA256:92jBH80vpXyaZHjaIl47pjRq+Yt7XGTArqQg1V7hSqg
2 changed files with 3 additions and 22 deletions

View File

@ -1,18 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Tour - Iced</title>
</head>
<body>
<script type="module">
import init from "./tour/tour.js";
init('./tour/tour_bg.wasm');
</script>
</body>
</html>

View File

@ -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<ChatMessage>,
}
@ -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