fixed ai integration
Continuous integration / build (push) Failing after 6m27s

This commit is contained in:
2025-07-27 19:15:30 +01:00
parent 6a25c6c05c
commit bc71a30bfa
7 changed files with 292 additions and 43 deletions
+7 -8
View File
@@ -2,6 +2,7 @@ use serde::{Deserialize, Serialize};
pub fn continue_content(
context: &str,
previous_content: &str,
instruction: &str,
_max_tokens: usize,
) -> Result<String, Box<dyn std::error::Error>> {
@@ -19,11 +20,15 @@ pub fn continue_content(
},
Message {
role: "user".to_string(),
content: context.to_string(),
content: format!("Context / General instructions: {context}"),
},
Message {
role: "user".to_string(),
content: format!("Instructions: {instruction}"),
content: format!("Previous content: {previous_content}"),
},
Message {
role: "user".to_string(),
content: format!("Specific instructions: {instruction}"),
},
];
@@ -49,12 +54,6 @@ pub fn continue_content(
Err("No response from model".into())
}
}
pub fn ai_enabled() -> bool {
let client = reqwest::blocking::Client::new();
client.get("http://localhost:1234/v1/models").send().is_ok()
}
// Simple request structure
#[derive(Serialize)]
struct ChatRequest {