From 08b980a5061e3cc17902164d695c9cabaf5a588d Mon Sep 17 00:00:00 2001 From: bracesproul Date: Thu, 10 Apr 2025 11:55:59 -0700 Subject: [PATCH] dont allow api key to be exposed to client --- src/providers/Stream.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/providers/Stream.tsx b/src/providers/Stream.tsx index 1345fd7..c12432c 100644 --- a/src/providers/Stream.tsx +++ b/src/providers/Stream.tsx @@ -131,8 +131,6 @@ export const StreamProvider: React.FC<{ children: ReactNode }> = ({ const envApiUrl: string | undefined = process.env.NEXT_PUBLIC_API_URL; const envAssistantId: string | undefined = process.env.NEXT_PUBLIC_ASSISTANT_ID; - const envApiKey: string | undefined = - process.env.NEXT_PUBLIC_LANGSMITH_API_KEY; // Use URL params with env var fallbacks const [apiUrl, setApiUrl] = useQueryState("apiUrl", { @@ -145,7 +143,7 @@ export const StreamProvider: React.FC<{ children: ReactNode }> = ({ // For API key, use localStorage with env var fallback const [apiKey, _setApiKey] = useState(() => { const storedKey = getApiKey(); - return storedKey || envApiKey || ""; + return storedKey || ""; }); const setApiKey = (key: string) => { @@ -157,7 +155,7 @@ export const StreamProvider: React.FC<{ children: ReactNode }> = ({ const finalApiUrl = apiUrl || envApiUrl; const finalAssistantId = assistantId || envAssistantId; - // If we're missing any required values, show the form + // Show the form if we: don't have an API URL, or don't have an assistant ID if (!finalApiUrl || !finalAssistantId) { return (