Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,13 +1,9 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
| 2 |
import os
|
| 3 |
import json
|
| 4 |
-
import time
|
| 5 |
-
import hashlib
|
| 6 |
-
from datetime import datetime
|
| 7 |
-
from concurrent.futures import ThreadPoolExecutor, as_completed
|
| 8 |
-
|
| 9 |
-
import gradio as gr
|
| 10 |
-
import google.generativeai as genai
|
| 11 |
|
| 12 |
# Dependências para PDF
|
| 13 |
try:
|
|
@@ -237,8 +233,8 @@ def automacao_upload_processamento(files, history, config_json):
|
|
| 237 |
|
| 238 |
try:
|
| 239 |
config_agentes = json.loads(config_json)
|
| 240 |
-
except:
|
| 241 |
-
|
| 242 |
|
| 243 |
if history is None:
|
| 244 |
history = []
|
|
@@ -612,8 +608,8 @@ async def analyze_message(message: str, config_json: str):
|
|
| 612 |
try:
|
| 613 |
prompt_contexto = gerenciador.gerar_prompt_com_transcricoes(message)
|
| 614 |
except Exception as e:
|
| 615 |
-
|
| 616 |
-
|
| 617 |
timeline_execucao = [{"passo": 1, "tipo": "prompt_usuario", "conteudo": prompt_contexto}]
|
| 618 |
pipeline_state = {"is_paused": False, "timeline": timeline_execucao, "remaining_agents": protocolo}
|
| 619 |
|
|
|
|
| 1 |
+
from fastapi import FastAPI, UploadFile, Form, HTTPException
|
| 2 |
+
from fastapi.responses import JSONResponse
|
| 3 |
+
from typing import List
|
| 4 |
+
import uvicorn
|
| 5 |
import os
|
| 6 |
import json
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
# Dependências para PDF
|
| 9 |
try:
|
|
|
|
| 233 |
|
| 234 |
try:
|
| 235 |
config_agentes = json.loads(config_json)
|
| 236 |
+
except json.JSONDecodeError:
|
| 237 |
+
raise HTTPException(status_code=400, detail="Configuração JSON inválida.")
|
| 238 |
|
| 239 |
if history is None:
|
| 240 |
history = []
|
|
|
|
| 608 |
try:
|
| 609 |
prompt_contexto = gerenciador.gerar_prompt_com_transcricoes(message)
|
| 610 |
except Exception as e:
|
| 611 |
+
raise HTTPException(status_code=500, detail=f"Erro ao gerar contexto: {str(e)}")
|
| 612 |
+
|
| 613 |
timeline_execucao = [{"passo": 1, "tipo": "prompt_usuario", "conteudo": prompt_contexto}]
|
| 614 |
pipeline_state = {"is_paused": False, "timeline": timeline_execucao, "remaining_agents": protocolo}
|
| 615 |
|