From d1cd0a88179fe1f6b40af5f7f23371b8610ae52b Mon Sep 17 00:00:00 2001 From: perf3ct Date: Fri, 28 Mar 2025 21:26:09 +0000 Subject: [PATCH] fix ai_settings TPL location --- .../type_widgets/options/ai_settings.js | 3 - .../type_widgets/options/ai_settings.ts | 713 +++++++++--------- 2 files changed, 358 insertions(+), 358 deletions(-) delete mode 100644 src/public/app/widgets/type_widgets/options/ai_settings.js diff --git a/src/public/app/widgets/type_widgets/options/ai_settings.js b/src/public/app/widgets/type_widgets/options/ai_settings.js deleted file mode 100644 index 17e039309..000000000 --- a/src/public/app/widgets/type_widgets/options/ai_settings.js +++ /dev/null @@ -1,3 +0,0 @@ -import AiSettingsWidget from "./ai_settings.ts"; - -export default AiSettingsWidget; 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 ee5c6130c..884d2e9d0 100644 --- a/src/public/app/widgets/type_widgets/options/ai_settings.ts +++ b/src/public/app/widgets/type_widgets/options/ai_settings.ts @@ -60,6 +60,7 @@ interface OpenAIModelResponse { }>; } +// After all interfaces, before class definition, add the TPL constant interface AnthropicModelResponse { success: boolean; chatModels: Array<{ @@ -74,367 +75,369 @@ interface AnthropicModelResponse { }>; } +const TPL = ` +
+

${t("ai_llm.title")}

+ + + + +
+ +
${t("ai_llm.enable_ai_description")}
+
+
+ +
+

${t("ai_llm.embedding_statistics")}

+
+
+
+
+
${t("ai_llm.processed_notes")}: -
+
${t("ai_llm.total_notes")}: -
+
${t("ai_llm.progress")}: -
+
+ +
+
${t("ai_llm.queued_notes")}: -
+
${t("ai_llm.failed_notes")}: -
+
${t("ai_llm.last_processed")}: -
+
+
+
+
+
0%
+
+
+ +
+
+ +
+ +
${t("ai_llm.failed_notes")}
+
+
+
+
${t("ai_llm.no_failed_embeddings")}
+
+
+
+
+ +
+

${t("ai_llm.provider_configuration")}

+ +
+ + +
${t("ai_llm.provider_precedence_description")}
+
+ +
+ + +
${t("ai_llm.temperature_description")}
+
+ +
+ + +
${t("ai_llm.system_prompt_description")}
+
+
+ + +
+ +
+ +
+

${t("ai_llm.embedding_configuration")}

+ +
+ + +
${t("ai_llm.embedding_default_provider_description")}
+
+ +
+ + +
${t("ai_llm.embedding_dimension_strategy_description")}
+
+ +
+ + +
${t("ai_llm.embedding_provider_precedence_description")}
+
+ +
+ + +
${t("ai_llm.embedding_generation_location_description")}
+
+ +
+ +
${t("ai_llm.enable_auto_update_embeddings_description")}
+
+ +
+ +
${t("ai_llm.enable_automatic_indexing_description")}
+
+ +
+ +
+
+
+ + +
${t("ai_llm.similarity_threshold_description")}
+
+ +
+ + +
${t("ai_llm.embedding_batch_size_description")}
+
+ +
+ + +
${t("ai_llm.embedding_default_dimension_description")}
+
+
+ +
+
+ + +
${t("ai_llm.max_notes_per_llm_query_description")}
+
+ +
+ + +
${t("ai_llm.embedding_update_interval_description")}
+
+
+
+ +
+ +
+
+
+ +
${t("ai_llm.reprocess_all_embeddings_description")}
+
+
+ +
+
+ +
${t("ai_llm.reprocess_index_description")}
+ + + +
+
+
+
`; + export default class AiSettingsWidget extends OptionsWidget { private statsRefreshInterval: NodeJS.Timeout | null = null; private indexRebuildRefreshInterval: NodeJS.Timeout | null = null; private readonly STATS_REFRESH_INTERVAL = 5000; // 5 seconds doRender() { - this.$widget = $(` -
-

${t("ai_llm.title")}

- - - - -
- -
${t("ai_llm.enable_ai_description")}
-
-
- -
-

${t("ai_llm.embedding_statistics")}

-
-
-
-
-
${t("ai_llm.processed_notes")}: -
-
${t("ai_llm.total_notes")}: -
-
${t("ai_llm.progress")}: -
-
- -
-
${t("ai_llm.queued_notes")}: -
-
${t("ai_llm.failed_notes")}: -
-
${t("ai_llm.last_processed")}: -
-
-
-
-
-
0%
-
-
- -
-
- -
- -
${t("ai_llm.failed_notes")}
-
-
-
-
${t("ai_llm.no_failed_embeddings")}
-
-
-
-
- -
-

${t("ai_llm.provider_configuration")}

- -
- - -
${t("ai_llm.provider_precedence_description")}
-
- -
- - -
${t("ai_llm.temperature_description")}
-
- -
- - -
${t("ai_llm.system_prompt_description")}
-
-
- - -
- -
- -
-

${t("ai_llm.embedding_configuration")}

- -
- - -
${t("ai_llm.embedding_default_provider_description")}
-
- -
- - -
${t("ai_llm.embedding_dimension_strategy_description")}
-
- -
- - -
${t("ai_llm.embedding_provider_precedence_description")}
-
- -
- - -
${t("ai_llm.embedding_generation_location_description")}
-
- -
- -
${t("ai_llm.enable_auto_update_embeddings_description")}
-
- -
- -
${t("ai_llm.enable_automatic_indexing_description")}
-
- -
- -
-
-
- - -
${t("ai_llm.similarity_threshold_description")}
-
- -
- - -
${t("ai_llm.embedding_batch_size_description")}
-
- -
- - -
${t("ai_llm.embedding_default_dimension_description")}
-
-
- -
-
- - -
${t("ai_llm.max_notes_per_llm_query_description")}
-
- -
- - -
${t("ai_llm.embedding_update_interval_description")}
-
-
-
- -
- -
-
-
- -
${t("ai_llm.reprocess_all_embeddings_description")}
-
-
- -
-
- -
${t("ai_llm.reprocess_index_description")}
- - - -
-
-
-
`); + this.$widget = $(TPL); const $aiEnabled = this.$widget.find('.ai-enabled'); $aiEnabled.on('change', async () => {