mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-09-17 16:56:38 +08:00
optimize the logic for showing chat history
This commit is contained in:
parent
efc1ea5d8b
commit
296d83c3a1
@ -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
|
||||||
|
@ -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>
|
@ -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,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,6 +126,7 @@
|
|||||||
v-model="showLoginDialog"
|
v-model="showLoginDialog"
|
||||||
:show-close="false"
|
:show-close="false"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
|
top="5vh"
|
||||||
title="请输入口令继续访问"
|
title="请输入口令继续访问"
|
||||||
>
|
>
|
||||||
<el-row>
|
<el-row>
|
||||||
@ -140,11 +141,15 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<div class="tip-text">
|
<div class="tip-text">
|
||||||
打开微信扫下面二维码免费领取口令, <strong>强烈建议你使用 PC 浏览器访问获得更好的聊天体验。</strong>
|
<p>扫码加入群聊,在群公告获取免费体验账号</p>
|
||||||
|
<el-alert type="warning" :closable="false">
|
||||||
|
<strong>特别声明:</strong> 我们充分尊重用户隐私,因此所有用户的聊天记录均只保存在本地设备,所以请尽量用同一设备访问,以便能查阅所有的聊天记录。
|
||||||
|
</el-alert>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-row class="row-center">
|
<el-row class="row-center">
|
||||||
<el-image src="images/wx.png" fit="cover"/>
|
<el-image src="https://img.r9it.com/chatgpt/wechat-group.jpeg" fit="cover"/>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@ -300,6 +305,11 @@ export default defineComponent({
|
|||||||
reader.readAsText(event.data, "UTF-8");
|
reader.readAsText(event.data, "UTF-8");
|
||||||
reader.onload = () => {
|
reader.onload = () => {
|
||||||
const data = JSON.parse(String(reader.result));
|
const data = JSON.parse(String(reader.result));
|
||||||
|
// 有聊天记录就不输出打招呼消息
|
||||||
|
if (data['is_hello_msg'] && this.chatData.length > 1) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (data.type === 'start') {
|
if (data.type === 'start') {
|
||||||
this.chatData.push({
|
this.chatData.push({
|
||||||
type: "reply",
|
type: "reply",
|
||||||
|
@ -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: {
|
||||||
|
Loading…
Reference in New Issue
Block a user