diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index 8467f96..7ce7b45 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -11,7 +11,9 @@ use chrono::{DateTime, Utc};
use rusqlite::{params, Connection};
use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};
-use tauri::{AppHandle, Emitter, Manager};
+use tauri::{AppHandle, Manager};
+use tokio::{io::{AsyncBufReadExt, BufReader}, process::Command};
+use std::process::Stdio;
use uuid::Uuid;
// ---------- Data Models ------------------------------------------------------------
@@ -537,6 +539,34 @@ fn delete_document(
Ok(())
}
+#[tauri::command]
+async fn run_fine_tune(config: String, app: AppHandle) -> Result<(), String> {
+ let script_path = app
+ .path_resolver()
+ .resolve_resource("../backend/fine_tune.py")
+ .ok_or("Script not found")?;
+
+ let mut child = Command::new("python3")
+ .arg(script_path)
+ .arg(config)
+ .stdout(Stdio::piped())
+ .spawn()
+ .map_err(|e| e.to_string())?;
+
+ if let Some(stdout) = child.stdout.take() {
+ let app_handle = app.clone();
+ tauri::async_runtime::spawn(async move {
+ let mut reader = BufReader::new(stdout).lines();
+ while let Ok(Some(line)) = reader.next_line().await {
+ let _ = app_handle.emit("fine_tune_log", line);
+ }
+ });
+ }
+
+ child.wait().await.map_err(|e| e.to_string())?;
+ Ok(())
+}
+
// ---------- Main Application ---------------------------------------------------
fn main() {
@@ -564,6 +594,7 @@ fn main() {
chat_with_documents,
get_chat_history,
delete_document,
+ run_fine_tune,
])
.run(tauri::generate_context!())
.expect("Error running RAG application");
diff --git a/src/App.svelte b/src/App.svelte
new file mode 100644
index 0000000..bff90a8
--- /dev/null
+++ b/src/App.svelte
@@ -0,0 +1,36 @@
+
+
+
+
+
+ {#if $panel === 'rag'}
+
+ {:else if $panel === 'fine-tune'}
+
+ {:else if $panel === 'playground'}
+
+ {/if}
+
+
diff --git a/src/components/FineTunePanel.svelte b/src/components/FineTunePanel.svelte
new file mode 100644
index 0000000..b8c4432
--- /dev/null
+++ b/src/components/FineTunePanel.svelte
@@ -0,0 +1,46 @@
+
+
+
diff --git a/src/components/PlaygroundPanel.svelte b/src/components/PlaygroundPanel.svelte
new file mode 100644
index 0000000..0d50890
--- /dev/null
+++ b/src/components/PlaygroundPanel.svelte
@@ -0,0 +1,48 @@
+
+
+
+
Playground
+
+
+
+
+
+ {#if response}
+
+
Response
+
{response}
+
+ {/if}
+ {#if mode === 'rag' && retrieved}
+
+
Retrieved context
+
{retrieved}
+
+ {/if}
+
diff --git a/src/routes/+page.svelte b/src/components/RagPanel.svelte
similarity index 100%
rename from src/routes/+page.svelte
rename to src/components/RagPanel.svelte
diff --git a/src/lib/theme.ts b/src/lib/theme.ts
new file mode 100644
index 0000000..a43c079
--- /dev/null
+++ b/src/lib/theme.ts
@@ -0,0 +1,12 @@
+import { writable } from 'svelte/store';
+
+export const darkMode = writable(false);
+
+if (typeof window !== 'undefined') {
+ const stored = localStorage.getItem('darkMode');
+ darkMode.set(stored === 'true');
+ darkMode.subscribe((val) => {
+ localStorage.setItem('darkMode', val ? 'true' : 'false');
+ document.documentElement.classList.toggle('dark', val);
+ });
+}
diff --git a/src/main.ts b/src/main.ts
index f244b3e..55e4ae1 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -1,4 +1,4 @@
-import App from './routes/+page.svelte';
+import App from './App.svelte';
import './app.css';
const app = new App({
diff --git a/tailwind.config.cjs b/tailwind.config.cjs
index 3afed93..6b075f9 100644
--- a/tailwind.config.cjs
+++ b/tailwind.config.cjs
@@ -1,4 +1,5 @@
module.exports = {
+ darkMode: 'class',
content: ['./index.html', './src/**/*.{js,ts,svelte}'],
theme: {
extend: {},