Merge remote-tracking branch 'origin/chat_and_cache' into websocket

This commit is contained in:
anovazzi1 2023-04-25 22:07:18 -03:00
commit aa8a45bab6
2 changed files with 11 additions and 0 deletions

View file

@ -120,10 +120,20 @@ class ChatManager:
raise e
# Send a response back to the frontend, if needed
intermediate_steps = intermediate_steps or ""
history = self.chat_history.get_history(client_id, filter=False)
file_responses = []
if history:
for msg in history:
if isinstance(msg, FileResponse):
file_responses.append(msg)
if msg.type == "start":
break
response = ChatResponse(
message=result or "",
intermediate_steps=intermediate_steps.strip(),
type="end",
files=file_responses,
)
self.chat_history.add_message(client_id, response)

View file

@ -16,6 +16,7 @@ class ChatResponse(ChatMessage):
intermediate_steps: str
type: str
is_bot: bool = True
files: list = []
@validator("type")
def validate_message_type(cls, v):