Browse Source

fix: sorting bug in AIChatService

KernelDeimos 5 months ago
parent
commit
7acb096add
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/backend/src/modules/puterai/AIChatService.js

+ 1 - 1
src/backend/src/modules/puterai/AIChatService.js

@@ -563,7 +563,7 @@ class AIChatService extends BaseService {
             // Calculate the sorted list
             // Calculate the sorted list
             const models = this.detail_model_list;
             const models = this.detail_model_list;
 
 
-            sorted_models = models.sort((a, b) => {
+            sorted_models = models.toSorted((a, b) => {
                 return Math.sqrt(
                 return Math.sqrt(
                     Math.pow(a.cost.input - target_model.cost.input, 2) +
                     Math.pow(a.cost.input - target_model.cost.input, 2) +
                     Math.pow(a.cost.output - target_model.cost.output, 2)
                     Math.pow(a.cost.output - target_model.cost.output, 2)