feat(ai): Day 8 — 会话 CRUD API + chat_handler session 模式
- 新增 4 个会话端点: POST/GET /ai/chat/sessions, PUT rename, POST close - ChatRequest 增加 session_id 字段(Optional,向后兼容) - session_id 模式: DB 加载历史 + 持久化消息 + Tool 调用日志写入 - 无 session_id 时保持原有 history 数组模式不变 - 权限: ai.chat.session.list / ai.chat.session.manage
This commit is contained in:
@@ -431,6 +431,22 @@ impl AiModule {
|
||||
"/ai/chat",
|
||||
axum::routing::post(crate::handler::chat_handler::chat),
|
||||
)
|
||||
.route(
|
||||
"/ai/chat/sessions",
|
||||
axum::routing::post(crate::handler::chat_handler::create_session),
|
||||
)
|
||||
.route(
|
||||
"/ai/chat/sessions",
|
||||
axum::routing::get(crate::handler::chat_handler::list_sessions),
|
||||
)
|
||||
.route(
|
||||
"/ai/chat/sessions/{session_id}/rename",
|
||||
axum::routing::put(crate::handler::chat_handler::rename_session),
|
||||
)
|
||||
.route(
|
||||
"/ai/chat/sessions/{session_id}/close",
|
||||
axum::routing::post(crate::handler::chat_handler::close_session),
|
||||
)
|
||||
.route(
|
||||
"/ai/config",
|
||||
axum::routing::get(crate::handler::config_handler::get_config),
|
||||
|
||||
Reference in New Issue
Block a user