forked from Shinonome/dots-hyprland
ai: fix invalid message when switching model
This commit is contained in:
@@ -8,6 +8,9 @@ import Quickshell.Io;
|
|||||||
import Qt.labs.platform
|
import Qt.labs.platform
|
||||||
import QtQuick;
|
import QtQuick;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basic service to handle LLM chats. Supports Google's and OpenAI's API formats.
|
||||||
|
*/
|
||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
@@ -184,7 +187,7 @@ Singleton {
|
|||||||
modelId = modelId.toLowerCase()
|
modelId = modelId.toLowerCase()
|
||||||
if (modelList.indexOf(modelId) !== -1) {
|
if (modelList.indexOf(modelId) !== -1) {
|
||||||
PersistentStateManager.setState("ai.model", modelId);
|
PersistentStateManager.setState("ai.model", modelId);
|
||||||
if (feedback) root.addMessage(StringUtils.format(StringUtils.format("Model set to {0}"), models[modelId].name, Ai.interfaceRole))
|
if (feedback) root.addMessage(StringUtils.format(StringUtils.format("Model set to {0}"), models[modelId].name), Ai.interfaceRole)
|
||||||
if (models[modelId].requires_key) {
|
if (models[modelId].requires_key) {
|
||||||
// If key not there show advice
|
// If key not there show advice
|
||||||
if (root.apiKeysLoaded && (!root.apiKeys[models[modelId].key_id] || root.apiKeys[models[modelId].key_id].length === 0)) {
|
if (root.apiKeysLoaded && (!root.apiKeys[models[modelId].key_id] || root.apiKeys[models[modelId].key_id].length === 0)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user