Skip to content

Commit 87c35fb

Browse files
committed
feat: add model description to dropdown
1 parent 1f6b7f7 commit 87c35fb

File tree

11 files changed

+45
-35
lines changed

11 files changed

+45
-35
lines changed

chat-client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"package": "webpack"
2525
},
2626
"dependencies": {
27-
"@aws/chat-client-ui-types": "^0.1.56",
27+
"@aws/chat-client-ui-types": "^0.1.57",
2828
"@aws/language-server-runtimes": "^0.2.129",
2929
"@aws/language-server-runtimes-types": "^0.1.50",
3030
"@aws/mynah-ui": "^4.36.6"

chat-client/src/client/mynahUi.test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ describe('MynahUI', () => {
571571
// Simulate the response from the server
572572
const models = [
573573
{ id: 'CLAUDE_3_7_SONNET_20250219_V1_0', name: 'Claude Sonnet 3.7' },
574-
{ id: 'CLAUDE_SONNET_4_20250514_V1_0', name: 'Claude Sonnet 4' },
574+
{ id: 'CLAUDE_SONNET_4_20250514_V1_0', name: 'Claude Sonnet 4', description: 'Test description' },
575575
]
576576

577577
const result: ListAvailableModelsResult = {
@@ -589,8 +589,12 @@ describe('MynahUI', () => {
589589
{
590590
id: 'model-selection',
591591
options: [
592-
{ value: 'CLAUDE_3_7_SONNET_20250219_V1_0', label: 'Claude Sonnet 3.7' },
593-
{ value: 'CLAUDE_SONNET_4_20250514_V1_0', label: 'Claude Sonnet 4' },
592+
{ value: 'CLAUDE_3_7_SONNET_20250219_V1_0', label: 'Claude Sonnet 3.7', description: '' },
593+
{
594+
value: 'CLAUDE_SONNET_4_20250514_V1_0',
595+
label: 'Claude Sonnet 4',
596+
description: 'Test description',
597+
},
594598
],
595599
type: 'select',
596600
value: 'CLAUDE_3_7_SONNET_20250219_V1_0',

chat-client/src/client/mynahUi.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1737,7 +1737,11 @@ ${params.message}`,
17371737
? {
17381738
...option,
17391739
type: 'select',
1740-
options: params.models.map(model => ({ value: model.id, label: model.name })),
1740+
options: params.models.map(model => ({
1741+
value: model.id,
1742+
label: model.name,
1743+
description: model.description ?? '',
1744+
})),
17411745
value: params.selectedModelId,
17421746
}
17431747
: option

chat-client/src/client/texts/modelSelection.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,24 @@ import { ChatItem, ChatItemFormItem, ChatItemType } from '@aws/mynah-ui'
55
*/
66
export enum BedrockModel {
77
CLAUDE_SONNET_4_20250514_V1_0 = 'CLAUDE_SONNET_4_20250514_V1_0',
8-
CLAUDE_3_7_SONNET_20250219_V1_0 = 'CLAUDE_3_7_SONNET_20250219_V1_0',
98
}
109

1110
type ModelDetails = {
1211
label: string
12+
description: string
1313
}
1414

1515
const modelRecord: Record<BedrockModel, ModelDetails> = {
16-
[BedrockModel.CLAUDE_3_7_SONNET_20250219_V1_0]: { label: 'Claude 3.7 Sonnet' },
17-
[BedrockModel.CLAUDE_SONNET_4_20250514_V1_0]: { label: 'Claude Sonnet 4' },
16+
[BedrockModel.CLAUDE_SONNET_4_20250514_V1_0]: {
17+
label: 'Claude Sonnet 4',
18+
description: 'Hybrid reasoning and coding for regular use',
19+
},
1820
}
1921

20-
const modelOptions = Object.entries(modelRecord).map(([value, { label }]) => ({
22+
const modelOptions = Object.entries(modelRecord).map(([value, { label, description }]) => ({
2123
value,
2224
label,
25+
description,
2326
}))
2427

2528
export const modelSelection: ChatItemFormItem = {

client/vscode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@
351351
"devDependencies": {
352352
"@aws-sdk/credential-providers": "^3.731.1",
353353
"@aws-sdk/types": "^3.734.0",
354-
"@aws/chat-client-ui-types": "^0.1.56",
354+
"@aws/chat-client-ui-types": "^0.1.57",
355355
"@aws/language-server-runtimes": "^0.2.129",
356356
"@types/uuid": "^9.0.8",
357357
"@types/vscode": "^1.98.0",

package-lock.json

Lines changed: 10 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/aws-lsp-codewhisperer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"@amzn/codewhisperer-streaming": "file:../../core/codewhisperer-streaming/amzn-codewhisperer-streaming-1.0.0.tgz",
3636
"@aws-sdk/util-arn-parser": "^3.723.0",
3737
"@aws-sdk/util-retry": "^3.374.0",
38-
"@aws/chat-client-ui-types": "^0.1.56",
38+
"@aws/chat-client-ui-types": "^0.1.57",
3939
"@aws/language-server-runtimes": "^0.2.129",
4040
"@aws/lsp-core": "^0.0.15",
4141
"@modelcontextprotocol/sdk": "^1.15.0",

server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3157,7 +3157,7 @@ ${' '.repeat(8)}}
31573157

31583158
// Verify fallback to FALLBACK_MODEL_OPTIONS
31593159
assert.strictEqual(result.tabId, mockTabId)
3160-
assert.strictEqual(result.models.length, 2) // FALLBACK_MODEL_OPTIONS length
3160+
assert.strictEqual(result.models.length, 1) // FALLBACK_MODEL_OPTIONS length
31613161

31623162
// Verify cache was not updated due to error
31633163
sinon.assert.notCalled(setCachedModelsStub)
@@ -3224,7 +3224,7 @@ ${' '.repeat(8)}}
32243224

32253225
it('should fall back to default model when session has no modelId and no defaultModelId in cache', async () => {
32263226
getCachedModelsStub.returns({
3227-
models: [{ id: 'model1', name: 'Model 1' }],
3227+
models: [{ id: 'model1', name: 'Model 1', description: 'Test model' }],
32283228
defaultModelId: undefined, // No default model
32293229
timestamp: Date.now(),
32303230
})

server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ export class AgenticChatController implements ChatHandlers {
761761
const { models, defaultModelId, errorFromAPI } = await this.#fetchModelsWithCache()
762762

763763
// Get the first fallback model option as default
764-
const defaultModelOption = FALLBACK_MODEL_OPTIONS[1]
764+
const defaultModelOption = FALLBACK_MODEL_OPTIONS[0]
765765
const DEFAULT_MODEL_ID = defaultModelId || defaultModelOption?.id
766766

767767
const sessionResult = this.#chatSessionManagementService.getSession(params.tabId)

server/aws-lsp-codewhisperer/src/language-server/agenticChat/constants/modelSelection.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,26 @@ describe('modelSelection', () => {
55
describe('modelOptions', () => {
66
it('should contain the correct model options', () => {
77
assert.ok(Array.isArray(FALLBACK_MODEL_OPTIONS), 'modelOptions should be an array')
8-
assert.strictEqual(FALLBACK_MODEL_OPTIONS.length, 2, 'modelOptions should have 2 items')
8+
assert.strictEqual(FALLBACK_MODEL_OPTIONS.length, 1, 'modelOptions should have 1 item')
99

1010
// Check that the array contains the expected models
1111
const modelIds = FALLBACK_MODEL_OPTIONS.map(model => model.id)
1212
assert.ok(modelIds.includes('CLAUDE_SONNET_4_20250514_V1_0'), 'Should include claude-sonnet-4')
13-
assert.ok(modelIds.includes('CLAUDE_3_7_SONNET_20250219_V1_0'), 'Should include claude-3.7-sonnet')
1413

1514
// Check that each model has the required properties
1615
FALLBACK_MODEL_OPTIONS.forEach(model => {
1716
assert.ok('id' in model, 'Model should have id property')
1817
assert.ok('name' in model, 'Model should have name property')
18+
assert.ok('description' in model, 'Model should have description property')
1919
assert.strictEqual(typeof model.id, 'string', 'Model id should be a string')
2020
assert.strictEqual(typeof model.name, 'string', 'Model name should be a string')
21+
assert.strictEqual(typeof model.description, 'string', 'Model description should be a string')
2122
})
2223

2324
// Check specific model names
2425
const claudeSonnet4 = FALLBACK_MODEL_OPTIONS.find(model => model.id === 'CLAUDE_SONNET_4_20250514_V1_0')
25-
const claudeSonnet37 = FALLBACK_MODEL_OPTIONS.find(model => model.id === 'CLAUDE_3_7_SONNET_20250219_V1_0')
2626

2727
assert.strictEqual(claudeSonnet4?.name, 'Claude Sonnet 4', 'claude-sonnet-4 should have correct name')
28-
assert.strictEqual(claudeSonnet37?.name, 'Claude 3.7 Sonnet', 'claude-3.7-sonnet should have correct name')
2928
})
3029
})
3130
})

0 commit comments

Comments
 (0)