File size: 3,748 Bytes
4998c27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a46d780
4998c27
 
 
 
 
 
 
 
 
 
a46d780
4998c27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a46d780
4998c27
 
 
5a5fc85
4998c27
5a5fc85
4998c27
 
 
 
 
 
 
 
5a5fc85
4998c27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/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 <<EOF >> /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 <<EOF > ~/.nanobot/config.json
{
  "providers": {
    "custom": {
      "apiKey": "dummy",
      "apiBase": "http://localhost:8080/v1"
    }
  },
  "agents": {
    "defaults": {
      "workspace": "~/.nanobot/workspace",
      "model": "Qwen3-30B-A3B-Instruct-2507-Q4_K_S-3.61bpw.gguf"
    }
  },
  "channels": {
   "telegram": {
   "enabled": false ,
   "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 "测试地址$HTTPS_PROXY..."
#curl -I https://discord.com
#curl -Iv -x "$HTTPS_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;"