fix(quickshell): load extraModels properly in AI sidebar

- Use Object.assign in addModel to trigger QML binding recalculation
- Load extraModels in Component.onCompleted as fallback when
  onReadyChanged doesn't fire (Config already ready at load time)
This commit is contained in:
tivnantu
2026-03-07 02:00:50 +08:00
parent 1dcf90ac57
commit b4b422bd9c
+10 -1
View File
@@ -321,6 +321,13 @@ Singleton {
Component.onCompleted: {
setModel(currentModelId, false, false); // Do necessary setup for model
// Load extra models from config (onReadyChanged may not fire if Config is already ready)
if (Config?.options?.ai?.extraModels) {
Config.options.ai.extraModels.forEach(model => {
const safeModelName = root.safeModelName(model["model"]);
root.addModel(safeModelName, model)
});
}
}
function guessModelLogo(model) {
@@ -345,7 +352,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 {