Skip to content

Commit

Permalink
fix: add engine in unload model request (#916)
Browse files Browse the repository at this point in the history
  • Loading branch information
marknguyen1302 authored Jul 25, 2024
1 parent bbcd90e commit 5caef68
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cortex-js/src/domain/abstracts/engine.abstract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ export abstract class EngineExtension extends Extension {
* Unloads a model from the engine.
* @param modelId
*/
async unloadModel(modelId: string): Promise<void> {}
async unloadModel(modelId: string, engine?: string): Promise<void> {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ export default class CortexProvider extends OAIEngineExtension {
).then(); // pipe error or void instead of throwing
}

override async unloadModel(modelId: string): Promise<void> {
override async unloadModel(modelId: string, engine?: string): Promise<void> {
return firstValueFrom(
this.httpService.post(this.unloadModelUrl, { model: modelId }),
this.httpService.post(this.unloadModelUrl, { model: modelId, engine }),
).then(); // pipe error or void instead of throwing
}

Expand Down
2 changes: 1 addition & 1 deletion cortex-js/src/usecases/models/models.usecases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ export class ModelsUsecases {
this.eventEmitter.emit('model.event', modelEvent);

return engine
.unloadModel(modelId)
.unloadModel(modelId, model.engine || Engines.llamaCPP)
.then(() => {
delete this.activeModelStatuses[modelId];
const modelEvent: ModelEvent = {
Expand Down

0 comments on commit 5caef68

Please sign in to comment.