mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-09 15:07:55 -05:00
fix(build): explicitly install shims module from anthropic and openai in stagehand route (#2350)
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { Stagehand } from '@browserbasehq/stagehand'
|
||||
import { type NextRequest, NextResponse } from 'next/server'
|
||||
import { z } from 'zod'
|
||||
import { env } from '@/lib/core/config/env'
|
||||
@@ -7,6 +6,8 @@ import { ensureZodObject, normalizeUrl } from '@/app/api/tools/stagehand/utils'
|
||||
|
||||
const logger = createLogger('StagehandAgentAPI')
|
||||
|
||||
type StagehandType = import('@browserbasehq/stagehand').Stagehand
|
||||
|
||||
const BROWSERBASE_API_KEY = env.BROWSERBASE_API_KEY
|
||||
const BROWSERBASE_PROJECT_ID = env.BROWSERBASE_PROJECT_ID
|
||||
|
||||
@@ -89,7 +90,7 @@ function substituteVariables(text: string, variables: Record<string, string> | u
|
||||
}
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
let stagehand: Stagehand | null = null
|
||||
let stagehand: StagehandType | null = null
|
||||
|
||||
try {
|
||||
const body = await request.json()
|
||||
@@ -157,6 +158,8 @@ export async function POST(request: NextRequest) {
|
||||
try {
|
||||
logger.info('Initializing Stagehand with Browserbase (v3)', { provider, modelName })
|
||||
|
||||
const { Stagehand } = await import('@browserbasehq/stagehand')
|
||||
|
||||
stagehand = new Stagehand({
|
||||
env: 'BROWSERBASE',
|
||||
apiKey: BROWSERBASE_API_KEY,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { Stagehand } from '@browserbasehq/stagehand'
|
||||
import { type NextRequest, NextResponse } from 'next/server'
|
||||
import { z } from 'zod'
|
||||
import { env } from '@/lib/core/config/env'
|
||||
@@ -7,6 +6,8 @@ import { ensureZodObject, normalizeUrl } from '@/app/api/tools/stagehand/utils'
|
||||
|
||||
const logger = createLogger('StagehandExtractAPI')
|
||||
|
||||
type StagehandType = import('@browserbasehq/stagehand').Stagehand
|
||||
|
||||
const BROWSERBASE_API_KEY = env.BROWSERBASE_API_KEY
|
||||
const BROWSERBASE_PROJECT_ID = env.BROWSERBASE_PROJECT_ID
|
||||
|
||||
@@ -21,7 +22,7 @@ const requestSchema = z.object({
|
||||
})
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
let stagehand: Stagehand | null = null
|
||||
let stagehand: StagehandType | null = null
|
||||
|
||||
try {
|
||||
const body = await request.json()
|
||||
@@ -93,6 +94,8 @@ export async function POST(request: NextRequest) {
|
||||
|
||||
logger.info('Initializing Stagehand with Browserbase (v3)', { provider, modelName })
|
||||
|
||||
const { Stagehand } = await import('@browserbasehq/stagehand')
|
||||
|
||||
stagehand = new Stagehand({
|
||||
env: 'BROWSERBASE',
|
||||
apiKey: BROWSERBASE_API_KEY,
|
||||
|
||||
@@ -79,7 +79,6 @@ const nextConfig: NextConfig = {
|
||||
'pino',
|
||||
'pino-pretty',
|
||||
'thread-stream',
|
||||
'@browserbasehq/stagehand',
|
||||
],
|
||||
experimental: {
|
||||
optimizeCss: true,
|
||||
|
||||
Reference in New Issue
Block a user