Skip to content

wlopyst/-OpenAI-Agent-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

文档生成 Multi-Agent 系统

一个基于 OpenAI 的多 Agent 协作文档生成工具,适合写进项目申报材料。

项目结构

report_agent/
├── main.py              # 主程序入口
├── agents.py            # 多 Agent 逻辑(5个Agent)
├── prompts.py           # 提示词设计
├── requirements.txt     # 依赖库
├── .env.example         # 环境变量示例
├── input_example.txt    # 示例输入文件
└── output/              # 生成结果目录(自动创建)

五大 Agent

Agent 职责
Agent-1 结构分析 解析原始输入,生成文档大纲
Agent-2 内容生成 根据大纲生成完整文档(≥1000字)
Agent-3 优化润色 提升逻辑性、专业性
Agent-4 日志分析 智能摘要运行日志
Agent-5 PPT讲稿 生成口头演讲稿

快速开始

1. 安装依赖

pip install -r requirements.txt

2. 配置 API Key

复制 .env.example.env,填入你的 OpenAI API Key:

cp .env.example .env
# 编辑 .env,填入你的 key

.env 内容:

OPENAI_API_KEY=你的key

3. 运行

python main.py

4. 选择模式

1. 完整报告(结构分析 → 内容生成 → 优化润色)
2. 日志摘要(快速分析日志内容)
3. PPT讲稿(根据文档生成演讲稿)
4. 全部生成(报告 + 日志摘要 + PPT讲稿)

5. 查看输出

所有结果保存在 output/ 目录:

  • report_<时间戳>.txt - 完整报告
  • log_summary_<时间戳>.txt - 日志摘要
  • ppt_script_<时间戳>.txt - PPT讲稿
  • run_log_<时间戳>.txt - 运行日志

架构说明(可写入申报材料)

本系统采用 串行 Multi-Agent Pipeline 架构:

用户输入
    ↓
[Agent-1] 结构分析  ── 提取关键信息,生成层级大纲
    ↓
[Agent-2] 内容生成  ── 根据大纲扩展为完整文档
    ↓
[Agent-3] 优化润色  ── 提升专业性与逻辑性
    ↓
最终输出文档

每个 Agent 都有独立的 Prompt 设计和职责边界,符合 Multi-Agent 系统的基本设计原则。

扩展方向

  • 接入向量数据库(RAG):让 Agent 参考已有文档库
  • 增加 Web UI(Gradio/Streamlit)
  • 支持 Word/PDF 输出格式
  • 接入本地 LLM(Ollama)替代 OpenAI

依赖

openai>=1.0.0
python-dotenv>=1.0.0

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors