diff --git a/src/main.ts b/src/main.ts
index b6c940a..5731957 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -218,7 +218,7 @@ export default class OmnisearchPlugin extends Plugin {
* @returns
*/
public getChsSegmenter(): any | undefined {
- return (this.app as any).plugins.plugins['cm-chs-patch']
+ return (this.app as any).plugins?.plugins?.['cm-chs-patch']
}
/**
diff --git a/src/repositories/documents-repository.ts b/src/repositories/documents-repository.ts
index c03f6d1..b25fc8c 100644
--- a/src/repositories/documents-repository.ts
+++ b/src/repositories/documents-repository.ts
@@ -149,25 +149,21 @@ export class DocumentsRepository {
}
// ** Image **
- else if (
- isFileImage(path) &&
- ((this.plugin.settings.imagesIndexing &&
- extractor?.canFileBeExtracted(path)) ||
- (this.plugin.settings.aiImageIndexing &&
- aiImageAnalyzer?.canBeAnalyzed(file)))
- ) {
- if (
- this.plugin.settings.imagesIndexing &&
- extractor?.canFileBeExtracted(path)
- ) {
- content = await extractor.extractText(file)
- }
-
+ else if (isFileImage(path)) {
+ // AI Image Analyzer
if (
this.plugin.settings.aiImageIndexing &&
aiImageAnalyzer?.canBeAnalyzed(file)
) {
- content = (await aiImageAnalyzer.analyzeImage(file)) + (content ?? '')
+ content = await aiImageAnalyzer.analyzeImage(file)
+ }
+
+ // Text Extractor
+ else if (
+ this.plugin.settings.imagesIndexing &&
+ extractor?.canFileBeExtracted(path)
+ ) {
+ content = await extractor.extractText(file)
}
}
// ** PDF **
@@ -256,6 +252,4 @@ export class DocumentsRepository {
: '',
}
}
-
-
}
diff --git a/src/settings/settings-indexing.ts b/src/settings/settings-indexing.ts
index 0f212c3..00ad552 100644
--- a/src/settings/settings-indexing.ts
+++ b/src/settings/settings-indexing.ts
@@ -90,7 +90,8 @@ export function injectSettingsIndexing(
// AI Images Indexing
const aiIndexImagesDesc = new DocumentFragment()
aiIndexImagesDesc.createSpan({}, span => {
- span.innerHTML = `Omnisearch will use AI Image Analyzer to index the content of your images with ai.`
+ span.innerHTML = `Omnisearch will use AI Image Analyzer to index the content of your images with ai.
+ ⚠️ If both AI Image Analyzer and Text Extractor are enabled, Text Extractor will only be used as a fallback.`
})
new Setting(containerEl)
.setName(`Images AI indexing ${aiImageAnalyzer ? '' : '⚠️ Disabled'}`)