File size: 1,551 Bytes
e5e8914
6b66ff8
18338f2
d39b316
657c2c4
 
df2b380
e9b1330
9fdb2f5
 
 
58a0da9
9fdb2f5
4233f52
 
 
 
 
 
 
9fdb2f5
 
 
 
6b66ff8
18338f2
6b66ff8
c25e656
 
 
 
 
 
 
 
d39b316
37f63d7
c25e656
37f63d7
 
2369ff4
cdcac2b
0c249e6
54ddfe5
2369ff4
b0387c0
 
 
 
 
0c249e6
c25e656
6b66ff8
 
 
e5e8914
 
 
54ddfe5
 
 
e5e8914
 
d39b316
6b66ff8
2e77236
be2f78d
fe220f1
5121a70
c9fc7cf
2e77236
 
 
 
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
#!/bin/sh
# 创建配置目录
mkdir -p ~/.nanobot
mkdir -p ~/.nanabot/workspace
echo $PATH

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
nameserver 2606:4700:4700::1111
nameserver 2606:4700:4700::1001
EOF

dig api.telegram.org
dig discord.com/api/v10


# 直接写入配置(对接你本地的 PowerServe 或 Ollama API)
cat <<EOF > ~/.nanobot/config.json
{
  "providers": {
    "vllm": {
      "apiKey": "dummy",
      "apiBase": "http://localhost:8080/v1"
    }
  },
  "agents": {
    "defaults": {
      "workspace": "~/.nanobot/workspace",
      "model": "vllm/qwen3-4b"
    }
  },
  "channels": {
   "telegram": {
   "enabled": true ,
   "token": "$TG_TOKEN" ,
   "allowFrom": ["$TG_ID"] ,
   "proxy": null
    },
    "discord": {
      "enabled": true,
      "token": "$DC_TOKEN",
      "allowFrom": ["$DC_ID"]
    }
  }
}
EOF


# 1. 启动 C++ 服务 (llama-server)
# 将端口改为 8080,并放到后台
 echo "Starting llama-server on port 8080..."
 ./llama-server -m "/app/Qwen3VL-4B-Instruct-Q4_K_M.gguf" --host "127.0.0.1" --port "8080" \
 -t "2" -c "8192" --flash-attn "on" --no-mmap --mlock &

echo "Starting Python bot on port 8888..."
 ~/.local/bin/nanobot gateway -p 8888 & 


~/.local/bin/nanobot status
~/.local/bin/nanobot --help


# 4. 启动 Nginx 作为主进程 (监听 7860)
# daemon off 确保容器不会立即退出
echo "Starting Nginx reverse proxy on port 7860..."
nginx -g "daemon off;"