Files
agent-park/scripts/add-markdown-project.js
T
mzaxdandClaude bf69555978 feat: 添加项目详情 Markdown 渲染支持及项目添加脚本
- 新增 MarkdownContent 组件支持 Markdown 渲染
- 新增 scripts 目录下的项目添加工具脚本
- 更新项目详情页面支持 Markdown 内容显示
- 更新依赖包支持 Markdown 解析

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-27 17:19:39 +08:00

182 lines
5.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const http = require('http');
const markdownContent = `# AutoGen
## 🎯 项目简介
**AutoGen** 是一个由微软开发的**多智能体 AI 应用程序框架**,可以创建能够自主工作或与人类协作的智能体。
### ✨ 核心特性
- **核心 API**:实现消息传递、事件驱动智能体以及本地和分布式运行时
- **AgentChat API**:提供更简单但更具主见的 API,用于快速原型设计
- **扩展 API**:支持 LLM 客户端的特定实现(如 OpenAI、Azure OpenAI
- **AutoGen Studio**:用于构建多智能体应用程序的无代码 GUI
- **AutoGen Bench**:用于评估智能体性能的基准测试套件
## 📦 安装方式
\`\`\`bash
# 使用 pip 安装
pip install -U "autogen-agentchat" "autogen-ext[openai]"
# 安装 AutoGen Studio
pip install -U "autogenstudio"
\`\`\`
> 💡 **提示**AutoGen 需要 **Python 3.10 或更高版本**
## 🚀 快速开始
### Hello World 示例
\`\`\`python
import asyncio
from autogen_agentchat.agents import AssistantAgent
from autogen_ext.models.openai import OpenAIChatCompletionClient
async def main() -> None:
model_client = OpenAIChatCompletionClient(model="gpt-4o")
agent = AssistantAgent("assistant", model_client=model_client)
print(await agent.run(task="Say 'Hello World!'"))
await model_client.close()
asyncio.run(main())
\`\`\`
## 📊 功能对比
| 特性 | AutoGen | LangChain | CrewAI |
|------|---------|-----------|--------|
| 多智能体协作 | ✅ | ✅ | ✅ |
| 无代码 GUI | ✅ | ❌ | ❌ |
| 分布式运行时 | ✅ | ❌ | ❌ |
| .NET 支持 | ✅ | ❌ | ❌ |
| 基准测试套件 | ✅ | ❌ | ❌ |
## 🔧 高级用法
### 多智能体编排
使用 \`AgentTool\` 创建基本的多智能体编排设置:
\`\`\`python
import asyncio
from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.tools import AgentTool
from autogen_ext.models.openai import OpenAIChatCompletionClient
async def main() -> None:
model_client = OpenAIChatCompletionClient(model="gpt-4o")
# 创建数学专家智能体
math_agent = AssistantAgent(
"math_expert",
model_client=model_client,
system_message="You are a math expert.",
description="A math expert assistant.",
)
# 创建化学专家智能体
chemistry_agent = AssistantAgent(
"chemistry_expert",
model_client=model_client,
system_message="You are a chemistry expert.",
description="A chemistry expert assistant.",
)
print("智能体创建成功!")
\`\`\`
## 📚 任务清单
- [x] 安装 AutoGen
- [ ] 创建第一个智能体
- [ ] 配置 OpenAI API
- [ ] 运行多智能体对话
- [ ] 部署到生产环境
## 🎓 学习资源
1. [官方文档](https://microsoft.github.io/autogen/)
2. [GitHub 仓库](https://github.com/microsoft/autogen)
3. [API 参考](https://microsoft.github.io/autogen/docs/reference)
4. [示例代码](https://github.com/microsoft/autogen/tree/main/samples)
## 💬 常见问题
### Q: AutoGen 是免费的吗?
**A**: 是的!AutoGen 使用 MIT 许可证,完全开源免费。
### Q: 支持哪些 LLM 提供商?
**A**: AutoGen 支持 OpenAI、Azure OpenAI,以及通过扩展 API 支持其他提供商。
---
## 📄 许可证
MIT License - 详见 [LICENSE](https://github.com/microsoft/autogen/blob/main/LICENSE) 文件
**Made with ❤️ by Microsoft**
`;
const data = JSON.stringify({
apiKey: 'sk_live_agent_park_webhook_key_2025',
projects: [{
name: 'AutoGen',
nameEn: 'AutoGen',
description: 'Microsoft 开发的多智能体 AI 应用程序框架,支持自主或与人类协作的智能体',
descriptionEn: 'A programming framework for creating multi-agent AI applications that can act autonomously or work alongside humans',
content: markdownContent,
contentEn: markdownContent, // 使用相同内容用于测试
status: 'ACTIVE',
source: 'GitHub',
tags: [
{ name: '多智能体', nameEn: 'Multi-Agent' },
{ name: '框架', nameEn: 'Framework' },
{ name: '微软', nameEn: 'Microsoft' },
{ name: 'Python', nameEn: 'Python' },
{ name: 'AI', nameEn: 'AI' },
{ name: 'LLM', nameEn: 'LLM' }
],
links: [
{ type: 'GITHUB', url: 'https://github.com/microsoft/autogen', title: 'GitHub 仓库' },
{ type: 'WEBSITE', url: 'https://microsoft.github.io/autogen/', title: '官方文档' },
{ type: 'WEBSITE', url: 'https://pypi.org/project/autogen-agentchat/', title: 'PyPI 包' }
]
}]
});
const options = {
hostname: '127.0.0.1',
port: 3001,
path: '/api/webhook/projects',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(data)
}
};
const req = http.request(options, (res) => {
let responseData = '';
res.on('data', (chunk) => {
responseData += chunk;
});
res.on('end', () => {
console.log('Status:', res.statusCode);
console.log('Response:', responseData);
});
});
req.on('error', (error) => {
console.error('Error:', error.message);
});
req.write(data);
req.end();