user restricted to own objects

This commit is contained in:
Per Stark committed 2024-12-15 22:52:34 +01:00
1 parent 646792291c
commit cf6078eceb
18 files changed
+109 -28

No files matched your search

+4 -1
View File
@@ -30,7 +30,8 @@ stored_object!(KnowledgeEntity, "knowledge_entity", {
description: String,
entity_type: KnowledgeEntityType,
metadata: Option<serde_json::Value>,
embedding: Vec<f32>
embedding: Vec<f32>,
user_id: String
});
impl KnowledgeEntity {
@@ -41,6 +42,7 @@ impl KnowledgeEntity {
entity_type: KnowledgeEntityType,
metadata: Option<serde_json::Value>,
embedding: Vec<f32>,
user_id: String,
) -> Self {
Self {
id: Uuid::new_v4().to_string(),
@@ -50,6 +52,7 @@ impl KnowledgeEntity {
entity_type,
metadata,
embedding,
user_id,
}
}
}
+4 -2
View File
@@ -4,16 +4,18 @@ use uuid::Uuid;
stored_object!(TextChunk, "text_chunk", {
source_id: String,
chunk: String,
embedding: Vec<f32>
embedding: Vec<f32>,
user_id: String
});
impl TextChunk {
pub fn new(source_id: String, chunk: String, embedding: Vec<f32>) -> Self {
pub fn new(source_id: String, chunk: String, embedding: Vec<f32>, user_id: String) -> Self {
Self {
id: Uuid::new_v4().to_string(),
source_id,
chunk,
embedding,
user_id,
}
}
}
+4 -1
View File
@@ -8,7 +8,8 @@ stored_object!(TextContent, "text_content", {
text: String,
file_info: Option<FileInfo>,
instructions: String,
category: String
category: String,
user_id: String
});
impl TextContent {
@@ -17,6 +18,7 @@ impl TextContent {
instructions: String,
category: String,
file_info: Option<FileInfo>,
user_id: String,
) -> Self {
Self {
id: Uuid::new_v4().to_string(),
@@ -24,6 +26,7 @@ impl TextContent {
file_info,
instructions,
category,
user_id,
}
}
}