From 47e99816607f814b5d22a891999cd6a0a3c4e75b Mon Sep 17 00:00:00 2001 From: Hyungi Ahn Date: Fri, 3 Apr 2026 11:44:21 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20Qwen3.5=20Thinking=20Process=20=ED=85=8D?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=A0=9C=EA=B1=B0=20=E2=80=94=20JSON=20?= =?UTF-8?q?=ED=8C=8C=EC=8B=B1=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 첫 번째 { 이전의 모든 비-JSON 텍스트를 제거하여 thinking/reasoning preamble이 있어도 JSON 추출 가능. Co-Authored-By: Claude Opus 4.6 (1M context) --- app/ai/client.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/ai/client.py b/app/ai/client.py index ed69740..a370bf6 100644 --- a/app/ai/client.py +++ b/app/ai/client.py @@ -10,8 +10,14 @@ from core.config import settings def strip_thinking(text: str) -> str: - """Qwen3.5의 ... 블록 제거""" - return re.sub(r".*?", "", text, flags=re.DOTALL).strip() + """Qwen3.5의 ... 블록 및 Thinking Process 텍스트 제거""" + # 태그 제거 + text = re.sub(r".*?", "", text, flags=re.DOTALL) + # "Thinking Process:" 등 사고 과정 텍스트 제거 (첫 번째 { 이전의 모든 텍스트) + json_start = text.find("{") + if json_start > 0: + text = text[json_start:] + return text.strip() def parse_json_response(raw: str) -> dict | None: