GitHub查询AI代理

一个基于Streamlit、LangChain和MCP工具构建的AI代理,能够查询GitHub仓库信息。

  • by c12k
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 c12k/agent_1

使用说明

AI 代理

一个使用Streamlit、LangChain和MCP工具构建的代理,可以查询github。

GitHub API设置

要使用GitHub搜索功能,您需要设置一个GitHub API令牌:

  1. 创建GitHub个人访问令牌:

  2. 配置令牌:

    • 创建一个 .env 项目根目录中的文件
    • 添加您的令牌: GITHUB_TOKEN=your_actual_token_here
    • 这 .env 文件已在 .gitignore 出于安全考虑

Docker设置

要使用Docker Compose运行所有组件:

# Build and start all services
docker-compose up --build

# Run in background
docker-compose up -d --build

# Stop all services
docker-compose down

服务

  • 没有 (端口11434):LLM服务(对于mac运行本地安装,因为docker ollama速度慢,不使用mac gpu)
  • MCP服务器 (端口3001):搜索服务(用于AI代理的MCP工具)
  • API服务器 (端口3002):FastAPI后端(用于托管AI代理)
  • Streamlit应用程序 (端口8501):Web界面(主要是vibe编码为一次性原型进行测试)

接入点

  • Web用户界面:http://localhost:8501
  • APIhttp://localhost:3002
  • 奥拉玛:http://localhost:11434

首次运行

您需要在本地安装ollama

# For Mac
brew install ollama

# For Linux
curl -fsSL https://ollama.com/install.sh | sh

# For Windows
# Download and install from: https://ollama.com/download/windows

您还需要在Ollama中拉一个模型:

# qwen:4b is small enough and has reasoning capabilities
ollama pull qwen:4b