#!/bin/sh # 创建配置目录 mkdir -p ~/.nanobot # 直接写入配置(对接你本地的 PowerServe 或 Ollama API) cat < ~/.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;"