-
Notifications
You must be signed in to change notification settings - Fork 3.9k
feat: add hyperswitch ai chats table #8831
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…perswitch into add-hyperswitch-ai-chats-table
…perswitch into add-hyperswitch-ai-chats-table
…perswitch into add-hyperswitch-ai-chats-table
pub database_query: Option<String>, | ||
pub interaction_status: Option<String>, | ||
pub created_at: PrimitiveDateTime, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have it under a feature flag
Cc: @jarnura
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currently all the routes related to the chat are inside chat config, it is a runtime feature flag chat_enabled
that says whether chat feature is enabled or not in the given env.
#[diesel(table_name = hyperswitch_ai_interaction, primary_key(id), check_for_backend(diesel::pg::Pg))] | ||
pub struct HyperswitchAiInteraction { | ||
pub id: String, | ||
pub session_id: Option<String>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Difference between id
and session_id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id
is a request-id and session_id
is something which generated for that particular chat window
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id is the message_id* for particular user request query and response, and the session_id is related to the whole conversation, i.e. current chat window
Type of Change
Description
Additional Changes
This pull request introduces support for encrypted chat conversations and adds database models and APIs for storing and retrieving chat interactions. The changes span configuration, API models, database schema, and core logic to enable secure chat storage and querying, with proper secret management for encryption keys.
Chat encryption and configuration:
encryption_key
to[chat]
sections in all config files and updatedChatSettings
to use a secret for the encryption key, with secret management integration for secure handling.Chat API model extensions:
ChatListRequest
,ChatConversation
,ChatListResponse
)Database schema and models for chat interactions:
hyperswitch_ai_interaction
table and corresponding Rust models for storing encrypted chat queries andCore chat logic improvements:
Run this as part of migration
1.Manual Partition creation for next two year.
2.Creates partitions for each 3-month range
3.Add calendar event to re run this after two year.
General enhancements and constants:
Motivation and Context
Closes #8847
How did you test it?
Checklist
cargo +nightly fmt --all
cargo clippy