集装箱查询系统

AI驱动的集装箱追踪系统,使用Google Gemini和Temporal工作流。

  • by Kushal1715
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 Kushal1715/container-tracking-AI-agent

使用说明

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

启动服务

  1. 临时服务器:
temporal server start-dev
  1. 临时工:
python worker.py
  1. FastAPI后端 (1号航站楼):
uvicorn main:app --reload --host 0.0.0.0 --port 8000
  1. MCP工具服务器 (2号航站楼):
python -m mcp_tools.http_server
  1. 刮板API (3号航站楼):
python scraper_api.py
  1. 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 -默认值:8001
  • SCRAPER_API_PORT -默认值:8002
  • TEMPORAL_HOST -默认值:本地主机:7233
  • TEMPORAL_NAMESPACE -默认值:默认值