From 22140933cd5b6e49dcebf044b11a4d9386dcf481 Mon Sep 17 00:00:00 2001 From: hsinlun <43398440+hsinlun99@users.noreply.github.com> Date: Wed, 19 Jun 2024 14:56:01 +0800 Subject: [PATCH] feat: :sparkles: add warmup markers for llm usage (#155) --- src/api/gpt/index.ts | 9 +- .../data/gpt/warmup-markers-position.json | 144 ++++++++++++++++++ src/components/modal/LlmInput/index.tsx | 1 + 3 files changed, 153 insertions(+), 1 deletion(-) create mode 100644 src/assets/data/gpt/warmup-markers-position.json diff --git a/src/api/gpt/index.ts b/src/api/gpt/index.ts index b2ed23b4..cd3b6999 100644 --- a/src/api/gpt/index.ts +++ b/src/api/gpt/index.ts @@ -3,6 +3,7 @@ import env from "../../constants/env"; import referenceData from "../../assets/data/gpt/reference.json"; import markersPosition from "../../assets/data/gpt/markers-position.json"; import multiFloorMarkersPosition from "../../assets/data/gpt/multi-floor-markers-position.json"; +import warmUpMarkersPosition from "../../assets/data/gpt/warmup-markers-position.json"; import { PoisForGpt } from "../../models/poi"; import { changeStatusToEnglish } from "../../constants/gpt"; @@ -196,6 +197,7 @@ function find_closest_facility( floor: string, location: string, item: string, + clusterId: string, ) { const locationPosition = ( referenceData as { @@ -206,8 +208,13 @@ function find_closest_facility( const floorNumber = transFloorFromChineseToNumber(floor); - const candidateMarkersPosition = + const warmUpRegex = /TEST/; + + const markersPositionToUse = id === "m" ? multiFloorMarkersPosition : markersPosition; + const candidateMarkersPosition = warmUpRegex.test(clusterId) + ? warmUpMarkersPosition + : markersPositionToUse; const itemPositions = Object.entries(candidateMarkersPosition).find(([key]) => key.startsWith(item), diff --git a/src/assets/data/gpt/warmup-markers-position.json b/src/assets/data/gpt/warmup-markers-position.json new file mode 100644 index 00000000..a1bbf16d --- /dev/null +++ b/src/assets/data/gpt/warmup-markers-position.json @@ -0,0 +1,144 @@ +{ + "一般座位區": { + "一般座位區1-4": { + "位址": [ + 24.787581626232452, + 120.9974750397691 + ] + }, + "一般座位區1-1": { + "位址": [ + 24.787617765827697, + 120.99782313402345 + ] + }, + "一般座位區1-2": { + "位址": [ + 24.787557376622196, + 120.99770362831647 + ] + }, + "一般座位區1-3": { + "位址": [ + 24.787513544936825, + 120.99757488228376 + ] + } + }, + "公用電腦": { + "公用電腦1-5": { + "位址": [ + 24.78776321383609, + 120.99767703600573 + ] + }, + "公用電腦1-1": { + "位址": [ + 24.78776321383609, + 120.99793044297562 + ] + }, + "公用電腦1-6": { + "位址": [ + 24.78771572958834, + 120.99792977242336 + ] + }, + "公用電腦1-10": { + "位址": [ + 24.78771572958834, + 120.99767703600573 + ] + }, + "公用電腦1-4": { + "位址": [ + 24.78776321383609, + 120.99774738673945 + ] + }, + "公用電腦1-9": { + "位址": [ + 24.78771572958834, + 120.99774738673945 + ] + }, + "公用電腦1-3": { + "位址": [ + 24.78776321383609, + 120.9978077374732 + ] + }, + "公用電腦1-8": { + "位址": [ + 24.78771572958834, + 120.9978077374732 + ] + }, + "公用電腦1-2": { + "位址": [ + 24.78776321383609, + 120.997868088207 + ] + }, + "公用電腦1-7": { + "位址": [ + 24.78771572958834, + 120.997868088207 + ] + } + }, + "飲水機": { + "飲水機1-1": { + "位址": [ + 24.787781678119718, + 120.99799272070766 + ] + }, + "飲水機1-2": { + "位址": [ + 24.78804354948574, + 120.99759087157781 + ] + } + }, + "路邊一般停車位": { + "路邊一般停車位1-1": { + "位址": [ + 24.78789220637148, + 120.99736439864724 + ] + }, + "路邊一般停車位1-2": { + "位址": [ + 24.78779293166175, + 120.99736573975174 + ] + }, + "路邊一般停車位1-3": { + "位址": [ + 24.787717746153564, + 120.99736573975174 + ] + }, + "路邊一般停車位1-4": { + "位址": [ + 24.787606150485715, + 120.99736976306527 + ] + }, + "路邊一般停車位1-5": { + "位址": [ + 24.78753275093158, + 120.99736258827416 + ] + } + }, + "路邊無障礙停車位": { + "路邊無障礙停車位1-1": { + "位址": [ + 24.787979942973173, + 120.99735553852841 + ] + } + } +} \ No newline at end of file diff --git a/src/components/modal/LlmInput/index.tsx b/src/components/modal/LlmInput/index.tsx index d5a3755d..a618704b 100644 --- a/src/components/modal/LlmInput/index.tsx +++ b/src/components/modal/LlmInput/index.tsx @@ -110,6 +110,7 @@ const LlmInput: React.FC = () => { floor, location_input[0], item_input, + id ?? "", ); targetMarker = tmpTargetMarker;