This commit is contained in:
parent
0a009f9789
commit
18c9199b79
5 changed files with 8 additions and 39 deletions
|
@ -62,7 +62,7 @@ async fn main() -> std::io::Result<()> {
|
||||||
// Start automation service in background
|
// Start automation service in background
|
||||||
let automation_state = app_state.get_ref().clone(); // This gets the Arc<AppState>
|
let automation_state = app_state.get_ref().clone(); // This gets the Arc<AppState>
|
||||||
|
|
||||||
let automation = AutomationService::new(automation_state, "../../src/scripts");
|
let automation = AutomationService::new(automation_state, "src/prompts");
|
||||||
let _automation_handle = automation.spawn();
|
let _automation_handle = automation.spawn();
|
||||||
|
|
||||||
// Start HTTP server
|
// Start HTTP server
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
export container="pragmatismo-doc-editor"
|
export container="pragmatismo-system"
|
||||||
lxc stop "$container"
|
lxc stop "$container"
|
||||||
|
|
||||||
lxc config device override "$container" root size=5GB
|
lxc config device override "$container" root size=10GB
|
||||||
lxc config device set "$container" root size=5GB
|
lxc config device set "$container" root size=10GB
|
||||||
lxc start "$container"
|
lxc start "$container"
|
||||||
ROOT_DEV=$(lxc exec "$container" -- df / --output=source | tail -1)
|
ROOT_DEV=$(lxc exec "$container" -- df / --output=source | tail -1)
|
||||||
|
|
||||||
lxc exec "$container" -- growpart "$(dirname "$ROOT_DEV")" "$(basename "$ROOT_DEV")"
|
lxc exec "$container" -- growpart "$(dirname "$ROOT_DEV")" "$(basename "$ROOT_DEV")"
|
||||||
lxc exec "$container" -- resize2fs "$ROOT_DEV"
|
lxc exec "$container" -- resize2fs "$ROOT_DEV"
|
||||||
|
|
|
@ -64,7 +64,7 @@ impl AutomationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn check_table_changes(&self, automations: &[Automation], since: DateTime<Utc>) {
|
async fn check_table_changes(&self, automations: &[Automation], since: DateTime<Utc>) {
|
||||||
if let Some(pool) = &self.state.db {
|
if let Some(pool) = &self.state.db_custom {
|
||||||
for automation in automations {
|
for automation in automations {
|
||||||
if let Some(trigger_kind) = TriggerKind::from_i32(automation.kind) {
|
if let Some(trigger_kind) = TriggerKind::from_i32(automation.kind) {
|
||||||
if matches!(
|
if matches!(
|
||||||
|
|
|
@ -10,7 +10,7 @@ pub fn set_schedule_keyword(state: &AppState, engine: &mut Engine) {
|
||||||
let db = state.db_custom.clone();
|
let db = state.db_custom.clone();
|
||||||
|
|
||||||
engine
|
engine
|
||||||
.register_custom_syntax(["SET", "SCHEDULE", "$string$"], true, {
|
.register_custom_syntax(["SET_SCHEDULE", "$string$"], true, {
|
||||||
let db = db.clone();
|
let db = db.clone();
|
||||||
|
|
||||||
move |context, inputs| {
|
move |context, inputs| {
|
||||||
|
|
|
@ -237,37 +237,6 @@ fn messages_to_prompt(messages: &[ChatMessage]) -> String {
|
||||||
prompt
|
prompt
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cleanup function
|
|
||||||
pub fn cleanup_processes() {
|
|
||||||
println!("🧹 Cleaning up llama.cpp processes...");
|
|
||||||
|
|
||||||
unsafe {
|
|
||||||
if let Some(process_handle) = &LLAMA_PROCESS {
|
|
||||||
if let Ok(mut process) = process_handle.lock() {
|
|
||||||
if let Some(ref mut child) = *process {
|
|
||||||
println!("🔪 Killing llama server process...");
|
|
||||||
let _ = child.start_kill();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Kill any remaining llama processes
|
|
||||||
println!("🔍 Killing any remaining llama-server processes...");
|
|
||||||
let output = Command::new("pkill").arg("-f").arg("llama-server").output();
|
|
||||||
|
|
||||||
match output {
|
|
||||||
Ok(result) => {
|
|
||||||
if result.status.success() {
|
|
||||||
println!("✅ Successfully killed llama processes");
|
|
||||||
} else {
|
|
||||||
println!("ℹ️ No llama processes found to kill");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Err(e) => println!("⚠️ Error trying to kill processes: {}", e),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Proxy endpoint
|
// Proxy endpoint
|
||||||
#[post("/v1/chat/completions")]
|
#[post("/v1/chat/completions")]
|
||||||
pub async fn chat_completions(
|
pub async fn chat_completions(
|
||||||
|
|
Loading…
Add table
Reference in a new issue