mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-13 07:55:09 -05:00
Compare commits
2 Commits
main
...
fix/copilo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
04820a0075 | ||
|
|
09c9477091 |
@@ -85,7 +85,7 @@ const ChatMessageSchema = z.object({
|
|||||||
chatId: z.string().optional(),
|
chatId: z.string().optional(),
|
||||||
workflowId: z.string().optional(),
|
workflowId: z.string().optional(),
|
||||||
workflowName: z.string().optional(),
|
workflowName: z.string().optional(),
|
||||||
model: z.string().optional().default('claude-opus-4-6'),
|
model: z.string().optional().default('claude-opus-4-5'),
|
||||||
mode: z.enum(COPILOT_REQUEST_MODES).optional().default('agent'),
|
mode: z.enum(COPILOT_REQUEST_MODES).optional().default('agent'),
|
||||||
prefetch: z.boolean().optional(),
|
prefetch: z.boolean().optional(),
|
||||||
createNewChat: z.boolean().optional().default(false),
|
createNewChat: z.boolean().optional().default(false),
|
||||||
@@ -238,7 +238,7 @@ export async function POST(req: NextRequest) {
|
|||||||
let currentChat: any = null
|
let currentChat: any = null
|
||||||
let conversationHistory: any[] = []
|
let conversationHistory: any[] = []
|
||||||
let actualChatId = chatId
|
let actualChatId = chatId
|
||||||
const selectedModel = model || 'claude-opus-4-6'
|
const selectedModel = model || 'claude-opus-4-5'
|
||||||
|
|
||||||
if (chatId || createNewChat) {
|
if (chatId || createNewChat) {
|
||||||
const chatResult = await resolveOrCreateChat({
|
const chatResult = await resolveOrCreateChat({
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ import {
|
|||||||
|
|
||||||
const logger = createLogger('CopilotMcpAPI')
|
const logger = createLogger('CopilotMcpAPI')
|
||||||
const mcpRateLimiter = new RateLimiter()
|
const mcpRateLimiter = new RateLimiter()
|
||||||
const DEFAULT_COPILOT_MODEL = 'claude-opus-4-6'
|
const DEFAULT_COPILOT_MODEL = 'claude-opus-4-5'
|
||||||
|
|
||||||
export const dynamic = 'force-dynamic'
|
export const dynamic = 'force-dynamic'
|
||||||
export const runtime = 'nodejs'
|
export const runtime = 'nodejs'
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { resolveWorkflowIdForUser } from '@/lib/workflows/utils'
|
|||||||
import { authenticateV1Request } from '@/app/api/v1/auth'
|
import { authenticateV1Request } from '@/app/api/v1/auth'
|
||||||
|
|
||||||
const logger = createLogger('CopilotHeadlessAPI')
|
const logger = createLogger('CopilotHeadlessAPI')
|
||||||
const DEFAULT_COPILOT_MODEL = 'claude-opus-4-6'
|
const DEFAULT_COPILOT_MODEL = 'claude-opus-4-5'
|
||||||
|
|
||||||
const RequestSchema = z.object({
|
const RequestSchema = z.object({
|
||||||
message: z.string().min(1, 'message is required'),
|
message: z.string().min(1, 'message is required'),
|
||||||
|
|||||||
@@ -1042,7 +1042,7 @@ const cachedAutoAllowedTools = readAutoAllowedToolsFromStorage()
|
|||||||
// Initial state (subset required for UI/streaming)
|
// Initial state (subset required for UI/streaming)
|
||||||
const initialState = {
|
const initialState = {
|
||||||
mode: 'build' as const,
|
mode: 'build' as const,
|
||||||
selectedModel: 'anthropic/claude-opus-4-6' as CopilotStore['selectedModel'],
|
selectedModel: 'anthropic/claude-opus-4-5' as CopilotStore['selectedModel'],
|
||||||
agentPrefetch: false,
|
agentPrefetch: false,
|
||||||
availableModels: [] as AvailableModel[],
|
availableModels: [] as AvailableModel[],
|
||||||
isLoadingModels: false,
|
isLoadingModels: false,
|
||||||
@@ -2381,17 +2381,17 @@ export const useCopilotStore = create<CopilotStore>()(
|
|||||||
(model) => model.id === normalizedSelectedModel
|
(model) => model.id === normalizedSelectedModel
|
||||||
)
|
)
|
||||||
|
|
||||||
// Pick the best default: prefer claude-opus-4-6 with provider priority:
|
// Pick the best default: prefer claude-opus-4-5 with provider priority:
|
||||||
// direct anthropic > bedrock > azure-anthropic > any other.
|
// direct anthropic > bedrock > azure-anthropic > any other.
|
||||||
let nextSelectedModel = normalizedSelectedModel
|
let nextSelectedModel = normalizedSelectedModel
|
||||||
if (!selectedModelExists && normalizedModels.length > 0) {
|
if (!selectedModelExists && normalizedModels.length > 0) {
|
||||||
let opus46: AvailableModel | undefined
|
let opus45: AvailableModel | undefined
|
||||||
for (const prov of MODEL_PROVIDER_PRIORITY) {
|
for (const prov of MODEL_PROVIDER_PRIORITY) {
|
||||||
opus46 = normalizedModels.find((m) => m.id === `${prov}/claude-opus-4-6`)
|
opus45 = normalizedModels.find((m) => m.id === `${prov}/claude-opus-4-5`)
|
||||||
if (opus46) break
|
if (opus45) break
|
||||||
}
|
}
|
||||||
if (!opus46) opus46 = normalizedModels.find((m) => m.id.endsWith('/claude-opus-4-6'))
|
if (!opus45) opus45 = normalizedModels.find((m) => m.id.endsWith('/claude-opus-4-5'))
|
||||||
nextSelectedModel = opus46 ? opus46.id : normalizedModels[0].id
|
nextSelectedModel = opus45 ? opus45.id : normalizedModels[0].id
|
||||||
}
|
}
|
||||||
|
|
||||||
set({
|
set({
|
||||||
|
|||||||
Reference in New Issue
Block a user