Skip to content

Commit

Permalink
Update http_service.py
Browse files Browse the repository at this point in the history
  • Loading branch information
liu2-3zhi authored and lss233 committed Mar 3, 2024
1 parent 42c0a82 commit 706cc51
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions platforms/http_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
from constants import config, BotPlatform
from universal import handle_message

from urllib.parse import unquote

app = Quart(__name__)

lock = threading.Lock()
Expand Down Expand Up @@ -140,7 +142,7 @@ async def v2_chat():
async def v2_chat_response():
"""异步请求时,配合/v2/chat获取内容"""
request_id = request.args.get("request_id")
request_id = re.sub(r'^["\'%22]|["\'%22]$', '', request_id) # 添加替换操作,以兼容带有引号的request_id
request_id = re.sub(r'^[%22%27"\'"]*|[%22%27"\'"]*$', '', request_id) # 添加替换操作,以兼容头部和尾部带有引号和URL编码引号的request_id
bot_request: BotRequest = request_dic.get(request_id, None)
if bot_request is None:
return ResponseResult(message="没有更多了!", result_status=RESPONSE_FAILED).to_json()
Expand All @@ -152,8 +154,6 @@ async def v2_chat_response():
logger.debug(f"Bot request {request_id} response -> \n{response[:100]}")
return response



def clear_request_dict():
logger.debug("Watch and clean request_dic.")
while True:
Expand Down

0 comments on commit 706cc51

Please sign in to comment.