From 4730b78284df067b65a3b4e70fecfbbed5ea9127 Mon Sep 17 00:00:00 2001 From: dal Date: Tue, 4 Mar 2025 13:09:54 -0700 Subject: [PATCH] commit up update user --- api/libs/database/src/models.rs | 3 ++- api/libs/database/src/schema.rs | 1 + api/libs/handlers/src/chats/post_chat_handler.rs | 1 + api/migrations/2025-01-28-174921_adjust_messages_table/up.sql | 1 + api/src/routes/rest/routes/users/update_user.rs | 4 ---- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/libs/database/src/models.rs b/api/libs/database/src/models.rs index 18052faef..71086747b 100644 --- a/api/libs/database/src/models.rs +++ b/api/libs/database/src/models.rs @@ -42,8 +42,9 @@ pub struct Message { pub request_message: String, pub response_messages: Value, pub reasoning: Value, - pub final_reasoning_message: String, pub title: String, + pub raw_llm_messages: Value, + pub final_reasoning_message: String, pub chat_id: Uuid, pub created_at: DateTime, pub updated_at: DateTime, diff --git a/api/libs/database/src/schema.rs b/api/libs/database/src/schema.rs index 1c0d30474..4d11d0c2c 100644 --- a/api/libs/database/src/schema.rs +++ b/api/libs/database/src/schema.rs @@ -320,6 +320,7 @@ diesel::table! { response_messages -> Jsonb, reasoning -> Jsonb, title -> Text, + raw_llm_messages -> Jsonb, final_reasoning_message -> Text, chat_id -> Uuid, created_at -> Timestamptz, diff --git a/api/libs/handlers/src/chats/post_chat_handler.rs b/api/libs/handlers/src/chats/post_chat_handler.rs index 32e52d90e..11eaf8023 100644 --- a/api/libs/handlers/src/chats/post_chat_handler.rs +++ b/api/libs/handlers/src/chats/post_chat_handler.rs @@ -261,6 +261,7 @@ pub async fn post_chat_handler( reasoning: serde_json::to_value(&reasoning_messages)?, final_reasoning_message, title: title.title.clone().unwrap_or_default(), + raw_llm_messages: todo!(), }; // Insert message into database diff --git a/api/migrations/2025-01-28-174921_adjust_messages_table/up.sql b/api/migrations/2025-01-28-174921_adjust_messages_table/up.sql index 7e4e37dcc..3a82475ca 100644 --- a/api/migrations/2025-01-28-174921_adjust_messages_table/up.sql +++ b/api/migrations/2025-01-28-174921_adjust_messages_table/up.sql @@ -11,6 +11,7 @@ CREATE TABLE messages ( response_messages JSONB NOT NULL, reasoning JSONB NOT NULL, title TEXT NOT NULL, + raw_llm_messages JSONB NOT NULL, final_reasoning_message TEXT NOT NULL, chat_id UUID NOT NULL REFERENCES chats(id), created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), diff --git a/api/src/routes/rest/routes/users/update_user.rs b/api/src/routes/rest/routes/users/update_user.rs index 751fdbaf1..b478cdd02 100644 --- a/api/src/routes/rest/routes/users/update_user.rs +++ b/api/src/routes/rest/routes/users/update_user.rs @@ -73,10 +73,6 @@ pub async fn update_user_handler( } }; - if &auth_user.id == user_id { - return Err(anyhow::anyhow!("Cannot update self")); - }; - match is_user_workspace_admin_or_data_admin(auth_user, &user_organization_id).await { Ok(true) => (), Ok(false) => return Err(anyhow::anyhow!("Insufficient permissions")),