Files
st/server/router/app/chat.go

30 lines
1.0 KiB
Go
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.

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) // 删除消息
}
}