Make the retrieval/parsing of models.json sync on startup. We were jumping to many hoops to mitigate the async behavior.

This commit is contained in:
Adam Treat
2023-06-28 11:13:33 -04:00
committed by AT
parent 9560336490
commit e70899a26c
5 changed files with 172 additions and 182 deletions

View File

@@ -207,28 +207,9 @@ Window {
textRole: "name"
property string currentModelName: ""
function updateCurrentModelName() {
// During application startup the model names might not be processed yet, so don't
// set the combobox text until this is done OR the timer has timed out
if (!ModelList.modelHasNames && startupTimer.running)
return
var info = ModelList.modelInfo(currentChat.modelInfo.filename);
comboBox.currentModelName = info.name !== "" ? info.name : info.filename;
}
Timer {
id: startupTimer
interval: 3000 // 3 seconds
running: true
repeat: false
onTriggered: {
comboBox.updateCurrentModelName();
}
}
Connections {
target: ModelList
function onModelHasNamesChanged() {
comboBox.updateCurrentModelName();
}
}
Connections {
target: currentChat
function onModelInfoChanged() {