mirror of
https://github.com/logancyang/obsidian-copilot.git
synced 2026-07-22 07:50:24 +00:00
refactor(chainManager): rename initializeQAChain to refreshVaultIndex
The method no longer constructs any QA chain — it only triggers a vault re-index when options.refreshIndex is set and legacy semantic search is enabled. Rename to reflect actual behavior and drop the redundant chain-type guard at the call site (the sole caller passing refreshIndex is already in PROJECT_CHAIN, and reindexing is a no-op otherwise). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
6c4d19d229
commit
586167abe0
1 changed files with 9 additions and 16 deletions
|
|
@ -166,12 +166,8 @@ export default class ChainManager {
|
|||
|
||||
this.validateChainType(chainType);
|
||||
|
||||
if (
|
||||
chainType === ChainType.VAULT_QA_CHAIN ||
|
||||
chainType === ChainType.COPILOT_PLUS_CHAIN ||
|
||||
chainType === ChainType.PROJECT_CHAIN
|
||||
) {
|
||||
await this.initializeQAChain(options);
|
||||
if (options.refreshIndex) {
|
||||
await this.refreshVaultIndex();
|
||||
}
|
||||
|
||||
setChainType(chainType);
|
||||
|
|
@ -199,17 +195,14 @@ export default class ChainManager {
|
|||
}
|
||||
}
|
||||
|
||||
private async initializeQAChain(options: SetChainOptions) {
|
||||
// Handle index refresh if needed
|
||||
if (options.refreshIndex) {
|
||||
const settings = getSettings();
|
||||
if (settings.enableSemanticSearchV3) {
|
||||
// Use VectorStoreManager for Orama indexing
|
||||
const VectorStoreManager = (await import("@/search/vectorStoreManager")).default;
|
||||
await VectorStoreManager.getInstance().indexVaultToVectorStore(false);
|
||||
}
|
||||
// V3 search builds indexes on demand, no action needed
|
||||
private async refreshVaultIndex(): Promise<void> {
|
||||
// V3 (on-demand) search builds indexes lazily, so a refresh is only meaningful
|
||||
// when the legacy Orama-backed semantic search is enabled.
|
||||
if (!getSettings().enableSemanticSearchV3) {
|
||||
return;
|
||||
}
|
||||
const VectorStoreManager = (await import("@/search/vectorStoreManager")).default;
|
||||
await VectorStoreManager.getInstance().indexVaultToVectorStore(false);
|
||||
}
|
||||
|
||||
async runChain(
|
||||
|
|
|
|||
Loading…
Reference in a new issue