Enha: loaded model on top
This commit is contained in:
11
bot.go
11
bot.go
@@ -411,14 +411,21 @@ func fetchLCPModelsWithLoadStatus() ([]string, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
result := make([]string, 0, len(models.Data))
|
result := make([]string, 0, len(models.Data))
|
||||||
for _, m := range models.Data {
|
li := 0 // loaded index
|
||||||
|
for i, m := range models.Data {
|
||||||
modelName := m.ID
|
modelName := m.ID
|
||||||
if m.Status.Value == "loaded" {
|
if m.Status.Value == "loaded" {
|
||||||
modelName = "(loaded) " + modelName
|
modelName = "(loaded) " + modelName
|
||||||
|
li = i
|
||||||
}
|
}
|
||||||
result = append(result, modelName)
|
result = append(result, modelName)
|
||||||
}
|
}
|
||||||
return result, nil
|
if li == 0 {
|
||||||
|
return result, nil // no loaded models
|
||||||
|
}
|
||||||
|
loadedModel := result[li]
|
||||||
|
result = append(result[:li], result[li+1:]...)
|
||||||
|
return slices.Concat([]string{loadedModel}, result), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// fetchLCPModelsWithStatus returns the full LCPModels struct including status information.
|
// fetchLCPModelsWithStatus returns the full LCPModels struct including status information.
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ func showModelSelectionPopup() {
|
|||||||
// Find the current model index to set as selected
|
// Find the current model index to set as selected
|
||||||
currentModelIndex := -1
|
currentModelIndex := -1
|
||||||
for i, model := range modelList {
|
for i, model := range modelList {
|
||||||
if model == chatBody.Model {
|
if strings.TrimPrefix(model, "(loaded) ") == chatBody.Model {
|
||||||
currentModelIndex = i
|
currentModelIndex = i
|
||||||
}
|
}
|
||||||
modelListWidget.AddItem(model, "", 0, nil)
|
modelListWidget.AddItem(model, "", 0, nil)
|
||||||
|
|||||||
Reference in New Issue
Block a user