Skip to content

Commit dcbdf9f

Browse files
committed
Merge remote-tracking branch 'origin/main' into merge/1.109.0
2 parents 57ca2fa + 5576829 commit dcbdf9f

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/extension/conversation/vscode-node/languageModelAccess.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,23 @@ export class LanguageModelAccess extends Disposable implements IExtensionContrib
312312
progress: vscode.Progress<vscode.LanguageModelResponsePart2>,
313313
token: vscode.CancellationToken
314314
): Promise<void> {
315+
// --- Start Positron ---
316+
/*
315317
const endpoint = this._chatEndpoints.find(e => e.model === ModelAliasRegistry.resolveAlias(model.id));
318+
*/
319+
// This vscode.lm path fails for the 'auto' pseudo-model because its .model
320+
// property reflects the wrapped endpoint (e.g. 'gpt-4o'), not the pseudo-id
321+
// 'auto', so the alias lookup finds no match. The built-in copilot participant's
322+
// path already handles this via a pseudoModelId check in
323+
// endpointProviderImpl.ts getChatEndpoint().
324+
let endpoint: IChatEndpoint | undefined;
325+
if (model.id === AutoChatEndpoint.pseudoModelId) {
326+
endpoint = this._chatEndpoints.find(e => e instanceof AutoChatEndpoint);
327+
} else {
328+
endpoint = this._chatEndpoints.find(e => e.model === ModelAliasRegistry.resolveAlias(model.id));
329+
}
330+
// --- End Positron ---
331+
316332
if (!endpoint) {
317333
throw new Error(`Endpoint not found for model ${model.id}`);
318334
}
@@ -328,7 +344,19 @@ export class LanguageModelAccess extends Disposable implements IExtensionContrib
328344
text: string | vscode.LanguageModelChatMessage | vscode.LanguageModelChatMessage2,
329345
token: vscode.CancellationToken
330346
): Promise<number> {
347+
// --- Start Positron ---
348+
/*
331349
const endpoint = this._chatEndpoints.find(e => e.model === ModelAliasRegistry.resolveAlias(model.id));
350+
*/
351+
// See comment in _provideLanguageModelChatResponse above.
352+
let endpoint: IChatEndpoint | undefined;
353+
if (model.id === AutoChatEndpoint.pseudoModelId) {
354+
endpoint = this._chatEndpoints.find(e => e instanceof AutoChatEndpoint);
355+
} else {
356+
endpoint = this._chatEndpoints.find(e => e.model === ModelAliasRegistry.resolveAlias(model.id));
357+
}
358+
// --- End Positron ---
359+
332360
if (!endpoint) {
333361
throw new Error(`Endpoint not found for model ${model.id}`);
334362
}

0 commit comments

Comments
 (0)