style: optimize code styles

This commit is contained in:
RockYang 2023-06-18 15:17:59 +08:00
parent e7fd29b9cb
commit cd809d17d3
4 changed files with 26 additions and 18 deletions

View File

@ -67,7 +67,7 @@
<script setup>
import {computed, defineEmits, defineProps, onMounted, ref} from "vue"
import {computed, onMounted, ref} from "vue"
import {httpGet, httpPost} from "@/utils/http";
import {ElMessage} from "element-plus";
@ -91,7 +91,7 @@ onMounted(() => {
httpGet('/api/user/profile').then(res => {
form.value = res.data
}).catch(() => {
ElMessage.error({message:'获取用户信息失败', appendTo: '#user-info'})
ElMessage.error({message: '获取用户信息失败', appendTo: '#user-info'})
});
})
@ -104,7 +104,7 @@ const save = function () {
onClose: () => emits('hide', false)
})
//
emits('update-user', {nickname:form.value['nickname'], avatar: form.value['avatar']});
emits('update-user', {nickname: form.value['nickname'], avatar: form.value['avatar']});
}).catch(() => {
ElMessage.error({
message: '更新失败',

View File

@ -32,11 +32,10 @@
</template>
<script setup>
import {defineEmits, defineProps, onMounted, ref} from "vue"
import {onMounted, ref} from "vue"
import {httpPost} from "@/utils/http";
import {ElMessage} from "element-plus";
// eslint-disable-next-line no-unused-vars
const props = defineProps({
show: Boolean,
});
@ -47,13 +46,13 @@ onMounted(() => {
})
const emits = defineEmits(['hide','logout']);
const emits = defineEmits(['hide', 'logout']);
const save = function () {
if (!form.value['password'] || form.value['password'].length < 8) {
return ElMessage.error({message:"密码的长度为8-16个字符", appendTo:"#password-form"});
return ElMessage.error({message: "密码的长度为8-16个字符", appendTo: "#password-form"});
}
if (form.value['repass'] !== form.value['password']) {
return ElMessage.error({message:'两次输入密码不一致', appendTo:'#password-form'});
return ElMessage.error({message: '两次输入密码不一致', appendTo: '#password-form'});
}
httpPost('/api/user/password', form.value).then(() => {
ElMessage.success({
@ -63,7 +62,7 @@ const save = function () {
})
}).catch((e) => {
ElMessage.error({
message: '更新失败,'+e.message,
message: '更新失败,' + e.message,
appendTo: '#password-form'
})
})

View File

@ -74,7 +74,7 @@
<el-dropdown-item>
<i class="iconfont icon-github"></i>
<span>
<span>
powered by
<el-link type="primary" href="https://github.com/yangjian102621/chatgpt-plus" target="_blank">chatgpt-plus-v3</el-link>
</span>
@ -171,7 +171,7 @@
/>
<span class="send-btn">
<el-button @click="sendMessage">
<el-icon><Promotion /></el-icon>
<el-icon><Promotion/></el-icon>
</el-button>
</span>
</div>
@ -183,8 +183,9 @@
</el-main>
</el-container>
<config-dialog :show="showConfigDialog" :models="models" @hide="showConfigDialog = false" @update-user="updateUser" />
<password-dialog :show="showPasswordDialog" @hide="showPasswordDialog = false" @logout="logout" />
<config-dialog :show="showConfigDialog" :models="models" @hide="showConfigDialog = false"
@update-user="updateUser"/>
<password-dialog :show="showPasswordDialog" @hide="showPasswordDialog = false" @logout="logout"/>
</div>
@ -440,9 +441,9 @@ const connect = function (chat_id, role_id) {
let host = process.env.VUE_APP_WS_HOST
if (host === '') {
if (location.protocol === 'https:') {
host = 'wss://'+location.host;
host = 'wss://' + location.host;
} else {
host = 'ws://'+location.host;
host = 'ws://' + location.host;
}
}
const _socket = new WebSocket(host + `/api/chat/new?session_id=${_sessionId}&role_id=${role_id}&chat_id=${chat_id}&model=${model.value}`);
@ -645,6 +646,7 @@ const loadChatHistory = function (chatId) {
}
const md = require('markdown-it')();
// md.use(require('markdown-it-copy')); //
for (let i = 0; i < data.length; i++) {
if (data[i].type === "prompt") {
chatData.value.push(data[i]);
@ -673,7 +675,7 @@ const loadChatHistory = function (chatId) {
const stopGenerate = function () {
showStopGenerate.value = false;
httpGet("/api/chat/stop?session_id=" + getSessionId() ).then(() => {
httpGet("/api/chat/stop?session_id=" + getSessionId()).then(() => {
canSend.value = true;
if (previousText.value !== '') {
showReGenerate.value = true;
@ -990,6 +992,7 @@ const updateUser = function (data) {
.el-textarea {
max-width 600px;
.el-textarea__inner::-webkit-scrollbar {
width: 0;
height: 0;
@ -1004,7 +1007,7 @@ const updateUser = function (data) {
.el-button {
padding 8px 5px;
border-radius 6px;
background:rgb(25,195,125)
background: rgb(25, 195, 125)
color #ffffff;
font-size 20px;
}

View File

@ -10,7 +10,13 @@ module.exports = defineConfig({
},
plugins: [
new webpack.optimize.MinChunkSizePlugin({minChunkSize: 10000})
]
],
// resolve: {
// fallback: {
// fs: false,
// path: require.resolve('path-browserify')
// }
// }
},
publicPath: '/',