Repository navigation
Ability control access to LLM Config menu - #172
Merged
Merged
Conversation
Ability control access to LLM Config using env variable LLM_CONFIG_ADMIN_ONLY backward compatibility , default value is N everyone has access Display version next to UNLA
Contributor
Reviewer's GuideThis PR implements environment-driven access control for the LLM Config menu and displays the application version next to the Unla logo by propagating runtime settings from the backend to the frontend. Class diagram for updated runtime config handlingclassDiagram
class RuntimeConfigHandler {
+HandleRuntimeConfig(c *gin.Context)
}
class version {
+Version string
+Get() string
}
RuntimeConfigHandler --> version : uses Version
Class diagram for Layout component LLM Config access controlclassDiagram
class Layout {
+userInfo
+llmConfigAdminOnly
+canShowLLM
+menuGroups
}
Layout : +fetchUserInfo()
Layout : +render()
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey @boston008 - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `web/src/main.tsx:111` </location>
<code_context>
...(response.data.features || {})
- }
+ },
+ // Ensure LLM_CONFIG_ADMIN_ONLY is set to 'N' if not present
+ LLM_CONFIG_ADMIN_ONLY: typeof response.data.LLM_CONFIG_ADMIN_ONLY === 'undefined' ? 'N' : response.data.LLM_CONFIG_ADMIN_ONLY
};
} catch (error) {
</code_context>
<issue_to_address>
Check for null as well as undefined for LLM_CONFIG_ADMIN_ONLY.
The current check misses cases where LLM_CONFIG_ADMIN_ONLY is null. Use a check like response.data.LLM_CONFIG_ADMIN_ONLY == null to handle both undefined and null values.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
// Ensure LLM_CONFIG_ADMIN_ONLY is set to 'N' if not present
LLM_CONFIG_ADMIN_ONLY: typeof response.data.LLM_CONFIG_ADMIN_ONLY === 'undefined' ? 'N' : response.data.LLM_CONFIG_ADMIN_ONLY
=======
// Ensure LLM_CONFIG_ADMIN_ONLY is set to 'N' if not present (handles undefined and null)
LLM_CONFIG_ADMIN_ONLY: response.data.LLM_CONFIG_ADMIN_ONLY == null ? 'N' : response.data.LLM_CONFIG_ADMIN_ONLY
>>>>>>> REPLACE
</suggested_fix>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Comment on lines
+111
to
+112
| // Ensure LLM_CONFIG_ADMIN_ONLY is set to 'N' if not present | ||
| LLM_CONFIG_ADMIN_ONLY: typeof response.data.LLM_CONFIG_ADMIN_ONLY === 'undefined' ? 'N' : response.data.LLM_CONFIG_ADMIN_ONLY |
Contributor
There was a problem hiding this comment.
suggestion (bug_risk): Check for null as well as undefined for LLM_CONFIG_ADMIN_ONLY.
The current check misses cases where LLM_CONFIG_ADMIN_ONLY is null. Use a check like response.data.LLM_CONFIG_ADMIN_ONLY == null to handle both undefined and null values.
Suggested change
| // Ensure LLM_CONFIG_ADMIN_ONLY is set to 'N' if not present | |
| LLM_CONFIG_ADMIN_ONLY: typeof response.data.LLM_CONFIG_ADMIN_ONLY === 'undefined' ? 'N' : response.data.LLM_CONFIG_ADMIN_ONLY | |
| // Ensure LLM_CONFIG_ADMIN_ONLY is set to 'N' if not present (handles undefined and null) | |
| LLM_CONFIG_ADMIN_ONLY: response.data.LLM_CONFIG_ADMIN_ONLY == null ? 'N' : response.data.LLM_CONFIG_ADMIN_ONLY |
Contributor
Author
Add access logic to settings icon in Chat page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ability control access to LLM Config using env variable LLM_CONFIG_ADMIN_ONLY backward compatibility , default value is N everyone has access Display version next to UNLA
Display application version on ui page on top righ next to Unla
Summary by Sourcery
Add environment-based access control for the LLM Config menu and display the application version in the UI layout.
New Features:
Enhancements:
Chores: