fix: hover foncé + /api/ai/status + cache toolbar si pas de clé API
This commit is contained in:
+17
-1
@@ -10,13 +10,29 @@ from backend.ai import (
|
||||
ai_simplify, ai_change_tone, ai_translate, ai_explain, ai_summarize,
|
||||
ai_continue_writing, ai_custom_rewrite, ai_convert_to_list,
|
||||
ai_convert_to_table, ai_generate_frontmatter, ai_inline_complete,
|
||||
ai_convert_to_canvas,
|
||||
ai_convert_to_canvas, DEFAULT_PROVIDER, PROVIDERS,
|
||||
)
|
||||
|
||||
logger = logging.getLogger("obsigate.ai_routes")
|
||||
router = APIRouter(prefix="/api/ai", tags=["AI"])
|
||||
|
||||
|
||||
@router.get("/status")
|
||||
async def api_status():
|
||||
"""Check if AI is configured and which providers are available."""
|
||||
providers = {}
|
||||
for name, cfg in PROVIDERS.items():
|
||||
providers[name] = {
|
||||
"available": bool(cfg["api_key"]),
|
||||
"model": cfg["model"] if cfg["api_key"] else None,
|
||||
}
|
||||
return {
|
||||
"configured": any(p["available"] for p in providers.values()),
|
||||
"default_provider": DEFAULT_PROVIDER,
|
||||
"providers": providers,
|
||||
}
|
||||
|
||||
|
||||
class AIRequest(BaseModel):
|
||||
text: str = Field(..., description="Input text to process", min_length=1)
|
||||
instruction: Optional[str] = Field(None, description="Custom instruction for rewrite")
|
||||
|
||||
Reference in New Issue
Block a user