Initial curated Unraid-AppOps-Gateway source from 3bd6f6fee310125bfbb4d4650389a817f498724d
This commit is contained in:
commit
1dfbca08a1
528 files changed
+131054
No files matched your search
@@ -0,0 +1,40 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from fastapi import APIRouter, Depends, Request
|
||||
from sqlmodel import Session
|
||||
|
||||
from ..db.session import get_session
|
||||
from ..services import voice_catalog
|
||||
from ..services.home_assistant_voice_readiness import build_readiness
|
||||
from ..services.setup_service import apply_stored_connector_settings
|
||||
|
||||
|
||||
router = APIRouter(prefix='/api/operator/voice')
|
||||
|
||||
|
||||
@router.get('/commands')
|
||||
def commands(session: Session = Depends(get_session)):
|
||||
return voice_catalog.list_commands(session)
|
||||
|
||||
|
||||
@router.get('/home-assistant/export')
|
||||
def home_assistant_export(request: Request, session: Session = Depends(get_session)):
|
||||
apply_stored_connector_settings(session)
|
||||
return voice_catalog.home_assistant_export(session, str(request.base_url).rstrip('/'))
|
||||
|
||||
|
||||
@router.get('/home-assistant/readiness')
|
||||
def home_assistant_readiness(session: Session = Depends(get_session)):
|
||||
apply_stored_connector_settings(session)
|
||||
return build_readiness(session)
|
||||
|
||||
|
||||
@router.post('/test-intent')
|
||||
def test_intent(payload: dict | None = None, session: Session = Depends(get_session)):
|
||||
text = str((payload or {}).get('input') or (payload or {}).get('phrase') or '').strip()
|
||||
return voice_catalog.test_intent(session, text)
|
||||
|
||||
|
||||
@router.post('/commands/{command_id}/dry-run')
|
||||
def dry_run(command_id: str, session: Session = Depends(get_session)):
|
||||
return voice_catalog.dry_run(session, command_id)
|
||||
Reference in new issue
Block a user