(request: RunRequest)
| 42 | |
| 43 | @router.post("/") |
| 44 | async def create_run(request: RunRequest) -> dict[str, Any]: |
| 45 | task_id = make_task_id() |
| 46 | try: |
| 47 | logger.info( |
| 48 | "create_run[%s] model=%s query_len=%d files=%d", |
| 49 | task_id, |
| 50 | request.model, |
| 51 | len(request.query or ""), |
| 52 | len(request.project or {}), |
| 53 | ) |
| 54 | except Exception: |
| 55 | pass |
| 56 | |
| 57 | # Store full payload server-side to keep stream tokens small |
| 58 | await set_run_payload( |
| 59 | task_id, |
| 60 | { |
| 61 | "user_id": request.user_id, |
| 62 | "message_history": request.message_history, |
| 63 | "query": request.query, |
| 64 | "project": request.project, |
| 65 | "model": request.model, |
| 66 | "project_id": request.project_id, |
| 67 | }, |
| 68 | ) |
| 69 | # Issue a compact token carrying only the run id |
| 70 | stream_token = make_stream_token({"run_id": task_id}) |
| 71 | return {"task_id": task_id, "stream_token": stream_token} |
| 72 | |
| 73 | |
| 74 | @router.get("/{run_id}/events") |
nothing calls this directly
no test coverage detected