Skip to content

Commit d6bda5f

Browse files
committed
refactor: remove Clawdbot integration logic from get-ai-gateway.sh
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: higress-group/higress#3435 (higress-clawdbot-integration SKILL update)
1 parent 2988a07 commit d6bda5f

1 file changed

Lines changed: 0 additions & 121 deletions

File tree

all-in-one/get-ai-gateway.sh

Lines changed: 0 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,6 @@ cd - >/dev/null
6060

6161
CONFIGURED_MARK="$ROOT/.configured"
6262

63-
# Clawdbot integration paths
64-
CLAWDBOT_WORKSPACE="$HOME/clawd"
65-
CLAWDBOT_EXTENSIONS_DIR="$HOME/.clawdbot/extensions"
66-
CLAWDBOT_INTEGRATION_DIR="$SCRIPT_DIR/clawdbot-integration"
67-
6863
# Auto-routing configuration
6964
ENABLE_AUTO_ROUTING="false"
7065
AUTO_ROUTING_DEFAULT_MODEL=""
@@ -553,101 +548,6 @@ loadSavedConfig() {
553548
fi
554549
}
555550

556-
# Check if Clawdbot is installed
557-
checkClawdbot() {
558-
if [ -d "$CLAWDBOT_WORKSPACE" ]; then
559-
return 0
560-
fi
561-
return 1
562-
}
563-
564-
# Generic function to install files to a destination
565-
installFiles() {
566-
local SRC_DIR="$1"
567-
local DEST_DIR="$2"
568-
local NAME="$3"
569-
570-
if [ ! -d "$SRC_DIR" ]; then
571-
echo "Warning: $NAME source not found at $SRC_DIR"
572-
return 1
573-
fi
574-
575-
echo "Installing $NAME..."
576-
577-
# Create parent directory if not exists
578-
mkdir -p "$(dirname "$DEST_DIR")"
579-
580-
# Remove existing if present
581-
if [ -d "$DEST_DIR" ]; then
582-
echo "$NAME already exists, updating..."
583-
rm -rf "$DEST_DIR"
584-
fi
585-
586-
cp -r "$SRC_DIR" "$DEST_DIR"
587-
588-
echo "$NAME installed at: $DEST_DIR"
589-
return 0
590-
}
591-
592-
# Configure Clawdbot integration
593-
configureClawdbotIntegration() {
594-
if ! checkClawdbot; then
595-
return 0
596-
fi
597-
598-
echo
599-
echo "======================================================="
600-
echo " Clawdbot Integration Detected "
601-
echo "======================================================="
602-
echo
603-
echo "Clawdbot workspace found at: $CLAWDBOT_WORKSPACE"
604-
echo
605-
echo "Higress AI Gateway can integrate with Clawdbot to provide:"
606-
echo " 1. Auto-routing: Automatically route requests to different models"
607-
echo " based on message content (e.g., 'deep thinking' → claude-opus-4.5)"
608-
echo " 2. Model provider: Use Higress as a unified model provider in Clawdbot"
609-
echo
610-
611-
read -r -u 3 -p "Enable auto-routing feature? (y/N): " enableAutoRouting
612-
case "$enableAutoRouting" in
613-
[yY]|[yY][eE][sS])
614-
ENABLE_AUTO_ROUTING="true"
615-
616-
echo
617-
echo "Auto-routing allows you to route requests to different models based on"
618-
echo "keywords in your message. For example:"
619-
echo " - '深入思考 ...' or 'deep thinking ...' → reasoning model"
620-
echo " - '写代码 ...' or 'code: ...' → coding model"
621-
echo
622-
623-
# Get default model for auto-routing
624-
read -r -u 3 -p "Default model when no routing rule matches (default: qwen-turbo): " defaultModel
625-
if [ -z "$defaultModel" ]; then
626-
AUTO_ROUTING_DEFAULT_MODEL="qwen-turbo"
627-
else
628-
AUTO_ROUTING_DEFAULT_MODEL="$defaultModel"
629-
fi
630-
631-
echo
632-
echo "You can configure routing rules later using natural language in Clawdbot."
633-
echo "For example, say: 'route to claude-opus-4.5 when solving difficult problems'"
634-
echo
635-
;;
636-
*)
637-
ENABLE_AUTO_ROUTING="false"
638-
echo "Auto-routing disabled. You can enable it later via Higress Console."
639-
;;
640-
esac
641-
642-
# Install Clawdbot plugin and skill using generic function
643-
installFiles "$CLAWDBOT_INTEGRATION_DIR/plugin" "$CLAWDBOT_EXTENSIONS_DIR/higress-ai-gateway" "Higress AI Gateway plugin"
644-
645-
echo
646-
echo "To complete Clawdbot setup, run:"
647-
echo " clawdbot models auth login --provider higress"
648-
echo
649-
}
650-
651551
# Configure auto-routing in model-router plugin (inside container)
652552
configureAutoRouting() {
653553
if [ "$ENABLE_AUTO_ROUTING" != "true" ]; then
@@ -788,9 +688,6 @@ runConfigWizard() {
788688
echo "Error: Can only configure either OpenAI or Azure OpenAI, not both"
789689
exit 1
790690
fi
791-
792-
# Configure Clawdbot integration if detected
793-
configureClawdbotIntegration
794691
}
795692

796693
configureAzureProvider() {
@@ -1693,24 +1590,6 @@ outputWelcomeMessage() {
16931590
echo
16941591
echo "Access logs directory:"
16951592
echo " $DATA_FOLDER/logs"
1696-
1697-
# Show Clawdbot integration info if detected
1698-
if checkClawdbot; then
1699-
echo
1700-
echo "======================================================="
1701-
echo " Clawdbot Integration "
1702-
echo "======================================================="
1703-
echo
1704-
echo "To configure Clawdbot, run:"
1705-
echo " clawdbot models auth login --provider higress"
1706-
echo
1707-
if [ "$ENABLE_AUTO_ROUTING" == "true" ]; then
1708-
echo "To configure auto-routing rules, tell Clawdbot:"
1709-
echo " '我希望在解决困难问题时路由到claude-opus-4.5的模型'"
1710-
echo
1711-
fi
1712-
fi
1713-
17141593
echo
17151594
echo "To stop the gateway run:"
17161595
echo

0 commit comments

Comments
 (0)