-
Notifications
You must be signed in to change notification settings - Fork 8
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
refactor: move all enums in a dedicated module #515
Conversation
WalkthroughThis pull request refactors the codebase by replacing legacy enumeration definitions and import sources with a consolidated set of enums from the new Changes
Possibly related PRs
✨ Finishing Touches
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
Documentation and Community
|
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: 2
🔭 Outside diff range comments (1)
basilisk/enums.py (1)
152-161
: Consider using IntFlag for SearchMode.Since
SearchMode
uses integer values and could potentially be combined (e.g., PLAIN_TEXT | EXTENDED), consider usingIntFlag
instead ofEnum
.-class SearchMode(Enum): +class SearchMode(IntFlag): PLAIN_TEXT = 0 EXTENDED = 1 REGEX = 2
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (31)
basilisk/config/__init__.py
(0 hunks)basilisk/config/account_config.py
(8 hunks)basilisk/config/config_enums.py
(0 hunks)basilisk/config/main_config.py
(2 hunks)basilisk/consts.py
(0 hunks)basilisk/conversation/__init__.py
(1 hunks)basilisk/conversation/conversation_helper.py
(1 hunks)basilisk/conversation/conversation_model.py
(1 hunks)basilisk/conversation/image_model.py
(1 hunks)basilisk/enums.py
(1 hunks)basilisk/gui/account_dialog.py
(3 hunks)basilisk/gui/conversation_tab.py
(6 hunks)basilisk/gui/main_frame.py
(1 hunks)basilisk/gui/preferences_dialog.py
(3 hunks)basilisk/gui/search_dialog.py
(1 hunks)basilisk/main_app.py
(3 hunks)basilisk/message_segment_manager.py
(1 hunks)basilisk/provider.py
(1 hunks)basilisk/provider_capability.py
(0 hunks)basilisk/provider_engine/anthropic_engine.py
(2 hunks)basilisk/provider_engine/base_engine.py
(1 hunks)basilisk/provider_engine/deepseek_engine.py
(2 hunks)basilisk/provider_engine/gemini_engine.py
(3 hunks)basilisk/provider_engine/mistralai_engine.py
(1 hunks)basilisk/provider_engine/openai_engine.py
(2 hunks)basilisk/provider_engine/openrouter_engine.py
(1 hunks)basilisk/provider_engine/xai_engine.py
(1 hunks)basilisk/screen_capture_thread.py
(1 hunks)basilisk/server_thread.py
(1 hunks)basilisk/updater.py
(2 hunks)tests/test_message_position_manager.py
(1 hunks)
💤 Files with no reviewable changes (4)
- basilisk/consts.py
- basilisk/config/init.py
- basilisk/provider_capability.py
- basilisk/config/config_enums.py
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: build_app / build_windows (x86)
- GitHub Check: build_app / build_windows (x64)
🔇 Additional comments (44)
basilisk/conversation/__init__.py (1)
2-2
: LGTM! Clean removal ofMessageRoleEnum
.The changes align with the PR objective of moving enums to a dedicated module. The removal of
MessageRoleEnum
from both the import statement and__all__
list is consistent with the broader transition to useMessageRole
frombasilisk.enums
.Also applies to: 5-14
basilisk/provider_engine/xai_engine.py (1)
4-7
: LGTM! Clean transition to useProviderCapability
frombasilisk.enums
.The changes align with the PR objective. The import and usage of
ProviderCapability
enum in thecapabilities
attribute is correct.Also applies to: 13-16
basilisk/conversation/conversation_model.py (1)
8-8
: LGTM! Clean transition to useMessageRole
frombasilisk.enums
.The changes align with the PR objective. The import of
MessageRole
and the type update in theMessage
class are correct.Also applies to: 16-16
basilisk/screen_capture_thread.py (1)
11-11
: LGTM! Clean transition to useCaptureMode
frombasilisk.enums
.The changes align with the PR objective. The import and usage of
CaptureMode
enum is correct.basilisk/provider_engine/openrouter_engine.py (1)
9-9
: LGTM! Import change aligns with enum centralization.The change to import
ProviderCapability
frombasilisk.enums
is consistent with the PR's objective of centralizing enums in a dedicated module.basilisk/provider_engine/deepseek_engine.py (2)
11-12
: LGTM! Clean separation of model and enum imports.The separation of model imports (
Message
,MessageBlock
) from enum imports (MessageRole
,ProviderCapability
) improves code organization.
90-90
: LGTM! Correct enum usage.The update to use
MessageRole.ASSISTANT
aligns with the centralized enum approach.basilisk/config/main_config.py (2)
7-8
: LGTM! Clean import of centralized enums.The import of enums from
basilisk.enums
aligns with the centralization objective.
23-27
: LGTM! Consistent enum usage in field types.The field types and default values are correctly updated to use the new centralized enums.
basilisk/conversation/conversation_helper.py (1)
13-15
: LGTM! Clean separation of model and enum imports.The separation of the
ImageFile
model import from theImageFileTypes
enum import improves code organization while maintaining functionality.basilisk/enums.py (1)
1-4
: LGTM! Good organization of imports.The file has a clean structure with proper imports and type hints.
basilisk/provider.py (1)
9-9
: LGTM! Clean enum migration.The change correctly imports ProviderAPIType from the centralized enums module.
basilisk/main_app.py (1)
15-15
: LGTM! Clean enum migration.The changes correctly import and use AutomaticUpdateMode from the centralized enums module.
Also applies to: 76-77, 89-90, 95-96
basilisk/message_segment_manager.py (1)
7-7
: LGTM! Clean enum migration.The change correctly imports MessageSegmentType from the centralized enums module.
basilisk/provider_engine/gemini_engine.py (3)
9-10
: LGTM! Clean import reorganization.The imports have been properly reorganized to use the new enum module location.
101-109
: LGTM! Consistent enum usage in role conversion.The role conversion logic has been updated to use the new
MessageRole
enum while maintaining the same functionality.
164-164
: LGTM! Consistent enum usage in response handling.The response role assignment has been updated to use the new
MessageRole
enum.basilisk/provider_engine/anthropic_engine.py (2)
12-13
: LGTM! Clean import reorganization.The imports have been properly reorganized to use the new enum module location.
207-207
: LGTM! Consistent enum usage in response handling.The response role assignment has been updated to use the new
MessageRole
enum.basilisk/conversation/image_model.py (2)
25-25
: LGTM! Clean import reorganization.The import has been properly updated to use the new enum module location.
164-165
: LGTM! Consistent enum usage in type property.The type property correctly uses the imported
ImageFileTypes
enum.basilisk/provider_engine/openai_engine.py (2)
20-21
: LGTM! Clean import reorganization.The imports have been properly reorganized to use the new enum module location.
324-324
: LGTM! Consistent enum usage in response handling.The response role assignment has been updated to use the new
MessageRole
enum.basilisk/gui/search_dialog.py (1)
6-6
: LGTM! Clean enum refactoring.The change successfully moves the SearchDirection and SearchMode enums to the centralized basilisk.enums module while maintaining the existing functionality.
basilisk/gui/preferences_dialog.py (2)
7-7
: LGTM! Clean enum imports.The import statement correctly brings in the enums from the centralized basilisk.enums module.
13-17
: LGTM! Improved enum label handling.Using the get_labels() method from the enum classes is a cleaner approach than maintaining separate dictionaries for labels.
basilisk/config/account_config.py (3)
28-28
: LGTM! Clean enum imports.The import statement correctly brings in the enums from the centralized basilisk.enums module.
44-44
: LGTM! Correct enum field type update.The field type has been correctly updated to use the new KeyStorageMethod enum.
56-56
: LGTM! Consistent enum usage in validation.The validation logic correctly uses the new KeyStorageMethod enum while maintaining the same functionality.
Also applies to: 60-60
basilisk/updater.py (2)
17-18
: LGTM! Clean enum imports.The import statement correctly brings in the ReleaseChannel enum from the centralized basilisk.enums module.
426-431
: LGTM! Clean enum usage in match statement.The match-case statement correctly uses the new ReleaseChannel enum while maintaining the same control flow logic.
basilisk/gui/account_dialog.py (3)
8-9
: LGTM!The import statements have been updated to import enums from the dedicated
basilisk.enums
module, which aligns with the PR objectives.
16-18
: LGTM!The key storage methods dictionary correctly uses the new
KeyStorageMethod
enum values.
150-150
: LGTM!The code now uses
AccountSource.get_labels()
to retrieve labels, which is a more maintainable approach as it centralizes label management in the enum class.Also applies to: 542-542
basilisk/gui/main_frame.py (1)
16-18
: LGTM!The import statements have been updated to import enums from the dedicated
basilisk.enums
module, which aligns with the PR objectives.basilisk/gui/conversation_tab.py (5)
30-30
: LGTM!The import statements have been updated to import enums from the dedicated
basilisk.enums
module, which aligns with the PR objectives.
56-56
: LGTM!The code now uses
MessageRole.get_labels()
to retrieve labels, which is a more maintainable approach as it centralizes label management in the enum class.
1080-1080
: LGTM!The code correctly uses
MessageRole.SYSTEM
for system messages.
1096-1096
: LGTM!The code correctly uses
MessageRole.USER
for user messages.
1319-1319
: LGTM!The code correctly uses
MessageRole.USER
for title generation.basilisk/server_thread.py (1)
11-11
: LGTM!The import statements have been updated to import enums from the dedicated
basilisk.enums
module, which aligns with the PR objectives.basilisk/provider_engine/base_engine.py (1)
9-9
: Updated Import for ProviderCapability
The import forProviderCapability
has been correctly updated to use the centralized enum frombasilisk.enums
, ensuring consistency in how provider capabilities are referenced throughout the codebase.basilisk/provider_engine/mistralai_engine.py (1)
4-7
: Refactored ProviderCapability Import
The changes in this file now importProviderCapability
directly frombasilisk.enums
instead of indirectly via theopenai_engine
module. This reduces coupling between modules and aligns with the new refactoring goal of centralizing enums.tests/test_message_position_manager.py (1)
3-3
: Updated Import for MessageSegmentType
The test file now importsMessageSegmentType
frombasilisk.enums
, consistent with the reorganization of enum definitions. This update does not impact the test logic and positively contributes to maintainability.
basilisk/enums.py
Outdated
class ImageFileTypes(Enum): | ||
UNKNOWN = "unknown" | ||
IMAGE_LOCAL = "local" | ||
IMAGE_MEMORY = "memory" | ||
IMAGE_URL = "http" | ||
|
||
@classmethod | ||
def _missing_(cls, value: object) -> ImageFileTypes: | ||
if isinstance(value, str) and value.lower() == "data": | ||
return cls.IMAGE_URL | ||
if isinstance(value, str) and value.lower() == "https": | ||
return cls.IMAGE_URL | ||
if isinstance(value, str) and value.lower() == "zip": | ||
return cls.IMAGE_LOCAL | ||
return cls.UNKNOWN | ||
|
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.
🧹 Nitpick (assertive)
Consider using a more robust pattern matching in _missing_
.
The _missing_
method in ImageFileTypes
could be improved for better maintainability and readability.
@classmethod
def _missing_(cls, value: object) -> ImageFileTypes:
- if isinstance(value, str) and value.lower() == "data":
- return cls.IMAGE_URL
- if isinstance(value, str) and value.lower() == "https":
- return cls.IMAGE_URL
- if isinstance(value, str) and value.lower() == "zip":
- return cls.IMAGE_LOCAL
+ if not isinstance(value, str):
+ return cls.UNKNOWN
+
+ value_lower = value.lower()
+ url_schemes = {"data", "https"}
+ if value_lower in url_schemes:
+ return cls.IMAGE_URL
+ if value_lower == "zip":
+ return cls.IMAGE_LOCAL
return cls.UNKNOWN
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
class ImageFileTypes(Enum): | |
UNKNOWN = "unknown" | |
IMAGE_LOCAL = "local" | |
IMAGE_MEMORY = "memory" | |
IMAGE_URL = "http" | |
@classmethod | |
def _missing_(cls, value: object) -> ImageFileTypes: | |
if isinstance(value, str) and value.lower() == "data": | |
return cls.IMAGE_URL | |
if isinstance(value, str) and value.lower() == "https": | |
return cls.IMAGE_URL | |
if isinstance(value, str) and value.lower() == "zip": | |
return cls.IMAGE_LOCAL | |
return cls.UNKNOWN | |
class ImageFileTypes(Enum): | |
UNKNOWN = "unknown" | |
IMAGE_LOCAL = "local" | |
IMAGE_MEMORY = "memory" | |
IMAGE_URL = "http" | |
@classmethod | |
def _missing_(cls, value: object) -> ImageFileTypes: | |
if not isinstance(value, str): | |
return cls.UNKNOWN | |
value_lower = value.lower() | |
url_schemes = {"data", "https"} | |
if value_lower in url_schemes: | |
return cls.IMAGE_URL | |
if value_lower == "zip": | |
return cls.IMAGE_LOCAL | |
return cls.UNKNOWN |
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: 2
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
basilisk/config/account_config.py
(8 hunks)basilisk/enums.py
(1 hunks)basilisk/gui/account_dialog.py
(3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: build_app / build_windows (x86)
- GitHub Check: build_app / build_windows (x64)
🔇 Additional comments (13)
basilisk/enums.py (11)
6-18
: LGTM!The
AccountSource
enum is well-implemented with proper string values and translation support.
20-38
: LGTM!The
AutomaticUpdateMode
enum is well-implemented with proper string values and translation support.
40-44
: LGTM!The
CaptureMode
enum is well-implemented with proper string values.
52-68
: Consider using a more robust pattern matching in_missing_
.The
_missing_
method inImageFileTypes
could be improved for better maintainability and readability.
70-73
: LGTM!The
KeyStorageMethod
enum is well-implemented with proper string values.
75-99
: Consider using an IntEnum for LogLevel.Since
LogLevel
represents standard logging levels that map to integers in Python's logging module, consider usingIntEnum
for better interoperability.
116-120
: LGTM!The
MessageSegmentType
enum is well-implemented with proper string values.
122-127
: LGTM!The
ProviderAPIType
enum is well-implemented with proper string values.
129-134
: LGTM!The
ProviderCapability
enum is well-implemented with proper string values.
136-151
: LGTM!The
ReleaseChannel
enum is well-implemented with proper string values and translation support.
153-162
: LGTM!Both
SearchDirection
andSearchMode
enums are well-implemented with proper integer values.basilisk/config/account_config.py (1)
28-28
: LGTM!The changes to replace
KeyStorageMethodEnum
withKeyStorageMethod
are consistent and maintain the same functionality.Also applies to: 44-44, 56-56, 60-60, 70-70, 72-72, 79-79, 98-99, 128-128, 132-132, 142-142, 144-144, 221-221
basilisk/gui/account_dialog.py (1)
8-9
: LGTM!The changes to replace
KeyStorageMethodEnum
withKeyStorageMethod
and update label retrieval are consistent and maintain the same functionality.Also applies to: 16-16, 18-18, 150-150, 542-542
aabdcca
to
4ddd0df
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.
Actionable comments posted: 1
♻️ Duplicate comments (2)
basilisk/enums.py (2)
75-99
: 🧹 Nitpick (assertive)Consider using IntEnum for LogLevel.
Since
LogLevel
represents standard logging levels that map to integers in Python's logging module, consider usingIntEnum
for better interoperability.-class LogLevel(StrEnum): +class LogLevel(IntEnum): - NOTSET = "off" - DEBUG = auto() - INFO = auto() - WARNING = auto() - ERROR = auto() - CRITICAL = auto() + NOTSET = 0 + DEBUG = 10 + INFO = 20 + WARNING = 30 + ERROR = 40 + CRITICAL = 50
101-114
: 🧹 Nitpick (assertive)Add missing label for SYSTEM role.
The
get_labels
method doesn't include a label for theSYSTEM
role. Consider adding it for completeness.@classmethod def get_labels(cls) -> dict[MessageRole, str]: return { # Translators: Label indicating that the message is from the user in a conversation cls.USER: _("User:") + ' ', # Translators: Label indicating that the message is from the assistant in a conversation cls.ASSISTANT: _("Assistant:") + ' ', + # Translators: Label indicating that the message is from the system in a conversation + cls.SYSTEM: _("System:") + ' ', }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (31)
basilisk/config/__init__.py
(0 hunks)basilisk/config/account_config.py
(8 hunks)basilisk/config/config_enums.py
(0 hunks)basilisk/config/main_config.py
(2 hunks)basilisk/consts.py
(0 hunks)basilisk/conversation/__init__.py
(1 hunks)basilisk/conversation/conversation_helper.py
(1 hunks)basilisk/conversation/conversation_model.py
(1 hunks)basilisk/conversation/image_model.py
(1 hunks)basilisk/enums.py
(1 hunks)basilisk/gui/account_dialog.py
(3 hunks)basilisk/gui/conversation_tab.py
(6 hunks)basilisk/gui/main_frame.py
(1 hunks)basilisk/gui/preferences_dialog.py
(3 hunks)basilisk/gui/search_dialog.py
(1 hunks)basilisk/main_app.py
(3 hunks)basilisk/message_segment_manager.py
(1 hunks)basilisk/provider.py
(1 hunks)basilisk/provider_capability.py
(0 hunks)basilisk/provider_engine/anthropic_engine.py
(2 hunks)basilisk/provider_engine/base_engine.py
(1 hunks)basilisk/provider_engine/deepseek_engine.py
(2 hunks)basilisk/provider_engine/gemini_engine.py
(3 hunks)basilisk/provider_engine/mistralai_engine.py
(1 hunks)basilisk/provider_engine/openai_engine.py
(2 hunks)basilisk/provider_engine/openrouter_engine.py
(1 hunks)basilisk/provider_engine/xai_engine.py
(1 hunks)basilisk/screen_capture_thread.py
(1 hunks)basilisk/server_thread.py
(1 hunks)basilisk/updater.py
(2 hunks)tests/test_message_position_manager.py
(1 hunks)
💤 Files with no reviewable changes (4)
- basilisk/consts.py
- basilisk/config/init.py
- basilisk/provider_capability.py
- basilisk/config/config_enums.py
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: build_app / build_windows (x86)
- GitHub Check: build_app / build_windows (x64)
🔇 Additional comments (52)
basilisk/gui/preferences_dialog.py (12)
7-7
: Switching to enums module import.
The import frombasilisk.enums
aligns perfectly with the new dedicated module approach.
13-13
: Populatinglog_levels
fromLogLevel.get_labels()
.
Looks good and follows the new enum usage pattern.
15-15
: Populatingrelease_channels
fromReleaseChannel.get_labels()
.
No issues detected.
17-17
: Populatingauto_update_modes
fromAutomaticUpdateMode.get_labels()
.
Implementation is consistent with the refactoring.
41-41
: Possible KeyError on invalid config key.
self.conf.general.log_level
must match a validlog_levels
key. Consider gracefully handling unknown enum keys if the config is corrupted or outdated.
44-44
: No concerns with combobox choices.
These choices cleanly maplog_levels.values()
for display.
83-83
: Possible KeyError on invalid config key.
self.conf.general.release_channel
must correspond to a validrelease_channels
key. Consider a safe fallback.
88-88
: Combobox choices for release channels look correct.
Proper usage ofrelease_channels.values()
.
98-101
: Handled enum-based combo initialization.
However, ifself.conf.general.automatic_update_mode
is invalid, it may cause a KeyError.
311-311
: ValidateGetSelection()
index.
Ensurelist(log_levels.keys())[self.log_level.GetSelection()]
remains within bounds.
318-318
: ValidateGetSelection()
index for release channel.
Same principle; out-of-range selection could raise an IndexError.
321-321
: ValidateGetSelection()
index for automatic update mode.
Similarly, handle potential out-of-range errors.basilisk/conversation/__init__.py (1)
2-2
: RemovingMessageRoleEnum
import.
This is consistent with the move to the new enums module.basilisk/provider_engine/xai_engine.py (1)
4-7
: SwitchingProviderCapability
import source.
Importing frombasilisk.enums
is aligned with the dedicated enums refactor.basilisk/conversation/conversation_model.py (1)
8-8
: LGTM! The enum refactoring looks good.The changes correctly implement the PR objective by:
- Importing
MessageRole
from the new dedicated enums module- Updating the type annotation in the
Message
classAlso applies to: 16-16
basilisk/server_thread.py (1)
11-11
: LGTM! The enum import update is correct.The import statement has been properly updated to use the new dedicated enums module.
basilisk/provider_engine/deepseek_engine.py (1)
11-12
: LGTM! The enum refactoring is consistent.The changes correctly:
- Import enums from the dedicated module
- Update the message role usage in the response creation
Also applies to: 90-90
basilisk/config/main_config.py (1)
7-8
: LGTM! The enum refactoring is thorough.The changes correctly:
- Import multiple enums from the dedicated module
- Update all relevant type annotations in the
GeneralSettings
classAlso applies to: 23-27
basilisk/enums.py (4)
6-18
: LGTM!The enum implementation is clean and follows best practices. The
get_labels
method provides proper translations for UI display.
20-38
: LGTM!The enum implementation is clean and follows best practices. The
get_labels
method provides proper translations for UI display.
52-68
: LGTM!The enum implementation is clean and follows best practices. The
_missing_
method has been improved for better maintainability.
116-162
: LGTM!The remaining enum implementations are clean and follow best practices.
basilisk/main_app.py (1)
15-15
: LGTM!The changes correctly update the imports and enum references as part of the enum refactoring.
Also applies to: 76-76, 89-89, 95-95
basilisk/provider_engine/gemini_engine.py (1)
9-10
: LGTM!The changes correctly update the imports and enum references as part of the enum refactoring.
Also applies to: 101-107, 164-164
basilisk/provider_engine/anthropic_engine.py (1)
12-13
: LGTM!The changes correctly update the imports and enum references as part of the enum refactoring.
Also applies to: 207-207
basilisk/conversation/image_model.py (2)
25-25
: LGTM! Import updated correctly.The import statement has been updated to use the new centralized enum module.
164-165
: Verify the type property implementation.The property now relies on the protocol attribute of the location to determine the image type. This change could potentially introduce issues if the protocol values don't match the expected ImageFileTypes enum values.
basilisk/provider_engine/openai_engine.py (2)
20-21
: LGTM! Imports updated correctly.The imports have been updated to use the new centralized enum module while maintaining the necessary imports from conversation module.
324-324
: LGTM! Enum usage updated correctly.The MessageRole.ASSISTANT usage is consistent with the new enum structure.
basilisk/config/account_config.py (2)
28-28
: LGTM! Imports updated correctly.The imports have been updated to use the new centralized enum module.
44-44
: LGTM! Enum usage updated consistently.All references to KeyStorageMethodEnum have been correctly updated to use KeyStorageMethod. The validation logic and storage method checks remain functionally equivalent.
Also applies to: 56-56, 60-60, 70-70, 72-72, 79-79, 98-99, 128-128, 132-132, 142-142, 144-144, 221-221
basilisk/updater.py (2)
17-18
: LGTM! Imports updated correctly.The imports have been updated to use the new centralized enum module.
426-431
: LGTM! Match cases updated correctly.The match cases have been updated to use ReleaseChannel consistently:
- STABLE case for stable releases
- BETA case for pre-releases
- DEV case for nightly builds
basilisk/gui/account_dialog.py (3)
8-9
: LGTM: Import statements updated correctly.The imports have been properly updated to use the new enum module.
15-18
: LGTM: Key storage method enum usage updated correctly.The key_storage_methods dictionary correctly uses the new KeyStorageMethod enum.
150-150
: LGTM: Account source labels retrieval updated correctly.The code now uses AccountSource.get_labels() method consistently.
Also applies to: 542-542
basilisk/gui/main_frame.py (3)
16-18
: LGTM: Import statements updated correctly.The imports have been properly updated to use the new enum module.
232-246
: LGTM: Hotkey registration updated correctly.The hotkey registration code correctly uses the new HotkeyAction enum.
248-256
: LGTM: Hotkey handling updated correctly.The hotkey handling code correctly uses the new HotkeyAction enum with pattern matching.
basilisk/gui/conversation_tab.py (3)
30-30
: LGTM: Import statements updated correctly.The imports have been properly updated to use the new enum module.
56-56
: LGTM: Role labels retrieval updated correctly.The code now uses MessageRole.get_labels() method for role labels.
1080-1080
: LGTM: Message role assignments updated correctly.The code consistently uses the new MessageRole enum for all message role assignments.
Also applies to: 1096-1096, 1160-1160, 1319-1319
basilisk/screen_capture_thread.py (1)
11-11
: LGTM: Import statement updated correctly.The import has been properly updated to use the new enum module.
basilisk/provider_engine/openrouter_engine.py (1)
9-9
: Centralized ProviderCapability Import
The import forProviderCapability
has been updated to use the centralized enum frombasilisk.enums
instead of the legacy source. This change is consistent with the project’s objective to consolidate enums into a dedicated module.basilisk/provider_engine/base_engine.py (1)
9-9
: Unified ProviderCapability Source
The import ofProviderCapability
is now sourced frombasilisk.enums
, which improves consistency across the codebase and aligns with the refactoring objective. No further modifications are needed here.basilisk/provider_engine/mistralai_engine.py (1)
4-4
: Updated Enum Import in MistralAIEngine
ProviderCapability
is now imported frombasilisk.enums
rather than an old location. This update ensures that the enum source is uniform across all engine modules and simplifies dependency management.basilisk/conversation/conversation_helper.py (1)
13-15
: Refactored ImageFileTypes Import
The import forImageFileTypes
has been updated to reference the centralized enum inbasilisk.enums
. This change, along with removing it from the local import of.image_model
, guarantees that all references to image file types are maintained from a single source.basilisk/provider.py (1)
9-9
: Migrated ProviderAPIType to Centralized Module
The local definition ofProviderAPIType
has been replaced with an import frombasilisk.enums
. This refactoring drives consistency in enum usage across the application without altering provider functionality.basilisk/message_segment_manager.py (2)
7-7
: Migrate Enum Import Successfully.
The import on line 7 now sourcesMessageSegmentType
from the centralizedbasilisk.enums
module instead of defining it locally. Please confirm that the centralized enum includes all the expected members (e.g.,PREFIX
,CONTENT
,SUFFIX
) so that its usage throughout the module remains consistent.
135-139
: Verify Enum Member Semantics in Focus Method.
Within thefocus_content_block
method (lines 135–139), the code compares the current segment’s kind againstMessageSegmentType.PREFIX
andMessageSegmentType.SUFFIX
and then navigates accordingly. Ensure that these enum members in the centralized module retain the same semantics as those previously defined locally.tests/test_message_position_manager.py (1)
3-3
: Updated Enum Import for Test Consistency.
The change on line 3 importsMessageSegmentType
frombasilisk.enums
instead of from the local module. This aligns tests with the refactored organization. Please verify that all enum member references in tests (e.g.,CONTENT
,PREFIX
) remain valid in the new centralized definition.basilisk/gui/search_dialog.py (1)
6-6
: Centralize GUI Enum Usage.
On line 6,SearchDirection
andSearchMode
are now imported frombasilisk.enums
, which is a welcome improvement for consistency and maintainability across the codebase. Please ensure that the definitions in the centralized module provide all the necessary members for the search dialog’s logic.
class HotkeyAction(IntEnum): | ||
TOGGLE_VISIBILITY = 1 | ||
CAPTURE_FULL = 20 | ||
CAPTURE_WINDOW = 21 | ||
|
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.
🧹 Nitpick (assertive)
Document the value gaps in HotkeyAction.
The enum values are not sequential (1, 20, 21). Consider adding a comment explaining why these specific values were chosen and what the gaps represent.
Summary by CodeRabbit