minor changes
Continuous integration / build (push) Failing after 6m40s

This commit is contained in:
2025-07-27 23:23:47 +01:00
parent bc71a30bfa
commit 4d0e0c90a7
8 changed files with 42 additions and 31 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
"project_author": "Your Name", "project_author": "Your Name",
"project_description": "Description of your project", "project_description": "Description of your project",
"enable_ai": true, "enable_ai": true,
"llm_api_uri": "http://localhost:1234", "llm_api_uri": "http://192.168.1.218:1234",
"llm_api_key": "", "llm_api_key": "",
"ai_context_prompt": "" "ai_context_prompt": ""
} }
File diff suppressed because one or more lines are too long
@@ -4,22 +4,23 @@
"name": "The Chancellor", "name": "The Chancellor",
"fields": { "fields": {
"age": { "age": {
"Number": 37.0 "Number": 50.0
},
"parent": {
"Link": ""
},
"dob": {
"Date": "1970-01-01"
}, },
"description": { "description": {
"MultiLine": "a tall ahh american" "MultiLine": "Chancellor Marcus R Beltaine\n\npatriot turned authoritarian with a militaristic vision, and ambitions of global power"
},
"dob": {
"Date": "1995-01-01"
}, },
"pfp": { "pfp": {
"Image": "characters/the chancellor.jpg" "Image": "characters/the chancellor.jpg"
},
"parent": {
"Link": ""
} }
}, },
"tags": [ "tags": [
"a9bb96a8-038b-4b2a-a325-f100fa112781",
"bbeddabd-914c-4648-8262-bf14bfcf8fff" "bbeddabd-914c-4648-8262-bf14bfcf8fff"
] ]
} }
@@ -8,21 +8,21 @@
"field_type": "MultiLine", "field_type": "MultiLine",
"required": true, "required": true,
"on_preview": true, "on_preview": true,
"description": "yes" "description": "description"
}, },
{ {
"name": "age", "name": "age",
"field_type": "Number", "field_type": "Number",
"required": true, "required": true,
"on_preview": false, "on_preview": false,
"description": "yes" "description": "character's age in years"
}, },
{ {
"name": "dob", "name": "dob",
"field_type": "Date", "field_type": "Date",
"required": true, "required": true,
"on_preview": false, "on_preview": false,
"description": "yes" "description": "character's date of birth if known"
}, },
{ {
"name": "parent", "name": "parent",
@@ -33,14 +33,14 @@
}, },
"required": true, "required": true,
"on_preview": false, "on_preview": false,
"description": "yes" "description": "character's known parents"
}, },
{ {
"name": "pfp", "name": "pfp",
"field_type": "Image", "field_type": "Image",
"required": true, "required": true,
"on_preview": true, "on_preview": true,
"description": "yes" "description": "portrait of the character"
} }
] ]
} }
+9 -7
View File
@@ -81,7 +81,7 @@ impl ContentAI {
}; };
if is_open { if is_open {
egui::Window::new("ContentAI") egui::Window::new("AI Assistant")
.open(&mut is_open) .open(&mut is_open)
.show(ui.ctx(), |ui| match self { .show(ui.ctx(), |ui| match self {
ContentAI::Summarise { ContentAI::Summarise {
@@ -92,7 +92,6 @@ impl ContentAI {
} => { } => {
egui::ScrollArea::vertical() egui::ScrollArea::vertical()
.auto_shrink([false, false]) .auto_shrink([false, false])
.max_height(200.0)
.max_width(ui.available_width()) .max_width(ui.available_width())
.show(ui, |ui| { .show(ui, |ui| {
ui.add( ui.add(
@@ -123,21 +122,23 @@ impl ContentAI {
ready, ready,
.. ..
} => { } => {
ui.label("Continue"); ui.weak("(The model will see current file content)");
ui.separator();
ui.add( ui.add(
egui::TextEdit::multiline(instruction) egui::TextEdit::multiline(instruction)
.frame(false) .frame(false)
.hint_text("Instruction"), .hint_text("Writing Instructions"),
); );
ui.separator();
ui.add( ui.add(
egui::TextEdit::multiline(context_override) egui::TextEdit::multiline(context_override)
.frame(false) .frame(false)
.hint_text("Any additional context?"), .hint_text("Any additional context?"),
); );
ui.separator();
ui.label("Max Tokens"); ui.label("Max Tokens");
ui.add(egui::Slider::new(max_tokens, 1000..=1000000)); ui.add(egui::Slider::new(max_tokens, 1000..=1000000));
ui.separator();
if ui.button("Continue").clicked() { if ui.button("Continue").clicked() {
match Self::continue_content( match Self::continue_content(
instruction, instruction,
@@ -176,7 +177,7 @@ impl ContentAI {
max_tokens: usize, max_tokens: usize,
context_override: &str, context_override: &str,
project: &mut ProjectContext, project: &mut ProjectContext,
content: &mut String, content: &mut str,
) -> Result<String, Box<dyn std::error::Error>> { ) -> Result<String, Box<dyn std::error::Error>> {
crate::llm_integration::content_llm::continue_content( crate::llm_integration::content_llm::continue_content(
if context_override.is_empty() { if context_override.is_empty() {
@@ -187,6 +188,7 @@ impl ContentAI {
content, content,
instruction, instruction,
max_tokens, max_tokens,
project,
) )
} }
} }
+2 -2
View File
@@ -16,8 +16,8 @@ pub struct ProjectContext {
// settings // settings
enable_ai: bool, enable_ai: bool,
llm_api_uri: String, pub llm_api_uri: String,
llm_api_key: String, pub llm_api_key: String,
pub ai_context_prompt: String, pub ai_context_prompt: String,
#[serde(skip)] #[serde(skip)]
+10 -2
View File
@@ -1,10 +1,13 @@
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::editors::context_editor::ProjectContext;
pub fn continue_content( pub fn continue_content(
context: &str, context: &str,
previous_content: &str, previous_content: &str,
instruction: &str, instruction: &str,
_max_tokens: usize, max_tokens: usize,
project: &ProjectContext,
) -> Result<String, Box<dyn std::error::Error>> { ) -> Result<String, Box<dyn std::error::Error>> {
let client = reqwest::blocking::Client::new(); let client = reqwest::blocking::Client::new();
@@ -35,10 +38,12 @@ pub fn continue_content(
let request = ChatRequest { let request = ChatRequest {
messages, messages,
temperature: 0.7, temperature: 0.7,
max_tokens,
stream: false,
}; };
let response = client let response = client
.post("http://localhost:1234/v1/chat/completions") .post(project.llm_api_uri.clone() + "/v1/chat/completions")
.json(&request) .json(&request)
.send()?; .send()?;
@@ -54,11 +59,14 @@ pub fn continue_content(
Err("No response from model".into()) Err("No response from model".into())
} }
} }
// Simple request structure // Simple request structure
#[derive(Serialize)] #[derive(Serialize)]
struct ChatRequest { struct ChatRequest {
messages: Vec<Message>, messages: Vec<Message>,
temperature: f32, temperature: f32,
max_tokens: usize,
stream: bool,
} }
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
-2
View File
@@ -141,8 +141,6 @@ impl Interface {
if let Some(load_doc) = load_doc { if let Some(load_doc) = load_doc {
self.editor = load_doc; self.editor = load_doc;
self.editor.show_editor = true;
self.editor.show_preview = true;
} }
}); });
} }