From 3876b07bc331c912b82420006d86e9291cf0888f Mon Sep 17 00:00:00 2001
From: end-4 <97237370+end-4@users.noreply.github.com>
Date: Sat, 10 May 2025 11:49:09 +0200
Subject: [PATCH] ai: dont keep text when command fails
---
.config/quickshell/modules/sidebarLeft/AiChat.qml | 2 +-
.config/quickshell/services/Ai.qml | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/.config/quickshell/modules/sidebarLeft/AiChat.qml b/.config/quickshell/modules/sidebarLeft/AiChat.qml
index 77aac582a..167cc7322 100644
--- a/.config/quickshell/modules/sidebarLeft/AiChat.qml
+++ b/.config/quickshell/modules/sidebarLeft/AiChat.qml
@@ -447,8 +447,8 @@ int main(int argc, char* argv[]) {
event.accepted = true
} else { // Accept text
const inputText = messageInputField.text
- root.handleInput(inputText)
messageInputField.clear()
+ root.handleInput(inputText)
event.accepted = true
}
}
diff --git a/.config/quickshell/services/Ai.qml b/.config/quickshell/services/Ai.qml
index 770c99fe2..de265e6e8 100644
--- a/.config/quickshell/services/Ai.qml
+++ b/.config/quickshell/services/Ai.qml
@@ -44,7 +44,7 @@ Singleton {
"requires_key": true,
"key_id": "gemini",
"key_get_link": "https://aistudio.google.com/app/apikey",
- "key_get_description": "Pricing: free. Data used for training.\n\nInstructions: Log into Google account, allow AI Studio to create Google Cloud project or whatever it asks, go back and click Get API key",
+ "key_get_description": "**Pricing**: free. Data used for training.\n\n**Instructions**: Log into Google account, allow AI Studio to create Google Cloud project or whatever it asks, go back and click Get API key",
"api_format": "gemini",
"tools": [
{
@@ -62,7 +62,7 @@ Singleton {
"requires_key": true,
"key_id": "openrouter",
"key_get_link": "https://openrouter.ai/settings/keys",
- "key_get_description": "Pricing: free. Data use policy varies depending on your OpenRouter account settings.\n\nInstructions: Log into OpenRouter account, go to Keys on the topright menu, click Create API Key",
+ "key_get_description": "**Pricing**: free. Data use policy varies depending on your OpenRouter account settings.\n\n**Instructions**: Log into OpenRouter account, go to Keys on the topright menu, click Create API Key",
},
"openrouter-deepseek-r1": {
"name": "DeepSeek R1",
@@ -153,7 +153,7 @@ Singleton {
function addApiKeyAdvice(model) {
root.addMessage(
- StringUtils.format(qsTr('To set an API key, pass it with the command\n\nTo view the key, pass "get" with the command
For {0}, you can grab one at:\n\n{1}\n\n{2}'),
+ StringUtils.format(qsTr('To set an API key, pass it with the command\n\nTo view the key, pass "get" with the command
\n\n### For {0}:\n\n**Link**: {1}\n\n{2}'),
model.name, model.key_get_link, model.key_get_description ?? qsTr("No further instruction provided")),
Ai.interfaceRole
);
@@ -172,9 +172,9 @@ Singleton {
}
}
} else {
- if (feedback) root.addMessage(qsTr("Invalid model. Supported: \n- ") + modelList.join("\n- "), Ai.interfaceRole)
+ if (feedback) root.addMessage(qsTr("Invalid model. Supported: \n```\n") + modelList.join("\n```\n```\n"), Ai.interfaceRole) + "\n```"
}
- if (models[model].requires_key) {
+ if (models[model]?.requires_key) {
KeyringStorage.fetchKeyringData();
}
}