Skip to content

Commit 5ab7bc1

Browse files
Samiya CaurDevtools-frontend LUCI CQ
authored andcommitted
[AI Assistance] Update input placeholder for the disabled state when there is no context selected
Fixed: 380394111 Change-Id: Ic0cd625ffc5d7b8aaaead3325d2e73e4d2238815 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6090599 Auto-Submit: Samiya Caur <[email protected]> Commit-Queue: Alex Rudenko <[email protected]> Reviewed-by: Alex Rudenko <[email protected]>
1 parent cb1c422 commit 5ab7bc1

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

front_end/panels/ai_assistance/components/ChatView.ts

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,22 @@ const UIStringsNotTranslate = {
132132
*@description Placeholder text for the chat UI input.
133133
*/
134134
inputPlaceholderForPerformanceAgent: 'Ask a question about the selected item and its call tree',
135+
/**
136+
*@description Placeholder text for the chat UI input when there is no context selected.
137+
*/
138+
inputPlaceholderForFreestylerAgentNoContext: 'Select an element to ask a question',
139+
/**
140+
*@description Placeholder text for the chat UI input when there is no context selected.
141+
*/
142+
inputPlaceholderForNetworkAgentNoContext: 'Select a network request to ask a question',
143+
/**
144+
*@description Placeholder text for the chat UI input when there is no context selected.
145+
*/
146+
inputPlaceholderForFileAgentNoContext: 'Select a file to ask a question',
147+
/**
148+
*@description Placeholder text for the chat UI input when there is no context selected.
149+
*/
150+
inputPlaceholderForPerformanceAgentNoContext: 'Select an item to ask a question',
135151
/**
136152
* @description Placeholder text for the input shown when the conversation is blocked because a cross-origin context was selected.
137153
*/
@@ -1043,13 +1059,19 @@ export class ChatView extends HTMLElement {
10431059
}
10441060
switch (agentType) {
10451061
case AgentType.STYLING:
1046-
return lockedString(UIStringsNotTranslate.inputPlaceholderForFreestylerAgent);
1062+
return this.#props.selectedContext ? lockedString(UIStringsNotTranslate.inputPlaceholderForFreestylerAgent) :
1063+
lockedString(UIStringsNotTranslate.inputPlaceholderForFileAgentNoContext);
10471064
case AgentType.FILE:
1048-
return lockedString(UIStringsNotTranslate.inputPlaceholderForFileAgent);
1065+
return this.#props.selectedContext ? lockedString(UIStringsNotTranslate.inputPlaceholderForFileAgent) :
1066+
lockedString(UIStringsNotTranslate.inputPlaceholderForFileAgentNoContext);
10491067
case AgentType.NETWORK:
1050-
return lockedString(UIStringsNotTranslate.inputPlaceholderForNetworkAgent);
1068+
return this.#props.selectedContext ?
1069+
lockedString(UIStringsNotTranslate.inputPlaceholderForNetworkAgent) :
1070+
lockedString(UIStringsNotTranslate.inputPlaceholderForNetworkAgentNoContext);
10511071
case AgentType.PERFORMANCE:
1052-
return lockedString(UIStringsNotTranslate.inputPlaceholderForPerformanceAgent);
1072+
return this.#props.selectedContext ?
1073+
lockedString(UIStringsNotTranslate.inputPlaceholderForPerformanceAgent) :
1074+
lockedString(UIStringsNotTranslate.inputPlaceholderForPerformanceAgentNoContext);
10531075
}
10541076
}
10551077

0 commit comments

Comments
 (0)