Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/api/providers/pearai/pearai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export class PearAiHandler extends BaseProvider implements SingleCompletionHandl
apiModelId: underlyingModel,
})
} else {
// Use OpenAI fields here as we are using the same handler structure as OpenAI Hander lin PearAIGenericHandler
this.handler = new PearAIGenericHandler({
...options,
openAiBaseUrl: PEARAI_URL,
Expand Down
24 changes: 13 additions & 11 deletions src/api/providers/pearai/pearaiGeneric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,28 +221,30 @@ export class PearAIGenericHandler extends BaseProvider implements SingleCompleti
}

override getModel(): { id: string; info: ModelInfo } {
const modelId = this.options.openAiModelId ?? "none"
const modelId = this.options.openAiModelId
// Prioritize serverside model info
if (this.options.apiModelId && this.options.pearaiAgentModels) {
if (modelId && this.options.pearaiAgentModels) {
let modelInfo = null
if (this.options.apiModelId.startsWith("pearai")) {
modelInfo = this.options.pearaiAgentModels.models[this.options.apiModelId].underlyingModelUpdated
if (modelId.startsWith("pearai")) {
modelInfo = this.options.pearaiAgentModels.models[modelId].underlyingModelUpdated
} else {
modelInfo = this.options.pearaiAgentModels.models[this.options.apiModelId || "pearai-model"]
modelInfo = this.options.pearaiAgentModels.models[modelId || "pearai-model"]
}
if (modelInfo) {
return {
id: this.options.apiModelId,
const result = {
id: modelId,
info: modelInfo,
}
return result
}
}
return {
id: modelId,
info: allModels[modelId],

const result = {
id: modelId ?? pearAiDefaultModelId,
info: allModels[modelId ?? pearAiDefaultModelId],
}
return result
}

async completePrompt(prompt: string): Promise<string> {
try {
const requestOptions: OpenAI.Chat.Completions.ChatCompletionCreateParamsNonStreaming = {
Expand Down
19 changes: 13 additions & 6 deletions src/core/webview/ClineProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -462,12 +462,19 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
}

public async getPearAIAgentModels() {
const response = await fetch(`${PEARAI_URL}/getPearAIAgentModels`)
if (!response.ok) {
throw new Error(`Failed to fetch models: ${response.statusText}`)
try {
const response = await fetch(`${PEARAI_URL}/getPearAIAgentModels`)
if (!response.ok) {
throw new Error(`Failed to fetch models: ${response.statusText}`)
}
const data = (await response.json()) as PearAIAgentModelsConfig
return data
} catch (error) {
vscode.window.showErrorMessage(
"Failed to fetch PearAI Agent Models. PearAI services may be down, please contact PearAI Support.",
)
return undefined
}
const data = (await response.json()) as PearAIAgentModelsConfig
return data
}

public async initClineWithSubTask(parent: Cline, task?: string, images?: string[]) {
Expand Down Expand Up @@ -655,7 +662,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
<script nonce="${nonce}">
window.IMAGES_BASE_URI = "${imagesUri}"
</script>
<title>Roo Code</title>
<title>Agent</title>
</head>
<body>
<div id="root"></div>
Expand Down
2 changes: 1 addition & 1 deletion src/integrations/editor/DiffViewProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ export class DiffViewProvider {
query: Buffer.from(this.originalContent ?? "").toString("base64"),
}),
uri,
`${fileName}: ${fileExists ? "Original ↔ Roo's Changes" : "New File"} (Editable)`,
`${fileName}: ${fileExists ? "Original ↔ Agent's Changes" : "New File"} (Editable)`,
)
// This may happen on very slow machines ie project idx
setTimeout(() => {
Expand Down
Loading