Compare commits

...
Author SHA1 Message Date
hermes 99f0e847d9 fix: num_ctx 16384 en el modelo (el 4096 da 400 en Open WebUI)
El primer mensaje con plantilla del sistema (~7k tokens) excedia el
contexto default de 4096 -> 400 exceed_context_size. Tras el import HF
y tras el pull del registry, re-crea el tag con PARAMETER num_ctx 16384
(FROM hereda pesos; verificado con ollama show: num_ctx 16384).
2026-09-12 21:19:18 +02:00
hermes 350d55c434 feat: modelo via HF primero, registry de Ollama como ultimo recurso (#10)
Co-authored-by: Hermes Agent <hermes@d0a1.es>
2026-09-12 21:11:02 +02:00
hermes 99e0eebc29 feat: 2o mirror de HF (unsloth) en el fallback del modelo (#9)
Co-authored-by: Hermes Agent <hermes@d0a1.es>
2026-09-12 21:05:06 +02:00
hermes a7609f56b0 feat: fallback del modelo via HuggingFace si el registry falla (#8)
Co-authored-by: Hermes Agent <hermes@d0a1.es>
2026-09-12 21:04:18 +02:00
hermes 539cd4d181 feat: pull del modelo respeta HTTPS_PROXY (#7)
Co-authored-by: Hermes Agent <hermes@d0a1.es>
2026-09-12 20:58:59 +02:00
hermes 912105f16f feat: down/rm de runs previos antes del up (#6)
Co-authored-by: Hermes Agent <hermes@d0a1.es>
2026-09-12 20:55:43 +02:00
hermes 8bd5bbf366 fix: IP del modo VPS via interfaz de la ruta por defecto (#5)
Co-authored-by: Hermes Agent <hermes@d0a1.es>
2026-09-12 20:49:29 +02:00
hermes 284d611b0c feat: reintento del ollama pull (3 intentos) (#4)
Co-authored-by: Hermes Agent <hermes@d0a1.es>
2026-09-12 20:45:40 +02:00
4 changed files with 192 additions and 10 deletions

No files matched your search

+45 -2
View File
@@ -96,6 +96,7 @@ Write-Host ''
# --- 1. Arrancar Ollama (Docker) -------------------------------------------
Warn '[1/3] Arrancando Ollama (IA local)...'
cmd /c docker rm -f d0a1-hermes-ollama '>' NUL '2>&1'
$running = docker ps --format '{{.Names}}' | Select-String -Quiet 'd0a1-hermes-ollama'
if (-not $running) {
docker run -d --name d0a1-hermes-ollama `
@@ -121,8 +122,50 @@ while ($true) {
}
}
Warn ' Descargando modelo (llama3.2:3b, ~2 GB)...'
docker exec d0a1-hermes-ollama ollama pull llama3.2:3b
if ($LASTEXITCODE -ne 0) { Err 'Fallo la descarga del modelo.'; exit 1 }
# Si el usuario define $env:HTTPS_PROXY, Ollama lo usa para el pull (doc oficial):
$ProxyEnv = @()
if ($env:HTTPS_PROXY) { $ProxyEnv = @('-e', "HTTPS_PROXY=$env:HTTPS_PROXY", '-e', "HTTP_PROXY=$env:HTTP_PROXY") }
# --- Modelo: HF primero (CDN propio, rapido) y registry de Ollama como ultimo recurso ---
$Gguf = Join-Path $ScriptDir 'llama3.2-3b-q4.gguf'
$HfUrls = @(
'https://huggingface.co/bartowski/Llama-3.2-3B-Instruct-GGUF/resolve/main/Llama-3.2-3B-Instruct-Q4_K_M.gguf',
'https://huggingface.co/unsloth/Llama-3.2-3B-Instruct-GGUF/resolve/main/Llama-3.2-3B-Instruct-Q4_K_M.gguf'
)
foreach ($Url in $HfUrls) {
Info 'Descargando modelo de IA (llama3.2:3b, ~2 GB)...'
curl.exe -sL --retry 3 --max-time 1800 -o "$Gguf" $Url
if ($LASTEXITCODE -eq 0 -and (Test-Path $Gguf) -and (Get-Item $Gguf).Length -gt 1900000000) { break }
Warn "Mirror no accesible, probando el siguiente..."
Remove-Item "$Gguf" -Force -ErrorAction SilentlyContinue
}
if ((Test-Path $Gguf) -and (Get-Item $Gguf).Length -gt 1900000000) {
Info 'Importando modelo en Ollama...'
docker cp "$Gguf" d0a1-hermes-ollama:/root/.ollama/import.gguf
docker exec d0a1-hermes-ollama sh -c 'printf "FROM /root/.ollama/import.gguf\\nPARAMETER num_ctx 16384\\n" > /tmp/mf && ollama create llama3.2:3b -f /tmp/mf'
$CreateOk = ($LASTEXITCODE -eq 0)
docker exec d0a1-hermes-ollama rm -f /root/.ollama/import.gguf | Out-Null
Remove-Item "$Gguf" -Force -ErrorAction SilentlyContinue
$PullOk = $CreateOk
if (-not $CreateOk) { Err 'Fallo al importar el modelo desde el GGUF.' }
} else {
# Ultimo recurso: pull directo (1 intento, ya sin esperar 3 rondas)
Warn 'HuggingFace no accesible. Probando el registry de Ollama (ultimo recurso)...'
docker exec @ProxyEnv d0a1-hermes-ollama ollama pull llama3.2:3b
if ($LASTEXITCODE -eq 0) {
$PullOk = $true
# Contexto ampliado (el default 4096 da 400 en Open WebUI con prompts largos)
docker exec d0a1-hermes-ollama sh -c 'printf "FROM llama3.2:3b\\nPARAMETER num_ctx 16384\\n" > /tmp/mf && ollama create llama3.2:3b -f /tmp/mf'
}
}
if (-not $PullOk) {
Err 'No se pudo descargar el modelo (ni HuggingFace ni registry).'
if (-not $env:HTTPS_PROXY) {
Write-Host ' Tu red bloquea ambos. Si tienes proxy/VPN:'
Write-Host ' $env:HTTPS_PROXY = "http://127.0.0.1:7890" # (puerto de tu proxy)'
Write-Host ' .\deploy.ps1 vps'
}
exit 1
}
Ok "Ollama corriendo en http://localhost:${OllamaPort}"
# --- 2. Instalar Hermes Agent ------------------------------------------------
+45 -2
View File
@@ -96,6 +96,7 @@ Write-Host ''
# --- 1. Arrancar Ollama (Docker) -------------------------------------------
Warn '[1/3] Arrancando Ollama (IA local)...'
cmd /c docker rm -f d0a1-openclaw-ollama '>' NUL '2>&1'
$running = docker ps --format '{{.Names}}' | Select-String -Quiet 'd0a1-openclaw-ollama'
if (-not $running) {
docker run -d --name d0a1-openclaw-ollama `
@@ -121,8 +122,50 @@ while ($true) {
}
}
Warn ' Descargando modelo (llama3.2:3b, ~2 GB)...'
docker exec d0a1-openclaw-ollama ollama pull llama3.2:3b
if ($LASTEXITCODE -ne 0) { Err 'Fallo la descarga del modelo.'; exit 1 }
# Si el usuario define $env:HTTPS_PROXY, Ollama lo usa para el pull (doc oficial):
$ProxyEnv = @()
if ($env:HTTPS_PROXY) { $ProxyEnv = @('-e', "HTTPS_PROXY=$env:HTTPS_PROXY", '-e', "HTTP_PROXY=$env:HTTP_PROXY") }
# --- Modelo: HF primero (CDN propio, rapido) y registry de Ollama como ultimo recurso ---
$Gguf = Join-Path $ScriptDir 'llama3.2-3b-q4.gguf'
$HfUrls = @(
'https://huggingface.co/bartowski/Llama-3.2-3B-Instruct-GGUF/resolve/main/Llama-3.2-3B-Instruct-Q4_K_M.gguf',
'https://huggingface.co/unsloth/Llama-3.2-3B-Instruct-GGUF/resolve/main/Llama-3.2-3B-Instruct-Q4_K_M.gguf'
)
foreach ($Url in $HfUrls) {
Info 'Descargando modelo de IA (llama3.2:3b, ~2 GB)...'
curl.exe -sL --retry 3 --max-time 1800 -o "$Gguf" $Url
if ($LASTEXITCODE -eq 0 -and (Test-Path $Gguf) -and (Get-Item $Gguf).Length -gt 1900000000) { break }
Warn "Mirror no accesible, probando el siguiente..."
Remove-Item "$Gguf" -Force -ErrorAction SilentlyContinue
}
if ((Test-Path $Gguf) -and (Get-Item $Gguf).Length -gt 1900000000) {
Info 'Importando modelo en Ollama...'
docker cp "$Gguf" d0a1-openclaw-ollama:/root/.ollama/import.gguf
docker exec d0a1-openclaw-ollama sh -c 'printf "FROM /root/.ollama/import.gguf\\nPARAMETER num_ctx 16384\\n" > /tmp/mf && ollama create llama3.2:3b -f /tmp/mf'
$CreateOk = ($LASTEXITCODE -eq 0)
docker exec d0a1-openclaw-ollama rm -f /root/.ollama/import.gguf | Out-Null
Remove-Item "$Gguf" -Force -ErrorAction SilentlyContinue
$PullOk = $CreateOk
if (-not $CreateOk) { Err 'Fallo al importar el modelo desde el GGUF.' }
} else {
# Ultimo recurso: pull directo (1 intento, ya sin esperar 3 rondas)
Warn 'HuggingFace no accesible. Probando el registry de Ollama (ultimo recurso)...'
docker exec @ProxyEnv d0a1-openclaw-ollama ollama pull llama3.2:3b
if ($LASTEXITCODE -eq 0) {
$PullOk = $true
# Contexto ampliado (el default 4096 da 400 en Open WebUI con prompts largos)
docker exec d0a1-openclaw-ollama sh -c 'printf "FROM llama3.2:3b\\nPARAMETER num_ctx 16384\\n" > /tmp/mf && ollama create llama3.2:3b -f /tmp/mf'
}
}
if (-not $PullOk) {
Err 'No se pudo descargar el modelo (ni HuggingFace ni registry).'
if (-not $env:HTTPS_PROXY) {
Write-Host ' Tu red bloquea ambos. Si tienes proxy/VPN:'
Write-Host ' $env:HTTPS_PROXY = "http://127.0.0.1:7890" # (puerto de tu proxy)'
Write-Host ' .\deploy.ps1 vps'
}
exit 1
}
Ok "Ollama corriendo en http://localhost:${OllamaPort}"
# --- 2. Instalar OpenClaw -----------------------------------------------------
+52 -3
View File
@@ -96,8 +96,12 @@ if ($Mode -eq 'local') {
Write-Host " URL: ${Cyan}http://localhost:${WebUiPort}${NC}"
} else {
Warn 'Modo: VPS (accesible desde fuera)'
# IP real de LAN: la de la interfaz con la ruta por defecto (evita vEthernet
# WSL/Hyper-V, Docker, VPN — que son 172.16-31.*, 10.x internos, etc.)
$GwIf = (Get-NetRoute -DestinationPrefix '0.0.0.0/0' -ErrorAction SilentlyContinue |
Sort-Object RouteMetric | Select-Object -First 1).ifIndex
$Ip = (Get-NetIPAddress -AddressFamily IPv4 -ErrorAction SilentlyContinue |
Where-Object { $_.IPAddress -notlike '127.*' -and $_.IPAddress -notlike '169.254.*' -and $_.IPAddress -notmatch '^172\.(1[6-9]|2[0-9]|3[01])\.' } |
Where-Object { $_.ifIndex -eq $GwIf -and $_.IPAddress -notlike '127.*' } |
Select-Object -First 1).IPAddress
if (-not $Ip) { $Ip = 'TU_IP' }
Write-Host " URL: ${Cyan}http://${Ip}:${WebUiPort}${NC}"
@@ -112,6 +116,9 @@ if ($WebUiPort -ne 3000) { Warn "Puerto 3000 ocupado, usando $WebUiPort" }
Write-Host ''
# --- Deploy ----------------------------------------------------------------
# Si hay un deploy previo del pack, tumbarlo primero (mantiene los volumenes:
# el modelo ya descargado no se re-descarga) para que los nuevos puertos apliquen.
cmd /c docker compose -f $ComposeFile down '>' NUL '2>&1'
Warn 'Descargando contenedores (2-3 min la primera vez)...'
$env:OLLAMA_PORT = "$OllamaPort"
$env:WEBUI_PORT = "$WebUiPort"
@@ -132,8 +139,50 @@ while ($true) {
exit 1
}
}
docker exec d0a1-ollama ollama pull llama3.2:3b
if ($LASTEXITCODE -ne 0) { Err 'Fallo la descarga del modelo.'; exit 1 }
# Si el usuario define $env:HTTPS_PROXY, Ollama lo usa para el pull (doc oficial):
$ProxyEnv = @()
if ($env:HTTPS_PROXY) { $ProxyEnv = @('-e', "HTTPS_PROXY=$env:HTTPS_PROXY", '-e', "HTTP_PROXY=$env:HTTP_PROXY") }
# --- Modelo: HF primero (CDN propio, rapido) y registry de Ollama como ultimo recurso ---
$Gguf = Join-Path $ScriptDir 'llama3.2-3b-q4.gguf'
$HfUrls = @(
'https://huggingface.co/bartowski/Llama-3.2-3B-Instruct-GGUF/resolve/main/Llama-3.2-3B-Instruct-Q4_K_M.gguf',
'https://huggingface.co/unsloth/Llama-3.2-3B-Instruct-GGUF/resolve/main/Llama-3.2-3B-Instruct-Q4_K_M.gguf'
)
foreach ($Url in $HfUrls) {
Info 'Descargando modelo de IA (llama3.2:3b, ~2 GB)...'
curl.exe -sL --retry 3 --max-time 1800 -o "$Gguf" $Url
if ($LASTEXITCODE -eq 0 -and (Test-Path $Gguf) -and (Get-Item $Gguf).Length -gt 1900000000) { break }
Warn "Mirror no accesible, probando el siguiente..."
Remove-Item "$Gguf" -Force -ErrorAction SilentlyContinue
}
if ((Test-Path $Gguf) -and (Get-Item $Gguf).Length -gt 1900000000) {
Info 'Importando modelo en Ollama...'
docker cp "$Gguf" d0a1-ollama:/root/.ollama/import.gguf
docker exec d0a1-ollama sh -c 'printf "FROM /root/.ollama/import.gguf\\nPARAMETER num_ctx 16384\\n" > /tmp/mf && ollama create llama3.2:3b -f /tmp/mf'
$CreateOk = ($LASTEXITCODE -eq 0)
docker exec d0a1-ollama rm -f /root/.ollama/import.gguf | Out-Null
Remove-Item "$Gguf" -Force -ErrorAction SilentlyContinue
$PullOk = $CreateOk
if (-not $CreateOk) { Err 'Fallo al importar el modelo desde el GGUF.' }
} else {
# Ultimo recurso: pull directo (1 intento, ya sin esperar 3 rondas)
Warn 'HuggingFace no accesible. Probando el registry de Ollama (ultimo recurso)...'
docker exec @ProxyEnv d0a1-ollama ollama pull llama3.2:3b
if ($LASTEXITCODE -eq 0) {
$PullOk = $true
# Contexto ampliado (el default 4096 da 400 en Open WebUI con prompts largos)
docker exec d0a1-ollama sh -c 'printf "FROM llama3.2:3b\\nPARAMETER num_ctx 16384\\n" > /tmp/mf && ollama create llama3.2:3b -f /tmp/mf'
}
}
if (-not $PullOk) {
Err 'No se pudo descargar el modelo (ni HuggingFace ni registry).'
if (-not $env:HTTPS_PROXY) {
Write-Host ' Tu red bloquea ambos. Si tienes proxy/VPN:'
Write-Host ' $env:HTTPS_PROXY = "http://127.0.0.1:7890" # (puerto de tu proxy)'
Write-Host ' .\deploy.ps1 vps'
}
exit 1
}
# --- Done -------------------------------------------------------------------
Write-Host ''
+50 -3
View File
@@ -131,8 +131,12 @@ if ($Mode -eq 'local') {
Write-Host " IA (chat): ${Cyan}http://localhost:${WebUiPort}${NC}"
} else {
Warn 'Modo: VPS (accesible desde fuera)'
# IP real de LAN: la de la interfaz con la ruta por defecto (evita
# vEthernet WSL/Hyper-V, Docker, VPN)
$GwIf = (Get-NetRoute -DestinationPrefix '0.0.0.0/0' -ErrorAction SilentlyContinue |
Sort-Object RouteMetric | Select-Object -First 1).ifIndex
$Ip = (Get-NetIPAddress -AddressFamily IPv4 -ErrorAction SilentlyContinue |
Where-Object { $_.IPAddress -notlike '127.*' -and $_.IPAddress -notlike '169.254.*' -and $_.IPAddress -notmatch '^172\.(1[6-9]|2[0-9]|3[01])\.' } |
Where-Object { $_.ifIndex -eq $GwIf -and $_.IPAddress -notlike '127.*' } |
Select-Object -First 1).IPAddress
if (-not $Ip) { $Ip = 'TU_IP' }
Write-Host " WordPress: ${Cyan}http://${Ip}:${WpPort}${NC}"
@@ -150,6 +154,7 @@ Write-Host ''
# --- Deploy ----------------------------------------------------------------
Warn 'Descargando contenedores (3-5 min la primera vez)...'
cmd /c docker compose -f $ComposeFile down '>' NUL '2>&1'
$env:OLLAMA_PORT = "$OllamaPort"
$env:WP_PORT = "$WpPort"
$env:WEBUI_PORT = "$WebUiPort"
@@ -170,8 +175,50 @@ while ($true) {
exit 1
}
}
docker exec d0a1-wp-ollama ollama pull llama3.2:3b
if ($LASTEXITCODE -ne 0) { Err 'Fallo la descarga del modelo.'; exit 1 }
# Si el usuario define $env:HTTPS_PROXY, Ollama lo usa para el pull (doc oficial):
$ProxyEnv = @()
if ($env:HTTPS_PROXY) { $ProxyEnv = @('-e', "HTTPS_PROXY=$env:HTTPS_PROXY", '-e', "HTTP_PROXY=$env:HTTP_PROXY") }
# --- Modelo: HF primero (CDN propio, rapido) y registry de Ollama como ultimo recurso ---
$Gguf = Join-Path $ScriptDir 'llama3.2-3b-q4.gguf'
$HfUrls = @(
'https://huggingface.co/bartowski/Llama-3.2-3B-Instruct-GGUF/resolve/main/Llama-3.2-3B-Instruct-Q4_K_M.gguf',
'https://huggingface.co/unsloth/Llama-3.2-3B-Instruct-GGUF/resolve/main/Llama-3.2-3B-Instruct-Q4_K_M.gguf'
)
foreach ($Url in $HfUrls) {
Info 'Descargando modelo de IA (llama3.2:3b, ~2 GB)...'
curl.exe -sL --retry 3 --max-time 1800 -o "$Gguf" $Url
if ($LASTEXITCODE -eq 0 -and (Test-Path $Gguf) -and (Get-Item $Gguf).Length -gt 1900000000) { break }
Warn "Mirror no accesible, probando el siguiente..."
Remove-Item "$Gguf" -Force -ErrorAction SilentlyContinue
}
if ((Test-Path $Gguf) -and (Get-Item $Gguf).Length -gt 1900000000) {
Info 'Importando modelo en Ollama...'
docker cp "$Gguf" d0a1-wp-ollama:/root/.ollama/import.gguf
docker exec d0a1-wp-ollama sh -c 'printf "FROM /root/.ollama/import.gguf\\nPARAMETER num_ctx 16384\\n" > /tmp/mf && ollama create llama3.2:3b -f /tmp/mf'
$CreateOk = ($LASTEXITCODE -eq 0)
docker exec d0a1-wp-ollama rm -f /root/.ollama/import.gguf | Out-Null
Remove-Item "$Gguf" -Force -ErrorAction SilentlyContinue
$PullOk = $CreateOk
if (-not $CreateOk) { Err 'Fallo al importar el modelo desde el GGUF.' }
} else {
# Ultimo recurso: pull directo (1 intento, ya sin esperar 3 rondas)
Warn 'HuggingFace no accesible. Probando el registry de Ollama (ultimo recurso)...'
docker exec @ProxyEnv d0a1-wp-ollama ollama pull llama3.2:3b
if ($LASTEXITCODE -eq 0) {
$PullOk = $true
# Contexto ampliado (el default 4096 da 400 en Open WebUI con prompts largos)
docker exec d0a1-wp-ollama sh -c 'printf "FROM llama3.2:3b\\nPARAMETER num_ctx 16384\\n" > /tmp/mf && ollama create llama3.2:3b -f /tmp/mf'
}
}
if (-not $PullOk) {
Err 'No se pudo descargar el modelo (ni HuggingFace ni registry).'
if (-not $env:HTTPS_PROXY) {
Write-Host ' Tu red bloquea ambos. Si tienes proxy/VPN:'
Write-Host ' $env:HTTPS_PROXY = "http://127.0.0.1:7890" # (puerto de tu proxy)'
Write-Host ' .\deploy.ps1 vps'
}
exit 1
}
# --- Done -------------------------------------------------------------------
Write-Host ''