mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-04-28 19:51:11 +00:00
BIG PYTHON REFACTOR
Python scripts moved out of python/ folder to root to be unified with plugins + frontend extension around api calls
This commit is contained in:
parent
f94b7d742c
commit
d02dda3667
326 changed files with 1096 additions and 862 deletions
|
|
@ -1,18 +0,0 @@
|
|||
from python.helpers.api import ApiHandler, Input, Output, Request, Response
|
||||
|
||||
from python.helpers import tokens
|
||||
|
||||
|
||||
class GetCtxWindow(ApiHandler):
|
||||
async def process(self, input: Input, request: Request) -> Output:
|
||||
ctxid = input.get("context", [])
|
||||
context = self.use_context(ctxid)
|
||||
agent = context.streaming_agent or context.agent0
|
||||
window = agent.get_data(agent.DATA_NAME_CTX_WINDOW)
|
||||
if not window or not isinstance(window, dict):
|
||||
return {"content": "", "tokens": 0}
|
||||
|
||||
text = window["text"]
|
||||
tokens = window["tokens"]
|
||||
|
||||
return {"content": text, "tokens": tokens}
|
||||
Loading…
Add table
Add a link
Reference in a new issue