{"openapi":"3.1.0","info":{"title":"PublisherKit Support Agent","description":"RAG-powered support chatbot for PublisherKit authors","version":"1.0.0"},"paths":{"/api/test-alert":{"post":{"summary":"Test Alert","description":"Send a test alert email to verify Resend integration.\n\nProtected by DAILY_REPORT_SECRET to prevent anonymous email flooding.","operationId":"test_alert_api_test_alert_post","parameters":[{"name":"secret","in":"query","required":false,"schema":{"type":"string","default":"","title":"Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/health":{"get":{"summary":"Health Check","description":"Health check endpoint","operationId":"health_check_api_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}}}}},"/api/chat":{"post":{"summary":"Chat","description":"Chat endpoint - ask questions and get RAG answers (optional screenshot).","operationId":"chat_api_chat_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_chat_api_chat_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/contact-support":{"post":{"summary":"Contact Support","description":"Send a user's question to the PublisherKit support team via email.","operationId":"contact_support_api_contact_support_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactSupportRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/feedback":{"post":{"summary":"Submit Feedback","description":"Store user feedback about their chat session.","operationId":"submit_feedback_api_feedback_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeedbackRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/run-scraper":{"get":{"summary":"Run Scraper","description":"Trigger the scraper pipeline.\n\nRuns in a background thread so the request returns immediately.\nProtected by DAILY_REPORT_SECRET.\n\nQuery params:\n  - secret: required auth token\n  - mode: \"targeted\" (default, uses seed URLs) or \"full\" (sitemap-based)\n  - embed_pk: re-embed PublisherKit knowledge after crawl (default true)\n\nExample: GET /api/run-scraper?secret=my-secret&mode=targeted&embed_pk=true","operationId":"run_scraper_api_run_scraper_get","parameters":[{"name":"secret","in":"query","required":false,"schema":{"type":"string","default":"","title":"Secret"}},{"name":"mode","in":"query","required":false,"schema":{"type":"string","default":"targeted","title":"Mode"}},{"name":"embed_pk","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Embed Pk"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"summary":"Run Scraper","description":"Trigger the scraper pipeline.\n\nRuns in a background thread so the request returns immediately.\nProtected by DAILY_REPORT_SECRET.\n\nQuery params:\n  - secret: required auth token\n  - mode: \"targeted\" (default, uses seed URLs) or \"full\" (sitemap-based)\n  - embed_pk: re-embed PublisherKit knowledge after crawl (default true)\n\nExample: GET /api/run-scraper?secret=my-secret&mode=targeted&embed_pk=true","operationId":"run_scraper_api_run_scraper_get","parameters":[{"name":"secret","in":"query","required":false,"schema":{"type":"string","default":"","title":"Secret"}},{"name":"mode","in":"query","required":false,"schema":{"type":"string","default":"targeted","title":"Mode"}},{"name":"embed_pk","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Embed Pk"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/scraper-status":{"get":{"summary":"Scraper Status","description":"Check the status of a running or last completed scraper run.","operationId":"scraper_status_api_scraper_status_get","parameters":[{"name":"secret","in":"query","required":false,"schema":{"type":"string","default":"","title":"Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/daily-report":{"get":{"summary":"Daily Report","description":"Trigger the daily analytics report email.\n\nProtected by a simple secret key passed as a query parameter.\nExample: GET /api/daily-report?secret=my-secret","operationId":"daily_report_api_daily_report_get","parameters":[{"name":"secret","in":"query","required":false,"schema":{"type":"string","default":"","title":"Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"summary":"Daily Report","description":"Trigger the daily analytics report email.\n\nProtected by a simple secret key passed as a query parameter.\nExample: GET /api/daily-report?secret=my-secret","operationId":"daily_report_api_daily_report_get","parameters":[{"name":"secret","in":"query","required":false,"schema":{"type":"string","default":"","title":"Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/chat-history":{"get":{"summary":"Chat History","description":"List recent chat sessions.\n\nProtected by DAILY_REPORT_SECRET — sessions carry user PII (email, name,\nlocation_id, page_url) and must never be publicly listable.","operationId":"chat_history_api_chat_history_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}},{"name":"secret","in":"query","required":false,"schema":{"type":"string","default":"","title":"Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SessionSummary"},"title":"Response Chat History Api Chat History Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/chat-history/{session_id}":{"get":{"summary":"Chat History Detail","description":"Get the full transcript of a chat session.\n\nProtected by DAILY_REPORT_SECRET — full transcripts include user PII and\nall questions/answers and must never be fetchable without auth.","operationId":"chat_history_detail_api_chat_history__session_id__get","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"secret","in":"query","required":false,"schema":{"type":"string","default":"","title":"Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/session-history/{session_id}":{"get":{"summary":"Session History Public","description":"Return a session's Q&A history for the widget to restore on a new page.\n\nSession IDs are 128-bit UUIDs minted client-side and only known to the\nbrowser that started the chat, so we treat knowledge of the ID as proof\nof ownership. PII (email, name, location) is stripped — only the\nquestions/answers the browser already saw are returned.","operationId":"session_history_public_api_session_history__session_id__get","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/costs":{"get":{"summary":"Admin Costs Page","description":"Admin cost observability dashboard. Auth happens on /api/costs/* (JSON).","operationId":"admin_costs_page_admin_costs_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/admin/chats":{"get":{"summary":"Admin Chats","description":"Admin page to browse all chat sessions with user/location info.","operationId":"admin_chats_admin_chats_get","parameters":[{"name":"secret","in":"query","required":false,"schema":{"type":"string","default":"","title":"Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/widget":{"get":{"summary":"Get Widget","description":"Serve the chat widget HTML","operationId":"get_widget_widget_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/widget.js":{"get":{"summary":"Get Widget Js","description":"Tiny cache-busting loader that delegates to /widget-core.js.","operationId":"get_widget_js_widget_js_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/widget-core.js":{"get":{"summary":"Get Widget Core Js","description":"Full widget loader + copilot module bundle, served as one file.","operationId":"get_widget_core_js_widget_core_js_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/widget-live.js":{"get":{"summary":"Serve Widget Live Js","description":"Serve the live-mode JS bundle (just live.js today).","operationId":"serve_widget_live_js_widget_live_js_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/live/quota":{"get":{"summary":"Check Live Quota","description":"Check remaining live minutes for the user on this session.","operationId":"check_live_quota_api_live_quota_get","parameters":[{"name":"session_id","in":"query","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"location_id","in":"query","required":false,"schema":{"type":"string","default":"","title":"Location Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/live/token":{"get":{"summary":"Get Live Token","description":"Mint an ephemeral Gemini token and start a live session.","operationId":"get_live_token_api_live_token_get","parameters":[{"name":"session_id","in":"query","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"location_id","in":"query","required":false,"schema":{"type":"string","default":"","title":"Location Id"}},{"name":"copilot_ready","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Copilot Ready"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/live/end":{"post":{"summary":"End Live Session","description":"End a live session. Duration calculated server-side.","operationId":"end_live_session_api_live_end_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LiveEndRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/live/heartbeat":{"post":{"summary":"Live Heartbeat","description":"Bump last_heartbeat_at so orphan cleanup bills only actual elapsed usage.","operationId":"live_heartbeat_api_live_heartbeat_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LiveHeartbeatRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/live/end-beacon":{"post":{"summary":"Live End Beacon","description":"Close a live session via navigator.sendBeacon on page unload.\n\nParams ride in the query string because sendBeacon can't set\nContent-Type reliably. We charge whole minutes of actual duration,\ndeduct quota, and return 204 so the browser is happy even though it\ncan't read the response during unload.","operationId":"live_end_beacon_api_live_end_beacon_post","parameters":[{"name":"live_session_id","in":"query","required":true,"schema":{"type":"string","title":"Live Session Id"}},{"name":"session_id","in":"query","required":false,"schema":{"type":"string","default":"","title":"Session Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rag-search":{"post":{"summary":"Rag Search","description":"Lightweight RAG search for Gemini Live tool calls.","operationId":"rag_search_api_rag_search_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RagSearchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/live/consult-deep":{"post":{"summary":"Consult Deep","description":"Deep escalation for Live voice tool calls (consult_deep_model).\n\nPre-marks the session escalated, then routes through RAGGenerator\nwith caller=\"live\" (which appends LIVE_DEEP_ADDENDUM for voice-fit\noutput). The pre-mark is what guarantees this turn — and every\nsubsequent turn in the session — routes to the Sonnet escalation\nmodel with RECOVERY_ADDENDUM applied; without it, the intent\nclassifier inside generate_answer would re-pick the model and a\nsimple-sounding question could land on Gemini Flash. Strips any\nleaked [confidence: ...] tag and returns a single plain-text string\nfor the Live widget to feed back as a tool result.\n\nAsync because generate_answer is a blocking ~10–15s OpenRouter call;\nrunning it on the FastAPI sync threadpool would tie up a worker for\nthe entire deep-consult round-trip and throttle every other sync\nroute under any concurrency. We hand off the blocking call to a\nthread via asyncio.to_thread so the event loop stays free.","operationId":"consult_deep_api_live_consult_deep_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsultDeepRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/telemetry/copilot":{"post":{"summary":"Post Copilot Telemetry","operationId":"post_copilot_telemetry_api_telemetry_copilot_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CopilotTelemetry"}}},"required":true},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/costs/summary":{"get":{"summary":"Summary","operationId":"summary_api_costs_summary_get","parameters":[{"name":"month","in":"query","required":true,"schema":{"type":"string","title":"Month"}},{"name":"x-pk-location-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Pk-Location-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/costs/sessions":{"get":{"summary":"Top Sessions","operationId":"top_sessions_api_costs_sessions_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":20,"title":"Limit"}},{"name":"order","in":"query","required":false,"schema":{"type":"string","default":"desc","title":"Order"}},{"name":"x-pk-location-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Pk-Location-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/costs/export.csv":{"get":{"summary":"Export Csv","operationId":"export_csv_api_costs_export_csv_get","parameters":[{"name":"from","in":"query","required":true,"schema":{"type":"string","title":"From"}},{"name":"to","in":"query","required":true,"schema":{"type":"string","title":"To"}},{"name":"x-pk-location-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Pk-Location-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"Body_chat_api_chat_post":{"properties":{"question":{"type":"string","minLength":1,"title":"Question"},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"},"top_k":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Top K"},"min_similarity":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Min Similarity"},"location_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location Id"},"page_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Url"},"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"},"user_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Email"},"user_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Name"},"history":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"History"},"image":{"anyOf":[{"type":"string","contentMediaType":"application/octet-stream"},{"type":"null"}],"title":"Image"}},"type":"object","required":["question"],"title":"Body_chat_api_chat_post"},"ChatResponse":{"properties":{"answer":{"type":"string","title":"Answer"},"sources":{"items":{"$ref":"#/components/schemas/SourceDocument"},"type":"array","title":"Sources","default":[]},"query":{"type":"string","title":"Query"},"messages_remaining":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Messages Remaining"},"moderated":{"type":"boolean","title":"Moderated","default":false},"timestamp":{"type":"string","title":"Timestamp"}},"type":"object","required":["answer","query"],"title":"ChatResponse","description":"Response schema for chat endpoint"},"ConsultDeepRequest":{"properties":{"session_id":{"type":"string","title":"Session Id"},"question":{"type":"string","title":"Question"},"what_didnt_work":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"What Didnt Work"},"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"},"transcript":{"items":{"$ref":"#/components/schemas/TranscriptTurn"},"type":"array","maxItems":80,"title":"Transcript"}},"type":"object","required":["session_id","question"],"title":"ConsultDeepRequest","description":"Live voice agent's tool-call payload for consult_deep_model.\n\nThe widget owns the live transcript (server only sees it at end-of-\nsession) so it ships the recent turns with the request as\n``transcript`` — formatted exactly like a text-bot client_history.\nCapped at 80 turns server-side (2x the widget's 40-turn rolling\nbuffer) so a buggy/abusive client can't ship 10k turns and blow up\nthe prompt or the OpenRouter request."},"ContactSupportRequest":{"properties":{"question":{"type":"string","minLength":1,"title":"Question"},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"},"user_email":{"type":"string","format":"email","title":"User Email"},"user_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Name"},"comment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Comment"},"chat_history":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Chat History"}},"type":"object","required":["question","user_email"],"title":"ContactSupportRequest","description":"Request schema for contact-support endpoint.\n\nuser_email is REQUIRED — without it the support team has no way to reply.\nThe widget enforces this client-side too (HTML5 required + JS regex)."},"CopilotTelemetry":{"properties":{"live_session_id":{"type":"string","title":"Live Session Id"},"tool_name":{"type":"string","title":"Tool Name"},"label":{"type":"string","title":"Label"},"context":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Context"},"outcome":{"type":"string","title":"Outcome"},"matched_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Matched Label"},"match_method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Match Method"},"timing_ms":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Timing Ms"}},"type":"object","required":["live_session_id","tool_name","label","outcome"],"title":"CopilotTelemetry"},"FeedbackRequest":{"properties":{"session_id":{"type":"string","title":"Session Id"},"rating":{"type":"string","title":"Rating"},"last_question":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Question"},"message_count":{"type":"integer","title":"Message Count","default":0},"contact_support_triggered":{"type":"boolean","title":"Contact Support Triggered","default":false},"comment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Comment"},"user_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Email"},"chat_history":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Chat History"}},"type":"object","required":["session_id","rating"],"title":"FeedbackRequest","description":"Request schema for feedback endpoint"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"HealthResponse":{"properties":{"status":{"type":"string","title":"Status"},"version":{"type":"string","title":"Version","default":"1.0.0"},"database_connected":{"type":"boolean","title":"Database Connected"},"document_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Document Count"}},"type":"object","required":["status","database_connected"],"title":"HealthResponse","description":"Response schema for health check"},"LiveEndRequest":{"properties":{"session_id":{"type":"string","title":"Session Id"},"live_session_id":{"type":"string","title":"Live Session Id"},"transcription":{"type":"string","title":"Transcription","default":""},"usage":{"anyOf":[{"additionalProperties":{"type":"integer"},"type":"object"},{"type":"null"}],"title":"Usage"},"tool_call_count":{"type":"integer","title":"Tool Call Count","default":0}},"type":"object","required":["session_id","live_session_id"],"title":"LiveEndRequest"},"LiveHeartbeatRequest":{"properties":{"live_session_id":{"type":"string","title":"Live Session Id"}},"type":"object","required":["live_session_id"],"title":"LiveHeartbeatRequest"},"MessageDetail":{"properties":{"question":{"type":"string","title":"Question"},"answer":{"type":"string","title":"Answer"},"sources":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Sources","default":[]},"moderated":{"type":"boolean","title":"Moderated","default":false},"contact_support":{"type":"boolean","title":"Contact Support","default":false},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["question","answer","created_at"],"title":"MessageDetail","description":"A single chat exchange"},"RagSearchRequest":{"properties":{"session_id":{"type":"string","title":"Session Id"},"query":{"type":"string","title":"Query"},"top_k":{"type":"integer","maximum":20.0,"title":"Top K","default":5}},"type":"object","required":["session_id","query"],"title":"RagSearchRequest"},"SessionDetail":{"properties":{"session_id":{"type":"string","title":"Session Id"},"started_at":{"type":"string","title":"Started At"},"last_active_at":{"type":"string","title":"Last Active At"},"message_count":{"type":"integer","title":"Message Count"},"location_id":{"type":"string","title":"Location Id","default":""},"page_url":{"type":"string","title":"Page Url","default":""},"user_email":{"type":"string","title":"User Email","default":""},"user_name":{"type":"string","title":"User Name","default":""},"messages":{"items":{"$ref":"#/components/schemas/MessageDetail"},"type":"array","title":"Messages","default":[]}},"type":"object","required":["session_id","started_at","last_active_at","message_count"],"title":"SessionDetail","description":"Full transcript of a chat session"},"SessionSummary":{"properties":{"session_id":{"type":"string","title":"Session Id"},"started_at":{"type":"string","title":"Started At"},"last_active_at":{"type":"string","title":"Last Active At"},"message_count":{"type":"integer","title":"Message Count"},"location_id":{"type":"string","title":"Location Id","default":""},"page_url":{"type":"string","title":"Page Url","default":""},"user_email":{"type":"string","title":"User Email","default":""},"user_name":{"type":"string","title":"User Name","default":""}},"type":"object","required":["session_id","started_at","last_active_at","message_count"],"title":"SessionSummary","description":"Summary of a chat session for history listing"},"SourceDocument":{"properties":{"title":{"type":"string","title":"Title"},"url":{"type":"string","title":"Url"},"chunk_index":{"type":"integer","title":"Chunk Index"},"total_chunks":{"type":"integer","title":"Total Chunks"},"relevance_score":{"type":"number","title":"Relevance Score"}},"type":"object","required":["title","url","chunk_index","total_chunks","relevance_score"],"title":"SourceDocument","description":"Schema for a source document"},"TranscriptTurn":{"properties":{"role":{"type":"string","title":"Role"},"content":{"type":"string","title":"Content"}},"type":"object","required":["role","content"],"title":"TranscriptTurn"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}