mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-08 18:23:45 +08:00
refactor: refactor chat_handler, add support for Azure and ChatGLM
This commit is contained in:
@@ -6,8 +6,7 @@
|
||||
|
||||
<script setup>
|
||||
import {ElConfigProvider} from 'element-plus';
|
||||
import zhCn from 'element-plus/es/locale/lang/zh-cn';
|
||||
</script>
|
||||
import zhCn from 'element-plus/es/locale/lang/zh-cn';</script>
|
||||
|
||||
|
||||
<style lang="stylus">
|
||||
@@ -35,7 +34,7 @@ html, body {
|
||||
margin 0;
|
||||
|
||||
.el-dialog__body {
|
||||
//max-height 1440px
|
||||
max-height 90vh
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="welcome">
|
||||
<div class="container">
|
||||
<h1 class="title">ChatGPT-PLUS</h1>
|
||||
<h1 class="title">{{ title }}</h1>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8">
|
||||
@@ -57,6 +57,8 @@
|
||||
|
||||
import {ref} from "vue";
|
||||
|
||||
const title = process.env.VUE_APP_TITLE
|
||||
|
||||
const samples = ref([
|
||||
"用小学生都能听懂的术语解释什么是量子纠缠",
|
||||
"能给一位6岁男孩的生日会提供一些创造性的建议吗?",
|
||||
|
||||
@@ -4,7 +4,7 @@ const routes = [
|
||||
{
|
||||
name: 'home',
|
||||
path: '/',
|
||||
meta: {title: 'ChatGPT-Plus'},
|
||||
meta: {title: '首页'},
|
||||
component: () => import('@/views/Home.vue'),
|
||||
},
|
||||
{
|
||||
@@ -23,7 +23,7 @@ const routes = [
|
||||
{
|
||||
name: 'plus',
|
||||
path: '/chat',
|
||||
meta: {title: 'ChatGPT-智能助手V3'},
|
||||
meta: {title: '创作中心'},
|
||||
component: () => import('@/views/ChatPlus.vue'),
|
||||
},
|
||||
{
|
||||
@@ -166,7 +166,7 @@ const router = createRouter({
|
||||
// dynamic change the title when router change
|
||||
router.beforeEach((to, from, next) => {
|
||||
if (to.meta.title) {
|
||||
document.title = `${to.meta.title} | ChatGPT-PLUS`
|
||||
document.title = `${to.meta.title} | ${process.env.VUE_APP_TITLE}`
|
||||
}
|
||||
next()
|
||||
})
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<div class="header">{{ title }}</div>
|
||||
<div class="content">
|
||||
<div class="block">
|
||||
<el-input placeholder="手机号/用户名" size="large" v-model="username" autocomplete="off">
|
||||
<el-input placeholder="手机号" size="large" v-model="username" autocomplete="off">
|
||||
<template #prefix>
|
||||
<el-icon>
|
||||
<UserFilled/>
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
<div class="content">
|
||||
<el-form :model="formData" label-width="120px" ref="formRef">
|
||||
<div class="block">
|
||||
<el-input placeholder="请输入用户名(4-30位)"
|
||||
size="large" maxlength="30"
|
||||
v-model="formData.username"
|
||||
<el-input placeholder="手机号码"
|
||||
size="large" maxlength="11"
|
||||
v-model="formData.mobile"
|
||||
autocomplete="off">
|
||||
<template #prefix>
|
||||
<el-icon>
|
||||
<UserFilled/>
|
||||
<Iphone/>
|
||||
</el-icon>
|
||||
</template>
|
||||
</el-input>
|
||||
@@ -49,19 +49,6 @@
|
||||
</el-input>
|
||||
</div>
|
||||
|
||||
<div class="block">
|
||||
<el-input placeholder="手机号码"
|
||||
size="large" maxlength="11"
|
||||
v-model="formData.mobile"
|
||||
autocomplete="off">
|
||||
<template #prefix>
|
||||
<el-icon>
|
||||
<Iphone/>
|
||||
</el-icon>
|
||||
</template>
|
||||
</el-input>
|
||||
</div>
|
||||
|
||||
<div class="block" v-if="enableMsg">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="12">
|
||||
@@ -113,19 +100,19 @@
|
||||
<script setup>
|
||||
|
||||
import {ref} from "vue";
|
||||
import {Checked, Iphone, Lock, UserFilled} from "@element-plus/icons-vue";
|
||||
import {Checked, Iphone, Lock} from "@element-plus/icons-vue";
|
||||
import {httpGet, httpPost} from "@/utils/http";
|
||||
import {ElMessage} from "element-plus";
|
||||
import {useRouter} from "vue-router";
|
||||
import FooterBar from "@/components/FooterBar.vue";
|
||||
import SendMsg from "@/components/SendMsg.vue";
|
||||
import {validateMobile} from "@/utils/validate";
|
||||
|
||||
const router = useRouter();
|
||||
const title = ref('ChatGPT-PLUS 用户注册');
|
||||
const formData = ref({
|
||||
username: '',
|
||||
password: '',
|
||||
mobile: '',
|
||||
password: '',
|
||||
code: '',
|
||||
repass: '',
|
||||
})
|
||||
@@ -141,8 +128,8 @@ httpGet('/api/sms/status').then(res => {
|
||||
})
|
||||
|
||||
const register = function () {
|
||||
if (formData.value.username.length < 4) {
|
||||
return ElMessage.error('用户名的长度为4-30个字符');
|
||||
if (!validateMobile(formData.value.mobile)) {
|
||||
return ElMessage.error('请输入合法的手机号');
|
||||
}
|
||||
if (formData.value.password.length < 8) {
|
||||
return ElMessage.error('密码的长度为8-16个字符');
|
||||
@@ -151,8 +138,8 @@ const register = function () {
|
||||
return ElMessage.error('两次输入密码不一致');
|
||||
}
|
||||
|
||||
if (formData.value.code === '') {
|
||||
formData.value.code = 0
|
||||
if (enableMsg.value && formData.value.code === '') {
|
||||
return ElMessage.error('请输入短信验证码');
|
||||
}
|
||||
httpPost('/api/user/register', formData.value).then(() => {
|
||||
ElMessage.success({"message": "注册成功,即将跳转到登录页...", onClose: () => router.push("login")})
|
||||
|
||||
Reference in New Issue
Block a user