This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user