Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions agentmain.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ def _hub_put(t):
if task:
print(f'[Reflect] triggered: {task[:80]}')
if (_ln := getattr(mod, 'LLM', None)): agent.next_llm(next((i for i, b in enumerate(agent.llmclients) if not isinstance(b, dict) and b.backend.name == _ln), agent.llm_no))
if getattr(mod, 'FRESH_CONTEXT', False): from frontends.continue_cmd import reset_conversation; reset_conversation(agent, snapshot=False)
dq = agent.put_task(task, source='reflect')
try:
while 'done' not in (item := dq.get(timeout=2200)): pass
Expand Down
4 changes: 2 additions & 2 deletions frontends/continue_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,13 +471,13 @@ def _snapshot_current_log(pid=None):
return snapshot


def reset_conversation(agent, message='🆕 已开启新对话,当前上下文已清空'):
def reset_conversation(agent, message='🆕 已开启新对话,当前上下文已清空', snapshot=True):
"""Abort current work and clear all known frontend-visible conversation state."""
try:
agent.abort()
except Exception:
pass
_snapshot_current_log()
if snapshot: _snapshot_current_log()
if hasattr(agent, 'history'):
agent.history = []
for client in _agent_clients(agent):
Expand Down
1 change: 1 addition & 0 deletions reflect/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

INTERVAL = 120
ONCE = False
FRESH_CONTEXT = True

_dir = os.path.dirname(os.path.abspath(__file__))
TASKS = os.path.join(_dir, '../sche_tasks')
Expand Down