feat: MiroFlow containerizado no docker-compose
- Dockerfile.miroflow: imagem Python 3.11 com miroflow instalado via submodule - docker-compose.prod.yml: novo serviço `miroflow` (porta 8006, rede interna) - MIROFLOW_HOST atualizado de host fixo (10.0.7.1) para container `miroflow` - miroflow_service.py: passa system_prompt e initial_user_message no AgentContext Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
4ceb407505
commit
76adec5893
|
|
@ -0,0 +1,24 @@
|
|||
FROM python:3.11-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
gcc \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Instalar MiroFlow e suas dependências direto do submodule
|
||||
COPY server/modules/miroflow/ ./server/modules/miroflow/
|
||||
RUN pip install --no-cache-dir -e ./server/modules/miroflow/
|
||||
|
||||
# Copiar o service script
|
||||
COPY server/python/miroflow_service.py ./server/python/miroflow_service.py
|
||||
|
||||
ENV MIROFLOW_PORT=8006
|
||||
ENV OLLAMA_BASE_URL=http://host.docker.internal:11434
|
||||
|
||||
EXPOSE 8006
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
|
||||
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8006/health')" || exit 1
|
||||
|
||||
CMD ["python", "server/python/miroflow_service.py"]
|
||||
|
|
@ -77,6 +77,9 @@ services:
|
|||
ERPNEXT_URL: ${ERPNEXT_URL:-http://erpnext:8080}
|
||||
ERPNEXT_API_KEY: ${ERPNEXT_API_KEY:-}
|
||||
ERPNEXT_API_SECRET: ${ERPNEXT_API_SECRET:-}
|
||||
# ── MiroFlow (container) ─────────────────────────────────────────────
|
||||
MIROFLOW_HOST: "miroflow"
|
||||
MIROFLOW_PORT: "8006"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:5000/api/health || exit 1"]
|
||||
interval: 30s
|
||||
|
|
@ -201,6 +204,18 @@ services:
|
|||
- arcadia-internal
|
||||
|
||||
|
||||
# ── MiroFlow (agente científico) ─────────────────────────────────────────────
|
||||
miroflow:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.miroflow
|
||||
restart: always
|
||||
environment:
|
||||
MIROFLOW_PORT: "8006"
|
||||
OLLAMA_BASE_URL: ${OLLAMA_BASE_URL:-http://10.0.7.1:11434}
|
||||
networks:
|
||||
- arcadia-internal
|
||||
|
||||
# ── Microserviços Python ─────────────────────────────────────────────────────
|
||||
contabil:
|
||||
build:
|
||||
|
|
|
|||
|
|
@ -65,7 +65,15 @@ async def run_agent(agent_type: str, task: str) -> tuple[str, str]:
|
|||
raise ValueError(f"Agente desconhecido: {agent_type}. Use: {list(AGENT_MODELS.keys())}")
|
||||
cfg = make_agent_cfg(agent_type)
|
||||
agent = build_agent(cfg)
|
||||
ctx = AgentContext(task_description=task)
|
||||
ctx = AgentContext(
|
||||
task_description=task,
|
||||
system_prompt=(
|
||||
"Você é um agente científico da Arcádia Suite especializado em análise de dados "
|
||||
"empresariais. Responda em português de forma clara e objetiva. "
|
||||
"Quando precisar de dados, explique o que analisaria e quais conclusões seriam esperadas."
|
||||
),
|
||||
initial_user_message=task,
|
||||
)
|
||||
result = await agent.run(ctx)
|
||||
text = result.get("summary", str(result)) if isinstance(result, dict) else str(result)
|
||||
return text, cfg["llm"]["model_name"]
|
||||
|
|
|
|||
Loading…
Reference in New Issue