-
Notifications
You must be signed in to change notification settings - Fork 59.7k
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
Fix gemini summary #5819
Fix gemini summary #5819
Conversation
@DDMeaqua is attempting to deploy a commit to the NextChat Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThe changes in this pull request focus on the Changes
Possibly related PRs
Suggested reviewers
π Recent review detailsConfiguration used: CodeRabbit UI π Files selected for processing (1)
π§ Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? πͺ§ TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Your build has completed! |
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.
Actionable comments posted: 0
π§Ή Outside diff range and nitpick comments (1)
app/client/platforms/google.ts (1)
65-65
: Add debug logging for response structure variations.While the additional fallback path improves resilience, consider adding debug logging when the primary extraction path fails. This would help track how often and why alternative paths are used.
return ( res?.candidates?.at(0)?.content?.parts.at(0)?.text || + (res?.candidates?.at(0) == null && console.debug('[Gemini] Primary extraction path failed, trying alternative')) || res?.at(0)?.candidates?.at(0)?.content?.parts.at(0)?.text || + (res?.at(0)?.candidates?.at(0) == null && console.debug('[Gemini] Alternative extraction path failed, checking error')) || res?.error?.message || "" );
π Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
π Files selected for processing (1)
app/client/platforms/google.ts
(1 hunks)
π Additional comments (2)
app/client/platforms/google.ts (2)
54-56
: Overall changes look good and improve robustness.
The modifications enhance the Gemini API integration by:
- Making URL construction more selective with SSE parameters
- Adding fallback paths for response parsing
The changes are focused, maintain type safety, and follow existing patterns.
Also applies to: 65-65
54-56
: Document the gemini-pro condition and verify its necessity.
While the URL parameter handling logic is correct, the condition excluding "gemini-pro" paths needs documentation explaining its purpose and implications.
Let's verify the necessity of this condition:
β Verification successful
The gemini-pro
SSE exclusion is correct and necessary
Based on the codebase analysis, the condition to exclude alt=sse
parameter for gemini-pro paths is correct. The evidence shows:
- The SSE parameter is handled differently for Gemini Pro in the API layer (
app/api/google.ts
), where SSE is conditionally added based on the request parameters. - The code follows Google's Gemini API streaming implementation pattern, as indicated by the comment:
// https://github.com/google-gemini/cookbook/blob/main/quickstarts/rest/Streaming_REST.ipynb
- The streaming functionality is properly managed through the
stream()
utility for both regular and function-calling scenarios.
π Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for any special handling of gemini-pro endpoints or SSE-related code
rg -l "gemini-pro.*alt=sse"
# Look for related documentation or comments
rg -l "gemini.*sse" -g "*.md"
Length of output: 61
Script:
#!/bin/bash
# Let's try a broader search for gemini-pro and SSE patterns
rg -A 5 "gemini-pro"
# Search for SSE-related code
rg -A 5 "alt=sse"
# Look for any Google API endpoint configurations
rg -A 5 "google.*api.*endpoint|GOOGLE.*API.*URL" -i
# Check the entire Google platform file content
cat app/client/platforms/google.ts
Length of output: 18487
app/client/platforms/google.ts
Outdated
@@ -51,15 +51,18 @@ export class GeminiProApi implements LLMApi { | |||
console.log("[Proxy Endpoint] ", baseUrl, path); | |||
|
|||
let chatPath = [baseUrl, path].join("/"); | |||
if (!chatPath.includes("gemini-pro")) { |
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.
εΊθ―₯δΈθ½θΏδΉε€ζε§οΌθΏιιθ¦ζη §ζ―ε¦θ΅°stream樑εΌθΏθ‘ε€ζοΌθδΈζ―ζ樑εεη§°θΏθ‘ε€ζ
π» εζ΄η±»ε | Change Type
π εζ΄θ―΄ζ | Description of Change
[#5308]
π θ‘₯ε δΏ‘ζ― | Additional Information
Summary by CodeRabbit
New Features
Bug Fixes