feat: add NativeOAISession + minor fixes (code_run script fallback, thinking prompt tags)

This commit is contained in:
Liang Jiaqing
2026-03-22 22:19:46 +08:00
parent fd5150ffad
commit 6f6d9f6570
4 changed files with 86 additions and 5 deletions

2
ga.py
View File

@@ -276,7 +276,7 @@ class GenericAgentHandler(BaseHandler):
matches = re.findall(pattern, response.content, re.DOTALL)
warning = ""
if not matches:
code = args.get("code")
code = args.get("code") or args.get("script")
if not code: return StepOutcome(None, next_prompt=f"【系统错误】:你调用了 code_run但未在先在回复正文中提供 ```{code_type} 代码块。请重新输出代码并附带工具调用。")
warning = "\n下次要记得先在回复正文中提供代码块,而不是放在参数中"
else: code = matches[-1].strip() # 提取最后一个代码块(通常是模型修正后的最终逻辑)