AiAssistant: Use SelectionAspect Data

Change-Id: I4d4c1b637b0306577e60865acd305bf1e85b9d4f
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <mua@spyro-soft.com>
This commit is contained in:
Marcus Tillmanns
2024-09-02 15:39:04 +02:00
parent 1043b1835c
commit 4747d82c92

View File

@@ -42,28 +42,14 @@ local function createCommand()
return cmd return cmd
end 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 function createInitOptions()
local llm_config = { local llm_config = {
cppLLM = mapLLMsDisplayToKey(Settings.cppLLM.stringValue), cppLLM = Settings.cppLLM.dataValue,
qmlLLM = mapLLMsDisplayToKey(Settings.qmlLLM.stringValue), qmlLLM = Settings.qmlLLM.dataValue,
otherLLM = mapLLMsDisplayToKey(Settings.otherLLM.stringValue), otherLLM = Settings.otherLLM.dataValue,
debugLLM = mapLLMsDisplayToKey(Settings.debugLLM.stringValue), debugLLM = Settings.debugLLM.dataValue,
reviewLLM = mapLLMsDisplayToKey(Settings.reviewLLM.stringValue), reviewLLM = Settings.reviewLLM.dataValue,
explainLLM = mapLLMsDisplayToKey(Settings.explainLLM.stringValue) explainLLM = Settings.explainLLM.dataValue
} }
local auth_token_config = { local auth_token_config = {
@@ -201,10 +187,15 @@ local function layoutSettings()
return layout return layout
end end
local available_llms = {
{ name = "Llama 3 70B Fine-Tuned", data = "Llama3" },
{ name = "Claude 3.5 Sonnet", data = "Claude35" }
}
local function createSelectionAspect(settingsKey, displayName) local function createSelectionAspect(settingsKey, displayName)
return S.SelectionAspect.create({ return S.SelectionAspect.create({
settingsKey = settingsKey, settingsKey = settingsKey,
options = available_llms.displayName, options = available_llms,
displayStyle = S.SelectionDisplayStyle.ComboBox, displayStyle = S.SelectionDisplayStyle.ComboBox,
displayName = displayName displayName = displayName
}) })