优化逻辑

This commit is contained in:
yuruo
2025-03-08 16:06:25 +08:00
parent aadf424704
commit b8ee2f2d26
2 changed files with 2 additions and 5 deletions

View File

@@ -68,7 +68,7 @@ def run_oai_interleaved(messages: list, system: str, model_name: str, api_key: s
# 删除思考和输出标签
def delete_think_and_output_tags(content: str, model_name: str):
final_answer = content
if "r1" in model_name:
if ("r1" in model_name) or ("reasoner" in model_name):
final_answer = content.split('</think>\n')[-1] if '</think>' in content else content
final_answer = final_answer.replace("<output>", "").replace("</output>", "")
return final_answer

View File

@@ -1,15 +1,12 @@
import json
from collections.abc import Callable
from typing import cast, Callable
from typing import Callable
import uuid
from PIL import Image, ImageDraw
import base64
from io import BytesIO
from anthropic import APIResponse
from anthropic.types import ToolResultBlockParam
from anthropic.types.beta import BetaMessage, BetaTextBlock, BetaToolUseBlock, BetaMessageParam, BetaUsage
from gradio_ui.agent.llm_utils.oaiclient import run_oai_interleaved
from gradio_ui.agent.llm_utils.utils import is_image_path
import time