mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-09-17 16:56:38 +08:00
style: optimize code styles
This commit is contained in:
parent
e7fd29b9cb
commit
cd809d17d3
@ -67,7 +67,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
|
|
||||||
|
|
||||||
import {computed, defineEmits, defineProps, onMounted, ref} from "vue"
|
import {computed, onMounted, ref} from "vue"
|
||||||
import {httpGet, httpPost} from "@/utils/http";
|
import {httpGet, httpPost} from "@/utils/http";
|
||||||
import {ElMessage} from "element-plus";
|
import {ElMessage} from "element-plus";
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ onMounted(() => {
|
|||||||
httpGet('/api/user/profile').then(res => {
|
httpGet('/api/user/profile').then(res => {
|
||||||
form.value = res.data
|
form.value = res.data
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
ElMessage.error({message:'获取用户信息失败', appendTo: '#user-info'})
|
ElMessage.error({message: '获取用户信息失败', appendTo: '#user-info'})
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ const save = function () {
|
|||||||
onClose: () => emits('hide', false)
|
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(() => {
|
}).catch(() => {
|
||||||
ElMessage.error({
|
ElMessage.error({
|
||||||
message: '更新失败',
|
message: '更新失败',
|
||||||
|
@ -32,11 +32,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {defineEmits, defineProps, onMounted, ref} from "vue"
|
import {onMounted, ref} from "vue"
|
||||||
import {httpPost} from "@/utils/http";
|
import {httpPost} from "@/utils/http";
|
||||||
import {ElMessage} from "element-plus";
|
import {ElMessage} from "element-plus";
|
||||||
|
|
||||||
// eslint-disable-next-line no-unused-vars
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
show: Boolean,
|
show: Boolean,
|
||||||
});
|
});
|
||||||
@ -47,13 +46,13 @@ onMounted(() => {
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const emits = defineEmits(['hide','logout']);
|
const emits = defineEmits(['hide', 'logout']);
|
||||||
const save = function () {
|
const save = function () {
|
||||||
if (!form.value['password'] || form.value['password'].length < 8) {
|
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']) {
|
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(() => {
|
httpPost('/api/user/password', form.value).then(() => {
|
||||||
ElMessage.success({
|
ElMessage.success({
|
||||||
@ -63,7 +62,7 @@ const save = function () {
|
|||||||
})
|
})
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
ElMessage.error({
|
ElMessage.error({
|
||||||
message: '更新失败,'+e.message,
|
message: '更新失败,' + e.message,
|
||||||
appendTo: '#password-form'
|
appendTo: '#password-form'
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -171,7 +171,7 @@
|
|||||||
/>
|
/>
|
||||||
<span class="send-btn">
|
<span class="send-btn">
|
||||||
<el-button @click="sendMessage">
|
<el-button @click="sendMessage">
|
||||||
<el-icon><Promotion /></el-icon>
|
<el-icon><Promotion/></el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@ -183,8 +183,9 @@
|
|||||||
</el-main>
|
</el-main>
|
||||||
</el-container>
|
</el-container>
|
||||||
|
|
||||||
<config-dialog :show="showConfigDialog" :models="models" @hide="showConfigDialog = false" @update-user="updateUser" />
|
<config-dialog :show="showConfigDialog" :models="models" @hide="showConfigDialog = false"
|
||||||
<password-dialog :show="showPasswordDialog" @hide="showPasswordDialog = false" @logout="logout" />
|
@update-user="updateUser"/>
|
||||||
|
<password-dialog :show="showPasswordDialog" @hide="showPasswordDialog = false" @logout="logout"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@ -440,9 +441,9 @@ const connect = function (chat_id, role_id) {
|
|||||||
let host = process.env.VUE_APP_WS_HOST
|
let host = process.env.VUE_APP_WS_HOST
|
||||||
if (host === '') {
|
if (host === '') {
|
||||||
if (location.protocol === 'https:') {
|
if (location.protocol === 'https:') {
|
||||||
host = 'wss://'+location.host;
|
host = 'wss://' + location.host;
|
||||||
} else {
|
} 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}`);
|
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')();
|
const md = require('markdown-it')();
|
||||||
|
// md.use(require('markdown-it-copy')); // 代码复制功能
|
||||||
for (let i = 0; i < data.length; i++) {
|
for (let i = 0; i < data.length; i++) {
|
||||||
if (data[i].type === "prompt") {
|
if (data[i].type === "prompt") {
|
||||||
chatData.value.push(data[i]);
|
chatData.value.push(data[i]);
|
||||||
@ -673,7 +675,7 @@ const loadChatHistory = function (chatId) {
|
|||||||
|
|
||||||
const stopGenerate = function () {
|
const stopGenerate = function () {
|
||||||
showStopGenerate.value = false;
|
showStopGenerate.value = false;
|
||||||
httpGet("/api/chat/stop?session_id=" + getSessionId() ).then(() => {
|
httpGet("/api/chat/stop?session_id=" + getSessionId()).then(() => {
|
||||||
canSend.value = true;
|
canSend.value = true;
|
||||||
if (previousText.value !== '') {
|
if (previousText.value !== '') {
|
||||||
showReGenerate.value = true;
|
showReGenerate.value = true;
|
||||||
@ -990,6 +992,7 @@ const updateUser = function (data) {
|
|||||||
|
|
||||||
.el-textarea {
|
.el-textarea {
|
||||||
max-width 600px;
|
max-width 600px;
|
||||||
|
|
||||||
.el-textarea__inner::-webkit-scrollbar {
|
.el-textarea__inner::-webkit-scrollbar {
|
||||||
width: 0;
|
width: 0;
|
||||||
height: 0;
|
height: 0;
|
||||||
@ -1004,7 +1007,7 @@ const updateUser = function (data) {
|
|||||||
.el-button {
|
.el-button {
|
||||||
padding 8px 5px;
|
padding 8px 5px;
|
||||||
border-radius 6px;
|
border-radius 6px;
|
||||||
background:rgb(25,195,125)
|
background: rgb(25, 195, 125)
|
||||||
color #ffffff;
|
color #ffffff;
|
||||||
font-size 20px;
|
font-size 20px;
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,13 @@ module.exports = defineConfig({
|
|||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.optimize.MinChunkSizePlugin({minChunkSize: 10000})
|
new webpack.optimize.MinChunkSizePlugin({minChunkSize: 10000})
|
||||||
]
|
],
|
||||||
|
// resolve: {
|
||||||
|
// fallback: {
|
||||||
|
// fs: false,
|
||||||
|
// path: require.resolve('path-browserify')
|
||||||
|
// }
|
||||||
|
// }
|
||||||
},
|
},
|
||||||
|
|
||||||
publicPath: '/',
|
publicPath: '/',
|
||||||
|
Loading…
Reference in New Issue
Block a user