mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-07-17 03:03:19 +08:00
feat: record self-evolution turn on streaming chat
This commit is contained in:
@@ -274,6 +274,11 @@ class ChatService:
|
|||||||
# Execute post-process tools
|
# Execute post-process tools
|
||||||
agent._execute_post_process_tools()
|
agent._execute_post_process_tools()
|
||||||
|
|
||||||
|
# Record this user turn for the self-evolution idle trigger. This
|
||||||
|
# streaming path bypasses agent_bridge.agent_reply, so the activity must
|
||||||
|
# be noted here, otherwise idle scans never see any signal to evolve.
|
||||||
|
self._note_evolution_turn(agent, context)
|
||||||
|
|
||||||
logger.info(f"[ChatService] Agent run completed: session={session_id}")
|
logger.info(f"[ChatService] Agent run completed: session={session_id}")
|
||||||
|
|
||||||
|
|
||||||
@@ -309,6 +314,19 @@ class ChatService:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"[ChatService] Failed to attach context to scheduler: {e}")
|
logger.warning(f"[ChatService] Failed to attach context to scheduler: {e}")
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _note_evolution_turn(agent, context):
|
||||||
|
"""Record a user turn so the self-evolution idle trigger has signal."""
|
||||||
|
try:
|
||||||
|
from agent.evolution.trigger import note_user_turn
|
||||||
|
ch = (context.get("channel_type") or "") if context else ""
|
||||||
|
rcv = (context.get("receiver") or "") if context else ""
|
||||||
|
is_group = bool(context.get("isgroup")) if context else False
|
||||||
|
# Only single chats get a proactive push target; group push is noisy.
|
||||||
|
note_user_turn(agent, channel_type=ch, receiver=(rcv if not is_group else ""))
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _persist_messages(session_id: str, new_messages: list, channel_type: str = ""):
|
def _persist_messages(session_id: str, new_messages: list, channel_type: str = ""):
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -38,12 +38,13 @@ services:
|
|||||||
DINGTALK_CLIENT_SECRET: ''
|
DINGTALK_CLIENT_SECRET: ''
|
||||||
WECOM_BOT_ID: ''
|
WECOM_BOT_ID: ''
|
||||||
WECOM_BOT_SECRET: ''
|
WECOM_BOT_SECRET: ''
|
||||||
# 如需通过宿主机访问 Web 控制台,改为 '0.0.0.0' 并设置 WEB_PASSWORD
|
# To access the web console from the host, set this to '0.0.0.0' and set WEB_PASSWORD
|
||||||
WEB_HOST: '127.0.0.1'
|
WEB_HOST: '127.0.0.1'
|
||||||
WEB_PASSWORD: ''
|
WEB_PASSWORD: ''
|
||||||
AGENT: 'True'
|
AGENT: 'True'
|
||||||
AGENT_MAX_CONTEXT_TOKENS: 50000
|
AGENT_MAX_CONTEXT_TOKENS: 50000
|
||||||
AGENT_MAX_CONTEXT_TURNS: 20
|
AGENT_MAX_CONTEXT_TURNS: 20
|
||||||
AGENT_MAX_STEPS: 20
|
AGENT_MAX_STEPS: 20
|
||||||
|
SELF_EVOLUTION_ENABLED: 'True'
|
||||||
volumes:
|
volumes:
|
||||||
- ./cow:/home/agent/cow
|
- ./cow:/home/agent/cow
|
||||||
|
|||||||
Reference in New Issue
Block a user