-
Notifications
You must be signed in to change notification settings - Fork 113
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
[front] - fix(conversations): render conversations with archived agents #8900
Conversation
…ersions are fetched - Modify fetchWorkspaceAgentConfigurationsWithoutActions to return either active versions if they exist, or otherwise the latest versions - Implement reduction logic to group agents by sId and select the correct version to return based on status and existence in the accumulator
So that I understand correctly this was the limit: 1 change right? So the diffs we had so far are: https://github.com/dust-tt/dust/pull/8888/files And now this one? Let's step back and really think through the change to make sure we have a full understanding here. To do so please update your PR description with references to previous 2 PRs what they changes what they broke and why this is guaranteed to be the right end-state 🙏 |
@@ -366,15 +366,35 @@ async function fetchWorkspaceAgentConfigurationsWithoutActions( | |||
}); | |||
default: | |||
if (typeof agentsGetView === "object" && "agentIds" in agentsGetView) { | |||
return AgentConfiguration.findAll({ | |||
const agents = await AgentConfiguration.findAll({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems a bit tough to not leverage the SQL query, no? Agent configurations can have hundreds or versions 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can go full sql, we're gonna hvave to go for raw sql though don't think we can use sequelize for such complicated query
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LEt's see the SQL query once you have it. Maybe we can map it to Sequelize.
@JulesBelveze do we understand when it broke and how it broke? This query has been here for a long time no? Yet participants have been working in the past? What exactly broke them? |
You mean the limit: 1 was at odd with the move to sId array I presume. Seems plausibe that it was problematic cc @philipperolet ? Good that we're getting down to a very clear picture. Feel like we now have reached full context, which is great \o/ |
@JulesBelveze if you can add @philipperolet as reviewer this would be great to make sure we have full context on getting the good final state 🙏 Thanks for digging! |
…rations - Implement a more efficient SQL query to directly fetch the necessary agent configurations - Remove the previous post-processing logic in favor of database-level aggregation and sorting
After looking at it I concur with @JulesBelveze the query didn't work. Apologies for missing that. It's strange that nobody noticed since it's been 2 months, but at the same time since it only impacts the fact that you don't see all the avatars on the top right of your screen in a conversation it's possible Thanks a lot for solving this @JulesBelveze |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- LGTM and thanks on fixing the issue from my PR moving to agentIds array 🙏
- however, I think the 'status:active' filter is what's breaking the preview; AFAICT, the preview is grabbing for a 'draft' ? continuing investigation there
For reference, I'm talking about this wrt the preview broken: https://github.com/dust-tt/tasks/issues/1703 |
Other topic: conversations with archived agents generate unhandled errors => https://dust4ai.slack.com/archives/C05F84CFP0E/p1732630658549379 |
Discussed IRL:
|
…uery - Include option to fetch all versions of agent configurations - Modify query to retrieve only latest versions of agent configurations using Sequelize ORM instead of raw query
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 (make sure to test)
Tested the following:
|
…ts (#8900) * [front/lib/api/assistant] - fix: ensure only active or latest agent versions are fetched - Modify fetchWorkspaceAgentConfigurationsWithoutActions to return either active versions if they exist, or otherwise the latest versions - Implement reduction logic to group agents by sId and select the correct version to return based on status and existence in the accumulator * [front/lib/api/assistant] - refactor: optimize fetching agent configurations - Implement a more efficient SQL query to directly fetch the necessary agent configurations - Remove the previous post-processing logic in favor of database-level aggregation and sorting * [front/lib/api/assistant] - refactor: optimize agent configurations query - Include option to fetch all versions of agent configurations - Modify query to retrieve only latest versions of agent configurations using Sequelize ORM instead of raw query
Description
This PR modifies
fetchWorkspaceAgentConfigurationsWithoutActions
to return either active versions if they exist, or otherwise the latest versions.This was recently introduced by #8892. The goal of #8892 was to fix #8888.
Context: we recently found out that:
was causing a bunch of errors on the
/participants
endpoint as it was limiting to return only one agent configuration. Because of this the conversation participants were broken.The initial fix was to retrieve all "active" agent configurations, which fixed the conversation participants issue. However, this led to not be able to retrieve conversation with an "archived" agent.
This PR ensures that we either return the active agent configuration or its latest archived version.
Risk
Low
Deploy Plan
Deploy
front