Support model as string[] in custom agent definitions (#289655)

* Initial plan

* Support model as string or string[] in custom agents

- Updated ICustomAgent.model to support string | string[] | undefined
- Updated IChatModeData.model and IChatMode.model accordingly
- Added getStringOrStringArrayAttribute method in PromptHeader
- Updated validateModel in promptValidator to handle both string and array types
- Added comprehensive tests for model array validation

Co-authored-by: aeschli <6461412+aeschli@users.noreply.github.com>

* Support model as string or string[] in custom agents - verified

- All code compiles successfully with 0 errors
- Tests verified to compile and be comprehensive
- Backward compatible with single string models
- Type-safe implementation with proper validation

Co-authored-by: aeschli <6461412+aeschli@users.noreply.github.com>

* Fix: Include empty strings in model array parsing

- Updated getStringOrStringArrayAttribute to include empty strings
- Allows downstream validation to catch empty string errors
- Addresses code review feedback

Co-authored-by: aeschli <6461412+aeschli@users.noreply.github.com>

* Fix: Update model validation in isCachedChatModeData to allow arrays

- Modified isCachedChatModeData to validate model as string | string[]
- Fixes test failures related to cached mode data validation
- All chat tests now passing

Co-authored-by: aeschli <6461412+aeschli@users.noreply.github.com>

* update

* add lookupLanguageModelByQualifiedName

* fix completion and hover

* Update src/vs/workbench/contrib/chat/common/languageModels.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix test

* update

* update

* fix

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: aeschli <6461412+aeschli@users.noreply.github.com>
Co-authored-by: Martin Aeschlimann <martinae@microsoft.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Copilot
2026-01-26 14:51:26 +00:00
committed by GitHub
parent 88868e5c29
commit 4de5008c32
18 changed files with 341 additions and 79 deletions

View File

@@ -474,7 +474,7 @@ export class InlineChatController implements IEditorContribution {
// Check for default model setting
const defaultModelSetting = this._configurationService.getValue<string>(InlineChatConfigKeys.DefaultModel);
if (defaultModelSetting && !this._zone.value.widget.chatWidget.input.switchModelByQualifiedName(defaultModelSetting)) {
if (defaultModelSetting && !this._zone.value.widget.chatWidget.input.switchModelByQualifiedName([defaultModelSetting])) {
this._logService.warn(`inlineChat.defaultModel setting value '${defaultModelSetting}' did not match any available model. Falling back to vendor default.`);
}