File size: 425 Bytes
5551822
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import fastapi

import logging

router = fastapi.APIRouter()


@router.post("/analyse_url")
async def analyse_url(thread_id:str,url: str):
    try:
        
        if not url:
            return {"data": "URL missing in headers"}
        res = await run_agent(thread_id, url)
        return {"data": res}
    except Exception as e:
        logging.error(f"Chat endpoint error: {e}")
        return {"data": "Failed to chat"}