Send a message to the scraping agent and get a response.
(request: MessageRequest)
| 26 | |
| 27 | @router.post("/message", response_model=MessageResponse) |
| 28 | async def send_message(request: MessageRequest): |
| 29 | """Send a message to the scraping agent and get a response.""" |
| 30 | try: |
| 31 | result = await openrouter_agent.process_message( |
| 32 | message=request.message, |
| 33 | pipeline_id=request.pipeline_id, |
| 34 | context=request.context |
| 35 | ) |
| 36 | |
| 37 | return MessageResponse( |
| 38 | response=result["response"], |
| 39 | urls=result["urls"], |
| 40 | schema=result["schema"], |
| 41 | code=result.get("code"), |
| 42 | results=result.get("results", []), |
| 43 | status=result["status"], |
| 44 | timestamp=datetime.utcnow() |
| 45 | ) |
| 46 | except Exception as e: |
| 47 | raise HTTPException(status_code=500, detail=str(e)) |
| 48 | |
| 49 | @router.get("/history/{pipeline_id}") |
| 50 | async def get_chat_history(pipeline_id: str, limit: int = 50): |
nothing calls this directly
no test coverage detected