Spaces:
Paused
Paused
Update entrypoint.sh
Browse files- entrypoint.sh +24 -4
entrypoint.sh
CHANGED
|
@@ -1,25 +1,45 @@
|
|
|
|
|
| 1 |
# 创建配置目录
|
| 2 |
mkdir -p ~/.nanobot
|
| 3 |
|
| 4 |
# 直接写入配置(对接你本地的 PowerServe 或 Ollama API)
|
| 5 |
cat <<EOF > ~/.nanobot/config.json
|
| 6 |
{
|
| 7 |
-
"
|
| 8 |
"apiKey": "local-no-key",
|
| 9 |
"apiBase": "http://localhost:8080/v1",
|
| 10 |
"extraHeaders": null
|
| 11 |
},
|
| 12 |
-
"model": "
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
"historySize": 10,
|
| 14 |
"systemPrompt": "You are a helpful local AI assistant ."
|
| 15 |
}
|
| 16 |
EOF
|
| 17 |
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
#
|
| 21 |
|
| 22 |
-
sleep
|
| 23 |
|
| 24 |
# 4. 启动 Nginx 作为主进程 (监听 7860)
|
| 25 |
# daemon off 确保容器不会立即退出
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
# 创建配置目录
|
| 3 |
mkdir -p ~/.nanobot
|
| 4 |
|
| 5 |
# 直接写入配置(对接你本地的 PowerServe 或 Ollama API)
|
| 6 |
cat <<EOF > ~/.nanobot/config.json
|
| 7 |
{
|
| 8 |
+
"llamacpp": {
|
| 9 |
"apiKey": "local-no-key",
|
| 10 |
"apiBase": "http://localhost:8080/v1",
|
| 11 |
"extraHeaders": null
|
| 12 |
},
|
| 13 |
+
"model": "llamacpp/qwen3:4b",
|
| 14 |
+
"server": {
|
| 15 |
+
"port": 8888,
|
| 16 |
+
"host": "127.0.0.1"
|
| 17 |
+
}
|
| 18 |
"historySize": 10,
|
| 19 |
"systemPrompt": "You are a helpful local AI assistant ."
|
| 20 |
}
|
| 21 |
EOF
|
| 22 |
|
| 23 |
+
|
| 24 |
+
# 1. 启动 C++ 服务 (llama-server)
|
| 25 |
+
# 将端口改为 8080,并放到后台
|
| 26 |
+
echo "Starting llama-server on port 8080..."
|
| 27 |
+
./llama-server \
|
| 28 |
+
-m "/app/Qwen3VL-4B-Instruct-Q4_K_M.gguf" \
|
| 29 |
+
--host "127.0.0.1" \
|
| 30 |
+
--port "8080" \
|
| 31 |
+
-t "2" \
|
| 32 |
+
-c "512" \
|
| 33 |
+
--flash-attn "on" \
|
| 34 |
+
--no-mmap \
|
| 35 |
+
--mlock &
|
| 36 |
+
|
| 37 |
+
echo "Starting Python bot on port 8888..."
|
| 38 |
+
PORT=8888 nanobot gateway &
|
| 39 |
|
| 40 |
#
|
| 41 |
|
| 42 |
+
sleep 5
|
| 43 |
|
| 44 |
# 4. 启动 Nginx 作为主进程 (监听 7860)
|
| 45 |
# daemon off 确保容器不会立即退出
|