use crate::generations::{Generation, GenerationStore, GenerationSummary}; use serde::Deserialize; #[derive(Debug, Deserialize)] pub struct GenerationAddRequest { pub kind: String, pub title: String, pub data: String, /// Optional input/source (theme, name, level, etc.) for the history list. pub source: Option, } #[tauri::command] pub fn generation_add( state: tauri::State<'_, crate::llm::AppState>, req: GenerationAddRequest, ) -> Result { state .gen .add(&req.kind, &req.title, &req.data, req.source.as_deref()) .map_err(|e| e.to_string()) } #[tauri::command] pub fn generation_list( state: tauri::State<'_, crate::llm::AppState>, kind: Option, ) -> Result, String> { state.gen.list(kind.as_deref()).map_err(|e| e.to_string()) } #[tauri::command] pub fn generation_get( state: tauri::State<'_, crate::llm::AppState>, id: i64, ) -> Result, String> { state.gen.get(id).map_err(|e| e.to_string()) } #[tauri::command] pub fn generation_delete( state: tauri::State<'_, crate::llm::AppState>, id: Option, ) -> Result { state.gen.delete(id).map_err(|e| e.to_string()) } #[tauri::command] pub fn generation_counts( state: tauri::State<'_, crate::llm::AppState>, ) -> Result, String> { state.gen.counts().map_err(|e| e.to_string()) } // Reference `GenerationStore` so the type is considered used by the module // (the public functions go through `state.gen`, which already uses it, // but this silences a future-proofing warning if all wrappers get removed). #[allow(dead_code)] fn _store_type_used(_: &GenerationStore) {}