@@ -462,12 +462,19 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
462462 }
463463
464464 public async getPearAIAgentModels ( ) {
465- const response = await fetch ( `${ PEARAI_URL } /getPearAIAgentModels` )
466- if ( ! response . ok ) {
467- throw new Error ( `Failed to fetch models: ${ response . statusText } ` )
465+ try {
466+ const response = await fetch ( `${ PEARAI_URL } /getPearAIAgentModels` )
467+ if ( ! response . ok ) {
468+ throw new Error ( `Failed to fetch models: ${ response . statusText } ` )
469+ }
470+ const data = ( await response . json ( ) ) as PearAIAgentModelsConfig
471+ return data
472+ } catch ( error ) {
473+ vscode . window . showErrorMessage (
474+ "Failed to fetch PearAI Agent Models. PearAI services may be down, please contact PearAI Support." ,
475+ )
476+ return undefined
468477 }
469- const data = ( await response . json ( ) ) as PearAIAgentModelsConfig
470- return data
471478 }
472479
473480 public async initClineWithSubTask ( parent : Cline , task ?: string , images ?: string [ ] ) {
@@ -493,7 +500,15 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
493500 const modePrompt = customModePrompts ?. [ mode ] as PromptComponent
494501 const effectiveInstructions = [ globalInstructions , modePrompt ?. customInstructions ] . filter ( Boolean ) . join ( "\n\n" )
495502
496- const pearaiAgentModels = await this . getPearAIAgentModels ( )
503+ let pearaiAgentModels
504+
505+ try {
506+ pearaiAgentModels = await this . getPearAIAgentModels ( )
507+ } catch ( error ) {
508+ vscode . window . showErrorMessage (
509+ "Failed to fetch PearAI Agent Models. PearAI services may be down, please contact PearAI Support." ,
510+ )
511+ }
497512
498513 const cline = new Cline ( {
499514 provider : this ,
@@ -655,7 +670,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
655670 <script nonce="${ nonce } ">
656671 window.IMAGES_BASE_URI = "${ imagesUri } "
657672 </script>
658- <title>Roo Code </title>
673+ <title>Agent </title>
659674 </head>
660675 <body>
661676 <div id="root"></div>
0 commit comments