Skip to content

Commit 88f19a8

Browse files
authored
feat(types): add types for quickSettings to update permission in tool executions (#642)
## Problem Require new field to attach to ChatResult to render the dropdown component for quickSettings Require a extra data field for ButtonClickParams for the functionality to work ## Solution Add quickSettings prop to ChatMessage Add metadata field in ButtonClickParams. It's a map for re-useable purpose ## Example Usage ```ts const metadata: Record<string, string> = {} const option = value[0] const [serverName, toolName] = option.value.split('@') const new_permission = option.id metadata['toolName'] = toolName metadata['serverName'] = serverName metadata['permission'] = new_permission const payload: ButtonClickParams = { tabId, messageId, buttonId: 'trust-command', metadata, } ``` <!--- REMINDER: - Read CONTRIBUTING.md first. - Add test coverage for your changes. - Link to related issues/commits. - Testing: how did you test your changes? - Screenshots if applicable --> ## License By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 334b55b commit 88f19a8

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

types/chat.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,23 @@ export interface ChatMessage {
183183
codeReference?: ReferenceTrackerInformation[]
184184
fileList?: FileList
185185
contextList?: FileList
186+
quickSettings?: {
187+
type: 'select' | 'checkbox' | 'radio'
188+
description?: string
189+
descriptionLink?: {
190+
id: string
191+
text: string
192+
destination: string
193+
}
194+
messageId: string
195+
tabId: string
196+
options: {
197+
id: string
198+
label: string
199+
value: string
200+
selected?: boolean | undefined
201+
}[]
202+
}
186203
}
187204

188205
/**
@@ -384,6 +401,7 @@ export interface ButtonClickParams {
384401
tabId: string
385402
messageId: string
386403
buttonId: string
404+
metadata: Record<string, string>
387405
}
388406

389407
export interface ButtonClickResult {

0 commit comments

Comments
 (0)