Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix azure anthropic
  • Loading branch information
Sg312 committed Feb 10, 2026
commit f959d787414d2581215f1aaad0244eaad9f765d7
3 changes: 2 additions & 1 deletion apps/sim/app/api/copilot/chat/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const ChatMessageSchema = z.object({
stream: z.boolean().optional().default(true),
implicitFeedback: z.string().optional(),
fileAttachments: z.array(FileAttachmentSchema).optional(),
provider: z.string().optional().default('openai'),
provider: z.string().optional(),
conversationId: z.string().optional(),
contexts: z
.array(
Expand Down Expand Up @@ -205,6 +205,7 @@ export async function POST(req: NextRequest) {
userMessageId: userMessageIdToUse,
mode,
model: selectedModel,
provider,
conversationHistory,
contexts: agentContexts,
fileAttachments,
Expand Down
1 change: 1 addition & 0 deletions apps/sim/lib/copilot/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export interface SendMessageRequest {
workflowId?: string
mode?: CopilotMode | CopilotTransportMode
model?: CopilotModelId
provider?: string
prefetch?: boolean
createNewChat?: boolean
stream?: boolean
Expand Down
3 changes: 3 additions & 0 deletions apps/sim/lib/copilot/chat-payload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface BuildPayloadParams {
userMessageId: string
mode: string
model: string
provider?: string
conversationHistory?: unknown[]
contexts?: Array<{ type: string; content: string }>
fileAttachments?: Array<{ id: string; key: string; size: number; [key: string]: unknown }>
Expand Down Expand Up @@ -58,6 +59,7 @@ export async function buildCopilotRequestPayload(
userId,
userMessageId,
mode,
provider,
contexts,
fileAttachments,
commands,
Expand Down Expand Up @@ -146,6 +148,7 @@ export async function buildCopilotRequestPayload(
workflowId,
userId,
model: selectedModel,
...(provider ? { provider } : {}),
mode: transportMode,
messageId: userMessageId,
version: SIM_AGENT_VERSION,
Expand Down
9 changes: 9 additions & 0 deletions apps/sim/stores/panel/copilot/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,12 @@ type InitiateStreamResult =
| { kind: 'success'; result: Awaited<ReturnType<typeof sendStreamingMessage>> }
| { kind: 'error'; error: unknown }

/** Look up the provider for the currently selected model from the available models list. */
function getSelectedProvider(get: CopilotGet): string | undefined {
const selectedModel = get().selectedModel
return get().availableModels.find((m) => m.id === selectedModel)?.provider
}

function prepareSendContext(
get: CopilotGet,
set: CopilotSet,
Expand Down Expand Up @@ -489,6 +495,7 @@ async function initiateStream(
workflowId: prepared.workflowId || undefined,
mode: apiMode,
model: get().selectedModel,
provider: getSelectedProvider(get),
prefetch: get().agentPrefetch,
createNewChat: !prepared.currentChat,
stream: prepared.stream,
Expand Down Expand Up @@ -866,6 +873,7 @@ async function resumeFromLiveStream(
chatId: resume.nextStream.chatId || get().currentChat?.id || undefined,
mode: get().mode === 'ask' ? 'ask' : get().mode === 'plan' ? 'plan' : 'agent',
model: get().selectedModel,
provider: getSelectedProvider(get),
prefetch: get().agentPrefetch,
stream: true,
resumeFromEventId: resume.resumeFromEventId,
Expand Down Expand Up @@ -1437,6 +1445,7 @@ export const useCopilotStore = create<CopilotStore>()(
workflowId,
mode: apiMode,
model: selectedModel,
provider: getSelectedProvider(get),
prefetch: get().agentPrefetch,
createNewChat: !currentChat,
stream: true,
Expand Down