-
-
Notifications
You must be signed in to change notification settings - Fork 407
Fix auto index trigger #1593
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 auto index trigger #1593
Conversation
…d DB operations - Updated applyPlusSettings to always trigger indexing when applying Plus settings, leveraging internal model change detection. - Enhanced user notifications in DBOperations for embedding model changes, distinguishing between Copilot Plus and other models.
- Added DEFAULT_FREE_CHAT_MODEL_KEY and DEFAULT_FREE_EMBEDDING_MODEL_KEY to utilize default settings for free users. - Updated turnOffPlus function to reset models to default free user settings when a user is no longer a Plus subscriber. - Enhanced settings management to ensure proper model key and chain type are set for free users.
bugbot run |
- Removed console logging of Plus settings in applyPlusSettings for cleaner output. - Simplified user notification in DBOperations by standardizing the message for embedding model changes, removing specific references to Copilot Plus.
…ings - Updated applyPlusSettings to explicitly check for changes in the embedding model and trigger indexing accordingly. - Added logging to track changes in the embedding model during Plus settings application and deactivation. - Improved handling of circular dependencies by importing VectorStoreManager at runtime.
bugbot run |
… settings - Added error logging and user notifications when indexing fails after applying Plus settings. - Improved the clarity of the indexing trigger logic to ensure it only occurs when the embedding model changes.
bugbot run |
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.
Bug: Redundant Setting Updates in `turnOffPlus()`
In turnOffPlus()
, defaultModelKey
and defaultChainType
are redundantly set. The function calls setModelKey()
and setChainType()
individually, then immediately calls setSettings()
with the same values. This duplicate update can trigger multiple setting change events and unintended side effects, potentially reintroducing the multiple indexing issue this PR aims to fix.
src/plusUtils.ts#L124-L132
obsidian-copilot/src/plusUtils.ts
Lines 124 to 132 in b13ab3a
// Reset models to default free user models | |
setModelKey(DEFAULT_FREE_CHAT_MODEL_KEY); | |
setChainType(DEFAULT_SETTINGS.defaultChainType); | |
setSettings({ | |
isPlusUser: false, | |
defaultModelKey: DEFAULT_FREE_CHAT_MODEL_KEY, | |
embeddingModelKey: DEFAULT_FREE_EMBEDDING_MODEL_KEY, | |
defaultChainType: DEFAULT_SETTINGS.defaultChainType, | |
}); |
Was this report helpful? Give feedback by reacting with 👍 or 👎
Fix a bug where auto indexing triggered 3 times at "Apply".