Import ClientFlow production v4928.1.5.132.4

This commit is contained in:
plx
2026-07-29 13:11:01 +00:00
parent 6445044ac6
commit 261d342057
405 changed files with 48373 additions and 1401 deletions

View File

@@ -0,0 +1,30 @@
# ClientFlow v4928.1.5.5 — Audit LLM Auth Hotfix
## Objetivo
Corrige um problema no script `scripts/audit_task_reply_suggestions.py` em que, quando executado com `--use-llm`, o próprio script podia injetar uma chave placeholder `OPENROUTER_API_KEY=not-used-by-task-reply-audit` antes de `app.config` carregar o `.env`.
Como variáveis de ambiente têm precedência sobre o ficheiro `.env`, essa placeholder podia ocultar a chave real e fazer as chamadas OpenRouter falharem com HTTP 401 / autenticação ausente.
## Alterações
- `--use-llm` deixa de definir `OPENROUTER_API_KEY` placeholder.
- A placeholder só é usada quando o LLM está desligado.
- Se uma placeholder antiga existir no ambiente do processo, é removida antes de importar `app.config`.
- Mantém o modo sem LLM compatível com auditorias read-only sem chave OpenRouter real.
## Teste recomendado
```bash
python scripts/audit_task_reply_suggestions.py \
--status pending \
--route vendas \
--use-llm \
--limit 5 \
--format markdown \
--out /tmp/task_reply_audit_llm_vendas.md
grep -n "LLM:" /tmp/task_reply_audit_llm_vendas.md | head -20
```
O esperado é aparecer `LLM: used` ou metadata de intenção/confiança gerada, em vez de `LLM: fallback` com erro `Missing Authentication header`.