diff --git a/web/src/components/ConfigDialog.vue b/web/src/components/ConfigDialog.vue index 7530917f..c8b16514 100644 --- a/web/src/components/ConfigDialog.vue +++ b/web/src/components/ConfigDialog.vue @@ -156,9 +156,11 @@ export default defineComponent({ mounted() { // 获取用户信息 const data = getLoginUser(); - this.user = data.user; - this.user['active_time'] = dateFormat(this.user['active_time']); - this.user['expired_time'] = dateFormat(this.user['expired_time']); + if (data !== null) { + this.user = data["user"]; + this.user['active_time'] = dateFormat(this.user['active_time']); + this.user['expired_time'] = dateFormat(this.user['expired_time']); + } }, methods: { save: function () { diff --git a/web/src/utils/storage.js b/web/src/utils/storage.js index 86aaad53..b0f749df 100644 --- a/web/src/utils/storage.js +++ b/web/src/utils/storage.js @@ -20,6 +20,6 @@ export function getLoginUser() { } } -export function setLoginUser(value) { - sessionStorage.setItem(SessionUserKey, JSON.stringify(value)) +export function setLoginUser(user) { + sessionStorage.setItem(SessionUserKey, JSON.stringify(user)) } \ No newline at end of file diff --git a/web/src/views/ChatPlus.vue b/web/src/views/ChatPlus.vue index 3b18ae67..5c63e902 100644 --- a/web/src/views/ChatPlus.vue +++ b/web/src/views/ChatPlus.vue @@ -12,18 +12,36 @@
- - - - - +
@@ -141,7 +159,7 @@ import ChatPrompt from "@/components/plus/ChatPrompt.vue"; import ChatReply from "@/components/plus/ChatReply.vue"; import {isMobile, randString} from "@/utils/libs"; import {ElMessage, ElMessageBox} from 'element-plus' -import {Tools, Lock, Delete, Picture, Search} from '@element-plus/icons-vue' +import {Tools, Lock, Delete, Picture, Search, ArrowDown, Monitor} from '@element-plus/icons-vue' import ConfigDialog from '@/components/ConfigDialog.vue' import {httpPost, httpGet} from "@/utils/http"; import {getSessionId, setLoginUser} from "@/utils/storage"; @@ -150,7 +168,7 @@ import 'highlight.js/styles/a11y-dark.css' export default defineComponent({ name: "ChatPlus", - components: {Search, ChatPrompt, ChatReply, Tools, Lock, Delete, Picture, ConfigDialog}, + components: {ArrowDown, Search, ChatPrompt, ChatReply, Tools, Lock, Delete, Picture, Monitor, ConfigDialog}, data() { return { title: 'ChatGPT 控制台', @@ -372,8 +390,10 @@ export default defineComponent({ target.blur(); } - if (this.sending || this.inputValue.trim().length === 0) { + if (this.inputValue.trim().length === 0) { return false; + } else if (this.sending) { + ElMessage.warning("AI 正在作答中请稍后...") } // 追加消息 @@ -509,12 +529,24 @@ export default defineComponent({ justify-content flex-end; align-items center; - .el-image { - margin-right 5px; - } + .user-info { + margin-left 20px; - .clear-history, .config { - margin-left 5px; + .el-dropdown-link { + cursor pointer + + img { + width 30px; + height 30px; + border-radius 50%; + } + + .el-icon { + bottom 8px + color #cccccc + margin-left 5px; + } + } } }