-
Notifications
You must be signed in to change notification settings - Fork 2k
fix: LlmPopover after filling in an initial model #5504
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
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀
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.
Greptile Overview
Summary
This PR fixes a React hook dependency issue in useLlmManager
by adding llmProviders
to the useEffect dependency array. The fix prevents stale closures that could occur when LLM providers change after the initial render, ensuring that temperature initialization always uses the current provider state.
- Fixed useEffect dependency array to include
llmProviders
parameter - Prevents stale closure bugs when provider configuration changes
- Ensures temperature is correctly initialized based on current LLM providers
Confidence Score: 5/5
- This PR is safe to merge with minimal risk
- Score reflects a simple, correct React hook dependency fix that follows React best practices and prevents potential bugs without introducing new complexity
- No files require special attention
Important Files Changed
File Analysis
Filename | Score | Overview |
---|---|---|
web/src/lib/hooks.ts | 5/5 | Fixed React useEffect dependency array by adding llmProviders to prevent stale closures |
Sequence Diagram
sequenceDiagram
participant UI as UI Component
participant Hook as useLlmManager
participant State as React State
UI->>Hook: Initial render with llmProviders
Hook->>State: Initialize temperature (useState)
Note over State: Temperature set based on currentChatSession/liveAssistant
UI->>Hook: llmProviders change
Hook->>Hook: useEffect triggers (with llmProviders in deps)
Hook->>State: Update temperature based on new providers
Note over Hook: Prevents stale closure with old llmProviders reference
UI->>Hook: liveAssistant change
Hook->>Hook: useEffect triggers
Hook->>State: Recalculate temperature (0 for search tools, 0.5 default)
UI->>Hook: currentChatSession change
Hook->>Hook: useEffect triggers
Hook->>State: Use session temperature override or default
1 file reviewed, no comments
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.
No issues found across 1 file
Description
^
Fixes https://linear.app/danswer/issue/DAN-2501/after-putting-in-llm-key-models-dont-automatically-update-giving-the
How Has This Been Tested?
[Describe the tests you ran to verify your changes]
Additional Options
Summary by cubic
Fixes startup by ensuring temperature is initialized when LLM providers load. Added llmProviders to the useLlmManager effect dependencies to avoid stale temperature on initial run.