diff --git a/db/migrations/0229__ai_llm_options.sql b/db/migrations/0229__ai_llm_options.sql
index dcbd42b8b..041ccea42 100644
--- a/db/migrations/0229__ai_llm_options.sql
+++ b/db/migrations/0229__ai_llm_options.sql
@@ -23,4 +23,7 @@ INSERT INTO options (name, value, isSynced, utcDateModified) VALUES ('aiTemperat
INSERT INTO options (name, value, isSynced, utcDateModified) VALUES ('aiSystemPrompt', '', 1, strftime('%Y-%m-%dT%H:%M:%fZ', 'now'));
-- Embedding settings
-INSERT INTO options (name, value, isSynced, utcDateModified) VALUES ('embeddingsDefaultProvider', 'openai', 1, strftime('%Y-%m-%dT%H:%M:%fZ', 'now'));
\ No newline at end of file
+INSERT INTO options (name, value, isSynced, utcDateModified) VALUES ('embeddingsDefaultProvider', 'openai', 1, strftime('%Y-%m-%dT%H:%M:%fZ', 'now'));
+INSERT INTO options (name, value, isSynced, utcDateModified) VALUES ('enableAutomaticIndexing', 'true', 1, strftime('%Y-%m-%dT%H:%M:%fZ', 'now'));
+INSERT INTO options (name, value, isSynced, utcDateModified) VALUES ('embeddingSimilarityThreshold', '0.65', 1, strftime('%Y-%m-%dT%H:%M:%fZ', 'now'));
+INSERT INTO options (name, value, isSynced, utcDateModified) VALUES ('maxNotesPerLlmQuery', '10', 1, strftime('%Y-%m-%dT%H:%M:%fZ', 'now'));
\ No newline at end of file
diff --git a/src/public/app/widgets/type_widgets/options/ai_settings.ts b/src/public/app/widgets/type_widgets/options/ai_settings.ts
index 6b9519eb4..3563ff07c 100644
--- a/src/public/app/widgets/type_widgets/options/ai_settings.ts
+++ b/src/public/app/widgets/type_widgets/options/ai_settings.ts
@@ -193,6 +193,26 @@ export default class AiSettingsWidget extends OptionsWidget {
${t("ai_llm.enable_auto_update_embeddings_description")}
+
+
+
+
+
+
@@ -387,6 +407,21 @@ export default class AiSettingsWidget extends OptionsWidget {
await this.updateOption('embeddingAutoUpdateEnabled', $embeddingAutoUpdateEnabled.prop('checked') ? "true" : "false");
});
+ const $enableAutomaticIndexing = this.$widget.find('.enable-automatic-indexing');
+ $enableAutomaticIndexing.on('change', async () => {
+ await this.updateOption('enableAutomaticIndexing', $enableAutomaticIndexing.prop('checked') ? "true" : "false");
+ });
+
+ const $embeddingSimilarityThreshold = this.$widget.find('.embedding-similarity-threshold');
+ $embeddingSimilarityThreshold.on('change', async () => {
+ await this.updateOption('embeddingSimilarityThreshold', $embeddingSimilarityThreshold.val() as string);
+ });
+
+ const $maxNotesPerLlmQuery = this.$widget.find('.max-notes-per-llm-query');
+ $maxNotesPerLlmQuery.on('change', async () => {
+ await this.updateOption('maxNotesPerLlmQuery', $maxNotesPerLlmQuery.val() as string);
+ });
+
const $embeddingDefaultProvider = this.$widget.find('.embedding-default-provider');
$embeddingDefaultProvider.on('change', async () => {
await this.updateOption('embeddingsDefaultProvider', $embeddingDefaultProvider.val() as string);
@@ -466,6 +501,9 @@ export default class AiSettingsWidget extends OptionsWidget {
// Load embedding options
this.$widget.find('.embedding-default-provider').val(options.embeddingsDefaultProvider || 'openai');
this.setCheckboxState(this.$widget.find('.embedding-auto-update-enabled'), options.embeddingAutoUpdateEnabled || 'true');
+ this.setCheckboxState(this.$widget.find('.enable-automatic-indexing'), options.enableAutomaticIndexing || 'true');
+ this.$widget.find('.embedding-similarity-threshold').val(options.embeddingSimilarityThreshold || '0.65');
+ this.$widget.find('.max-notes-per-llm-query').val(options.maxNotesPerLlmQuery || '10');
this.$widget.find('.embedding-batch-size').val(options.embeddingBatchSize || '10');
this.$widget.find('.embedding-update-interval').val(options.embeddingUpdateInterval || '5000');
this.$widget.find('.embedding-default-dimension').val(options.embeddingDefaultDimension || '1536');
@@ -658,7 +696,7 @@ export default class AiSettingsWidget extends OptionsWidget {
if (!failedResult || !failedResult.failedNotes.length) {
// Use consistent styling with the rest of the application
this.$widget.find('.embedding-failed-notes-list').html(
- `No failed embeddings
`
+ `${t("ai_llm.no_failed_embeddings")}
`
);
return;
}
diff --git a/src/public/translations/en/translation.json b/src/public/translations/en/translation.json
index b3f84ac09..9d675a234 100644
--- a/src/public/translations/en/translation.json
+++ b/src/public/translations/en/translation.json
@@ -1161,6 +1161,12 @@
"enable_auto_update_embeddings_description": "Automatically update embeddings when notes are modified",
"auto_update_embeddings": "Auto-update Embeddings",
"auto_update_embeddings_desc": "Automatically update embeddings when notes are modified",
+ "enable_automatic_indexing": "Automatic Indexing",
+ "enable_automatic_indexing_description": "Periodically run indexing jobs in the background to maintain the knowledge base",
+ "similarity_threshold": "Similarity Threshold",
+ "similarity_threshold_description": "Minimum similarity score (0-1) for notes to be included in context for LLM queries",
+ "max_notes_per_llm_query": "Max Notes Per Query",
+ "max_notes_per_llm_query_description": "Maximum number of notes to include as context for each LLM query",
"embedding_batch_size": "Batch Size",
"embedding_batch_size_description": "Number of notes to process in a single batch (1-50)",
"embedding_update_interval": "Update Interval (ms)",
diff --git a/src/services/options_interface.ts b/src/services/options_interface.ts
index aa00166b2..2d7b5a66b 100644
--- a/src/services/options_interface.ts
+++ b/src/services/options_interface.ts
@@ -69,6 +69,9 @@ export interface OptionDefinitions extends KeyboardShortcutsOptions