🔥 改为前后端分离形式
This commit is contained in:
@@ -2,6 +2,9 @@ package app
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"go-wechat/common/response"
|
||||
"go-wechat/config"
|
||||
"go-wechat/service"
|
||||
)
|
||||
|
||||
// SaveAssistant
|
||||
@@ -12,3 +15,22 @@ func SaveAssistant(ctx *gin.Context) {
|
||||
//ctx.String(http.StatusOK, "操作成功")
|
||||
ctx.Redirect(302, "/assistant.html")
|
||||
}
|
||||
|
||||
// GetAssistants
|
||||
// @description: 获取AI助手列表
|
||||
// @param ctx
|
||||
func GetAssistants(ctx *gin.Context) {
|
||||
records, err := service.GetAllAiAssistant()
|
||||
if err != nil {
|
||||
response.New(ctx).SetMsg("系统错误").SetError(err).Fail()
|
||||
return
|
||||
}
|
||||
response.New(ctx).SetData(records).Success()
|
||||
}
|
||||
|
||||
// GetAiModels
|
||||
// @description: 获取AI模型列表
|
||||
// @param ctx
|
||||
func GetAiModels(ctx *gin.Context) {
|
||||
response.New(ctx).SetData(config.Conf.Ai.Models).Success()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user