🫥 | Commit... yeah, commit.

This commit is contained in:
2026-05-05 12:57:06 +03:00
parent 55917b9d1a
commit 642f498e79
3 changed files with 27 additions and 11 deletions

View File

@@ -6,6 +6,7 @@ import org.kde.kirigami as Kirigami
Kirigami.Page {
id: page
property alias cfg_systemPrompt: systemPrompt.text
property alias cfg_defaultModel: defaultModelField.text
contentItem: ColumnLayout {
Kirigami.Heading {
@@ -22,5 +23,17 @@ Kirigami.Page {
wrapMode: TextEdit.Wrap
clip: true
}
Kirigami.Heading {
text: "Default Model"
level: 3
Layout.fillWidth: true
}
QQC2.TextField {
id: defaultModelField
placeholderText: "Enter the default model name (e.g., llama3)"
Layout.fillWidth: true
}
}
}

View File

@@ -20,6 +20,15 @@ PlasmoidItem {
}
}
Connections {
target: plasmoid.configuration
function onDefaultModelChanged() {
if (models.includes(plasmoid.configuration.defaultModel)) {
currentModel = plasmoid.configuration.defaultModel;
}
}
}
property string ollamaUrl: "http://localhost:11434"
property var models: []
property string currentModel: ""
@@ -74,8 +83,12 @@ PlasmoidItem {
if (res.models) {
res.models.forEach(m => list.push(m.name));
models = list;
if (list.length > 0 && currentModel === "")
// Prefer user configured default model if present
if (plasmoid.configuration.defaultModel && list.includes(plasmoid.configuration.defaultModel)) {
currentModel = plasmoid.configuration.defaultModel;
} else if (list.length > 0 && currentModel === "") {
currentModel = list[0];
}
}
}
};