mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-10 22:55:16 -05:00
Fix azure anthropic
This commit is contained in:
@@ -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(
|
||||
@@ -205,6 +205,7 @@ export async function POST(req: NextRequest) {
|
||||
userMessageId: userMessageIdToUse,
|
||||
mode,
|
||||
model: selectedModel,
|
||||
provider,
|
||||
conversationHistory,
|
||||
contexts: agentContexts,
|
||||
fileAttachments,
|
||||
|
||||
@@ -69,6 +69,7 @@ export interface SendMessageRequest {
|
||||
workflowId?: string
|
||||
mode?: CopilotMode | CopilotTransportMode
|
||||
model?: CopilotModelId
|
||||
provider?: string
|
||||
prefetch?: boolean
|
||||
createNewChat?: boolean
|
||||
stream?: boolean
|
||||
|
||||
@@ -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 }>
|
||||
@@ -58,6 +59,7 @@ export async function buildCopilotRequestPayload(
|
||||
userId,
|
||||
userMessageId,
|
||||
mode,
|
||||
provider,
|
||||
contexts,
|
||||
fileAttachments,
|
||||
commands,
|
||||
@@ -146,6 +148,7 @@ export async function buildCopilotRequestPayload(
|
||||
workflowId,
|
||||
userId,
|
||||
model: selectedModel,
|
||||
...(provider ? { provider } : {}),
|
||||
mode: transportMode,
|
||||
messageId: userMessageId,
|
||||
version: SIM_AGENT_VERSION,
|
||||
|
||||
@@ -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,
|
||||
@@ -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,
|
||||
@@ -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,
|
||||
@@ -1437,6 +1445,7 @@ export const useCopilotStore = create<CopilotStore>()(
|
||||
workflowId,
|
||||
mode: apiMode,
|
||||
model: selectedModel,
|
||||
provider: getSelectedProvider(get),
|
||||
prefetch: get().agentPrefetch,
|
||||
createNewChat: !currentChat,
|
||||
stream: true,
|
||||
|
||||
Reference in New Issue
Block a user