From 56834a28cb159d1e8f8c7a9590ba96d97057d655 Mon Sep 17 00:00:00 2001 From: AT Date: Sun, 30 Jun 2024 20:55:42 -0400 Subject: [PATCH] Fix response generation which was broken by themeable syntax highlighting. (#2494) Signed-off-by: Adam Treat --- gpt4all-chat/chatmodel.h | 5 +++++ gpt4all-chat/qml/ChatView.qml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gpt4all-chat/chatmodel.h b/gpt4all-chat/chatmodel.h index fa4f5506..9313dff6 100644 --- a/gpt4all-chat/chatmodel.h +++ b/gpt4all-chat/chatmodel.h @@ -188,6 +188,11 @@ public: } } + Q_INVOKABLE void forceUpdate(int index) + { + emit dataChanged(createIndex(index, 0), createIndex(index, 0), {ValueRole}); + } + Q_INVOKABLE void updateValue(int index, const QString &value) { if (index < 0 || index >= m_chatItems.size()) return; diff --git a/gpt4all-chat/qml/ChatView.qml b/gpt4all-chat/qml/ChatView.qml index bcc9ccc5..c47b537a 100644 --- a/gpt4all-chat/qml/ChatView.qml +++ b/gpt4all-chat/qml/ChatView.qml @@ -966,7 +966,7 @@ Rectangle { textProcessor.codeColors.headerColor = theme.codeHeaderColor textProcessor.codeColors.backgroundColor = theme.codeBackgroundColor textProcessor.textDocument = textDocument - myTextArea.text = value + chatModel.forceUpdate(index); // called to trigger a reprocessing of the text } Component.onCompleted: {