From 81ab5871c1186bf25e4eb96cbc55a2c778e1723c Mon Sep 17 00:00:00 2001 From: nanhaoluo <3075912108@qq.com> Date: Tue, 27 Jan 2026 11:01:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20API=20=E5=AF=86?= =?UTF-8?q?=E9=92=A5=E6=9F=A5=E7=9C=8B=E6=8C=89=E9=92=AE=E5=92=8C=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E5=88=97=E8=A1=A8=E8=8E=B7=E5=8F=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复 API 密钥输入框的查看密码按钮被 label 包裹导致重复显示的问题 - 修复硅基流动模型列表过滤过于严格,只显示包含 Instruct 的模型 - 优化 OpenAI 模型列表过滤逻辑,排除嵌入、音频、图像等非聊天模型 - 硅基流动现在会显示所有聊天模型,只排除嵌入和图像生成模型 --- functions.php | 32 ++++++++++++++++++++++++-------- settings.php | 14 +++++++------- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/functions.php b/functions.php index f2c3b06..fb12a15 100644 --- a/functions.php +++ b/functions.php @@ -9291,12 +9291,20 @@ function argon_get_openai_models($api_key, $custom_endpoint = '') { $models = []; foreach ($body['data'] as $model) { - // 只显示 GPT 聊天模型 - if (strpos($model['id'], 'gpt') !== false && strpos($model['id'], 'instruct') === false) { - $models[] = [ - 'id' => $model['id'], - 'name' => $model['id'] - ]; + // 只显示 GPT 聊天模型,排除嵌入、音频、图像等模型 + if (isset($model['id'])) { + $model_id = $model['id']; + // 只保留 gpt 开头的模型,排除其他类型 + if (strpos($model_id, 'gpt') === 0 && + strpos($model_id, 'embedding') === false && + strpos($model_id, 'whisper') === false && + strpos($model_id, 'tts') === false && + strpos($model_id, 'dall-e') === false) { + $models[] = [ + 'id' => $model['id'], + 'name' => $model['id'] + ]; + } } } @@ -9735,8 +9743,16 @@ function argon_get_siliconflow_models($api_key, $custom_endpoint = '') { $models = []; foreach ($body['data'] as $model) { - // 只显示聊天模型 - if (isset($model['id']) && strpos($model['id'], 'Instruct') !== false) { + // 过滤掉嵌入模型和图像模型,只保留聊天模型 + if (isset($model['id'])) { + $model_id = $model['id']; + // 排除嵌入模型和图像模型 + if (strpos($model_id, 'embedding') !== false || + strpos($model_id, 'FLUX') !== false || + strpos($model_id, 'stable-diffusion') !== false || + strpos($model_id, 'kolors') !== false) { + continue; + } $name = isset($model['name']) ? $model['name'] : $model['id']; $models[] = [ 'id' => $model['id'], diff --git a/settings.php b/settings.php index 61eb6ea..17a7f45 100644 --- a/settings.php +++ b/settings.php @@ -2162,13 +2162,13 @@ function themeoptions_page(){
-
+
+
+