mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 04:51:31 +08:00 
			
		
		
		
	add additional options for users
This commit is contained in:
		
							parent
							
								
									0d2858c7e9
								
							
						
					
					
						commit
						3f37196fe7
					
				| @ -24,3 +24,6 @@ INSERT INTO options (name, value, isSynced, utcDateModified) VALUES ('aiSystemPr | ||||
| 
 | ||||
| -- Embedding settings | ||||
| 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'));  | ||||
| @ -193,6 +193,26 @@ export default class AiSettingsWidget extends OptionsWidget { | ||||
|                     <div class="help-text">${t("ai_llm.enable_auto_update_embeddings_description")}</div> | ||||
|                 </div> | ||||
| 
 | ||||
|                 <div class="form-group"> | ||||
|                     <label> | ||||
|                         <input class="enable-automatic-indexing" type="checkbox"> | ||||
|                         ${t("ai_llm.enable_automatic_indexing")} | ||||
|                     </label> | ||||
|                     <div class="help-text">${t("ai_llm.enable_automatic_indexing_description")}</div> | ||||
|                 </div> | ||||
| 
 | ||||
|                 <div class="form-group"> | ||||
|                     <label>${t("ai_llm.similarity_threshold")}</label> | ||||
|                     <input class="embedding-similarity-threshold form-control" type="number" min="0" max="1" step="0.01"> | ||||
|                     <div class="help-text">${t("ai_llm.similarity_threshold_description")}</div> | ||||
|                 </div> | ||||
| 
 | ||||
|                 <div class="form-group"> | ||||
|                     <label>${t("ai_llm.max_notes_per_llm_query")}</label> | ||||
|                     <input class="max-notes-per-llm-query form-control" type="number" min="1" max="50"> | ||||
|                     <div class="help-text">${t("ai_llm.max_notes_per_llm_query_description")}</div> | ||||
|                 </div> | ||||
| 
 | ||||
|                 <div class="form-group"> | ||||
|                     <label>${t("ai_llm.embedding_batch_size")}</label> | ||||
|                     <input class="embedding-batch-size form-control" type="number" min="1" max="50"> | ||||
| @ -248,7 +268,7 @@ export default class AiSettingsWidget extends OptionsWidget { | ||||
|                     <label>${t("ai_llm.failed_notes")}</label> | ||||
|                     <div class="embedding-failed-notes-container"> | ||||
|                         <div class="embedding-failed-notes-list"> | ||||
|                             <div class="text-muted small">${t("ai_llm.no_failed_embeddings")}</div> | ||||
|                             <div class="alert alert-info">${t("ai_llm.no_failed_embeddings")}</div> | ||||
|                         </div> | ||||
|                     </div> | ||||
|                 </div> | ||||
| @ -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( | ||||
|                 `<div class="text-muted small">No failed embeddings</div>` | ||||
|                 `<div class="alert alert-info">${t("ai_llm.no_failed_embeddings")}</div>` | ||||
|             ); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
| @ -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)", | ||||
|  | ||||
| @ -69,6 +69,9 @@ export interface OptionDefinitions extends KeyboardShortcutsOptions<KeyboardActi | ||||
|     embeddingDefaultDimension: number; | ||||
|     embeddingAutoUpdate: boolean; | ||||
|     embeddingsDefaultProvider: string; | ||||
|     enableAutomaticIndexing: boolean; | ||||
|     embeddingSimilarityThreshold: string; | ||||
|     maxNotesPerLlmQuery: string; | ||||
| 
 | ||||
|     lastSyncedPull: number; | ||||
|     lastSyncedPush: number; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 perf3ct
						perf3ct