From f5818557437a7a6bc9d2516cdedb4c747b0c1722 Mon Sep 17 00:00:00 2001 From: rogersun Date: Tue, 7 Jul 2026 10:12:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96AI=E6=A8=A1=E5=9E=8B=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E5=8F=82=E6=95=B0=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E5=BC=BA=E5=88=B6=E8=BF=94=E5=9B=9Ejson=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ai/utils/basic_func.py | 3 ++- ai/utils/show_prompt.py | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ai/utils/basic_func.py b/ai/utils/basic_func.py index be3981e..246f5e0 100644 --- a/ai/utils/basic_func.py +++ b/ai/utils/basic_func.py @@ -5,6 +5,7 @@ from ai.models import * from io import StringIO from django_redis import get_redis_connection from ai.models import CinemaHall +from django.db.models import Q # 清除redis锁 @@ -178,7 +179,7 @@ def get_runtime_val(key: str): # 获取当前开启的模型 def get_current_model(): - return AiModel.objects.filter(current_used=True).first() + return AiModel.objects.filter(Q(current_used=True) & Q(delete_flag=False)).first() # 通不过不同key获取数据 diff --git a/ai/utils/show_prompt.py b/ai/utils/show_prompt.py index 496b555..2d7979e 100644 --- a/ai/utils/show_prompt.py +++ b/ai/utils/show_prompt.py @@ -242,7 +242,10 @@ class ShowAI: ], stream=False, reasoning_effort="high", - extra_body={"thinking": {"type": "enabled"}} + extra_body={"thinking": {"type": "enabled"}}, + response_format={ + 'type': 'json_object' + } ) res_json = response.model_dump_json() res_obj = json.loads(res_json)