mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-22 05:41:39 +03:00
59fe7b089b
* feat(chat): use openai function for answer (backend) * feat(chat): use openai function for answer (frontend) * chore: refacto BrainPicking * feat: update chat creation logic * feat: simplify chat system logic * feat: set default method to gpt-3.5-turbo-0613 * feat: use user own openai key * feat(chat): slightly improve prompts * feat: add global error interceptor * feat: remove unused endpoints * docs: update chat system doc * chore(linter): add unused import remove config * feat: improve dx * feat: improve OpenAiFunctionBasedAnswerGenerator prompt
20 lines
593 B
Python
20 lines
593 B
Python
from models.chat import ChatHistory
|
|
from models.settings import common_dependencies
|
|
from typing import List # For type hinting
|
|
|
|
|
|
def get_chat_history(chat_id: str) -> List[ChatHistory]:
|
|
commons = common_dependencies()
|
|
history: List[ChatHistory] = (
|
|
commons["supabase"]
|
|
.from_("chat_history")
|
|
.select("*")
|
|
.filter("chat_id", "eq", chat_id)
|
|
.order("message_time", desc=False) # Add the ORDER BY clause
|
|
.execute()
|
|
).data
|
|
if history is None:
|
|
return []
|
|
else:
|
|
return [ChatHistory(message) for message in history]
|