This commit is contained in:
shaoyongjun 2024-04-30 22:11:21 +08:00
parent 3183e451b1
commit 576fa3531b
4 changed files with 39 additions and 3 deletions

View File

@ -54,6 +54,10 @@ func main() {
return c.String(http.StatusOK, "aMVgO6pcg3RRrMvk") return c.String(http.StatusOK, "aMVgO6pcg3RRrMvk")
}) })
//登录界面
e.GET("/", static.Login)
e.GET("/chat", static.Chat)
//user //user
apps.InitUserGroup(e.Group("/v1/user/")) apps.InitUserGroup(e.Group("/v1/user/"))

View File

@ -9,10 +9,13 @@
font-family: Arial, sans-serif; font-family: Arial, sans-serif;
margin: 0; margin: 0;
padding: 0; padding: 0;
background-color: var(--white);
background: url("/v1/static/img/003.jpeg");
} }
.chat-container { .chat-container {
max-width: 600px; max-width: 85%;
max-height: 85%;
margin: 20px auto; margin: 20px auto;
border: 1px solid #ccc; border: 1px solid #ccc;
border-radius: 5px; border-radius: 5px;
@ -20,7 +23,7 @@
} }
.chat-box { .chat-box {
height: 300px; height: 500px;
overflow-y: scroll; overflow-y: scroll;
border-bottom: 1px solid #ccc; border-bottom: 1px solid #ccc;
padding-bottom: 10px; padding-bottom: 10px;
@ -42,6 +45,15 @@
.message { .message {
margin-bottom: 10px; 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 { .sender {
@ -185,7 +197,7 @@
*/ */
function displayChatGPTMessageAndGetContainer() { function displayChatGPTMessageAndGetContainer() {
const messageDiv = document.createElement('div'); const messageDiv = document.createElement('div');
messageDiv.classList.add('message'); messageDiv.classList.add('gpt');
const senderSpan = document.createElement('span'); const senderSpan = document.createElement('span');
senderSpan.classList.add('sender'); senderSpan.classList.add('sender');

View File

@ -27,6 +27,12 @@ func initPageMap() map[string][]byte {
pageMap["login.html"] = data pageMap["login.html"] = data
} }
//ai-chat.html
data, err = pageList.ReadFile("ai-chat.html")
if err == nil {
pageMap["ai-chat.html"] = data
}
return pageMap return pageMap
} }

View File

@ -5,6 +5,20 @@ import (
"net/http" "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) { func InitStaticGroup(g *echo.Group) {
g.GET("login.html", func(c echo.Context) error { g.GET("login.html", func(c echo.Context) error {