fix: Correct Ollama endpoint and BotVPS path
- Ollama: Use ollama-lw4s8g4gc8gss4gkc4gg0wk4 hostname instead of localhost - BotVPS: Path is /app inside container - Improve detect_git_repo_path to find correct paths - Update planner prompt with correct context
This commit is contained in:
@@ -21,22 +21,18 @@ from credential_manager import sync_credentials, get_services_status
|
||||
PLANNER_SYSTEM_PROMPT = """Você é o PLANNER AGENT do BotVPS.
|
||||
Seu trabalho é decompor tarefas em passos executáveis CORRETOS.
|
||||
|
||||
### REPOSITORIOS CONHECIDOS:
|
||||
- BotVPS: /data/applications/bw1erd9ww5121i1fsh420bcj
|
||||
- TrackSteel: /data/repositories/0/5/5adtracksteel/AdmTrackSteel
|
||||
|
||||
{CONTEXT_INFO}
|
||||
|
||||
### REGRAS CRÍTICAS DE COMANDOS:
|
||||
1. USE SEMPRE "docker compose" (COM ESPAÇO), NUNCA "docker-compose" (COM HÍFEN)
|
||||
2. Para git, use o caminho ABSOLUTO completo do repositório
|
||||
3. Para docker compose, use "cd /caminho && docker compose up -d"
|
||||
4. Se não souber o caminho, use: find /data/repositories -name '*.git' -type d
|
||||
2. O BotVPS está em /app (dentro do container)
|
||||
3. Use "cd /app && git pull" para atualizar
|
||||
4. Use "cd /app && docker compose up -d --build" para rebuild e deploy
|
||||
|
||||
### EXEMPLOS DE COMANDOS CORRETOS:
|
||||
✅ CORRETO: cd /repo/path && git pull origin master
|
||||
✅ CORRETO: cd /repo/path && docker compose up -d --build
|
||||
✅ CORRETO: docker restart nome-do-container
|
||||
✅ CORRETO: cd /app && git pull origin master
|
||||
✅ CORRETO: cd /app && docker compose up -d --build
|
||||
✅ CORRETO: docker restart vps-ai-agent
|
||||
|
||||
### NÍVEIS DE PERIGO:
|
||||
- SAFE: listar, ver status, ler logs
|
||||
@@ -113,41 +109,57 @@ def detect_git_repo_path(task: str) -> str:
|
||||
# Normaliza o texto da tarefa
|
||||
task_lower = task.lower()
|
||||
|
||||
# Lista de repositórios conhecidos no host
|
||||
known_repos = [
|
||||
"/data/repositories/0/5/5adtracksteel/AdmTrackSteel",
|
||||
"/data/repositories/0/5/5adtracksteel/BotVPS",
|
||||
"/data/applications/bw1erd9ww5121i1fsh420bcj",
|
||||
"/data/coolify",
|
||||
"/root",
|
||||
"/app"
|
||||
]
|
||||
# Caminhos específicos por nome de app
|
||||
app_paths = {
|
||||
"tracksteel": [
|
||||
"/data/repositories/0/5/5adtracksteel/AdmTrackSteel",
|
||||
"/data/repositories/admtracksteel/AdmTrackSteel",
|
||||
],
|
||||
"botvps": [
|
||||
"/data/repositories/admtracksteel/BotVPS",
|
||||
"/data/repositories/botvps",
|
||||
"/app",
|
||||
],
|
||||
"coolify": [
|
||||
"/data/coolify",
|
||||
"/data/coolify/source",
|
||||
]
|
||||
}
|
||||
|
||||
# Tenta detectar pelo nome mencionado na tarefa
|
||||
if "tracksteel" in task_lower or "tracksteel" in task_lower:
|
||||
return "/data/repositories/0/5/5adtracksteel/AdmTrackSteel"
|
||||
if "botvps" in task_lower or "bot vps" in task_lower:
|
||||
return "/data/applications/bw1erd9ww5121i1fsh420bcj"
|
||||
if "coolify" in task_lower:
|
||||
return "/data/coolify"
|
||||
# Detecta qual app o usuário quer
|
||||
if "botvps" in task_lower or "bot vps" in task_lower or "antigravity" in task_lower:
|
||||
paths_to_try = app_paths["botvps"]
|
||||
elif "tracksteel" in task_lower:
|
||||
paths_to_try = app_paths["tracksteel"]
|
||||
elif "coolify" in task_lower:
|
||||
paths_to_try = app_paths["coolify"]
|
||||
else:
|
||||
paths_to_try = []
|
||||
|
||||
# Tenta encontrar repositório git válido
|
||||
for repo_path in known_repos:
|
||||
# Procura nos caminhos específicos
|
||||
for repo_path in paths_to_try:
|
||||
result = run_bash(f"test -d {repo_path}/.git && echo 'FOUND:{repo_path}' || true")
|
||||
if result.get("success") and "FOUND:" in result.get("output", ""):
|
||||
return result["output"].split("FOUND:")[1].strip()
|
||||
found_path = result["output"].split("FOUND:")[1].strip()
|
||||
print(f"[DETECT] Found {task_lower} at: {found_path}")
|
||||
return found_path
|
||||
|
||||
# Procura em /data/repositories por repositórios git
|
||||
result = run_bash("find /data/repositories -name '*.git' -type d 2>/dev/null | head -10")
|
||||
result = run_bash("find /data/repositories -name '*.git' -type d 2>/dev/null | head -20")
|
||||
if result.get("success") and result.get("output"):
|
||||
# Retorna o primeiro repositório encontrado
|
||||
first_repo = result["output"].split("\n")[0].replace("/.git", "")
|
||||
return first_repo
|
||||
lines = result["output"].strip().split("\n")
|
||||
for line in lines:
|
||||
if line:
|
||||
repo_dir = line.replace("/.git", "")
|
||||
print(f"[DETECT] Found repo: {repo_dir}")
|
||||
return repo_dir
|
||||
|
||||
# Fallback: retorna /app se existir
|
||||
if os.path.exists("/app/.git"):
|
||||
print(f"[DETECT] Using fallback: /app")
|
||||
return "/app"
|
||||
|
||||
print(f"[DETECT] No repo found, returning /")
|
||||
return "/"
|
||||
|
||||
def detect_app_in_docker(task: str) -> str:
|
||||
@@ -232,9 +244,9 @@ def plan_task(task: str) -> Dict:
|
||||
# Contexto adicional para o planner
|
||||
context_info = f"""
|
||||
### CONTEXTO DETECTADO:
|
||||
- Repositório mais provável: {detected_repo}
|
||||
- Aplicação mais provável: {detected_app}
|
||||
- Para descobrir o repositório correto, use: find /data/repositories -name '*.git' -type d 2>/dev/null
|
||||
- BotVPS está em: /app
|
||||
- Repositório detectado: {detected_repo}
|
||||
- Container: vps-ai-agent
|
||||
"""
|
||||
|
||||
system_prompt = PLANNER_SYSTEM_PROMPT.replace("{TOOLS_LIST}", _format_tools_for_prompt())
|
||||
|
||||
Reference in New Issue
Block a user