fix(coding-agent): handle slash-delimited /model refs closes #2174
This commit is contained in:
@@ -56,7 +56,7 @@ import type {
|
||||
import { FooterDataProvider, type ReadonlyFooterDataProvider } from "../../core/footer-data-provider.js";
|
||||
import { type AppAction, KeybindingsManager } from "../../core/keybindings.js";
|
||||
import { createCompactionSummaryMessage } from "../../core/messages.js";
|
||||
import { resolveModelScope } from "../../core/model-resolver.js";
|
||||
import { findExactModelReferenceMatch, resolveModelScope } from "../../core/model-resolver.js";
|
||||
import type { ResourceDiagnostic } from "../../core/resource-loader.js";
|
||||
import { type SessionContext, SessionManager } from "../../core/session-manager.js";
|
||||
import { BUILTIN_SLASH_COMMANDS } from "../../core/slash-commands.js";
|
||||
@@ -3244,30 +3244,8 @@ export class InteractiveMode {
|
||||
}
|
||||
|
||||
private async findExactModelMatch(searchTerm: string): Promise<Model<any> | undefined> {
|
||||
const term = searchTerm.trim();
|
||||
if (!term) return undefined;
|
||||
|
||||
let targetProvider: string | undefined;
|
||||
let targetModelId = "";
|
||||
|
||||
if (term.includes("/")) {
|
||||
const parts = term.split("/", 2);
|
||||
targetProvider = parts[0]?.trim().toLowerCase();
|
||||
targetModelId = parts[1]?.trim().toLowerCase() ?? "";
|
||||
} else {
|
||||
targetModelId = term.toLowerCase();
|
||||
}
|
||||
|
||||
if (!targetModelId) return undefined;
|
||||
|
||||
const models = await this.getModelCandidates();
|
||||
const exactMatches = models.filter((item) => {
|
||||
const idMatch = item.id.toLowerCase() === targetModelId;
|
||||
const providerMatch = !targetProvider || item.provider.toLowerCase() === targetProvider;
|
||||
return idMatch && providerMatch;
|
||||
});
|
||||
|
||||
return exactMatches.length === 1 ? exactMatches[0] : undefined;
|
||||
return findExactModelReferenceMatch(searchTerm, models);
|
||||
}
|
||||
|
||||
private async getModelCandidates(): Promise<Model<any>[]> {
|
||||
|
||||
Reference in New Issue
Block a user