diff --git a/main.go b/main.go index 3e3295a..69f6ca0 100644 --- a/main.go +++ b/main.go @@ -54,6 +54,10 @@ func main() { return c.String(http.StatusOK, "aMVgO6pcg3RRrMvk") }) + //登录界面 + e.GET("/", static.Login) + e.GET("/chat", static.Chat) + //user apps.InitUserGroup(e.Group("/v1/user/")) diff --git a/static/ai-chat.html b/static/ai-chat.html index 2f96a1d..e93f9e4 100644 --- a/static/ai-chat.html +++ b/static/ai-chat.html @@ -9,10 +9,13 @@ font-family: Arial, sans-serif; margin: 0; padding: 0; + background-color: var(--white); + background: url("/v1/static/img/003.jpeg"); } .chat-container { - max-width: 600px; + max-width: 85%; + max-height: 85%; margin: 20px auto; border: 1px solid #ccc; border-radius: 5px; @@ -20,7 +23,7 @@ } .chat-box { - height: 300px; + height: 500px; overflow-y: scroll; border-bottom: 1px solid #ccc; padding-bottom: 10px; @@ -42,6 +45,15 @@ .message { margin-bottom: 10px; + justify-content: flex-end; + background-color: #d6eaff; + color: #000000; + } + .gpt{ + margin-bottom: 10px; + justify-content: flex-start; + background-color: #e5ece7; + color: #000; } .sender { @@ -185,7 +197,7 @@ */ function displayChatGPTMessageAndGetContainer() { const messageDiv = document.createElement('div'); - messageDiv.classList.add('message'); + messageDiv.classList.add('gpt'); const senderSpan = document.createElement('span'); senderSpan.classList.add('sender'); diff --git a/static/init.go b/static/init.go index f873dfd..de43650 100644 --- a/static/init.go +++ b/static/init.go @@ -27,6 +27,12 @@ func initPageMap() map[string][]byte { pageMap["login.html"] = data } + //ai-chat.html + data, err = pageList.ReadFile("ai-chat.html") + if err == nil { + pageMap["ai-chat.html"] = data + } + return pageMap } diff --git a/static/page.go b/static/page.go index 389795d..5f89441 100644 --- a/static/page.go +++ b/static/page.go @@ -5,6 +5,20 @@ import ( "net/http" ) +func Login(c echo.Context) error { + c.Response().Header().Set("Content-Type", "text/html; charset=utf-8") + c.Response().Header().Set("Cache-Control", "max-age=3600") + + return c.Blob(http.StatusOK, "text/html; charset=utf-8", pageMap["login.html"]) +} + +func Chat(c echo.Context) error { + c.Response().Header().Set("Content-Type", "text/html; charset=utf-8") + c.Response().Header().Set("Cache-Control", "max-age=3600") + + return c.Blob(http.StatusOK, "text/html; charset=utf-8", pageMap["ai-chat.html"]) +} + func InitStaticGroup(g *echo.Group) { g.GET("login.html", func(c echo.Context) error {