From f7c2d034286d7fc6beeed5646631264e928eea51 Mon Sep 17 00:00:00 2001 From: aixianling Date: Mon, 19 Aug 2024 14:36:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E4=BD=8D=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/packages/ai/AiCopilot.vue | 35 ++++-- ui/packages/tools/AiLocateDialog.vue | 181 +++++++++++++++++++++++++++ 2 files changed, 207 insertions(+), 9 deletions(-) create mode 100644 ui/packages/tools/AiLocateDialog.vue diff --git a/ui/packages/ai/AiCopilot.vue b/ui/packages/ai/AiCopilot.vue index d6e9b73a..35c42224 100644 --- a/ui/packages/ai/AiCopilot.vue +++ b/ui/packages/ai/AiCopilot.vue @@ -2,7 +2,8 @@ import ChatContent from "./components/chatContent.vue"; import ThinkingBar from "./components/thinkingBar.vue"; import {mapState} from "vuex"; -import AiDrag from "../../dv/AiDrag.vue"; +import AiDrag from "../basic/AiDrag.vue"; +import AiLocateDialog from "../tools/AiLocateDialog.vue"; export default { name: "AiCopilot", @@ -21,26 +22,34 @@ export default { filter: "", conversations: [], currentConversation: null, - app: {} + app: {}, + locate: false, + latlng: "" } }, computed: { ...mapState(["user"]), profile: v => v.user.info || {}, expandBtn: v => v.expand ? "收起" : "展开", - btns: () => [ + btns: v => [ { label: "文件", icon: "https://cdn.sinoecare.com/i/2024/07/04/668663436e46e.png", click: () => { } + }, + { + label: "位置", icon: "https://cdn.sinoecare.com/i/2024/07/04/668663436e46e.png", click: () => { + v.locate = 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}, {icon: "https://cdn.sinoecare.com/i/2024/07/04/66866eda99e4d.png", label: "删除", click: row => v.handleDeleteConversation(row.conversationId)}, - ] + ], + dialogWidth: v => v.expand ? 960 : 468 }, - components: {AiDrag, ThinkingBar, ChatContent}, + components: {AiLocateDialog, AiDrag, ThinkingBar, ChatContent}, methods: { getHistory(params) { this.http.post("/app/appaicopilotinfo/list", null, {params}).then(res => { @@ -81,8 +90,8 @@ export default { if (++i < content.length) setTimeout(() => concatenateStr(content, i, target), 50) } this.$debounce(() => { - const {currentConversation: conversationId, app, prompt: content} = this.$data - const message = {appType: "2", userType: 0, content, conversationId, ...app} + const {currentConversation: conversationId, app, prompt: content, latlng} = this.$data + const message = {appType: "2", userType: 0, content, conversationId, ...app, supplementContent: latlng} this.history.push(message) this.loading = true this.prompt = "" @@ -122,6 +131,11 @@ export default { return { backgroundImage: `url(${icon})` } + }, + handleLocate(v) { + const {lat, lng} = v.location + this.latlng = [lat, lng].join(",") + this.locate = false } }, watch: { @@ -141,7 +155,7 @@ export default { @@ -252,14 +267,15 @@ export default { .content { height: calc(100% - 50px); + float: right; .left { width: 0; height: 100%; - transition: width 1s; padding: 14px 0; overflow-x: hidden; overflow-y: auto; + flex-shrink: 0; & > * { margin: 0 14px; @@ -422,6 +438,7 @@ export default { border-bottom: 1px solid #E0E0E0; margin-bottom: 10px; align-items: flex-start; + gap: 8px; .btn { font-size: 12px; diff --git a/ui/packages/tools/AiLocateDialog.vue b/ui/packages/tools/AiLocateDialog.vue new file mode 100644 index 00000000..81854ad1 --- /dev/null +++ b/ui/packages/tools/AiLocateDialog.vue @@ -0,0 +1,181 @@ + + + + +