From ad13cef89c2d604c1af84a8af819d91e638f8ce5 Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Fri, 14 Feb 2025 00:08:03 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=8Cperf:=20sort=20models=20by=20id=20w?= =?UTF-8?q?hen=20listing=20models=20#384?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astrbot/core/provider/sources/openai_source.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/astrbot/core/provider/sources/openai_source.py b/astrbot/core/provider/sources/openai_source.py index 9b7803491..a3114a6c1 100644 --- a/astrbot/core/provider/sources/openai_source.py +++ b/astrbot/core/provider/sources/openai_source.py @@ -55,7 +55,7 @@ class ProviderOpenAIOfficial(Provider): try: models_str = [] models = await self.client.models.list() - models = models.data + models = sorted(models.data, key=lambda x: x.id) for model in models: models_str.append(model.id) return models_str