mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-08-31 01:46:49 +00:00
nudge
This commit is contained in:
parent
9fae02b2a5
commit
e0b0b6f636
4 changed files with 58 additions and 15 deletions
21
python/api/nudge.py
Normal file
21
python/api/nudge.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
from python.helpers.api import ApiHandler
|
||||
from flask import Request, Response
|
||||
|
||||
from python.helpers import persist_chat
|
||||
|
||||
class Nudge(ApiHandler):
|
||||
async def process(self, input: dict, request: Request) -> dict | Response:
|
||||
ctxid = input.get("ctxid", "")
|
||||
if not ctxid:
|
||||
raise Exception("No context id provided")
|
||||
|
||||
context = self.get_context(ctxid)
|
||||
context.nudge()
|
||||
|
||||
msg = "Context reset, agent nudged."
|
||||
context.log.log(type="info", content=msg)
|
||||
|
||||
return {
|
||||
"message": msg,
|
||||
"ctxid": context.id,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue