fix: Qwen3.5 Thinking Process 텍스트 제거 — JSON 파싱 개선
첫 번째 { 이전의 모든 비-JSON 텍스트를 제거하여
thinking/reasoning preamble이 있어도 JSON 추출 가능.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -10,8 +10,14 @@ from core.config import settings
|
||||
|
||||
|
||||
def strip_thinking(text: str) -> str:
|
||||
"""Qwen3.5의 <think>...</think> 블록 제거"""
|
||||
return re.sub(r"<think>.*?</think>", "", text, flags=re.DOTALL).strip()
|
||||
"""Qwen3.5의 <think>...</think> 블록 및 Thinking Process 텍스트 제거"""
|
||||
# <think> 태그 제거
|
||||
text = re.sub(r"<think>.*?</think>", "", 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:
|
||||
|
||||
Reference in New Issue
Block a user