Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

Fix AIPreset deserialization - add default values for url and model

Louis Beaumontc584a4e7a39e
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.lock b/screenpipe-app-tauri/src-tauri/Cargo.lock
index 49fb82f6e..df4aa2754 100755
--- a/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -5640,7 +5640,7 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "screenpipe-app"
-version = "2.0.0"
+version = "2.0.1"
dependencies = [
"anyhow",
"async-stream",
diff --git a/screenpipe-app-tauri/src-tauri/src/store.rs b/screenpipe-app-tauri/src-tauri/src/store.rs
index 0da377e13..9f5a82709 100644
--- a/screenpipe-app-tauri/src-tauri/src/store.rs
+++ b/screenpipe-app-tauri/src-tauri/src/store.rs
@@ -193,11 +193,14 @@ pub enum AIProviderType {
}
#[derive(Serialize, Deserialize,Type,Clone)]
+#[serde(default)]
pub struct AIPreset {
pub id: String,
pub prompt: String,
pub provider: AIProviderType,
+ #[serde(default)]
pub url: String,
+ #[serde(default)]
pub model: String,
#[serde(rename = "defaultPreset")]
pub default_preset: bool,
@@ -207,6 +210,21 @@ pub struct AIPreset {
pub max_context_chars: u32,
}
+impl Default for AIPreset {
+ fn default() -> Self {
+ Self {
+ id: String::new(),
+ prompt: String::new(),
+ provider: AIProviderType::ScreenpipeCloud,
+ url: "https://ai-proxy.i-f9f.workers.dev/v1".to_string(),
+ model: "claude-3-5-haiku-latest".to_string(),
+ default_preset: false,
+ api_key: None,
+ max_context_chars: 512000,
+ }
+ }
+}
+
#[derive(Serialize, Deserialize,Type,Clone)]
#[serde(default)]
pub struct User {