PNCT集装箱查询系统
使用Google Gemini和Temporal工作流的人工智能集装箱跟踪系统。
快速开始
先决条件
- Python 3.8+
- 时态CLI
- Google Gemini API密钥
安装
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt环境设置
创建 .env 文件:
GEMINI_API_KEY=your_api_key_here启动服务
- 临时服务器:
temporal server start-dev- 临时工:
python worker.py- FastAPI后端 (1号航站楼):
uvicorn main:app --reload --host 0.0.0.0 --port 8000- MCP工具服务器 (2号航站楼):
python -m mcp_tools.http_server- 刮板API (3号航站楼):
python scraper_api.py- Streamlit聊天界面 (4号航站楼):
streamlit run streamlit_app.py用法
API端点
发布 /container/query
curl -X POST http://localhost:8000/container/query \
-H "Content-Type: application/json" \
-d '{"query": "What is the status of container ABCU1234567?"}'聊天界面
打开http://localhost:8501在您的浏览器中。
项目结构
.
├── main.py # FastAPI backend
├── scraper_api.py # Scraper API
├── worker.py # Temporal worker
├── streamlit_app.py # Chat interface
├── agent/ # AI Agent
├── mcp_tools/ # MCP Tool layer
├── workflows/ # Temporal workflows
└── activities/ # Temporal activities配置
环境变量(可选):
GEMINI_API_KEY-必填项MCP_SERVER_PORT-默认值:8001SCRAPER_API_PORT-默认值:8002TEMPORAL_HOST-默认值:本地主机:7233TEMPORAL_NAMESPACE-默认值:默认值
