mirror of
https://github.com/escalante29/WealthySmart.git
synced 2026-07-17 14:28:47 +02:00
Agent: resolve "today" in the browser's timezone, not hardcoded CR
The CR-hardcoded today broke two scenarios: the owner traveling, and any future non-CR user. Now the provider sends the browser's IANA timezone (X-Client-Timezone) with every CopilotKit request — the runtime forwards x-* headers to the agent on its own — and the backend binds it to a per-request ContextVar next to the DB session. get_current_date and the future-cuota bounds use it; the tool also reports the timezone so the model can echo it. Unknown or absent zones (n8n posts, tests) fall back to Costa Rica; comma-joined duplicate header values are tolerated. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -77,7 +77,17 @@ export default function App() {
|
||||
<PrivacyProvider>
|
||||
<AuthProvider>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<CopilotKit runtimeUrl="/api/copilotkit" agent="wealthysmart">
|
||||
<CopilotKit
|
||||
runtimeUrl="/api/copilotkit"
|
||||
agent="wealthysmart"
|
||||
headers={{
|
||||
// Lets the agent resolve "hoy"/"este mes" in the user's
|
||||
// local time wherever they are; backend falls back to
|
||||
// Costa Rica when absent.
|
||||
"X-Client-Timezone":
|
||||
Intl.DateTimeFormat().resolvedOptions().timeZone,
|
||||
}}
|
||||
>
|
||||
<AppRoutes />
|
||||
<Toaster richColors position="top-right" closeButton />
|
||||
</CopilotKit>
|
||||
|
||||
Reference in New Issue
Block a user