Backend: thread on_fallback callback through analysis chain (gemini_service → agents → analysis_service → handlers). The handler sends a 'model_fallback' WebSocket message exactly once per analysis when the primary model is unavailable. Frontend: handle 'model_fallback' WS message and show a dismissible yellow toast at the bottom of the screen with an 8-second auto-dismiss. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
34 lines
1.2 KiB
Python
Executable file
34 lines
1.2 KiB
Python
Executable file
from abc import ABC, abstractmethod
|
|
from typing import Awaitable, Callable, List, Optional, Tuple
|
|
|
|
from app.models.schemas import PreviousReviewContext, SubReview
|
|
|
|
|
|
class BaseAgent(ABC):
|
|
"""Abstract base class for all review agents."""
|
|
|
|
name: str = "Base Agent"
|
|
|
|
@abstractmethod
|
|
async def analyze(
|
|
self,
|
|
images: List[Tuple[bytes, str]],
|
|
previous_review: Optional[PreviousReviewContext] = None,
|
|
on_fallback: Optional[Callable[[], Awaitable[None]]] = None,
|
|
) -> SubReview:
|
|
"""
|
|
Analyze the proof and return a SubReview.
|
|
|
|
Args:
|
|
images: List of (file_data, mime_type) tuples representing the proof.
|
|
For single images/videos, this will contain one tuple.
|
|
For multi-page PDFs, this will contain one tuple per page.
|
|
previous_review: Optional context from the previous version's review
|
|
for revision-aware analysis.
|
|
|
|
Returns:
|
|
SubReview containing ragStatus, feedback, and issues.
|
|
When previous_review is provided, also includes resolvedIssues,
|
|
outstandingIssues, and newIssues.
|
|
"""
|
|
pass
|