diff --git a/app/assistant.go b/app/assistant.go new file mode 100644 index 0000000..b1c12a6 --- /dev/null +++ b/app/assistant.go @@ -0,0 +1,14 @@ +package app + +import ( + "github.com/gin-gonic/gin" +) + +// SaveAssistant +// @description: 保存AI助手 +// @param ctx +func SaveAssistant(ctx *gin.Context) { + + //ctx.String(http.StatusOK, "操作成功") + ctx.Redirect(302, "/assistant.html") +} diff --git a/app/pages.go b/app/pages.go index 2770588..1c8d5c8 100644 --- a/app/pages.go +++ b/app/pages.go @@ -92,6 +92,21 @@ func Group(ctx *gin.Context) { ctx.HTML(http.StatusOK, "group.html", result) } +// Assistant +// @description: AI角色 +// @param ctx +func Assistant(ctx *gin.Context) { + var result = gin.H{ + "msg": "success", + } + + result["aiModels"] = config.Conf.Ai.Models + result["assistant"], _ = service.GetAllAiAssistant() + + // 渲染页面 + ctx.HTML(http.StatusOK, "assistant.html", result) +} + // PageNotFound // @description: 404页面 // @param ctx diff --git a/main.go b/main.go index 5eb07dd..0ca0fbe 100644 --- a/main.go +++ b/main.go @@ -48,6 +48,8 @@ func main() { return "群组列表" case "index": return "首页" + case "assistant": + return "AI角色" default: return "其他页面" } diff --git a/router/router.go b/router/router.go index 950d9c4..d216360 100644 --- a/router/router.go +++ b/router/router.go @@ -14,9 +14,10 @@ func Init(g *gin.Engine) { ctx.Redirect(302, "/index.html") }) - g.GET("/index.html", app.Index) // 首页 - g.GET("/friend.html", app.Friend) // 好友列表 - g.GET("/group.html", app.Group) // 群组列表 + g.GET("/index.html", app.Index) // 首页 + g.GET("/friend.html", app.Friend) // 好友列表 + g.GET("/group.html", app.Group) // 群组列表 + g.GET("/assistant.html", app.Assistant) // AI角色 g.GET("/404.html", app.PageNotFound) // 群组列表 @@ -33,4 +34,6 @@ func Init(g *gin.Engine) { api.GET("/group/users", app.GetGroupUsers) // 获取群成员列表 api.PUT("/summary/status", app.ChangeEnableSummaryStatus) // 修改是否开启群聊总结状态 api.PUT("/clearmembers", app.AutoClearMembers) // 自动清理群成员 + + api.POST("/assistant", app.SaveAssistant) // 保存AI助手 } diff --git a/views/assistant.html b/views/assistant.html new file mode 100644 index 0000000..e1f1796 --- /dev/null +++ b/views/assistant.html @@ -0,0 +1,89 @@ + + + + + + 水群助手 + + + + + + + + + + + +
+ {{ template "head.html" "assistant" }} + +
+
+
+
    + {{ range .assistant }} +
  • + + + + + + + + + +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    + +
    + +
    + +
    +
    + +
    + +
    + +
    +
    +
    +
    +
    + +
    + +
    +
    +
  • + {{ end }} +
+
+
+
+ + {{ template "footer.html" }} + + {{ template "groupuser.html" }} +
+ + diff --git a/views/head.html b/views/head.html index ce5dbe4..e121fae 100644 --- a/views/head.html +++ b/views/head.html @@ -13,6 +13,7 @@ 好友 群组 + AI角色