diff --git a/src/providers/Thread.tsx b/src/providers/Thread.tsx index 759853f4..f1873149 100644 --- a/src/providers/Thread.tsx +++ b/src/providers/Thread.tsx @@ -34,8 +34,18 @@ function getThreadSearchMetadata( } export function ThreadProvider({ children }: { children: ReactNode }) { - const [apiUrl] = useQueryState("apiUrl"); - const [assistantId] = useQueryState("assistantId"); + // Get environment variables + const envApiUrl: string | undefined = process.env.NEXT_PUBLIC_API_URL; + const envAssistantId: string | undefined = + process.env.NEXT_PUBLIC_ASSISTANT_ID; + + // Use URL params with env var fallbacks + const [apiUrl] = useQueryState("apiUrl", { + defaultValue: envApiUrl || "", + }); + const [assistantId] = useQueryState("assistantId", { + defaultValue: envAssistantId || "", + }); const [threads, setThreads] = useState([]); const [threadsLoading, setThreadsLoading] = useState(false);