🎨 优化扩展模块,完成ai接入和对话功能

This commit is contained in:
2026-02-12 23:12:28 +08:00
parent 4e611d3a5e
commit 572f3aa15b
779 changed files with 194400 additions and 3136 deletions

29
server/router/app/chat.go Normal file
View 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) // 删除消息
}
}