summaryrefslogtreecommitdiff
path: root/setup.sh
diff options
context:
space:
mode:
Diffstat (limited to 'setup.sh')
-rwxr-xr-xsetup.sh73
1 files changed, 73 insertions, 0 deletions
diff --git a/setup.sh b/setup.sh
new file mode 100755
index 0000000..7255a43
--- /dev/null
+++ b/setup.sh
@@ -0,0 +1,73 @@
+#!/bin/bash
+# MiMo V2.5 ASR — Hermes Agent Plugin Setup
+# 用法: bash setup.sh [--uninstall]
+
+set -euo pipefail
+
+HERMES_HOME="${HERMES_HOME:-$HOME/.hermes}"
+PLUGIN_DIR="$HERMES_HOME/plugins/stt/mimo"
+SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
+
+GREEN='\033[0;32m'; YELLOW='\033[1;33m'; RED='\033[0;31m'; NC='\033[0m'
+ok() { echo -e "${GREEN}✓${NC} $*"; }
+warn() { echo -e "${YELLOW}⚠${NC} $*"; }
+fail() { echo -e "${RED}✗${NC} $*" >&2; }
+
+# ── Uninstall ──────────────────────────────────────────────────────
+if [[ "${1:-}" == "--uninstall" ]]; then
+ echo "Uninstalling MiMo ASR plugin..."
+ command -v hermes &>/dev/null && hermes plugins disable stt/mimo 2>/dev/null || true
+ rm -rf "$PLUGIN_DIR"
+ rm -f "$HOME/xiaomi-asr.py" "$HOME/xiaomi-asr.sh"
+ ok "Done. Restart Hermes session (/reset) to take effect."
+ exit 0
+fi
+
+# ── Install ────────────────────────────────────────────────────────
+echo "Installing MiMo V2.5 ASR plugin for Hermes Agent..."
+
+# 1. Pre-flight checks
+[[ -d "$HERMES_HOME" ]] || { fail "Hermes not found at $HERMES_HOME"; exit 1; }
+
+if [[ -f "$HERMES_HOME/.env" ]]; then
+ grep -q "^XIAOMI_API_KEY=" "$HERMES_HOME/.env" 2>/dev/null \
+ && ok "XIAOMI_API_KEY found" \
+ || warn "XIAOMI_API_KEY missing in $HERMES_HOME/.env"
+else
+ warn ".env not found — add XIAOMI_API_KEY before using ASR"
+fi
+
+# 2. Install plugin
+mkdir -p "$PLUGIN_DIR"
+cp "$SCRIPT_DIR/plugin.yaml" "$PLUGIN_DIR/plugin.yaml"
+cp "$SCRIPT_DIR/__init__.py" "$PLUGIN_DIR/__init__.py"
+cp "$SCRIPT_DIR/provider.py" "$PLUGIN_DIR/provider.py"
+ok "Plugin installed → $PLUGIN_DIR"
+
+# 3. Copy standalone scripts
+cp "$SCRIPT_DIR/xiaomi-asr.py" "$HOME/xiaomi-asr.py"
+chmod +x "$HOME/xiaomi-asr.py"
+cp "$SCRIPT_DIR/xiaomi-asr.sh" "$HOME/xiaomi-asr.sh"
+chmod +x "$HOME/xiaomi-asr.sh"
+ok "Standalone scripts → $HOME/xiaomi-asr.{py,sh}"
+
+# 4. Enable in Hermes
+if command -v hermes &>/dev/null; then
+ hermes plugins enable stt/mimo 2>/dev/null && ok "Enabled in Hermes" \
+ || warn "Run manually: hermes plugins enable stt/mimo"
+else
+ warn "hermes not in PATH — run: hermes plugins enable stt/mimo"
+fi
+
+# 5. Done
+echo ""
+echo "── Next steps ──────────────────────────────────────"
+echo " hermes config set stt.provider mimo-asr"
+echo " hermes config set stt.providers.mimo-asr.type plugin"
+echo ""
+echo " Or use command mode (standalone script):"
+echo " hermes config set stt.providers.mimo-asr.type command"
+echo " hermes config set stt.providers.mimo-asr.command \"python \$HOME/xiaomi-asr.py {input_path} {output_path} mimo-v2.5-asr {language}\""
+echo ""
+echo " /reset # restart session"
+echo "────────────────────────────────────────────────────"