From 651968aad1d28e91403402f771b37aa57f9dcc05 Mon Sep 17 00:00:00 2001 From: alexjmpb Date: Fri, 27 Sep 2024 11:03:25 -0500 Subject: [PATCH] fix: fixing llmsummarize plugin options --- lms/static/js/edxnotes/plugins/llm_summarize.js | 6 ++---- lms/static/js/edxnotes/views/notes_factory.js | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lms/static/js/edxnotes/plugins/llm_summarize.js b/lms/static/js/edxnotes/plugins/llm_summarize.js index cc74718f8231..85644466e3f5 100644 --- a/lms/static/js/edxnotes/plugins/llm_summarize.js +++ b/lms/static/js/edxnotes/plugins/llm_summarize.js @@ -87,9 +87,7 @@ let annotator = this.annotator; document.head.appendChild(style); this.modifyDom(this.annotator); - annotator.editor.options.llmSummarize = { - courseId: annotator.options.llmSummarize.courseId, - } + annotator.editor.options.llmSummarize = annotator.options.llmSummarize const summarizeButton = document.getElementById('summarizeButton'); summarizeButton.addEventListener('click', function(ev) { @@ -117,7 +115,7 @@ }, body: JSON.stringify({ text_to_summarize: annotation.quote, - course_id: editor.options?.llmSummarize.courseId, + course_id: editor.options?.llmSummarize?.courseId, }), }); diff --git a/lms/static/js/edxnotes/views/notes_factory.js b/lms/static/js/edxnotes/views/notes_factory.js index 12092555aa62..f918ce8dcf76 100644 --- a/lms/static/js/edxnotes/views/notes_factory.js +++ b/lms/static/js/edxnotes/views/notes_factory.js @@ -53,8 +53,8 @@ } }, llmSummarize: { - isEnabled: params.llmSummarize.isEnabled, - courseId: params.llmSummarize.courseId, + isEnabled: params?.llmSummarize?.isEnabled, + courseId: params?.llmSummarize?.courseId, }, }; }; @@ -89,7 +89,7 @@ logger = NotesLogger.getLogger(element.id, params.debug), annotator; - if (options.llmSummarize?.isEnabled) plugins.push('LlmSummarize') + if (options?.llmSummarize?.isEnabled) plugins.push('LlmSummarize') annotator = $el.annotator(options).data('annotator'); setupPlugins(annotator, plugins, options); NotesCollector.storeNotesRequestData(