diff --git a/dots/.config/quickshell/ii/services/Ai.qml b/dots/.config/quickshell/ii/services/Ai.qml index a273415f5..d177cac80 100644 --- a/dots/.config/quickshell/ii/services/Ai.qml +++ b/dots/.config/quickshell/ii/services/Ai.qml @@ -305,14 +305,18 @@ Singleton { } property ApiStrategy currentApiStrategy: apiStrategies[models[currentModelId]?.api_format || "openai"] + function addUserModels() { + (Config?.options.ai?.extraModels ?? []).forEach(model => { + const safeModelName = root.safeModelName(model["model"]); + root.addModel(safeModelName, model) + }); + } + Connections { target: Config function onReadyChanged() { if (!Config.ready) return; - (Config?.options.ai?.extraModels ?? []).forEach(model => { - const safeModelName = root.safeModelName(model["model"]); - root.addModel(safeModelName, model) - }); + root.addUserModels() } } @@ -321,6 +325,7 @@ Singleton { Component.onCompleted: { setModel(currentModelId, false, false); // Do necessary setup for model + root.addUserModels() } function guessModelLogo(model) { @@ -345,7 +350,9 @@ Singleton { } function addModel(modelName, data) { - root.models[modelName] = aiModelComponent.createObject(this, data); + root.models = Object.assign({}, root.models, { + [modelName]: aiModelComponent.createObject(this, data) + }); } Process {