-
Notifications
You must be signed in to change notification settings - Fork 10.5k
fix(patch): cherry-pick 54de675 to release/v0.21.0-preview.2-pr-14961 [CONFLICTS] #14968
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
Conversation
…quota is present. (#14961) # Conflicts: # packages/cli/src/ui/components/StatsDisplay.test.tsx # packages/cli/src/ui/components/StatsDisplay.tsx # packages/cli/src/ui/components/__snapshots__/StatsDisplay.test.tsx.snap
Summary of ChangesHello @gemini-cli-robot, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request automates the cherry-picking of a significant commit aimed at enhancing the clarity and presentation of token statistics and user quota information within the CLI's UI. The changes involve refining metric names, adjusting token calculations to highlight uncached input, and introducing dynamic rendering logic to simplify the statistics display based on the presence of quota data. However, the automated process encountered merge conflicts, necessitating manual intervention to integrate these improvements. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request is a cherry-pick that has resulted in several merge conflicts, as noted in the description. I've identified unresolved merge conflict markers in StatsDisplay.tsx, StatsDisplay.test.tsx, and its corresponding snapshot file. These are critical issues that must be resolved before the PR can be merged. Additionally, within one of the conflict blocks in StatsDisplay.tsx, there's a reference to an undefined variable VALID_GEMINI_MODELS which will cause a build failure. Please resolve all conflicts and ensure the code compiles and all tests pass.
| <<<<<<< HEAD | ||
| expect(output).not.toContain('Efficiency & Optimizations'); | ||
| expect(output).not.toContain('Model'); // The table header | ||
| ======= | ||
| >>>>>>> 54de67536 (feat(cli): polish cached token stats and simplify stats display when quota is present. (#14961)) |
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.
| <<<<<<< HEAD | ||
| ======= | ||
| // Logic for building the unified list of table rows | ||
| const buildModelRows = ( | ||
| models: Record<string, ModelMetrics>, | ||
| quotas?: RetrieveUserQuotaResponse, | ||
| ) => { | ||
| const getBaseModelName = (name: string) => name.replace('-001', ''); | ||
| const usedModelNames = new Set(Object.keys(models).map(getBaseModelName)); | ||
|
|
||
| // 1. Models with active usage | ||
| const activeRows = Object.entries(models).map(([name, metrics]) => { | ||
| const modelName = getBaseModelName(name); | ||
| const cachedTokens = metrics.tokens.cached; | ||
| const totalInputTokens = metrics.tokens.prompt; | ||
| const uncachedTokens = Math.max(0, totalInputTokens - cachedTokens); | ||
| return { | ||
| key: name, | ||
| modelName, | ||
| requests: metrics.api.totalRequests, | ||
| cachedTokens: cachedTokens.toLocaleString(), | ||
| uncachedTokens: uncachedTokens.toLocaleString(), | ||
| totalInputTokens: totalInputTokens.toLocaleString(), | ||
| outputTokens: metrics.tokens.candidates.toLocaleString(), | ||
| bucket: quotas?.buckets?.find((b) => b.modelId === modelName), | ||
| isActive: true, | ||
| }; | ||
| }); | ||
|
|
||
| // 2. Models with quota only | ||
| const quotaRows = | ||
| quotas?.buckets | ||
| ?.filter( | ||
| (b) => | ||
| b.modelId && | ||
| VALID_GEMINI_MODELS.has(b.modelId) && | ||
| !usedModelNames.has(b.modelId), | ||
| ) | ||
| .map((bucket) => ({ | ||
| key: bucket.modelId!, | ||
| modelName: bucket.modelId!, | ||
| requests: '-', | ||
| cachedTokens: '-', | ||
| uncachedTokens: '-', | ||
| totalInputTokens: '-', | ||
| outputTokens: '-', | ||
| bucket, | ||
| isActive: false, | ||
| })) || []; | ||
|
|
||
| return [...activeRows, ...quotaRows]; | ||
| }; | ||
|
|
||
| >>>>>>> 54de67536 (feat(cli): polish cached token stats and simplify stats display when quota is present. (#14961)) |
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.
| ?.filter( | ||
| (b) => | ||
| b.modelId && | ||
| VALID_GEMINI_MODELS.has(b.modelId) && |
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.
| <<<<<<< HEAD | ||
| ======= | ||
| exports[`<StatsDisplay /> > Quota Display > renders quota information for unused models 1`] = ` | ||
| "╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ | ||
| │ │ | ||
| │ Session Stats │ | ||
| │ │ | ||
| │ Interaction Summary │ | ||
| │ Session ID: test-session-id │ | ||
| │ Tool Calls: 0 ( ✓ 0 x 0 ) │ | ||
| │ Success Rate: 0.0% │ | ||
| │ │ | ||
| │ Performance │ | ||
| │ Wall Time: 1s │ | ||
| │ Agent Active: 0s │ | ||
| │ » API Time: 0s (0.0%) │ | ||
| │ » Tool Time: 0s (0.0%) │ | ||
| │ │ | ||
| │ │ | ||
| │ Model Usage Reqs Usage left │ | ||
| │ ────────────────────────────────────────────────────────────────────────────────────────────── │ | ||
| │ gemini-2.5-flash - 50.0% (Resets in 2h) │ | ||
| │ │ | ||
| │ Usage limits span all sessions and reset daily. │ | ||
| │ /auth to upgrade or switch to API key. │ | ||
| │ │ | ||
| │ │ | ||
| │ » Tip: For a full token breakdown, run \`/stats model\`. │ | ||
| │ │ | ||
| ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯" | ||
| `; | ||
|
|
||
| >>>>>>> 54de67536 (feat(cli): polish cached token stats and simplify stats display when quota is present. (#14961)) |
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.
jacob314
left a 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.
|
Size Change: +4.48 kB (+0.02%) Total Size: 21.6 MB
ℹ️ View Unchanged
|
jacob314
left a 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.
73add0f
into
release/v0.21.0-preview.2-pr-14961

This PR automatically cherry-picks commit 54de675 to patch version v0.21.0-preview.2 in the preview release to create version 0.21.0-preview.3.
This cherry-pick resulted in merge conflicts that need manual resolution.
🔧 Next Steps:
📋 Files with conflicts:
The commit has been created with conflict markers for easier manual resolution.
🚨 Important: