Spaces:
Paused
Paused
Update app/core/response_handlers.py
Browse files
app/core/response_handlers.py
CHANGED
|
@@ -4,6 +4,7 @@ Response handlers for streaming and non-streaming responses
|
|
| 4 |
|
| 5 |
import json
|
| 6 |
import time
|
|
|
|
| 7 |
from typing import Generator, Optional
|
| 8 |
import requests
|
| 9 |
from fastapi import HTTPException
|
|
@@ -459,6 +460,8 @@ class NonStreamResponseHandler(ResponseHandler):
|
|
| 459 |
|
| 460 |
if upstream_data.data.phase == "thinking":
|
| 461 |
content = transform_thinking_content(content)
|
|
|
|
|
|
|
| 462 |
|
| 463 |
# 处理思考内容的分块格式
|
| 464 |
if not self.in_thinking_phase:
|
|
|
|
| 4 |
|
| 5 |
import json
|
| 6 |
import time
|
| 7 |
+
import re
|
| 8 |
from typing import Generator, Optional
|
| 9 |
import requests
|
| 10 |
from fastapi import HTTPException
|
|
|
|
| 460 |
|
| 461 |
if upstream_data.data.phase == "thinking":
|
| 462 |
content = transform_thinking_content(content)
|
| 463 |
+
# 移除单层引用,但保留多层引用
|
| 464 |
+
content = re.sub(r'^\s*>\s*(?!>)', '', content, flags=re.MULTILINE)
|
| 465 |
|
| 466 |
# 处理思考内容的分块格式
|
| 467 |
if not self.in_thinking_phase:
|