File size: 3,741 Bytes
b2b6837
6b66ff8
18338f2
9418cac
7f77abb
657c2c4
 
c8ec589
14470cb
a6c20e6
e9b1330
a6c20e6
b680be3
9fdb2f5
fe2ce4e
9fdb2f5
9eb93fb
4233f52
bdaedce
 
4233f52
 
9eb93fb
a6c20e6
b680be3
9fdb2f5
 
6b66ff8
18338f2
6b66ff8
c25e656
af51ac7
c25e656
0ad856f
c25e656
 
 
 
d39b316
af51ac7
c25e656
37f63d7
 
2369ff4
b07b67c
0c249e6
58e6791
b0387c0
 
fe2ce4e
b0387c0
 
0c249e6
c25e656
6b66ff8
 
 
9707563
9e99f8b
 
476db76
8957ec9
9581d1b
c8ec589
 
 
 
 
683464d
72a4570
683464d
3744638
e9de1a6
3744638
e9de1a6
570499c
c8ec589
7f77abb
a79ff7c
6cf177c
 
3e5e3aa
 
 
bb13c31
efd3249
bb13c31
 
b5577f2
bb13c31
 
 
 
 
 
 
 
73a8b08
bb13c31
40ab011
bb13c31
06b07be
b44c22a
8088475
b44c22a
1f5f865
0ab69f5
7f77abb
0ab69f5
bb13c31
40ab011
3e5e3aa
 
3744638
1c0ef9d
0ab69f5
06b07be
0ab69f5
 
bb13c31
0ab69f5
 
e5e8914
 
 
7e6f125
4610d8c
32b73fc
71003f4
8842133
f9e89b3
58e6791
4d13443
 
 
 
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"
    }
  },
  "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;"