From 0761c19add7cb1ce45cb51eae9236410c5d27148 Mon Sep 17 00:00:00 2001 From: Mariusz Szczepanik Date: Mon, 2 Sep 2024 14:11:56 +0200 Subject: [PATCH] AI Assistant: Sync LLMs names with the Language Server Change-Id: Ic7d83da3fe2ecca97dbf11b730c344944036ac88 Reviewed-by: Marcus Tillmanns --- .../lua-plugins/ai_asistant/init.lua | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/share/qtcreator/lua-plugins/ai_asistant/init.lua b/share/qtcreator/lua-plugins/ai_asistant/init.lua index 3d30755f978..31737bd4894 100644 --- a/share/qtcreator/lua-plugins/ai_asistant/init.lua +++ b/share/qtcreator/lua-plugins/ai_asistant/init.lua @@ -43,14 +43,28 @@ local function createCommand() return cmd end +local available_llms = { + displayName = {"Llama 3 70B Fine-Tuned", "Claude 3.5 Sonnet"}, + keyName = {"Llama3", "Claude35"} +} + +local function mapLLMsDisplayToKey(displayValue) + for index, value in ipairs(available_llms.displayName) do + if value == displayValue then + return available_llms.keyName[index] + end + end + return "" +end + local function createInitOptions() local llm_config = { - cppLLM = Settings.cppLLM.stringValue, - qmlLLM = Settings.qmlLLM.stringValue, - otherLLM = Settings.otherLLM.stringValue, - debugLLM = Settings.debugLLM.stringValue, - reviewLLM = Settings.reviewLLM.stringValue, - explainLLM = Settings.explainLLM.stringValue + cppLLM = mapLLMsDisplayToKey(Settings.cppLLM.stringValue), + qmlLLM = mapLLMsDisplayToKey(Settings.qmlLLM.stringValue), + otherLLM = mapLLMsDisplayToKey(Settings.otherLLM.stringValue), + debugLLM = mapLLMsDisplayToKey(Settings.debugLLM.stringValue), + reviewLLM = mapLLMsDisplayToKey(Settings.reviewLLM.stringValue), + explainLLM = mapLLMsDisplayToKey(Settings.explainLLM.stringValue) } local auth_token_config = { @@ -209,12 +223,10 @@ local function layoutSettings() return layout end -local available_llms = {"Llama 3 70B Fine-Tuned", "Claude 3.5 Sonnet"} - local function createSelectionAspect(settingsKey, displayName) return S.SelectionAspect.create({ settingsKey = settingsKey, - options = available_llms, + options = available_llms.displayName, displayStyle = S.SelectionDisplayStyle.ComboBox, displayName = displayName })