feat: endpoint to display host images in insights and update prompt
This commit is contained in:
13
main.py
13
main.py
@@ -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."""
|
||||
|
||||
Reference in New Issue
Block a user