feat(chat_manager.py): add file responses to ChatResponse
feat(schemas.py): add files field to ChatResponse schema
This commit is contained in:
parent
167d6c0f1e
commit
4dcfd9d1db
2 changed files with 11 additions and 0 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue