🎨 优化扩展模块,完成ai接入和对话功能
This commit is contained in:
29
server/router/app/chat.go
Normal file
29
server/router/app/chat.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
v1 "git.echol.cn/loser/st/server/api/v1"
|
||||
"git.echol.cn/loser/st/server/middleware"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type ChatRouter struct{}
|
||||
|
||||
func (cr *ChatRouter) InitChatRouter(Router *gin.RouterGroup) {
|
||||
chatApi := v1.ApiGroupApp.AppApiGroup.ChatApi
|
||||
|
||||
// 所有对话接口都需要登录
|
||||
chatRouter := Router.Group("chat").Use(middleware.AppJWTAuth())
|
||||
{
|
||||
// 对话管理
|
||||
chatRouter.POST("", chatApi.CreateChat) // 创建对话
|
||||
chatRouter.GET("/list", chatApi.GetChatList) // 对话列表
|
||||
chatRouter.GET("/:id", chatApi.GetChatDetail) // 对话详情
|
||||
chatRouter.GET("/:id/messages", chatApi.GetChatMessages) // 获取消息
|
||||
chatRouter.DELETE("/:id", chatApi.DeleteChat) // 删除对话
|
||||
|
||||
// 消息操作
|
||||
chatRouter.POST("/send", chatApi.SendMessage) // 发送消息(SSE 流式)
|
||||
chatRouter.POST("/message/edit", chatApi.EditMessage) // 编辑消息
|
||||
chatRouter.POST("/message/delete", chatApi.DeleteMessage) // 删除消息
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user