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