From de86b003fa7c7d3ac0744f8216cb315ac373c3ed Mon Sep 17 00:00:00 2001 From: aixianling Date: Thu, 22 Aug 2024 14:17:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BD=93=E9=9C=80=E8=A6=81=E5=AE=9A=E4=BD=8D?= =?UTF-8?q?=E7=9A=84=E6=A8=A1=E5=9E=8B=EF=BC=8C=E5=9C=A8=E5=AF=B9=E8=AF=9D?= =?UTF-8?q?=E6=97=B6=E6=9C=AA=E8=8E=B7=E5=8F=96=E5=88=B0=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=20=E5=88=99=E8=AF=A5=E6=9D=A1=E5=AF=B9=E8=AF=9D=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=20=E4=B8=8D=E5=BA=94=E8=AF=A5=E5=8F=91=E9=80=81?= =?UTF-8?q?=E5=87=BA=E5=8E=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/packages/ai/AiCopilot.vue | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/ui/packages/ai/AiCopilot.vue b/ui/packages/ai/AiCopilot.vue index 0c73b4de..50404fd2 100644 --- a/ui/packages/ai/AiCopilot.vue +++ b/ui/packages/ai/AiCopilot.vue @@ -31,17 +31,18 @@ export default { ...mapState(["user"]), profile: v => v.user.info || {}, expandBtn: v => v.expand ? "收起" : "展开", + isNeedPosition: v => ["1"].includes(v.app.ability), btns: v => [ { label: "文件", icon: "https://cdn.sinoecare.com/i/2024/07/04/668663436e46e.png", click: () => { } }, { - label: "位置", icon: "https://cdn.sinoecare.com/i/2024/08/19/66c2f907bd444.png", click: () => { + label: "位置", icon: "https://cdn.sinoecare.com/i/2024/08/19/66c2f907bd444.png", hide: !v.isNeedPosition, click: () => { v.locate = true } } - ], + ].filter(e => e.hide !== true), rowBtns: v => [ {icon: "https://cdn.sinoecare.com/i/2024/07/04/66866edc2910a.png", label: "置顶", click: row => 0}, {icon: "https://cdn.sinoecare.com/i/2024/07/04/66866ed734540.png", label: "编辑", click: row => 0}, @@ -85,6 +86,7 @@ export default { }, handleSend() { if (!this.prompt.trim()) return this.$message.error("无法发送空白信息") + else if (this.isNeedPosition && !this.latlng) return this.$message.error("请先选择您所在的位置") const concatenateStr = (content, i = 0, target = this.history.at(-1)) => { target.content += content.slice(i, i + 1) if (++i < content.length) setTimeout(() => concatenateStr(content, i, target), 50) @@ -118,13 +120,13 @@ export default { }).catch(() => 0) }, handleChangeApp(item) { - const {appId, id: aiConfigId} = item - this.handleChangeConversation({appId, aiConfigId}) + const {appId, id: aiConfigId, ability} = item + this.handleChangeConversation({appId, aiConfigId, ability}) this.history = [{userType: 2, content: `当前应用已切换至【${item.appName}】`}] }, - handleChangeConversation({conversationId, appId, aiConfigId} = {}) { + handleChangeConversation({conversationId, appId, aiConfigId, ability} = {}) { this.currentConversation = conversationId - this.app = {appId, aiConfigId} + this.app = {appId, aiConfigId, ability} }, getIcon(item = {}) { const icon = item.appIconUrl || "https://cdn.sinoecare.com/i/2024/07/04/66864da1684ad.png" @@ -145,8 +147,8 @@ export default { }, created() { Promise.all([this.getApps(), this.getConversations()]).then(() => { - const {appId, id: aiConfigId} = this.apps.at(0) - this.handleChangeConversation(this.conversations.at(0) || {appId, aiConfigId}) + const {appId, id: aiConfigId, ability} = this.apps.at(0) + this.handleChangeConversation(this.conversations.at(0) || {appId, aiConfigId, ability}) }) }