Skip to content

Commit f56ab9a

Browse files
authored
Merge pull request #71 from trypear/1.8.8-hotfix
Added v1.8.8 hotfix
2 parents bfc299f + 4727943 commit f56ab9a

2 files changed

Lines changed: 14 additions & 11 deletions

File tree

src/api/providers/pearai/pearai.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export class PearAiHandler extends BaseProvider implements SingleCompletionHandl
8282
apiModelId: underlyingModel,
8383
})
8484
} else {
85+
// Use OpenAI fields here as we are using the same handler structure as OpenAI Hander lin PearAIGenericHandler
8586
this.handler = new PearAIGenericHandler({
8687
...options,
8788
openAiBaseUrl: PEARAI_URL,

src/api/providers/pearai/pearaiGeneric.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -221,28 +221,30 @@ export class PearAIGenericHandler extends BaseProvider implements SingleCompleti
221221
}
222222

223223
override getModel(): { id: string; info: ModelInfo } {
224-
const modelId = this.options.openAiModelId ?? "none"
224+
const modelId = this.options.openAiModelId
225225
// Prioritize serverside model info
226-
if (this.options.apiModelId && this.options.pearaiAgentModels) {
226+
if (modelId && this.options.pearaiAgentModels) {
227227
let modelInfo = null
228-
if (this.options.apiModelId.startsWith("pearai")) {
229-
modelInfo = this.options.pearaiAgentModels.models[this.options.apiModelId].underlyingModelUpdated
228+
if (modelId.startsWith("pearai")) {
229+
modelInfo = this.options.pearaiAgentModels.models[modelId].underlyingModelUpdated
230230
} else {
231-
modelInfo = this.options.pearaiAgentModels.models[this.options.apiModelId || "pearai-model"]
231+
modelInfo = this.options.pearaiAgentModels.models[modelId || "pearai-model"]
232232
}
233233
if (modelInfo) {
234-
return {
235-
id: this.options.apiModelId,
234+
const result = {
235+
id: modelId,
236236
info: modelInfo,
237237
}
238+
return result
238239
}
239240
}
240-
return {
241-
id: modelId,
242-
info: allModels[modelId],
241+
242+
const result = {
243+
id: modelId ?? pearAiDefaultModelId,
244+
info: allModels[modelId ?? pearAiDefaultModelId],
243245
}
246+
return result
244247
}
245-
246248
async completePrompt(prompt: string): Promise<string> {
247249
try {
248250
const requestOptions: OpenAI.Chat.Completions.ChatCompletionCreateParamsNonStreaming = {

0 commit comments

Comments
 (0)