mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-09-17 16:56:38 +08:00
opt: refactor the web page's router and layout
This commit is contained in:
parent
c3f016eae8
commit
4b46d847f0
@ -134,6 +134,7 @@ func (h *ChatHandler) ChatHandle(c *gin.Context) {
|
|||||||
err = h.sendMessage(ctx, session, chatRole, message, client)
|
err = h.sendMessage(ctx, session, chatRole, message, client)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error(err)
|
logger.Error(err)
|
||||||
|
utils.ReplyChunkMessage(client, types.WsMessage{Type: types.WsEnd})
|
||||||
} else {
|
} else {
|
||||||
utils.ReplyChunkMessage(client, types.WsMessage{Type: types.WsEnd})
|
utils.ReplyChunkMessage(client, types.WsMessage{Type: types.WsEnd})
|
||||||
logger.Info("回答完毕: " + string(message))
|
logger.Info("回答完毕: " + string(message))
|
||||||
@ -272,7 +273,11 @@ func (h *ChatHandler) sendMessage(ctx context.Context, session *types.ChatSessio
|
|||||||
case types.ChatGLM:
|
case types.ChatGLM:
|
||||||
return h.sendChatGLMMessage(chatCtx, req, userVo, ctx, session, role, prompt, ws)
|
return h.sendChatGLMMessage(chatCtx, req, userVo, ctx, session, role, prompt, ws)
|
||||||
}
|
}
|
||||||
return fmt.Errorf("not supported platform: %s", session.Model.Platform)
|
utils.ReplyChunkMessage(ws, types.WsMessage{
|
||||||
|
Type: types.WsMiddle,
|
||||||
|
Content: fmt.Sprintf("Not supported platform: %s", session.Model.Platform),
|
||||||
|
})
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tokens 统计 token 数量
|
// Tokens 统计 token 数量
|
||||||
|
@ -19,7 +19,7 @@ $borderColor = #4676d0;
|
|||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
|
|
||||||
.logo {
|
.logo {
|
||||||
background-color: #ffffff
|
//background-color: #ffffff
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
width: 35px;
|
width: 35px;
|
||||||
height: 35px;
|
height: 35px;
|
||||||
@ -41,6 +41,7 @@ $borderColor = #4676d0;
|
|||||||
.search-box {
|
.search-box {
|
||||||
flex-wrap: wrap
|
flex-wrap: wrap
|
||||||
padding: 10px 15px;
|
padding: 10px 15px;
|
||||||
|
//background-color #343540
|
||||||
|
|
||||||
.el-input__wrapper {
|
.el-input__wrapper {
|
||||||
background-color: #363535;
|
background-color: #363535;
|
||||||
|
@ -4,8 +4,30 @@ const routes = [
|
|||||||
{
|
{
|
||||||
name: 'home',
|
name: 'home',
|
||||||
path: '/',
|
path: '/',
|
||||||
|
redirect: '/chat',
|
||||||
meta: {title: '首页'},
|
meta: {title: '首页'},
|
||||||
component: () => import('@/views/Home.vue'),
|
component: () => import('@/views/Home.vue'),
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
name: 'chat',
|
||||||
|
path: '/chat',
|
||||||
|
meta: {title: '创作中心'},
|
||||||
|
component: () => import('@/views/ChatPlus.vue'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'chat-id',
|
||||||
|
path: '/chat/:id',
|
||||||
|
meta: {title: '创作中心'},
|
||||||
|
component: () => import('@/views/ChatPlus.vue'),
|
||||||
|
props: true // 将路由参数传递给组件的 props
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'chat-export',
|
||||||
|
path: '/chat/export',
|
||||||
|
meta: {title: '导出会话记录'},
|
||||||
|
component: () => import('@/views/ChatExport.vue'),
|
||||||
|
},
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'login',
|
name: 'login',
|
||||||
@ -20,25 +42,6 @@ const routes = [
|
|||||||
meta: {title: '用户注册'},
|
meta: {title: '用户注册'},
|
||||||
component: () => import('@/views/Register.vue'),
|
component: () => import('@/views/Register.vue'),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: 'chat',
|
|
||||||
path: '/chat',
|
|
||||||
meta: {title: '创作中心'},
|
|
||||||
component: () => import('@/views/ChatPlus.vue'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'chat-id',
|
|
||||||
path: '/chat/:id',
|
|
||||||
meta: {title: '创作中心'},
|
|
||||||
component: () => import('@/views/ChatPlus.vue'),
|
|
||||||
props: true // 将路由参数传递给组件的 props
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'chat-export',
|
|
||||||
path: '/chat/export',
|
|
||||||
meta: {title: '导出会话记录'},
|
|
||||||
component: () => import('@/views/ChatExport.vue'),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: '/admin/login',
|
path: '/admin/login',
|
||||||
name: 'admin-login',
|
name: 'admin-login',
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="common-layout theme-white">
|
<div class="common-layout theme-white">
|
||||||
<el-container>
|
<el-container>
|
||||||
<el-aside width="320px">
|
<el-aside>
|
||||||
<div class="title-box">
|
<div class="title-box">
|
||||||
<el-image :src="logo" class="logo"/>
|
<el-image :src="logo" class="logo"/>
|
||||||
<span>{{ title }}</span>
|
<span>{{ title }}</span>
|
||||||
@ -47,7 +47,7 @@
|
|||||||
<el-icon><ArrowDown/></el-icon>
|
<el-icon><ArrowDown/></el-icon>
|
||||||
</span>
|
</span>
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu style="width: 315px;">
|
<el-dropdown-menu style="width: 296px;">
|
||||||
<el-dropdown-item @click="showConfig">
|
<el-dropdown-item @click="showConfig">
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<Tools/>
|
<Tools/>
|
||||||
|
@ -1,50 +1,49 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="home">
|
<div class="home">
|
||||||
<div class="inner">
|
<div class="navigator"></div>
|
||||||
<h1>HI <br/> ChatGPT-PLUS</h1>
|
<div class="content">
|
||||||
|
<router-view v-slot="{ Component }">
|
||||||
|
<transition name="move" mode="out-in">
|
||||||
|
<component :is="Component"></component>
|
||||||
|
</transition>
|
||||||
|
</router-view>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {useRouter} from "vue-router";
|
|
||||||
import {checkSession} from "@/action/session";
|
|
||||||
import {isMobile} from "@/utils/libs";
|
|
||||||
|
|
||||||
const router = useRouter();
|
// const router = useRouter();
|
||||||
checkSession().then(() => {
|
// checkSession().then(() => {
|
||||||
if (isMobile()) {
|
// if (isMobile()) {
|
||||||
router.push("/mobile")
|
// router.push("/mobile")
|
||||||
} else {
|
// } else {
|
||||||
router.push("/chat")
|
// router.push("/chat")
|
||||||
}
|
// }
|
||||||
}).catch(() => {
|
// }).catch(() => {
|
||||||
router.push("/login")
|
// router.push("/login")
|
||||||
})
|
// })
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="stylus" scoped>
|
<style lang="stylus" scoped>
|
||||||
.home {
|
.home {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
background-color: #343540;
|
||||||
background-color: #282c34;
|
|
||||||
height 100vh
|
height 100vh
|
||||||
|
width 100%
|
||||||
|
|
||||||
.inner {
|
.navigator {
|
||||||
text-align center
|
|
||||||
display flex
|
display flex
|
||||||
justify-content center
|
width 30px
|
||||||
max-width 400px
|
padding 10px 6px
|
||||||
align-items center
|
}
|
||||||
|
|
||||||
h1 {
|
.content {
|
||||||
color: #202020;
|
width: 100%;
|
||||||
font-size: 55px;
|
height: 100vh;
|
||||||
line-height 1.5
|
overflow-y: scroll;
|
||||||
font-weight: bold;
|
box-sizing: border-box;
|
||||||
text-shadow: -1px -1px 1px #111111, 2px 2px 1px #363636;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user