From 7385b6c2b3ba3b4a1a2e6482db9ff63be0c235c8 Mon Sep 17 00:00:00 2001
From: wujingjing <gersonwu@qq.com>
Date: 星期五, 22 十一月 2024 10:31:36 +0800
Subject: [PATCH] 经纬度

---
 src/components/chat/Chat.vue |   10 +++++++++-
 src/stores/chatRoom.ts       |    2 ++
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/src/components/chat/Chat.vue b/src/components/chat/Chat.vue
index d55c3d9..2e6bd2a 100644
--- a/src/components/chat/Chat.vue
+++ b/src/components/chat/Chat.vue
@@ -307,6 +307,7 @@
 import { ErrorCode } from '/@/utils/request';
 import { toMyFixed } from '/@/utils/util';
 import { findLast, orderBy } from 'lodash-es';
+import { getCurrentPosition } from '/@/utils/brower';
 const chatWidth = '75%';
 const voicePageIsShow = ref(false);
 let isTalking = ref(false);
@@ -422,7 +423,7 @@
 
 const DEFAULT_SECTION_A_ID = 'knowledge_base';
 let questionRes = null;
-
+let position = null;
 let finalCalcSectionAId = null;
 const questionAi = async (text) => {
 	let judgeParams = null;
@@ -463,6 +464,12 @@
 		raw_mode: roomConfig.value?.[currentRouteId]?.isAnswerByLLM ?? false,
 		...judgeParams,
 	} as any;
+
+	if (position) {
+		const longitude = position.coords.longitude;
+		const latitude = position.coords.latitude;
+		params.cur_pos = [longitude, latitude].join(',');
+	}
 
 	if (activeGroupType.value) {
 		params.group_type = activeGroupType.value;
@@ -547,6 +554,7 @@
 		ElMessage.warning('ai 姝e湪鍥炲涓紝璇风◢鍚庡皾璇曟彁闂�');
 		return;
 	}
+	position = position ?? (await getCurrentPosition());
 
 	const isNewChat = messageList.value.length === 0;
 	if (isNewChat) {
diff --git a/src/stores/chatRoom.ts b/src/stores/chatRoom.ts
index a147283..67af8b5 100644
--- a/src/stores/chatRoom.ts
+++ b/src/stores/chatRoom.ts
@@ -6,6 +6,7 @@
 import emitter from '../utils/mitt';
 import { gotoRoute } from '../utils/route';
 import { Local } from '../utils/storage';
+
 /**
  * Room 鍏宠仈鐨勪竴浜涢厤缃�
  */
@@ -229,3 +230,4 @@
 		reject(error);
 	});
 };
+

--
Gitblit v1.9.3