-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
feat(chatMessages): add brain_id and prompt_id columns #912
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Risk Level 2 - /home/runner/work/quivr/quivr/backend/core/models/databases/supabase/chats.py The code is generally well written, but there are a few areas that could be improved:
Risk Level 2 - /home/runner/work/quivr/quivr/backend/core/repository/chat/update_chat_history.py The function
This will ensure that an appropriate error is raised when the update operation fails. Risk Level 3 - /home/runner/work/quivr/quivr/backend/core/routes/chat_routes.py
🔒🐛🔄 Powered by Code Review GPT |
|
||
|
||
def get_brain_prompt_id(brain_id: UUID) -> UUID | None: | ||
if not brain_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.
but brain_id is typed as UUID in the input props
user_message: str | ||
assistant: str | ||
message_time: str | ||
prompt_title: Optional[str] = "" |
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.
not at the chatHistory level, its at the message level no ? a chat history could be generated using multiple brains in the future
supabase_db = get_supabase_db() | ||
history: List[ChatHistory] = supabase_db.get_chat_history(chat_id).data | ||
history: List[dict] = supabase_db.get_chat_history(chat_id).data |
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.
why dict instead of ChatHistory ?
scripts/tables.sql
Outdated
@@ -23,7 +23,9 @@ CREATE TABLE IF NOT EXISTS chat_history ( | |||
user_message TEXT, | |||
assistant TEXT, | |||
message_time TIMESTAMP DEFAULT current_timestamp, | |||
PRIMARY KEY (chat_id, message_id) | |||
PRIMARY KEY (chat_id, message_id), | |||
prompt_id UUID, |
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.
prompt_id and brain_id should reference the prompts and brains table respectively, can be null
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.
Reference prompts and brains tables in chat_history
fb6acc9
to
0eb87b5
Compare
BEGIN | ||
IF NOT EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name = 'chat_history' AND column_name = 'brain_id') THEN | ||
-- Add brain_id column | ||
ALTER TABLE chat_history ADD COLUMN brain_id UUID; |
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.
reference brains table
IF NOT EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name = 'chat_history' AND column_name = 'prompt_id') THEN | ||
-- Add prompt_id column | ||
ALTER TABLE chat_history ADD COLUMN prompt_id UUID; | ||
END IF; |
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.
reference prompts table
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.
Missing references to tables in migration script
0eb87b5
to
01ebbc8
Compare
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.
Bien vuuuu
* feat: add prompt_id and brain_id to chat history) * feat: add prompt_id and brain_id to chat routes
Description