Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Clean up Ensu UniFFI wrappers

Manav Rathi41faa5aae971
diff --git a/rust/Cargo.lock b/rust/Cargo.lock
index aa747c3724..e797cbb1fd 100644
--- a/rust/Cargo.lock
+++ b/rust/Cargo.lock
@@ -4479,7 +4479,6 @@ name = "inference"
version = "0.0.0"
dependencies = [
"inference_rs",
- "serde",
"thiserror 1.0.69",
"uniffi",
]
diff --git a/rust/bindings/uniffi/ensu/db/build.rs b/rust/bindings/uniffi/ensu/db/build.rs
deleted file mode 100644
index f328e4d9d0..0000000000
--- a/rust/bindings/uniffi/ensu/db/build.rs
+++ /dev/null
@@ -1 +0,0 @@
-fn main() {}
diff --git a/rust/bindings/uniffi/ensu/db/src/api.udl b/rust/bindings/uniffi/ensu/db/src/api.udl
deleted file mode 100644
index 4bda840b90..0000000000
--- a/rust/bindings/uniffi/ensu/db/src/api.udl
+++ /dev/null
@@ -1,73 +0,0 @@
-[Error]
-interface DbError {
- Message(string message);
-};
-
-enum Sender {
- "SelfUser",
- "Other"
-};
-
-enum AttachmentKind {
- "Image",
- "Document"
-};
-
-dictionary AttachmentMeta {
- string id;
- AttachmentKind kind;
- i64 size;
- string name;
-};
-
-dictionary Session {
- string uuid;
- string title;
- i64 created_at_us;
- i64 updated_at_us;
- string? remote_id;
- boolean needs_sync;
- i64? deleted_at_us;
-};
-
-dictionary Message {
- string uuid;
- string session_uuid;
- string? parent_message_uuid;
- Sender sender;
- string text;
- sequence<AttachmentMeta> attachments;
- i64 created_at_us;
- i64? deleted_at_us;
-};
-
-namespace db {
- [Throws=DbError]
- sequence<u8> compress_attachment_image(sequence<u8> data);
-
- interface EnsuDb {
- [Constructor, Throws=DbError]
- EnsuDb(string main_db_path, string attachments_db_path, sequence<u8> key);
-
- [Throws=DbError]
- Session create_session(string title);
-
- [Throws=DbError]
- sequence<Session> list_sessions();
-
- [Throws=DbError]
- Session? get_session(string uuid);
-
- [Throws=DbError]
- void delete_session(string uuid);
-
- [Throws=DbError]
- Message insert_message(string session_uuid, Sender sender, string text, string? parent_message_uuid, sequence<AttachmentMeta> attachments);
-
- [Throws=DbError]
- sequence<Message> get_messages(string session_uuid);
-
- [Throws=DbError]
- void update_message_text(string uuid, string text);
- };
-};
diff --git a/rust/bindings/uniffi/ensu/inference/Cargo.toml b/rust/bindings/uniffi/ensu/inference/Cargo.toml
index 2204e57f6b..24b1a140a2 100644
--- a/rust/bindings/uniffi/ensu/inference/Cargo.toml
+++ b/rust/bindings/uniffi/ensu/inference/Cargo.toml
@@ -7,6 +7,5 @@ crate-type = ["staticlib", "cdylib"]
[dependencies]
inference_rs.workspace = true
-serde = { version = "1", features = ["derive"] }
thiserror = "1"
uniffi = { version = "0.31.0" }
diff --git a/rust/bindings/uniffi/ensu/inference/src/api.rs b/rust/bindings/uniffi/ensu/inference/src/api.rs
index 8d2ad55a76..867f60fca7 100644
--- a/rust/bindings/uniffi/ensu/inference/src/api.rs
+++ b/rust/bindings/uniffi/ensu/inference/src/api.rs
@@ -1,5 +1,4 @@
use inference_rs as core;
-use serde::{Deserialize, Serialize};
use std::sync::Arc;
use thiserror::Error;
@@ -15,7 +14,7 @@ impl From<String> for InferenceError {
}
}
-#[derive(Debug, Clone, Serialize, Deserialize, uniffi::Record)]
+#[derive(Debug, Clone, uniffi::Record)]
pub struct ModelLoadParams {
pub model_path: String,
pub n_gpu_layers: Option<i32>,
@@ -23,14 +22,14 @@ pub struct ModelLoadParams {
pub use_mlock: Option<bool>,
}
-#[derive(Debug, Clone, Serialize, Deserialize, uniffi::Record)]
+#[derive(Debug, Clone, uniffi::Record)]
pub struct ContextParams {
pub context_size: Option<i32>,
pub n_threads: Option<i32>,
pub n_batch: Option<i32>,
}
-#[derive(Debug, Clone, Serialize, Deserialize, uniffi::Record)]
+#[derive(Debug, Clone, uniffi::Record)]
pub struct EnsuModelPreset {
pub id: String,
pub title: String,
@@ -38,7 +37,7 @@ pub struct EnsuModelPreset {
pub mmproj_url: Option<String>,
}
-#[derive(Debug, Clone, Serialize, Deserialize, uniffi::Record)]
+#[derive(Debug, Clone, uniffi::Record)]
pub struct EnsuDefaults {
pub mobile_system_prompt_body: String,
pub desktop_system_prompt_body: String,
@@ -50,13 +49,13 @@ pub struct EnsuDefaults {
pub desktop_model_presets: Vec<EnsuModelPreset>,
}
-#[derive(Debug, Clone, Serialize, Deserialize, uniffi::Record)]
+#[derive(Debug, Clone, uniffi::Record)]
pub struct ChatMessage {
pub role: String,
pub content: String,
}
-#[derive(Debug, Clone, Serialize, Deserialize, uniffi::Record)]
+#[derive(Debug, Clone, uniffi::Record)]
pub struct GenerateChatRequest {
pub messages: Vec<ChatMessage>,
pub template_override: Option<String>,
@@ -76,7 +75,7 @@ pub struct GenerateChatRequest {
pub grammar: Option<String>,
}
-#[derive(Debug, Clone, Serialize, Deserialize, uniffi::Record)]
+#[derive(Debug, Clone, uniffi::Record)]
pub struct GenerateSummary {
pub job_id: i64,
pub prompt_tokens: Option<i32>,
@@ -84,14 +83,14 @@ pub struct GenerateSummary {
pub total_time_ms: Option<i64>,
}
-#[derive(Debug, Clone, Serialize, Deserialize, uniffi::Record)]
+#[derive(Debug, Clone, uniffi::Record)]
pub struct LlmModelDownloadTarget {
pub label: String,
pub url: String,
pub destination_path: String,
}
-#[derive(Debug, Clone, Serialize, Deserialize, uniffi::Record)]
+#[derive(Debug, Clone, uniffi::Record)]
pub struct LlmModelDownloadProgress {
pub label: String,
pub downloaded_bytes: i64,
@@ -109,7 +108,7 @@ pub struct LlmModelDownloadProgress {
pub complete: bool,
}
-#[derive(Debug, Clone, Serialize, Deserialize, uniffi::Enum)]
+#[derive(Debug, Clone, uniffi::Enum)]
pub enum GenerateEvent {
Text {
job_id: i64,