Skip to content

Commit

Permalink
fix: wrong remote engine payload (#911)
Browse files Browse the repository at this point in the history
  • Loading branch information
marknguyen1302 authored Jul 25, 2024
1 parent b66b761 commit 65e0670
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cortex-js/src/usecases/chat/chat.usecases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { CreateEmbeddingsDto } from '@/infrastructure/dtos/embeddings/embeddings
import { FileManagerService } from '@/infrastructure/services/file-manager/file-manager.service';
import { Engines } from '@/infrastructure/commanders/types/engine.interface';
import { ModelsUsecases } from '../models/models.usecases';
import { isRemoteEngine } from '@/utils/normalize-model-id';

@Injectable()
export class ChatUsecases {
Expand Down Expand Up @@ -49,9 +50,13 @@ export class ChatUsecases {
if (engine == null) {
throw new Error(`No engine found with name: ${model.engine}`);
}
const payload = {
...createChatDto,
...(model.engine && isRemoteEngine(model.engine) && { engine: model.engine }),
};
try {
return await engine.inference(
{ ...createChatDto, engine: model.engine },
payload,
headers,
);
} catch (error) {
Expand Down

0 comments on commit 65e0670

Please sign in to comment.