Skip to content

Commit

Permalink
fix: stop openai inference raises something amiss (janhq#1799)
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-jan authored Jan 26, 2024
1 parent a7edd37 commit bdebbca
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions extensions/inference-openai-extension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export default class JanInferenceOpenAIExtension extends BaseExtension {
*/
private static async handleMessageRequest(
data: MessageRequest,
instance: JanInferenceOpenAIExtension
instance: JanInferenceOpenAIExtension,
) {
if (data.model.engine !== "openai") {
return;
Expand Down Expand Up @@ -176,7 +176,7 @@ export default class JanInferenceOpenAIExtension extends BaseExtension {
...JanInferenceOpenAIExtension._currentModel,
parameters: data.model.parameters,
},
instance.controller
instance.controller,
).subscribe({
next: (content) => {
const messageContent: ThreadContent = {
Expand All @@ -197,7 +197,7 @@ export default class JanInferenceOpenAIExtension extends BaseExtension {
},
error: async (err) => {
if (instance.isCancelled || message.content.length > 0) {
message.status = MessageStatus.Error;
message.status = MessageStatus.Stopped;
events.emit(MessageEvent.OnMessageUpdate, message);
return;
}
Expand All @@ -209,7 +209,7 @@ export default class JanInferenceOpenAIExtension extends BaseExtension {
},
};
message.content = [messageContent];
message.status = MessageStatus.Ready;
message.status = MessageStatus.Error;
events.emit(MessageEvent.OnMessageUpdate, message);
},
});
Expand Down

0 comments on commit bdebbca

Please sign in to comment.