optimize the logic for showing chat history

This commit is contained in:
RockYang 2023-04-20 11:56:33 +08:00
parent efc1ea5d8b
commit 296d83c3a1
6 changed files with 603 additions and 597 deletions

View File

@ -86,7 +86,7 @@ func (s *Server) Run(webRoot embed.FS, path string, debug bool) {
engine.Use(AuthorizeMiddleware(s)) engine.Use(AuthorizeMiddleware(s))
engine.Use(Recover) engine.Use(Recover)
engine.POST("test", s.TestHandle) engine.POST("api/test", s.TestHandle)
engine.GET("api/session/get", s.GetSessionHandle) engine.GET("api/session/get", s.GetSessionHandle)
engine.POST("api/login", s.LoginHandle) engine.POST("api/login", s.LoginHandle)
engine.POST("api/logout", s.LogoutHandle) engine.POST("api/logout", s.LogoutHandle)
@ -116,6 +116,9 @@ func (s *Server) Run(webRoot embed.FS, path string, debug bool) {
if c.Request.URL.Path == "/favicon.ico" { if c.Request.URL.Path == "/favicon.ico" {
c.Redirect(http.StatusMovedPermanently, "/chat/"+c.Request.URL.Path) c.Redirect(http.StatusMovedPermanently, "/chat/"+c.Request.URL.Path)
} }
if c.Request.URL.Path == "/" {
c.Redirect(http.StatusMovedPermanently, "/chat")
}
}) })
// process front-end web static files // process front-end web static files

View File

@ -5,19 +5,8 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="favicon.ico"> <link rel="icon" href="favicon.ico" type="image/x-icon">
<title>ChatGPT 助手</title> <title>ChatGPT-Plus</title>
<style>
* {
margin: 0;
padding: 0;
}
html, body {
height: 100%;
}
</style>
</head> </head>
<body> <body>
@ -25,7 +14,6 @@
<strong>请开启JavaScript支持</strong> <strong>请开启JavaScript支持</strong>
</noscript> </noscript>
<div id="app"></div> <div id="app"></div>
<script type="module" src="src/main.js"></script>
</body> </body>
</html> </html>

View File

@ -1,4 +1,4 @@
import {createRouter, createWebHistory} from 'vue-router' import {createRouter, createWebHashHistory} from 'vue-router'
import {createApp} from 'vue' import {createApp} from 'vue'
import ElementPlus from "element-plus" import ElementPlus from "element-plus"
import "element-plus/dist/index.css" import "element-plus/dist/index.css"
@ -45,7 +45,7 @@ const routes = [
] ]
const router = createRouter({ const router = createRouter({
history: createWebHistory(), history: createWebHashHistory(),
routes: routes, routes: routes,
}) })

View File

@ -679,8 +679,16 @@ export default defineComponent({
.tip-text { .tip-text {
text-align left text-align left
padding 10px 20px; padding 0 20px 10px 20px;
line-height 1.5
.el-alert {
padding 5px;
.el-alert__description {
font-size 14px;
}
}
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -16,10 +16,7 @@ module.exports = defineConfig({
] ]
}, },
publicPath: process.env.NODE_ENV === 'production' publicPath: process.env.NODE_ENV === 'production' ? '/chat' : '/',
? '/chat'
: '/',
outputDir: '../dist', outputDir: '../dist',
crossorigin: "anonymous", crossorigin: "anonymous",
devServer: { devServer: {