Add read-only production runtime audit
This commit is contained in:
@@ -3,7 +3,7 @@ from __future__ import annotations
|
||||
import uuid
|
||||
from typing import Annotated, Any, Literal, Protocol
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Request
|
||||
from fastapi import APIRouter, Depends, HTTPException, Query, Request
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from rag.answer import DISCLAIMER, GroundedAnswerService
|
||||
@@ -36,6 +36,7 @@ class RagQueryRequest(BaseModel):
|
||||
# (follow-up inheritance, clarify, smalltalk). Absent → single-turn, exactly
|
||||
# as before, so existing callers are unchanged.
|
||||
conversation_id: str | None = Field(default=None, max_length=128)
|
||||
response_mode: Literal["ai", "monograph"] = "ai"
|
||||
|
||||
|
||||
class CitationResponse(BaseModel):
|
||||
@@ -198,7 +199,7 @@ _HISTORY_LIMIT = 50
|
||||
|
||||
@router.get("/history", response_model=HistoryResponse)
|
||||
def list_history(
|
||||
conversation_id: str,
|
||||
conversation_id: Annotated[str, Query(max_length=128)],
|
||||
traces: Annotated[TraceWriter, Depends(_trace_writer)],
|
||||
) -> HistoryResponse:
|
||||
"""Feature-List #25: past queries for one session, most recent first, so
|
||||
@@ -430,7 +431,11 @@ def query_rag(
|
||||
# then routes to the safety-verified retrieval + grounded-answer
|
||||
# engine. Replaces the old fuzzy resolver + keyword section router +
|
||||
# manual follow-up inheritance for both single- and multi-turn.
|
||||
reply = agent.handle(payload.query, payload.conversation_id)
|
||||
reply = agent.handle(
|
||||
payload.query,
|
||||
payload.conversation_id,
|
||||
response_mode=payload.response_mode,
|
||||
)
|
||||
decision = reply.decision
|
||||
reason = reply.reason
|
||||
answer = reply.clarification if reply.clarification is not None else reply.answer
|
||||
|
||||
Reference in New Issue
Block a user