fix: tool_use regex negative lookahead to prevent cross-tag matching; tgapp relative path resolve

This commit is contained in:
Jiaqing Liang
2026-03-23 11:46:10 +08:00
parent 6f6d9f6570
commit 4b4dc51336
2 changed files with 3 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
import os, sys, re, threading, asyncio, queue as Q, socket, time
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
_TEMP_DIR = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'temp')
from agentmain import GeneraticAgent
try:
from telegram import Update
@@ -65,6 +66,7 @@ async def _stream(dq, msg):
if done:
files = re.findall(r'\[FILE:([^\]]+)\]', show[-1000:])
for fpath in files:
if not os.path.isabs(fpath): fpath = os.path.join(_TEMP_DIR, fpath)
if os.path.exists(fpath):
if fpath.lower().endswith(('.png','.jpg','.jpeg','.gif','.webp')):
try: await msg.reply_photo(open(fpath,'rb'))