当需要定位的模型,在对话时未获取到位置
则该条对话记录 不应该发送出去
This commit is contained in:
		| @@ -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}) | ||||
|     }) | ||||
|   } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user