feat: add hyperswitch ai chats table (#8831)

Co-authored-by: Apoorv Dixit <apoorv.dixit@juspay.in>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Jeeva Ramachandran
2025-09-16 13:55:41 +05:30
committed by GitHub
parent d93e73dd83
commit 8ed3f7dbf2
34 changed files with 743 additions and 37 deletions

View File

@ -1,12 +1,13 @@
use common_utils::id_type;
use masking::Secret;
use time::PrimitiveDateTime;
#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)]
pub struct ChatRequest {
pub message: Secret<String>,
}
#[derive(Debug, serde::Deserialize, serde::Serialize)]
#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)]
pub struct ChatResponse {
pub response: Secret<serde_json::Value>,
pub merchant_id: id_type::MerchantId,
@ -16,3 +17,32 @@ pub struct ChatResponse {
#[serde(skip_serializing)]
pub row_count: Option<i32>,
}
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct ChatListRequest {
pub merchant_id: Option<id_type::MerchantId>,
pub limit: Option<i64>,
pub offset: Option<i64>,
}
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct ChatConversation {
pub id: String,
pub session_id: Option<String>,
pub user_id: Option<String>,
pub merchant_id: Option<String>,
pub profile_id: Option<String>,
pub org_id: Option<String>,
pub role_id: Option<String>,
pub user_query: Secret<String>,
pub response: Secret<serde_json::Value>,
pub database_query: Option<String>,
pub interaction_status: Option<String>,
#[serde(with = "common_utils::custom_serde::iso8601")]
pub created_at: PrimitiveDateTime,
}
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct ChatListResponse {
pub conversations: Vec<ChatConversation>,
}

View File

@ -1,5 +1,8 @@
use common_utils::events::{ApiEventMetric, ApiEventsType};
use crate::chat::{ChatRequest, ChatResponse};
use crate::chat::{ChatListRequest, ChatListResponse, ChatRequest, ChatResponse};
common_utils::impl_api_event_type!(Chat, (ChatRequest, ChatResponse));
common_utils::impl_api_event_type!(
Chat,
(ChatRequest, ChatResponse, ChatListRequest, ChatListResponse)
);