-
Notifications
You must be signed in to change notification settings - Fork 117
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
[refacto] - refacto: agent popularity query #6145
Conversation
…timeframe and simplify data - Change the agent ranking calculation period from 30 days to a shorter 7 days timeframe for more recent data relevance - Remove the tracking and storage of user counts related to agent mentions, simplifying the data model and storage requirements - Clean up unused imports and functions, such as `agentMentionsUserCount`, to streamline the codebase - Update related functions to adapt to the removal of user count tracking and the new ranking timeframe - Ensure backwards compatibility by incrementing message count only if the counts have already been computed
- The userCount field is removed from the usage data structure for agent configurations [types] - refactor: update AgentUsageType interface - Removed userCount property to reflect changes in usage data handling - Adjusted associated comments to remove references to userCount in the timePeriodSec field
…in SharingDropdown - Remove conditions related to initial state and user count when setting new scope [front/components/assistant] - refactor: streamline assistant usage message in Usage.tsx - Remove user count detail from the usage message display logic
🔍 Existing Issues For ReviewYour pull request is modifying functions with the following pre-existing issues: 📄 File: front/lib/api/assistant/agent_usage.ts
Did you find this useful? React with a 👍 or 👎 |
- Removed unnecessary use of Promise.all for a single async operation
254fd2e
to
5715782
Compare
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 👍
// Ranking of agents is done over a 30 days period. | ||
const rankingTimeframeSec = 60 * 60 * 24 * 30; // 30 days | ||
// Ranking of agents is done over a 7 days period. | ||
const rankingTimeframeSec = 60 * 60 * 24 * 7; // 30 days |
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.
nit: remove 30 days comment
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.
Oops overlooked that one sorry 👍🏼
- Fixed the inaccurate comment to reflect the actual 7 days period used for agent ranking computations
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.
Thank you 🙇
* [front/lib/api/assistant] - refactor: update agent usage calculation timeframe and simplify data - Change the agent ranking calculation period from 30 days to a shorter 7 days timeframe for more recent data relevance - Remove the tracking and storage of user counts related to agent mentions, simplifying the data model and storage requirements - Clean up unused imports and functions, such as `agentMentionsUserCount`, to streamline the codebase - Update related functions to adapt to the removal of user count tracking and the new ranking timeframe - Ensure backwards compatibility by incrementing message count only if the counts have already been computed * [front] - refactor: remove userCount from agent usage data - The userCount field is removed from the usage data structure for agent configurations [types] - refactor: update AgentUsageType interface - Removed userCount property to reflect changes in usage data handling - Adjusted associated comments to remove references to userCount in the timePeriodSec field * [front/components/assistant] - refactor: simplify scope change logic in SharingDropdown - Remove conditions related to initial state and user count when setting new scope [front/components/assistant] - refactor: streamline assistant usage message in Usage.tsx - Remove user count detail from the usage message display logic * [front] - refactor: simplify retrieval of agent message count - Removed unnecessary use of Promise.all for a single async operation * [assistant] - fix: correct comment for agent ranking timeframe - Fixed the inaccurate comment to reflect the actual 7 days period used for agent ranking computations --------- Co-authored-by: Jules <[email protected]>
@JulesBelveze you might have a bit more context, do you know why we poke redis for the usage on the ui ? |
@albandum The main reason we were storing usage on Redis is because those queries are really expensive and we do not want them to be ran for each admin landing on the workspace page. |
@JulesBelveze looks like we removed that from the workspace page, now it only shows when you open an assistant modal if I'm not mistaken so might not be necessary anymore |
Description
This PR refactors the agent popularity query to improve efficiency and reduce database load. The main changes include:
Risk
Overlooking files in which
userCount
was used.There will be a discrepancy between in the message count until the Redis caches expire. Indeed, we are switching from 30 days to 7 days and what's currently in Redis cache is the count for 30 days.
Deploy Plan
front-edge
front