Files
DronePlanningV2/run_api.sh
2026-03-17 10:51:32 +08:00

37 lines
1.1 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# 启动 LLM 服务 + DronePlanning API
# - Chat 模型8081
# - Embedding 模型8090
# - API8000
cd "$(dirname "$0")"
# llama-server 所在目录(可在该目录下启动模型)
LLAMA_BIN_DIR="${LLAMA_BIN_DIR:-$HOME/llama.cpp/build/bin}"
cleanup() {
echo ""
echo "正在停止服务..."
kill $LLAMA_CHAT_PID $LLAMA_EMBED_PID 2>/dev/null
exit 0
}
trap cleanup SIGINT SIGTERM
# 启动 Chat 模型 (8081)
echo "=== 启动 LLM Chat 服务 (端口 8081) ==="
(cd "$LLAMA_BIN_DIR" && ./llama-server -m ~/models/gguf/Qwen3/Qwen3-4B/Qwen3-4B-Q5_K_M.gguf --port 8081 --gpu_layers 36 --host 0.0.0.0) &
LLAMA_CHAT_PID=$!
# 启动 Embedding 模型 (8090)
echo "=== 启动 LLM Embedding 服务 (端口 8090) ==="
(cd "$LLAMA_BIN_DIR" && ./llama-server -m ~/models/gguf/Qwen3/Qwen3-Embedding-4B/Qwen3-Embedding-4B-Q5_K_M.gguf --gpu_layers 36 --embeddings --port 8090 --host 0.0.0.0) &
LLAMA_EMBED_PID=$!
# 等待 LLM 服务就绪
echo "等待 LLM 服务启动..."
sleep 8
# 启动 DronePlanning API (8000)
echo "=== 启动 DronePlanning API (端口 8000) ==="
python -m uvicorn main:app --reload --host 0.0.0.0 --port 8000