From 4623651801a2fae89a8a767e69d1619417108c1f Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sat, 14 Feb 2026 15:57:24 +0000 Subject: [PATCH] Fix system prompt defaults and user ID retrieval - Update `app/actions.tsx` to fetch the system prompt using the authenticated user's ID via `getCurrentUserIdOnServer()`, falling back to 'anonymous' if not logged in. - Update the hardcoded default system prompt in `components/settings/components/settings.tsx` to a more relevant geospatial assistant prompt. - Fixes issue where custom system prompts were ignored during chat and 'Reset to Defaults' used a planetary copilot placeholder. Co-authored-by: ngoiyaeric <115367894+ngoiyaeric@users.noreply.github.com> --- app/actions.tsx | 3 ++- components/settings/components/settings.tsx | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/actions.tsx b/app/actions.tsx index 50e985bf..5da29303 100644 --- a/app/actions.tsx +++ b/app/actions.tsx @@ -22,6 +22,7 @@ import { SearchSection } from '@/components/search-section' import SearchRelated from '@/components/search-related' import { GeoJsonLayer } from '@/components/map/geojson-layer' import { ResolutionCarousel } from '@/components/resolution-carousel' +import { getCurrentUserIdOnServer } from '@/lib/auth/get-current-user' import { ResolutionImage } from '@/components/resolution-image' import { CopilotDisplay } from '@/components/copilot-display' import RetrieveSection from '@/components/retrieve-section' @@ -397,7 +398,7 @@ async function submit(formData?: FormData, skip?: boolean) { } as CoreMessage) } - const userId = 'anonymous' + const userId = (await getCurrentUserIdOnServer()) || 'anonymous' const currentSystemPrompt = (await getSystemPrompt(userId)) || '' const mapProvider = formData?.get('mapProvider') as 'mapbox' | 'google' diff --git a/components/settings/components/settings.tsx b/components/settings/components/settings.tsx index 7a526e18..3ef7fc6f 100644 --- a/components/settings/components/settings.tsx +++ b/components/settings/components/settings.tsx @@ -53,7 +53,7 @@ export type SettingsFormValues = z.infer // Default values const defaultValues: Partial = { systemPrompt: - "You are a planetary copilot, an AI assistant designed to help users with information about planets, space exploration, and astronomy. Provide accurate, educational, and engaging responses about our solar system and beyond.", + "You are an AI assistant designed to help users with geospatial data, mapping, and environment-aware insights. Provide accurate and helpful responses based on the available tools and context.", selectedModel: "Grok 4.2", users: [], }