-
-
Notifications
You must be signed in to change notification settings - Fork 7
Reset branch to commit bf6043b #498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,26 @@ | |
| import { useEffect } from 'react'; | ||
| import { useMapData } from './map-data-context'; | ||
| import { useMapToggle, MapToggleEnum } from '../map-toggle-context'; | ||
| import { ToolOutput } from '@/lib/types/tools'; | ||
|
|
||
| // Define the expected structure of the mcp_response from geospatialTool | ||
| interface McpResponseData { | ||
| location: { | ||
| latitude?: number; | ||
| longitude?: number; | ||
| place_name?: string; | ||
| address?: string; | ||
| }; | ||
| mapUrl?: string; | ||
| } | ||
|
|
||
| interface ToolOutput { | ||
| type: string; | ||
| originalUserInput?: string; | ||
| timestamp: string; | ||
| mcp_response?: McpResponseData | null; | ||
| features?: any[]; | ||
| error?: string | null; | ||
| } | ||
|
Comment on lines
+7
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
SuggestionReintroduce a single shared Reply with "@CharlieHelps yes please" if you'd like me to add a commit with this suggestion. |
||
|
|
||
| interface MapQueryHandlerProps { | ||
| toolOutput?: ToolOutput | null; | ||
|
|
@@ -14,12 +33,7 @@ export const MapQueryHandler: React.FC<MapQueryHandlerProps> = ({ toolOutput }) | |
| const { setMapType } = useMapToggle(); | ||
|
|
||
| useEffect(() => { | ||
| if (!toolOutput) { | ||
| if (process.env.NODE_ENV === 'development') { | ||
| console.warn('MapQueryHandler: missing toolOutput'); | ||
| } | ||
| return; | ||
| } | ||
| if (!toolOutput) return; | ||
|
|
||
| if (toolOutput.type === 'DRAWING_TRIGGER' && toolOutput.features) { | ||
| console.log('MapQueryHandler: Received drawing data.', toolOutput.features); | ||
|
|
@@ -28,25 +42,19 @@ export const MapQueryHandler: React.FC<MapQueryHandlerProps> = ({ toolOutput }) | |
| ...prevData, | ||
| pendingFeatures: toolOutput.features | ||
| })); | ||
| } else if (toolOutput.type === 'MAP_QUERY_TRIGGER') { | ||
| if (toolOutput.mcp_response && toolOutput.mcp_response.location) { | ||
| const { latitude, longitude, place_name } = toolOutput.mcp_response.location; | ||
|
|
||
| if (typeof latitude === 'number' && typeof longitude === 'number') { | ||
| console.log(`MapQueryHandler: Received data from geospatialTool. Place: ${place_name}, Lat: ${latitude}, Lng: ${longitude}`); | ||
| setMapData(prevData => ({ | ||
| ...prevData, | ||
| targetPosition: { lat: latitude, lng: longitude }, | ||
| mapFeature: { | ||
| place_name, | ||
| mapUrl: toolOutput.mcp_response?.mapUrl | ||
| } | ||
| })); | ||
| } else { | ||
| console.warn('MapQueryHandler: invalid MAP_QUERY_TRIGGER payload', { toolOutput, mcp_response: toolOutput.mcp_response }); | ||
| } | ||
| } else { | ||
| console.warn('MapQueryHandler: invalid MAP_QUERY_TRIGGER payload', { toolOutput, mcp_response: toolOutput?.mcp_response }); | ||
| } else if (toolOutput.type === 'MAP_QUERY_TRIGGER' && toolOutput.mcp_response && toolOutput.mcp_response.location) { | ||
| const { latitude, longitude, place_name } = toolOutput.mcp_response.location; | ||
|
|
||
| if (typeof latitude === 'number' && typeof longitude === 'number') { | ||
| console.log(`MapQueryHandler: Received data from geospatialTool. Place: ${place_name}, Lat: ${latitude}, Lng: ${longitude}`); | ||
| setMapData(prevData => ({ | ||
| ...prevData, | ||
| targetPosition: { lat: latitude, lng: longitude }, | ||
| mapFeature: { | ||
| place_name, | ||
| mapUrl: toolOutput.mcp_response?.mapUrl | ||
| } | ||
| })); | ||
| } | ||
| } | ||
| }, [toolOutput, setMapData, setMapType]); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switching from
sonnertoreact-toastifyis a breaking change unless the app is already configured withToastContainerand CSS imports. In this diff there’s no corresponding setup, so runtime toasts may silently fail or look unstyled.Suggestion
Either revert to the previously configured toast library (
sonner) or ensurereact-toastifyis globally configured (e.g.,<ToastContainer />in the root layout and the CSS import once). If you keepreact-toastify, add/verify the app-wide setup in the same PR to avoid a partial migration.Reply with "@CharlieHelps yes please" if you'd like me to add a commit with this suggestion.