feat: Step 5 - 聊天 API (v0.9.4)

- 创建 chat.py 路由文件
- 实现 7 个 REST API 端点:
  - GET /api/chat/sessions - 获取聊天会话列表
  - POST /api/chat/sessions - 创建聊天会话
  - GET /api/chat/sessions/:id - 获取会话详情
  - GET /api/chat/sessions/:id/messages - 获取消息历史
  - POST /api/chat/sessions/:id/messages - 发送消息
  - PUT /api/chat/sessions/:id/read - 标记已读
  - DELETE /api/chat/sessions/:id - 关闭会话
- 支持分页、过滤、Bot 信息关联
- 注册蓝图到应用
- 更新版本号到 0.9.4
This commit is contained in:
2026-03-15 10:43:10 +08:00
parent b74ec0b73d
commit 04132c298a
2 changed files with 387 additions and 3 deletions

View File

@@ -39,7 +39,7 @@ def create_app(config_name='default'):
def index():
return {
'service': '智队中枢',
'version': '0.9.2',
'version': '0.9.4',
'status': 'running',
'endpoints': {
'health': '/health',
@@ -93,7 +93,8 @@ def _register_blueprints(app):
from app.routes.gateways import gateways_bp
from app.routes.messages import messages_bp
from app.routes.stats import stats_bp
from app.routes.bots import bots_bp # Step 3: Bot API
from app.routes.bots import bots_bp
from app.routes.chat import chat_bp # Step 5: Chat API
from app.web.routes import web_bp
from app.web.api import web_api_bp
@@ -103,7 +104,8 @@ def _register_blueprints(app):
app.register_blueprint(gateways_bp, url_prefix='/api/gateways')
app.register_blueprint(messages_bp, url_prefix='/api/messages')
app.register_blueprint(stats_bp, url_prefix='/api/stats')
app.register_blueprint(bots_bp, url_prefix='/api/bots') # Step 3: Bot API
app.register_blueprint(bots_bp, url_prefix='/api/bots')
app.register_blueprint(chat_bp, url_prefix='/api/chat') # Step 5: Chat API
app.register_blueprint(web_bp, url_prefix='/web')
app.register_blueprint(web_api_bp)