@@ -12,7 +12,7 @@ import build, {
1212import { seedFromJson } from '../../../../../../test/mocks/seed' ;
1313import { db } from '../../../../../drizzle/db' ;
1414import { assertIsDefined } from '../../../../../utils/assertions' ;
15- import { APP_ITEMS_PREFIX } from '../../../../../utils/config' ;
15+ import { APP_ITEMS_PREFIX , OPENAI_GPT_VERSION } from '../../../../../utils/config' ;
1616import { OpenAILengthError , OpenAIUnknownStopError } from '../../../../../utils/errors' ;
1717import { getAccessToken } from '../test/fixtures' ;
1818import { FinishReason } from './chatBot.types' ;
@@ -304,6 +304,36 @@ describe('Chat Bot Tests', () => {
304304 expect ( response . statusCode ) . toEqual ( StatusCodes . BAD_REQUEST ) ;
305305 } ) ;
306306
307+ it ( 'OK if using accepted version but default to newer model' , async ( ) => {
308+ const { apps } = await seedFromJson ( { apps : [ { } ] } ) ;
309+ const {
310+ items : [ item ] ,
311+ actor,
312+ } = await seedFromJson ( {
313+ items : [
314+ {
315+ type : ItemType . APP ,
316+ memberships : [ { account : 'actor' } ] ,
317+ } ,
318+ ] ,
319+ } ) ;
320+ const chosenApp = apps [ 0 ] ;
321+
322+ assertIsDefined ( actor ) ;
323+ mockAuthenticate ( actor ) ;
324+ const token = await getAccessToken ( app , item , chosenApp ) ;
325+ const response = await app . inject ( {
326+ method : HttpMethod . Post ,
327+ url : `${ APP_ITEMS_PREFIX } /${ item . id } /${ CHAT_PATH } ?gptVersion=gpt-4` ,
328+ headers : {
329+ Authorization : `Bearer ${ token } ` ,
330+ } ,
331+ payload : DOCKER_MOCKED_BODY ,
332+ } ) ;
333+ expect ( response . statusCode ) . toEqual ( StatusCodes . OK ) ;
334+ expect ( response . json ( ) . model ) . toBe ( OPENAI_GPT_VERSION ) ;
335+ } ) ;
336+
307337 it ( 'Bad request if post chat with invalid temperature' , async ( ) => {
308338 const { apps } = await seedFromJson ( { apps : [ { } ] } ) ;
309339 const {
0 commit comments