From d6bda5fae7ebdf3fff6bb367003399c384299a90 Mon Sep 17 00:00:00 2001 From: johnlanni Date: Sun, 1 Feb 2026 21:14:21 +0800 Subject: [PATCH] refactor: remove Clawdbot integration logic from get-ai-gateway.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Moved Clawdbot integration configuration to the higress-clawdbot-integration SKILL in the higress repository for better separation of concerns. **Removed:** - `configureClawdbotIntegration()` function (96 lines) - `checkClawdbot()` function (6 lines) - `installFiles()` generic helper function (25 lines) - Clawdbot-related variable definitions (3 lines): - CLAWDBOT_WORKSPACE - CLAWDBOT_EXTENSIONS_DIR - CLAWDBOT_INTEGRATION_DIR - Clawdbot integration info display in success message (18 lines) - Related function call in runConfigWizard - Related comments **Total lines removed:** 121 **Rationale:** Integration logic is now maintained in the higress repository as an independent script (`configure-clawdbot.sh`) within the higress-clawdbot-integration SKILL. This provides: ✅ Better separation of concerns (setup vs integration) ✅ Easier maintenance (integration logic in one place) ✅ Independent versioning (SKILL can be updated independently) ✅ Clearer documentation flow ✅ Reduced complexity in get-ai-gateway.sh **Migration Path:** Users can now configure Clawdbot integration using: ```bash cd .claude/skills/higress-clawdbot-integration ./configure-clawdbot.sh setup ``` Or manually: ```bash clawdbot models auth login --provider higress ``` **Related:** - Higress PR: alibaba/higress#3435 (higress-clawdbot-integration SKILL update) --- all-in-one/get-ai-gateway.sh | 121 ----------------------------------- 1 file changed, 121 deletions(-) diff --git a/all-in-one/get-ai-gateway.sh b/all-in-one/get-ai-gateway.sh index aa3d6b1..ae84078 100755 --- a/all-in-one/get-ai-gateway.sh +++ b/all-in-one/get-ai-gateway.sh @@ -60,11 +60,6 @@ cd - >/dev/null CONFIGURED_MARK="$ROOT/.configured" -# Clawdbot integration paths -CLAWDBOT_WORKSPACE="$HOME/clawd" -CLAWDBOT_EXTENSIONS_DIR="$HOME/.clawdbot/extensions" -CLAWDBOT_INTEGRATION_DIR="$SCRIPT_DIR/clawdbot-integration" - # Auto-routing configuration ENABLE_AUTO_ROUTING="false" AUTO_ROUTING_DEFAULT_MODEL="" @@ -553,101 +548,6 @@ loadSavedConfig() { fi } -# Check if Clawdbot is installed -checkClawdbot() { - if [ -d "$CLAWDBOT_WORKSPACE" ]; then - return 0 - fi - return 1 -} - -# Generic function to install files to a destination -installFiles() { - local SRC_DIR="$1" - local DEST_DIR="$2" - local NAME="$3" - - if [ ! -d "$SRC_DIR" ]; then - echo "Warning: $NAME source not found at $SRC_DIR" - return 1 - fi - - echo "Installing $NAME..." - - # Create parent directory if not exists - mkdir -p "$(dirname "$DEST_DIR")" - - # Remove existing if present - if [ -d "$DEST_DIR" ]; then - echo "$NAME already exists, updating..." - rm -rf "$DEST_DIR" - fi - - cp -r "$SRC_DIR" "$DEST_DIR" - - echo "✓ $NAME installed at: $DEST_DIR" - return 0 -} - -# Configure Clawdbot integration -configureClawdbotIntegration() { - if ! checkClawdbot; then - return 0 - fi - - echo - echo "=======================================================" - echo " Clawdbot Integration Detected " - echo "=======================================================" - echo - echo "Clawdbot workspace found at: $CLAWDBOT_WORKSPACE" - echo - echo "Higress AI Gateway can integrate with Clawdbot to provide:" - echo " 1. Auto-routing: Automatically route requests to different models" - echo " based on message content (e.g., 'deep thinking' → claude-opus-4.5)" - echo " 2. Model provider: Use Higress as a unified model provider in Clawdbot" - echo - - read -r -u 3 -p "Enable auto-routing feature? (y/N): " enableAutoRouting - case "$enableAutoRouting" in - [yY]|[yY][eE][sS]) - ENABLE_AUTO_ROUTING="true" - - echo - echo "Auto-routing allows you to route requests to different models based on" - echo "keywords in your message. For example:" - echo " - '深入思考 ...' or 'deep thinking ...' → reasoning model" - echo " - '写代码 ...' or 'code: ...' → coding model" - echo - - # Get default model for auto-routing - read -r -u 3 -p "Default model when no routing rule matches (default: qwen-turbo): " defaultModel - if [ -z "$defaultModel" ]; then - AUTO_ROUTING_DEFAULT_MODEL="qwen-turbo" - else - AUTO_ROUTING_DEFAULT_MODEL="$defaultModel" - fi - - echo - echo "You can configure routing rules later using natural language in Clawdbot." - echo "For example, say: 'route to claude-opus-4.5 when solving difficult problems'" - echo - ;; - *) - ENABLE_AUTO_ROUTING="false" - echo "Auto-routing disabled. You can enable it later via Higress Console." - ;; - esac - - # Install Clawdbot plugin and skill using generic function - installFiles "$CLAWDBOT_INTEGRATION_DIR/plugin" "$CLAWDBOT_EXTENSIONS_DIR/higress-ai-gateway" "Higress AI Gateway plugin" - - echo - echo "To complete Clawdbot setup, run:" - echo " clawdbot models auth login --provider higress" - echo -} - # Configure auto-routing in model-router plugin (inside container) configureAutoRouting() { if [ "$ENABLE_AUTO_ROUTING" != "true" ]; then @@ -788,9 +688,6 @@ runConfigWizard() { echo "Error: Can only configure either OpenAI or Azure OpenAI, not both" exit 1 fi - - # Configure Clawdbot integration if detected - configureClawdbotIntegration } configureAzureProvider() { @@ -1693,24 +1590,6 @@ outputWelcomeMessage() { echo echo "Access logs directory:" echo " $DATA_FOLDER/logs" - - # Show Clawdbot integration info if detected - if checkClawdbot; then - echo - echo "=======================================================" - echo " Clawdbot Integration " - echo "=======================================================" - echo - echo "To configure Clawdbot, run:" - echo " clawdbot models auth login --provider higress" - echo - if [ "$ENABLE_AUTO_ROUTING" == "true" ]; then - echo "To configure auto-routing rules, tell Clawdbot:" - echo " '我希望在解决困难问题时路由到claude-opus-4.5的模型'" - echo - fi - fi - echo echo "To stop the gateway run:" echo