feat: endpoint to display host images in insights and update prompt

This commit is contained in:
Marcos
2026-03-22 00:08:16 -03:00
parent 9d4be3fee9
commit cc61da67d9
2 changed files with 16 additions and 0 deletions

13
main.py
View File

@@ -149,6 +149,19 @@ async def get_audio_file(filename: str):
return FileResponse(filepath, media_type="audio/mpeg")
raise HTTPException(status_code=404, detail="Arquivo de áudio não encontrado.")
@app.get("/api/host_file")
async def get_host_file(path: str, is_auth: bool = Depends(verify_password)):
"""Serve arquivos (como imagens) da máquina host para exibir no painel de insights."""
host_path = f"/host_root{path}" if not path.startswith("/host_root") else path
# Previne directory traversal básico garantindo que comece com /host_root
if not host_path.startswith("/host_root"):
raise HTTPException(status_code=400, detail="Caminho inválido.")
if os.path.isfile(host_path):
return FileResponse(host_path)
raise HTTPException(status_code=404, detail="Arquivo não encontrado no host.")
@app.get("/api/test_llm")
async def test_llm_speed(is_auth: bool = Depends(verify_password)):
"""Mede a velocidade de resposta da IA ativa."""