#!/bin/bash # 创建配置目录 mkdir -p ~/.nanobot mkdir -p ~/.nanobot/workspace #mkdir -p /tmp/agent_slots echo $PATH #echo "tgproxy.806044.xyz api.telegram.org" | tee -a /etc/hosts #apt install dnsutils -y #dig api.telegram.org #dig discord.com/api/v10 cat /dev/null >/etc/resolv.conf cat <> /etc/resolv.conf nameserver 1.1.1.1 nameserver 8.8.8.8 EOF #dig api.telegram.org #dig discord.com/api/v10 # 直接写入配置(对接你本地的 PowerServe 或 Ollama API) cat < ~/.nanobot/config.json { "providers": { "custom": { "apiKey": "dummy", "apiBase": "http://localhost:8080" } }, "agents": { "defaults": { "workspace": "~/.nanobot/workspace", "model": "Qwen3-30B-A3B-Instruct-2507-Q4_K_S-3.61bpw.gguf" } }, "channels": { "telegram": { "enabled": true , "token": "$TG_TOKEN" , "allowFrom": ["$TG_ID"] }, "discord": { "enabled": false , "token": "$DC_TOKEN", "allowFrom": ["$DC_ID"] } } } EOF curl -Lo /usr/local/bin/ttyd https://github.com/tsl0922/ttyd/releases/download/1.7.3/ttyd.x86_64 && \ chmod +x /usr/local/bin/ttyd # 修改 entrypoint.sh 中的 ttyd 启动命令 ttyd bash & #sh /app/test.sh &&sleep 80 #apt install wget sudo -y #wget -q https://github.com/v2rayA/v2rayA/releases/download/v2.3.2/installer_debian_x64_2.3.2.deb && \ # wget -q https://raw.githubusercontent.com/v2rayA/v2raya-apt/refs/heads/master/pool/main/x/xray/xray_25.8.3_amd64.deb && \ # apt update && apt-get install -y ./installer_debian_x64_2.3.2.deb ./xray_25.8.3_amd64.deb && \ # rm installer_debian_x64_2.3.2.deb && rm xray_25.8.3_amd64.deb #bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install #curl -s https://install.zerotier.com | bash #zerotier-cli join 8d1c312afaa97775 #v2raya --lite & #apt install openssl update-ca-certificates -y # 下载草稿模型 (建议用 Qwen2.5-1.5B-Instruct-GGUF 的 Q4_K_M 版本) echo "Downloading model..." python3 -c "from huggingface_hub import hf_hub_download; \ hf_hub_download(repo_id='byteshape/Qwen3-30B-A3B-Instruct-2507-GGUF', \ filename='Qwen3-30B-A3B-Instruct-2507-Q4_K_S-3.61bpw.gguf', local_dir='/app')" # 切换到临时目录 # 下载文件 curl -LO https://github.com/go-gost/gost/releases/download/v3.2.6/gost_3.2.6_linux_amd64.tar.gz # 解压 tar -zxvf gost_3.2.6_linux_amd64.tar.gz # 将 gost 移动到系统可执行 mv gost /usr/local/bin/ # 赋予执行权限 chmod +x /usr/local/bin/gost # 在本地监听 1080 端口,并将流量通过 wss (加密的ws) 转发给你的 Tunnel #gost -L http://:1081 -F wss://pxde.806044.xyz:443 & #sh /app/setup_proxy.sh api.telegram.org tgproxy.806044.xyz #. /app/start_gost.sh sleep 3 echo "测试地址$ALL_PROXY..." #curl -I https://discord.com #curl -Iv -x "$ALL_PROXY" https://api.telegram.org #nginx -s stop #export ALL_PROXY="http://127.0.0.1:1081" export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt export REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt echo "Starting Python bot on port 8888..." # ~/.local/bin/nanobot gateway -p 8888 & ~/.local/bin/nanobot status #~/.local/bin/nanobot --help # 1. 启动 C++ 服务 (llama-server) # 将端口改为 8080,并放到后台 echo "Starting llama-server on port 8080..." ./llama-server -m "/app/Qwen3-30B-A3B-Instruct-2507-Q4_K_S-3.61bpw.gguf" --host "0.0.0.0" --port "8080" \ -t "2" -c "8192" --flash-attn "on" --no-mmap -ctk q4_0 -ctv q4_0 & #date #echo "Current nanobot version: $(pip show nanobot)" # 4. 启动 Nginx 作为主进程 (监听 7860) # daemon off 确保容器不会立即退出 echo "Starting Nginx reverse proxy on port 7860..." nginx -g "daemon off;"