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