Skip to content

yanghuiyao779-blip/protocol-mind

Repository files navigation

Wisdom Agent - FastAPI 版本

这是一个基于 AI 的智能代理系统,采用 FastAPI 框架构建。

项目特性

  • 基于 FastAPI 的高性能异步 Web 框架
  • 集成 AI 客户端 (支持多种 AI 模型)
  • MCP (Model Context Protocol) 协议支持
  • RAG (Retrieval Augmented Generation) 系统
  • MinIO 对象存储集成

安装和运行

  1. 安装依赖:
pip install -r requirements.txt
  1. 设置环境变量: 创建 .env 文件并配置:
AI_API_KEY=your_api_key_here
MCP_SERVER_HOST=localhost
MCP_SERVER_PORT=8001
FASTAPI_HOST=0.0.0.0
FASTAPI_PORT=8000
  1. 运行服务器:
python main.py

或使用 agent_server 启动:

python bin/agent_server.py

API 端点

  • GET / - 根路径
  • POST /query/ - 查询端点
  • POST /ai/generate/ - AI 响应生成
  • POST /rag/search/ - 知识库搜索
  • POST /knowledge-base/create/ - 创建知识库
  • GET /health/ - 健康检查

项目结构

wisdom-agent/
├── agent/                   # FastAPI 基础配置
│   ├── __init__.py
│   └── app.py               # FastAPI 应用配置
├── app/                     # 应用核心逻辑
│   ├── agent/               # Agent 相关服务
│   │   ├── service/         # Agent 服务层
│   │   │   └── agent_service.py
│   │   └── apis.py          # Agent API 接口
│   ├── ai/                  # AI 核心模块
│   │   ├── __init__.py
│   │   ├── agent.py         # AI Agent 实现
│   │   └── client.py        # AI 客户端
│   ├── mcp/                 # MCP (Model Context Protocol) 模块
│   │   ├── __init__.py
│   │   ├── client.py        # MCP 客户端
│   │   └── server.py        # MCP 服务器
│   └── rag/                 # RAG (Retrieval Augmented Generation) 模块
│       ├── __init__.py
│       ├── core.py          # RAG 核心功能
│       ├── document_parser.py # 文档解析器
│       └── vector_store.py    # 向量存储
├── bin/                     # 可执行脚本
│   └── agent_server.py      # Agent 服务器启动脚本
├── servers/                 # 服务器相关
│   └── mcp_server.py        # MCP 服务器
├── utils/                   # 工具类
│   ├── __init__.py
│   ├── minio_client.py      # MinIO 客户端
│   └── tools.py             # 通用工具
├── client.py                # 客户端示例
├── config.py                # 配置文件
├── config.yaml              # YAML 配置
├── main.py                  # 主入口文件
├── model_element.md         # 模型元素说明
├── requirements.txt         # 依赖列表
├── settings.py              # 项目设置
└── README.md                # 项目说明

环境要求

  • Python >= 3.8
  • FastAPI
  • LangChain
  • 其他依赖见 requirements.txt

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors