fix: conditionally import test models to resolve Node.js module errors in production (#1163)
This commit is contained in:
parent
9829b99ebe
commit
60b09d170c
1 changed files with 16 additions and 14 deletions
|
|
@ -4,23 +4,25 @@ import {
|
|||
wrapLanguageModel,
|
||||
} from 'ai';
|
||||
import { gateway } from '@ai-sdk/gateway';
|
||||
import {
|
||||
import { isTestEnvironment } from '../constants';
|
||||
|
||||
export const myProvider = isTestEnvironment
|
||||
? (() => {
|
||||
const {
|
||||
artifactModel,
|
||||
chatModel,
|
||||
reasoningModel,
|
||||
titleModel,
|
||||
} from './models.test';
|
||||
import { isTestEnvironment } from '../constants';
|
||||
|
||||
export const myProvider = isTestEnvironment
|
||||
? customProvider({
|
||||
} = require('./models.test');
|
||||
return customProvider({
|
||||
languageModels: {
|
||||
'chat-model': chatModel,
|
||||
'chat-model-reasoning': reasoningModel,
|
||||
'title-model': titleModel,
|
||||
'artifact-model': artifactModel,
|
||||
},
|
||||
})
|
||||
});
|
||||
})()
|
||||
: customProvider({
|
||||
languageModels: {
|
||||
'chat-model': gateway.languageModel('xai/grok-2-vision-1212'),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue