📋 飞行侠添加:会议纪要生成
新增:
- meetings/utils.py: 纪要生成工具函数
- generate_meeting_minutes(): 生成纪要数据
- export_minutes_to_markdown(): 导出 Markdown
- meetings/views.py: minutes action
- 支持 JSON 和 Markdown 两种格式
- 自动统计参会者消息数
- 提取待办事项
- test_minutes.py: 纪要测试脚本
使用:
- GET /api/v1/meetings/{id}/minutes/ → JSON
- GET /api/v1/meetings/{id}/minutes/?output=markdown → Markdown
This commit is contained in:
69
backend/test_minutes.py
Normal file
69
backend/test_minutes.py
Normal file
@@ -0,0 +1,69 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
测试会议纪要生成
|
||||
"""
|
||||
|
||||
import requests
|
||||
|
||||
API_BASE = 'http://localhost:8000/api/v1'
|
||||
|
||||
def test_minutes():
|
||||
# 登录
|
||||
res = requests.post(f'{API_BASE}/auth/login/', json={
|
||||
'username': 'test',
|
||||
'password': 'test123'
|
||||
})
|
||||
token = res.json()['token']
|
||||
headers = {'Authorization': f'Bearer {token}'}
|
||||
|
||||
# 创建会议
|
||||
res = requests.post(f'{API_BASE}/meetings/', json={
|
||||
'topic': '会议纪要测试会议'
|
||||
}, headers=headers)
|
||||
meeting_id = res.json()['id']
|
||||
print(f"✅ 创建会议:{meeting_id}")
|
||||
|
||||
# 发送几条消息
|
||||
messages = [
|
||||
"大家好,开始今天的会议!",
|
||||
"我来汇报一下 Q2 的进度。",
|
||||
"这个项目需要更多资源支持。",
|
||||
"好的,我会跟进这件事。",
|
||||
]
|
||||
|
||||
for msg in messages:
|
||||
requests.post(
|
||||
f'{API_BASE}/meetings/{meeting_id}/send_message/',
|
||||
json={'content': msg, 'requires_response': '资源' in msg},
|
||||
headers=headers
|
||||
)
|
||||
print(f"✅ 发送 {len(messages)} 条消息")
|
||||
|
||||
# 生成纪要(JSON)
|
||||
res = requests.get(f'{API_BASE}/meetings/{meeting_id}/minutes/')
|
||||
if res.status_code == 200:
|
||||
data = res.json()
|
||||
print(f"\n✅ 会议纪要 (JSON):")
|
||||
print(f" 主题:{data['topic']}")
|
||||
print(f" 消息数:{data['message_count']}")
|
||||
print(f" 摘要:{data['summary'][:100]}...")
|
||||
print(f" 待办:{len(data['todos'])} 项")
|
||||
else:
|
||||
print(f"❌ 生成纪要失败:{res.text}")
|
||||
return False
|
||||
|
||||
# 生成纪要(Markdown)- 用 minutes action
|
||||
res = requests.get(f'{API_BASE}/meetings/{meeting_id}/minutes/?output=markdown')
|
||||
if res.status_code == 200:
|
||||
data = res.json()
|
||||
print(f"\n✅ 会议纪要 (Markdown):")
|
||||
print(data['markdown'][:500])
|
||||
else:
|
||||
print(f"❌ 生成 Markdown 失败:{res.text}")
|
||||
return False
|
||||
|
||||
print("\n✅ 会议纪要测试通过!")
|
||||
return True
|
||||
|
||||
if __name__ == '__main__':
|
||||
test_minutes()
|
||||
Reference in New Issue
Block a user