Skip to content

Fix issue where chat history is saved redundantly #180

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

Merged
merged 1 commit into from
Mar 8, 2024

Conversation

merrygoround-of-life
Copy link
Contributor

This is to fix the following issue:

  1. At initialization, AgentActor performs the following tasks:
    a. Fills self._chat_history from app_session_data.
    b. Retrieves a list of conversations up to self._config["chat_history_limit"] from self._chat_history.
    c. Appends the last retrieved conversation list to self._agent_messages (ultimately used for openai chat completion).
  2. Subsequently, when the openai client of AgentActor receives finish_reason=stop, it saves chat_history to app_session_data as self._chat_history + self._agent_messages. As a result, the conversation list obtained in b exists on both sides, leading to duplicate conversation storage.

To solve this issue, when saving app_session_data, modify it to exclude conversations up to chat_history_limit and save them to avoid unnecessary duplication.

Copy link

vercel bot commented Mar 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
llmstack ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 7, 2024 1:07pm

Copy link
Contributor

@ajhai ajhai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this @merrygoround-of-life!

@ajhai ajhai merged commit e3ed054 into trypromptly:main Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants