diff --git a/agentmain.py b/agentmain.py
index 7a853f2..15d2571 100644
--- a/agentmain.py
+++ b/agentmain.py
@@ -188,13 +188,13 @@ if __name__ == '__main__':
if 'next' in item and random.random() < 0.95: # 概率写一次中间结果
with open(f'{d}/output{nround}.txt', 'w', encoding='utf-8') as f: f.write(item.get('next', ''))
with open(f'{d}/output{nround}.txt', 'w', encoding='utf-8') as f: f.write(item['done'] + '\n\n[ROUND END]\n')
- for _ in range(300): # 等reply.txt,5分钟超时
+ for _ in range(300): # 等reply.txt,10分钟超时
time.sleep(2)
if os.path.exists(rp):
with open(rp, encoding='utf-8') as f: raw = f.read()
os.remove(rp); break
else: break
- nround = int(nround) + 1 if nround.isdigit() else 1
+ nround = nround + 1 if isinstance(nround, int) else 1
elif args.reflect:
import importlib.util
spec = importlib.util.spec_from_file_location('reflect_script', args.reflect)
diff --git a/frontends/stapp.py b/frontends/stapp.py
index 41f0a88..67e8355 100644
--- a/frontends/stapp.py
+++ b/frontends/stapp.py
@@ -139,6 +139,7 @@ if prompt := st.chat_input("请输入指令"):
turns = []; cache = []; response = ''
for response in agent_backend_stream(prompt):
render_segments(fold_turns(response), placeholders=turns, rendered_cache=cache, suffix='▌')
+ st.empty() # force Streamlit to check StopException on every iteration (incl. heartbeat)
render_segments(fold_turns(response), placeholders=turns, rendered_cache=cache, force_text=True)
st.session_state.messages.append({"role": "assistant", "content": response})
st.session_state.last_reply_time = int(time.time())
diff --git a/ga.py b/ga.py
index 7e54e2b..85803e0 100644
--- a/ga.py
+++ b/ga.py
@@ -251,7 +251,7 @@ def smart_format(data, max_str_len=100, omit_str=' ... '):
class GenericAgentHandler(BaseHandler):
'''Generic Agent 工具库,包含多种工具的实现。工具函数自动加上了 do_ 前缀。实际工具名没有前缀。'''
- def __init__(self, parent, last_history=None, cwd='./'):
+ def __init__(self, parent, last_history=None, cwd='./temp'):
self.parent = parent
self.working = {}
self.cwd = cwd; self.current_turn = 0