Add OpenClaw local repair script
This commit is contained in:
@@ -97,6 +97,24 @@ openclaw doctor
|
|||||||
openclaw gateway status
|
openclaw gateway status
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Si OpenClaw devuelve respuestas vacías o de un token, ejecuta el reparador
|
||||||
|
local como el usuario que ejecuta OpenClaw (`ctello`, no `root`):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
chmod +x fix_openclaw_local.sh
|
||||||
|
bash ./fix_openclaw_local.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
El script respalda `openclaw.json`, fuerza el Gateway local, desactiva el
|
||||||
|
razonamiento predeterminado y la memoria semántica sin embeddings, inicializa
|
||||||
|
el workspace Git y reinicia el Gateway. No borra sesiones ni secretos.
|
||||||
|
|
||||||
|
Después crea una sesión nueva en el dashboard y prueba:
|
||||||
|
|
||||||
|
```text
|
||||||
|
Responde exactamente: SESION NUEVA OK
|
||||||
|
```
|
||||||
|
|
||||||
Para acceder al dashboard desde Windows mediante PowerShell, usa un túnel SSH
|
Para acceder al dashboard desde Windows mediante PowerShell, usa un túnel SSH
|
||||||
hacia el servidor Ubuntu:
|
hacia el servidor Ubuntu:
|
||||||
|
|
||||||
|
|||||||
Executable
+115
@@ -0,0 +1,115 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -Eeuo pipefail
|
||||||
|
|
||||||
|
readonly SCRIPT_NAME="$(basename "$0")"
|
||||||
|
readonly OPENCLAW_HOME="${OPENCLAW_HOME:-$HOME/.openclaw}"
|
||||||
|
readonly CONFIG_FILE="${OPENCLAW_CONFIG_PATH:-$OPENCLAW_HOME/openclaw.json}"
|
||||||
|
readonly WORKSPACE_DIR="$OPENCLAW_HOME/workspace"
|
||||||
|
readonly BACKUP_DIR="$OPENCLAW_HOME/config-backups"
|
||||||
|
|
||||||
|
show_help() {
|
||||||
|
cat <<EOF
|
||||||
|
Uso: $SCRIPT_NAME
|
||||||
|
|
||||||
|
Corrige la configuración local de OpenClaw para este servidor:
|
||||||
|
- usa Gateway local;
|
||||||
|
- desactiva thinking por defecto;
|
||||||
|
- desactiva memoria semántica sin proveedor de embeddings;
|
||||||
|
- inicializa el workspace Git requerido por OpenClaw;
|
||||||
|
- reinicia el Gateway de usuario;
|
||||||
|
- verifica LiteLLM y el modelo local.
|
||||||
|
|
||||||
|
El script no borra sesiones, no elimina secretos y no publica archivos.
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
|
||||||
|
show_help
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! command -v openclaw >/dev/null 2>&1; then
|
||||||
|
echo "Error: openclaw no está disponible en PATH." >&2
|
||||||
|
echo "Ejecuta: source ~/.bashrc" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -f "$CONFIG_FILE" ]]; then
|
||||||
|
echo "Error: no existe la configuración: $CONFIG_FILE" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "$BACKUP_DIR"
|
||||||
|
backup_file="$BACKUP_DIR/openclaw.json.$(date +%Y%m%d-%H%M%S).bak"
|
||||||
|
cp -p "$CONFIG_FILE" "$backup_file"
|
||||||
|
chmod 600 "$backup_file"
|
||||||
|
echo "Respaldo de configuración: $backup_file"
|
||||||
|
|
||||||
|
echo "Aplicando configuración local..."
|
||||||
|
openclaw config set gateway.mode local
|
||||||
|
openclaw config set agents.defaults.thinkingDefault off
|
||||||
|
openclaw config set memory.search.enabled false
|
||||||
|
|
||||||
|
if [[ ! -d "$WORKSPACE_DIR/.git" ]]; then
|
||||||
|
mkdir -p "$WORKSPACE_DIR"
|
||||||
|
git -C "$WORKSPACE_DIR" init
|
||||||
|
git -C "$WORKSPACE_DIR" config user.name "OpenClaw"
|
||||||
|
git -C "$WORKSPACE_DIR" config user.email "openclaw@localhost"
|
||||||
|
touch "$WORKSPACE_DIR/.gitkeep"
|
||||||
|
git -C "$WORKSPACE_DIR" add .gitkeep
|
||||||
|
git -C "$WORKSPACE_DIR" commit -m "Initialize OpenClaw workspace" >/dev/null
|
||||||
|
echo "Workspace Git inicializado: $WORKSPACE_DIR"
|
||||||
|
else
|
||||||
|
echo "Workspace Git ya estaba inicializado: $WORKSPACE_DIR"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v systemctl >/dev/null 2>&1; then
|
||||||
|
if systemctl --user daemon-reload 2>/dev/null; then
|
||||||
|
systemctl --user enable openclaw-gateway.service >/dev/null 2>&1 || true
|
||||||
|
systemctl --user restart openclaw-gateway.service
|
||||||
|
else
|
||||||
|
echo "Aviso: no se pudo conectar al bus systemd de usuario." >&2
|
||||||
|
echo "Cierra esta sesión SSH y vuelve a entrar como $(id -un)." >&2
|
||||||
|
echo "Después ejecuta: systemctl --user restart openclaw-gateway.service" >&2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Verificando configuración..."
|
||||||
|
openclaw config get gateway.mode
|
||||||
|
openclaw config get agents.defaults.thinkingDefault
|
||||||
|
openclaw config get agents.defaults.model.primary
|
||||||
|
openclaw config get models.providers.litellm.baseUrl
|
||||||
|
|
||||||
|
if command -v curl >/dev/null 2>&1; then
|
||||||
|
if curl --fail --silent --show-error --max-time 10 \
|
||||||
|
http://127.0.0.1:8000/v1/models | grep -q 'qwen2.5-coder:14b'; then
|
||||||
|
echo "OK: LiteLLM publica qwen2.5-coder:14b"
|
||||||
|
else
|
||||||
|
echo "ERROR: LiteLLM no publica qwen2.5-coder:14b" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v systemctl >/dev/null 2>&1; then
|
||||||
|
systemctl --user is-active --quiet openclaw-gateway.service && \
|
||||||
|
echo "OK: Gateway activo" || \
|
||||||
|
echo "Aviso: Gateway no está activo; revisa openclaw gateway status" >&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
|
||||||
|
Configuración aplicada.
|
||||||
|
|
||||||
|
IMPORTANTE: la sesión antigua puede seguir teniendo un historial demasiado
|
||||||
|
largo. En la web crea una sesión nueva y prueba:
|
||||||
|
|
||||||
|
Responde exactamente: SESION NUEVA OK
|
||||||
|
|
||||||
|
No continúes usando la sesión que mostraba estimatedInput=49724 y output=1.
|
||||||
|
|
||||||
|
Comprobación manual:
|
||||||
|
openclaw gateway status
|
||||||
|
openclaw doctor
|
||||||
|
EOF
|
||||||
Reference in New Issue
Block a user