diff --git a/frontends/tgapp.py b/frontends/tgapp.py
index 4198a9d..48ec5d4 100644
--- a/frontends/tgapp.py
+++ b/frontends/tgapp.py
@@ -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'))
diff --git a/llmcore.py b/llmcore.py
index 03ee440..a22fbed 100644
--- a/llmcore.py
+++ b/llmcore.py
@@ -717,7 +717,7 @@ class ToolClient:
remaining_text = re.sub(think_pattern, "", remaining_text, flags=re.DOTALL)
tool_calls = []; json_strs = []; errors = []
- tool_pattern = r"(.{15,}?)"
+ tool_pattern = r"((?:(?!).){15,}?)"
tool_all = re.findall(tool_pattern, remaining_text, re.DOTALL)
if tool_all: