Initial commit: 无人机行为规划后端系统

Made-with: Cursor
This commit is contained in:
2026-03-17 10:51:32 +08:00
commit 3ddc2e1ff4
35 changed files with 3219 additions and 0 deletions

36
run_api.sh Executable file
View File

@@ -0,0 +1,36 @@
#!/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