From 6d279e10194646139fb63bf8fddded84dfbc4777 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期日, 19 一月 2025 13:56:08 +0800 Subject: [PATCH] 剩余操作 --- src/components/chat/smallChat/index.vue | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 53 insertions(+), 3 deletions(-) diff --git a/src/components/chat/smallChat/index.vue b/src/components/chat/smallChat/index.vue index 10bb079..c63239b 100644 --- a/src/components/chat/smallChat/index.vue +++ b/src/components/chat/smallChat/index.vue @@ -84,7 +84,7 @@ import { AssistantContent } from './types'; import { agentStreamByPost } from '/@/api/ai/chat'; import { Logger } from '/@/model/logger/Logger'; -import type { OLMap } from '/@/model/map/OLMap'; +import { GaoDeSourceType, gaoDeSourceTypeMap, type OLMap } from '/@/model/map/OLMap'; import assistantPic from '/static/images/role/assistant-200x192.png'; import userPic from '/static/images/role/user-200x206.png'; import { useDrag } from '/@/hooks/useDrag'; @@ -103,7 +103,11 @@ const chatContainerRef = ref<HTMLDivElement>(null); -const { startDrag, style: chatContainerStyle, handleStyle } = useDrag({ +const { + startDrag, + style: chatContainerStyle, + handleStyle, +} = useDrag({ handle: chatHeaderRef, }); @@ -118,10 +122,35 @@ return result as ChatMessage<AssistantContent>; }; +const mockCommand = (question: string) => { + if (question === `鍒囨崲${gaoDeSourceTypeMap[GaoDeSourceType.Vector]}`) { + handleMapCommand({ operate: '鍒囨崲鏍囧噯鍦板浘' }); + return; + } else if (question === `鍒囨崲${gaoDeSourceTypeMap[GaoDeSourceType.Satellite]}`) { + handleMapCommand({ operate: '鍒囨崲鍗槦鍦板浘' }); + return; + } else if (question === `鍒囨崲${gaoDeSourceTypeMap[GaoDeSourceType.SatelliteRoad]}`) { + handleMapCommand({ operate: '鍒囨崲璺綉鍦板浘' }); + return; + } else if (question === '鏄剧ず璁惧') { + handleMapCommand({ operate: '鏄剧ず璁惧' }); + return; + } else if (question === '闅愯棌璁惧') { + handleMapCommand({ operate: '闅愯棌璁惧' }); + return; + } else if (question === '鑱氱劍璁惧') { + handleMapCommand({ operate: '鑱氱劍璁惧' }); + return; + } +} + const startStream = (question: string) => { if (lastIsInit) { showHistory.value = false; } + + // mockCommand(question); + // return; let haveMapOperate = false; agentStreamByPost( { @@ -157,6 +186,7 @@ last.content.isLoading = content.isLoading; } }; + const handleMapCommand = (command: any) => { if (!command) return; switch (command.operate) { @@ -166,6 +196,26 @@ case '缂╁皬': props.olMap.zoomOut(); + break; + case `鍒囨崲${gaoDeSourceTypeMap[GaoDeSourceType.Vector]}`: + props.olMap.setSourceType(GaoDeSourceType.Vector); + break; + case `鍒囨崲${gaoDeSourceTypeMap[GaoDeSourceType.Satellite]}`: + props.olMap.setSourceType(GaoDeSourceType.Satellite); + break; + + case `鍒囨崲${gaoDeSourceTypeMap[GaoDeSourceType.SatelliteRoad]}`: + props.olMap.setSourceType(GaoDeSourceType.SatelliteRoad); + break; + + case '鏄剧ず璁惧': + props.olMap.toggleMarkerOverlayVisible(true); + break; + case '闅愯棌璁惧': + props.olMap.toggleMarkerOverlayVisible(false); + break; + case '鑱氱劍璁惧': + props.olMap.adjustViewToMarkers(); break; } refreshAssistantMessage({ value: `宸叉墽琛屾搷浣�: ${command.operate}` }); @@ -215,7 +265,7 @@ const [userMessage, assistantMessage] = applyMessage(); const question = inputText.value; inputText.value = ''; - + startStream(question); }; -- Gitblit v1.9.3