Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix: resolve AI SDK URL and headers lazily to handle runtime redirects (#8973)

Myles Scolnick5d61c48df7f1
diff --git a/frontend/src/components/chat/chat-panel.tsx b/frontend/src/components/chat/chat-panel.tsx
index ce2185d404..40678773fc 100644
--- a/frontend/src/components/chat/chat-panel.tsx
+++ b/frontend/src/components/chat/chat-panel.tsx
@@ -465,7 +465,7 @@ const ChatPanelBody = () => {
messages: activeChat?.messages || [], // initial messages
transport: new DefaultChatTransport({
api: runtimeManager.getAiURL("chat").toString(),
- headers: runtimeManager.headers(),
+ headers: () => runtimeManager.headers(),
prepareSendMessagesRequest: async (options) => {
const completionBody = await buildCompletionRequestBody(
options.messages,
@@ -476,6 +476,7 @@ const ChatPanelBody = () => {
const tools = FRONTEND_TOOL_REGISTRY.getToolSchemas(chatMode);
return {
+ api: runtimeManager.getAiURL("chat").toString(),
body: {
tools,
...options,
diff --git a/frontend/src/components/editor/ai/add-cell-with-ai.tsx b/frontend/src/components/editor/ai/add-cell-with-ai.tsx
index dca2aaf72f..13e79609ee 100644
--- a/frontend/src/components/editor/ai/add-cell-with-ai.tsx
+++ b/frontend/src/components/editor/ai/add-cell-with-ai.tsx
@@ -122,7 +122,7 @@ export const AddCellWithAI: React.FC<{
transport: new StreamingChunkTransport(
{
api: runtimeManager.getAiURL("completion").toString(),
- headers: runtimeManager.headers(),
+ headers: () => runtimeManager.headers(),
prepareSendMessagesRequest: async (options) => {
const completionBody = await buildCompletionRequestBody(
options.messages,
@@ -136,6 +136,7 @@ export const AddCellWithAI: React.FC<{
};
return {
+ api: runtimeManager.getAiURL("completion").toString(),
body: body,
};
},