File size: 1,027 Bytes
e5e8914
6b66ff8
 
 
 
 
 
e5e8914
6b66ff8
 
 
 
e5e8914
 
 
 
 
6b66ff8
 
 
 
 
e5e8914
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b66ff8
 
 
e5e8914
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
#!/bin/sh
# 创建配置目录
mkdir -p ~/.nanobot

# 直接写入配置(对接你本地的 PowerServe 或 Ollama API)
cat <<EOF > ~/.nanobot/config.json
{
  "llamacpp": {
    "apiKey": "local-no-key",
    "apiBase": "http://localhost:8080/v1", 
    "extraHeaders": null
  },
  "model": "llamacpp/qwen3:4b",
  "server": {
    "port": 8888,
    "host": "127.0.0.1"
  }
  "historySize": 10,
  "systemPrompt": "You are a helpful local AI assistant ."
}
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 "512" \
    --flash-attn "on" \
    --no-mmap \
    --mlock &

echo "Starting Python bot on port 8888..."
PORT=8888 nanobot gateway &

#

sleep 5

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