From 496d8feb6636d7fe8d7069f0fd475196c973ef2f Mon Sep 17 00:00:00 2001 From: Petr Mironychev <9195189+Palm1r@users.noreply.github.com> Date: Sat, 19 Oct 2024 19:13:42 +0200 Subject: [PATCH 1/3] Add Qwen fim template --- CMakeLists.txt | 2 +- qodeassist.cpp | 5 +++-- templates/{QwenChat.hpp => Qwen.hpp} | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) rename templates/{QwenChat.hpp => Qwen.hpp} (72%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a691ac..a989304 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,7 +41,7 @@ add_qtc_plugin(QodeAssist templates/CustomFimTemplate.hpp templates/DeepSeekCoderChat.hpp templates/CodeLlamaChat.hpp - templates/QwenChat.hpp + templates/Qwen.hpp templates/StarCoderChat.hpp providers/OllamaProvider.hpp providers/OllamaProvider.cpp providers/LMStudioProvider.hpp providers/LMStudioProvider.cpp diff --git a/qodeassist.cpp b/qodeassist.cpp index 2aa3389..5007dd7 100644 --- a/qodeassist.cpp +++ b/qodeassist.cpp @@ -53,7 +53,7 @@ #include "templates/CustomFimTemplate.hpp" #include "templates/DeepSeekCoderChat.hpp" #include "templates/DeepSeekCoderFim.hpp" -#include "templates/QwenChat.hpp" +#include "templates/Qwen.hpp" #include "templates/StarCoder2Fim.hpp" #include "templates/StarCoderChat.hpp" @@ -94,9 +94,10 @@ public: templateManager.registerTemplate(); templateManager.registerTemplate(); templateManager.registerTemplate(); - templateManager.registerTemplate(); templateManager.registerTemplate(); templateManager.registerTemplate(); + templateManager.registerTemplate(); + templateManager.registerTemplate(); Utils::Icon QCODEASSIST_ICON( {{":/resources/images/qoderassist-icon.png", Utils::Theme::IconsBaseColor}}); diff --git a/templates/QwenChat.hpp b/templates/Qwen.hpp similarity index 72% rename from templates/QwenChat.hpp rename to templates/Qwen.hpp index f9dbb36..cf36629 100644 --- a/templates/QwenChat.hpp +++ b/templates/Qwen.hpp @@ -51,4 +51,21 @@ public: } }; +class QwenFim : public LLMCore::PromptTemplate +{ +public: + QString name() const override { return "Qwen FIM"; } + LLMCore::TemplateType type() const override { return LLMCore::TemplateType::Fim; } + QString promptTemplate() const override + { + return "<|fim_prefix|>%1<|fim_suffix|>%2<|fim_middle|>"; + } + QStringList stopWords() const override { return QStringList() << "<|endoftext|>" << "<|EOT|>"; } + void prepareRequest(QJsonObject &request, const LLMCore::ContextData &context) const override + { + QString formattedPrompt = promptTemplate().arg(context.prefix, context.suffix); + request["prompt"] = formattedPrompt; + } +}; + } // namespace QodeAssist::Templates From 693e429bddf788a0c169a7b16bdc06f3c5b27328 Mon Sep 17 00:00:00 2001 From: Petr Mironychev <9195189+Palm1r@users.noreply.github.com> Date: Sat, 19 Oct 2024 20:11:09 +0200 Subject: [PATCH 2/3] Fix name in bar badge --- chatview/qml/RootItem.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chatview/qml/RootItem.qml b/chatview/qml/RootItem.qml index 805d747..26b85c4 100644 --- a/chatview/qml/RootItem.qml +++ b/chatview/qml/RootItem.qml @@ -154,7 +154,7 @@ ChatRootView { spacing: 10 Badge { - text: "%1/%2".arg(root.chatModel.totalTokens).arg(root.chatModel.tokensThreshold) + text: qsTr("tokens:%1/%2").arg(root.chatModel.totalTokens).arg(root.chatModel.tokensThreshold) color: root.codeColor fontColor: root.primaryColor.hslLightness > 0.5 ? "black" : "white" } From 838d69623c82c9a0034b9fef64b6c2b21b1f2bf5 Mon Sep 17 00:00:00 2001 From: Petr Mironychev <9195189+Palm1r@users.noreply.github.com> Date: Mon, 21 Oct 2024 01:54:27 +0200 Subject: [PATCH 3/3] Upgrade to 0.3.4 --- QodeAssist.json.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/QodeAssist.json.in b/QodeAssist.json.in index 1aa26c3..d7133bd 100644 --- a/QodeAssist.json.in +++ b/QodeAssist.json.in @@ -1,6 +1,6 @@ { "Name" : "QodeAssist", - "Version" : "0.3.3", + "Version" : "0.3.4", "CompatVersion" : "${IDE_VERSION_COMPAT}", "Vendor" : "Petr Mironychev", "Copyright" : "(C) ${IDE_COPYRIGHT_YEAR} Petr Mironychev, (C) ${IDE_COPYRIGHT_YEAR} The Qt Company Ltd",