feat: Update default models for extraction and normalization to GPT-5.6 Luna across configuration files and documentation. Remove deprecated code and improve pricing details in the UI components. Add tests to ensure correct model settings and pricing calculations.
This commit is contained in:
@@ -53,9 +53,6 @@ class EventBus:
|
||||
for cb in self.callbacks:
|
||||
cb(event)
|
||||
|
||||
def add_callback(self, callback: EventCallback) -> None:
|
||||
self.callbacks.append(callback)
|
||||
|
||||
def close(self) -> None:
|
||||
if self.jsonl_logger is not None:
|
||||
self.jsonl_logger.close()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import time
|
||||
from typing import Callable, Optional, Tuple
|
||||
from typing import Callable, Tuple
|
||||
|
||||
from selenium import webdriver
|
||||
from selenium.common.exceptions import (
|
||||
|
||||
@@ -45,16 +45,3 @@ class FileManager:
|
||||
os.replace(archivo_temp, ruta_final)
|
||||
except Exception:
|
||||
os.rename(archivo_temp, ruta_final)
|
||||
|
||||
def remove_safe(self, ruta: str) -> None:
|
||||
try:
|
||||
if ruta and os.path.exists(ruta):
|
||||
os.remove(ruta)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def list_pdfs(self) -> set:
|
||||
return {
|
||||
f for f in os.listdir(self.carpeta_descarga)
|
||||
if f.lower().endswith(".pdf")
|
||||
}
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from bot_descarga.audit.events import BotEvent, EventType
|
||||
|
||||
|
||||
class ProgressTracker:
|
||||
"""Traduce BotEvent a contadores de progreso para la UI."""
|
||||
|
||||
def __init__(self):
|
||||
self.total = 0
|
||||
self.procesados = 0
|
||||
self.exitosos = 0
|
||||
self.fallidos = 0
|
||||
self.skipped = 0
|
||||
self.nit_actual = "—"
|
||||
self.nit_estado = "Esperando inicio del proceso..."
|
||||
|
||||
def reset(self) -> None:
|
||||
self.total = 0
|
||||
self.procesados = 0
|
||||
self.exitosos = 0
|
||||
self.fallidos = 0
|
||||
self.skipped = 0
|
||||
self.nit_actual = "—"
|
||||
self.nit_estado = "Esperando inicio del proceso..."
|
||||
|
||||
def handle(self, event: BotEvent) -> None:
|
||||
if event.index is not None and event.total is not None:
|
||||
self.procesados = event.index
|
||||
self.total = event.total
|
||||
|
||||
if event.event_type == EventType.RUN_STARTED:
|
||||
if "total" in event.metadata:
|
||||
self.total = int(event.metadata["total"])
|
||||
elif event.total is not None:
|
||||
self.total = event.total
|
||||
|
||||
elif event.event_type == EventType.NIT_STARTED:
|
||||
self.nit_actual = event.nit or "—"
|
||||
self.nit_estado = "Procesando radicados de este NIT..."
|
||||
|
||||
elif event.event_type == EventType.NIT_FINISHED:
|
||||
nit = event.nit or ""
|
||||
meta = event.metadata
|
||||
self.nit_estado = (
|
||||
f"Finalizó NIT {nit} | "
|
||||
f"OK: {meta.get('ok', 0)} | "
|
||||
f"Fallidos: {meta.get('fallidos', 0)} | "
|
||||
f"Ya existían: {meta.get('omitidos', 0)}"
|
||||
)
|
||||
|
||||
elif event.event_type == EventType.RADICADO_SAVED:
|
||||
self.exitosos += 1
|
||||
|
||||
elif event.event_type == EventType.RADICADO_SKIPPED:
|
||||
self.skipped += 1
|
||||
|
||||
elif event.event_type == EventType.RADICADO_FAILED:
|
||||
if "PROCESO TERMINADO" not in event.message:
|
||||
self.fallidos += 1
|
||||
|
||||
@property
|
||||
def percent(self) -> float:
|
||||
total = self.total if self.total > 0 else 1
|
||||
return min(self.procesados / total, 1.0)
|
||||
@@ -377,45 +377,6 @@ class DigitadorService:
|
||||
except Exception as e:
|
||||
print(f"Error al guardar reportes: {e}")
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Clipboard (sin tkinter)
|
||||
# ------------------------------------------------------------------
|
||||
def limpiar_clipboard(self) -> None:
|
||||
try:
|
||||
user32 = ctypes.windll.user32
|
||||
if user32.OpenClipboard(0):
|
||||
user32.EmptyClipboard()
|
||||
user32.CloseClipboard()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def leer_clipboard(self) -> str:
|
||||
try:
|
||||
CF_UNICODETEXT = 13
|
||||
user32 = ctypes.windll.user32
|
||||
kernel32 = ctypes.windll.kernel32
|
||||
if not user32.OpenClipboard(0):
|
||||
return ""
|
||||
try:
|
||||
handle = user32.GetClipboardData(CF_UNICODETEXT)
|
||||
if not handle:
|
||||
return ""
|
||||
ptr = kernel32.GlobalLock(handle)
|
||||
if not ptr:
|
||||
return ""
|
||||
try:
|
||||
return ctypes.wstring_at(ptr).strip()
|
||||
finally:
|
||||
kernel32.GlobalUnlock(handle)
|
||||
finally:
|
||||
user32.CloseClipboard()
|
||||
except Exception:
|
||||
return ""
|
||||
|
||||
def fecha_tiene_numeros(self, texto) -> bool:
|
||||
texto = str(texto).strip()
|
||||
return any(c.isdigit() for c in texto)
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Fechas / valores / docs
|
||||
# ------------------------------------------------------------------
|
||||
@@ -676,20 +637,6 @@ class DigitadorService:
|
||||
"radicado_existente.png",
|
||||
)
|
||||
|
||||
def check_diferencias_abierto_opencv(self, window) -> bool:
|
||||
return self.check_template_opencv(
|
||||
window,
|
||||
self.template_diferencias_path,
|
||||
"flecha_diferencias_abierto.png",
|
||||
)
|
||||
|
||||
def check_diferencias_cerrado_opencv(self, window) -> bool:
|
||||
return self.check_template_opencv(
|
||||
window,
|
||||
self.template_diferencias_cerrado_path,
|
||||
"flecha_diferencias_cerrado.png",
|
||||
)
|
||||
|
||||
def check_success_opencv(self, window) -> bool:
|
||||
return self.check_template_opencv(
|
||||
window,
|
||||
|
||||
Reference in New Issue
Block a user