Spaces:
Running
Running
luanpoppe
commited on
Commit
·
9acef67
1
Parent(s):
012cf60
fix: mostrar resultado final com a junção de todas as etapas do gerar documento
Browse files
_utils/gerar_relatorio_modelo_usuario/GerarDocumento.py
CHANGED
|
@@ -276,7 +276,12 @@ class GerarDocumento:
|
|
| 276 |
)
|
| 277 |
)
|
| 278 |
|
|
|
|
| 279 |
resposta_primeira_etapa = documento_gerado
|
|
|
|
|
|
|
|
|
|
|
|
|
| 280 |
|
| 281 |
if self.prompt_gerar_documento_etapa_2:
|
| 282 |
self.axiom_instance.send_axiom("GERANDO DOCUMENTO - COMEÇANDO ETAPA 2")
|
|
@@ -286,6 +291,7 @@ class GerarDocumento:
|
|
| 286 |
)
|
| 287 |
documento_gerado = llm.invoke(prompt_etapa_2).content
|
| 288 |
resposta_segunda_etapa = documento_gerado
|
|
|
|
| 289 |
self.axiom_instance.send_axiom(f"RESULTADO ETAPA 2: {documento_gerado}")
|
| 290 |
|
| 291 |
if self.prompt_gerar_documento_etapa_3:
|
|
@@ -297,11 +303,12 @@ class GerarDocumento:
|
|
| 297 |
},
|
| 298 |
)
|
| 299 |
documento_gerado = llm.invoke(prompt_etapa_3).content
|
|
|
|
| 300 |
self.axiom_instance.send_axiom(f"RESULTADO ETAPA 3: {documento_gerado}")
|
| 301 |
|
| 302 |
# Split the response into paragraphs
|
| 303 |
summaries = [
|
| 304 |
-
p.strip() for p in
|
| 305 |
]
|
| 306 |
|
| 307 |
structured_output = self.gerar_documento_utils.criar_output_estruturado(
|
|
|
|
| 276 |
)
|
| 277 |
)
|
| 278 |
|
| 279 |
+
texto_final_juntando_as_etapas = ""
|
| 280 |
resposta_primeira_etapa = documento_gerado
|
| 281 |
+
texto_final_juntando_as_etapas += resposta_primeira_etapa
|
| 282 |
+
self.axiom_instance.send_axiom(
|
| 283 |
+
f"RESULTADO ETAPA 1: {resposta_primeira_etapa}"
|
| 284 |
+
)
|
| 285 |
|
| 286 |
if self.prompt_gerar_documento_etapa_2:
|
| 287 |
self.axiom_instance.send_axiom("GERANDO DOCUMENTO - COMEÇANDO ETAPA 2")
|
|
|
|
| 291 |
)
|
| 292 |
documento_gerado = llm.invoke(prompt_etapa_2).content
|
| 293 |
resposta_segunda_etapa = documento_gerado
|
| 294 |
+
texto_final_juntando_as_etapas += f"\n\n{resposta_segunda_etapa}"
|
| 295 |
self.axiom_instance.send_axiom(f"RESULTADO ETAPA 2: {documento_gerado}")
|
| 296 |
|
| 297 |
if self.prompt_gerar_documento_etapa_3:
|
|
|
|
| 303 |
},
|
| 304 |
)
|
| 305 |
documento_gerado = llm.invoke(prompt_etapa_3).content
|
| 306 |
+
texto_final_juntando_as_etapas += f"\n\n{documento_gerado}"
|
| 307 |
self.axiom_instance.send_axiom(f"RESULTADO ETAPA 3: {documento_gerado}")
|
| 308 |
|
| 309 |
# Split the response into paragraphs
|
| 310 |
summaries = [
|
| 311 |
+
p.strip() for p in texto_final_juntando_as_etapas.split("\n\n") if p.strip() # type: ignore
|
| 312 |
]
|
| 313 |
|
| 314 |
structured_output = self.gerar_documento_utils.criar_output_estruturado(
|