File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ,
Original file line number Diff line number Diff 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 = {
You can’t perform that action at this time.
0 commit comments