Skip to content

Commit

Permalink
replace message content type list to string when file_objs is empty .. (
Browse files Browse the repository at this point in the history
  • Loading branch information
vikeychen authored Mar 8, 2024
1 parent bd26c93 commit 237bb85
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions api/core/memory/token_buffer_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,14 @@ def get_history_prompt_messages(self, max_token_limit: int = 2000,
files, message.app_model_config
)

prompt_message_contents = [TextPromptMessageContent(data=message.query)]
for file_obj in file_objs:
prompt_message_contents.append(file_obj.prompt_message_content)

prompt_messages.append(UserPromptMessage(content=prompt_message_contents))
if not file_objs:
prompt_messages.append(UserPromptMessage(content=message.query))
else:
prompt_message_contents = [TextPromptMessageContent(data=message.query)]
for file_obj in file_objs:
prompt_message_contents.append(file_obj.prompt_message_content)

prompt_messages.append(UserPromptMessage(content=prompt_message_contents))
else:
prompt_messages.append(UserPromptMessage(content=message.query))

Expand Down

0 comments on commit 237bb85

Please sign in to comment.