API separation

This commit is contained in:
frdel 2024-11-21 18:47:40 +01:00
parent 8db8d3fa18
commit c0947e30c7
28 changed files with 683 additions and 770 deletions

18
python/api/chat_remove.py Normal file
View file

@ -0,0 +1,18 @@
from python.helpers.api import ApiHandler
from flask import Request, Response
from agent import AgentContext
from python.helpers import persist_chat
class RemoveChat(ApiHandler):
async def process(self, input: dict, request: Request) -> dict | Response:
ctxid = input.get("context", "")
# context instance - get or create
AgentContext.remove(ctxid)
persist_chat.remove_chat(ctxid)
return {
"message": "Context removed.",
}