Skip to content

Commit 9702bf9

Browse files
authored
Merge pull request microsoft#264255 from microsoft/eli/history
Eli/history
2 parents 4cdcb79 + 33e1b15 commit 9702bf9

File tree

8 files changed

+443
-43
lines changed

8 files changed

+443
-43
lines changed

src/vs/workbench/contrib/chat/browser/actions/chatActions.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,10 @@ export function registerChatActions() {
424424
menu: [
425425
{
426426
id: MenuId.ViewTitle,
427-
when: ContextKeyExpr.equals('view', ChatViewId),
427+
when: ContextKeyExpr.and(
428+
ContextKeyExpr.equals('view', ChatViewId),
429+
ChatContextKeys.inEmptyStateWithHistoryEnabled.negate()
430+
),
428431
group: 'navigation',
429432
order: 2
430433
},

src/vs/workbench/contrib/chat/browser/actions/chatClearActions.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ export function registerNewChatActions() {
7575
},
7676
{
7777
id: MenuId.ViewTitle,
78-
when: ContextKeyExpr.equals('view', ChatViewId),
78+
when: ContextKeyExpr.and(
79+
ContextKeyExpr.equals('view', ChatViewId),
80+
ChatContextKeys.inEmptyStateWithHistoryEnabled.negate()
81+
),
7982
group: 'navigation',
8083
order: -1
8184
},

src/vs/workbench/contrib/chat/browser/chat.contribution.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,12 @@ configurationRegistry.registerConfiguration({
299299
mode: 'startup'
300300
}
301301
},
302+
[ChatConfiguration.EmptyStateHistoryEnabled]: {
303+
type: 'boolean',
304+
default: false,
305+
description: nls.localize('chat.emptyState.history.enabled', "Show recent chat history on the empty chat state."),
306+
tags: ['experimental']
307+
},
302308
'chat.checkpoints.enabled': {
303309
type: 'boolean',
304310
default: true,

src/vs/workbench/contrib/chat/browser/chatWidget.ts

Lines changed: 257 additions & 5 deletions
Large diffs are not rendered by default.

src/vs/workbench/contrib/chat/browser/media/chatViewWelcome.css

Lines changed: 163 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,51 @@
1313
}
1414
}
1515

16-
.interactive-session.experimental-welcome-view .interactive-input-part .dropdown-action-container {
17-
display: none;
18-
}
19-
20-
.interactive-session.experimental-welcome-view .interactive-input-part .chat-attachments-container {
21-
display: none;
22-
}
23-
24-
/* Container for chat widget welcome message */
25-
.interactive-session .chat-welcome-view-container {
26-
display: flex;
27-
align-items: center;
28-
justify-content: center;
29-
overflow: hidden;
30-
}
16+
/* Container for chat widget welcome message and interactive session variants */
17+
.interactive-session {
18+
&.experimental-welcome-view {
19+
.interactive-input-part {
20+
.dropdown-action-container { display: none; }
21+
.chat-attachments-container { display: none; }
22+
}
23+
.chat-input-toolbars > .chat-input-toolbar > div { display: none; }
24+
.chat-input-toolbars .action-item:not(:has(.monaco-dropdown-with-primary)) { display: none; }
25+
}
3126

32-
.interactive-session .experimental-welcome-view & > .chat-welcome-view-input-part {
33-
max-width: 650px;
34-
margin-bottom: 48px;
35-
}
27+
/* chat welcome container */
28+
.chat-welcome-view-container {
29+
display: flex;
30+
align-items: center;
31+
justify-content: center;
32+
overflow: hidden;
3633

37-
.interactive-session.experimental-welcome-view .chat-input-toolbars > .chat-input-toolbar > div {
38-
display: none;
39-
}
34+
&.has-chat-history {
35+
flex-direction: column;
36+
justify-content: flex-start;
37+
align-items: stretch;
38+
height: 100%;
39+
position: relative;
40+
div.chat-welcome-view > .chat-welcome-view-title { display: none; }
41+
.chat-welcome-view-icon .codicon { line-height: 48px; }
42+
div.chat-welcome-view { align-self: center; margin-top: auto; margin-bottom: auto; }
43+
.chat-welcome-view-message.experimental-empty-state,
44+
.chat-welcome-view-disclaimer {
45+
position: absolute;
46+
left: 0;
47+
right: 0;
48+
bottom: 0;
49+
margin: 0;
50+
padding: 0 8px;
51+
max-width: none;
52+
text-align: center;
53+
}
54+
}
55+
}
4056

41-
.interactive-session.experimental-welcome-view .chat-input-toolbars .action-item:not(:has(.monaco-dropdown-with-primary)) {
42-
display: none;
57+
.experimental-welcome-view & > .chat-welcome-view-input-part {
58+
max-width: 650px;
59+
margin-bottom: 48px;
60+
}
4361
}
4462

4563
/* Container for ChatViewPane welcome view */
@@ -143,18 +161,39 @@ div.chat-welcome-view {
143161
font-size: 16px;
144162

145163
a {
146-
color: var(--vscode-descriptionForeground);
164+
color: var(--vscode-input-placeholderForeground);
147165
}
148166
}
149167

150168
& > .chat-welcome-view-experimental-additional-message {
151-
font-size: 12px;
152-
color: var(--vscode-disabledForeground);
169+
color: var(--vscode-input-placeholderForeground);
153170
text-align: center;
154171
max-width: 400px;
155172
margin-top: 8px;
156173
}
157174

175+
/* Dedicated disclaimer container appended at root in TS */
176+
.interactive-session .chat-welcome-view-container.has-chat-history & > .chat-welcome-view-disclaimer {
177+
text-align: center;
178+
max-width: 400px;
179+
color: var(--vscode-input-placeholderForeground);
180+
margin: 16px auto;
181+
padding: 0 12px;
182+
a {
183+
color: var(--vscode-textLink-foreground);
184+
}
185+
}
186+
187+
.interactive-session .chat-welcome-view-container:not(.has-chat-history) & > .chat-welcome-view-disclaimer {
188+
color: var(--vscode-input-placeholderForeground);
189+
text-align: center;
190+
margin: -16px auto;
191+
max-width: 400px;
192+
a {
193+
color: var(--vscode-textLink-foreground);
194+
}
195+
}
196+
158197
& > .chat-welcome-view-suggested-prompts {
159198
display: flex;
160199
flex-wrap: wrap;
@@ -175,7 +214,7 @@ div.chat-welcome-view {
175214
width: fit-content;
176215
margin: 0 4px;
177216

178-
> .chat-welcome-view-suggested-prompt-icon {
217+
& > .chat-welcome-view-suggested-prompt-icon {
179218
display: flex;
180219
align-items: center;
181220
font-size: 4px;
@@ -184,7 +223,7 @@ div.chat-welcome-view {
184223
padding: 4px;
185224
}
186225

187-
> .chat-welcome-view-suggested-prompt-label {
226+
& > .chat-welcome-view-suggested-prompt-label {
188227
font-size: 14px;
189228
color: var(--vscode-editorWidget-foreground);
190229
padding: 4px 4px 4px 0;
@@ -196,9 +235,103 @@ div.chat-welcome-view {
196235
}
197236
}
198237

199-
> .chat-welcome-view-suggested-prompt:hover {
238+
& > .chat-welcome-view-suggested-prompt:hover {
200239
background-color: var(--vscode-list-hoverBackground);
201240
border-color: var(--vscode-focusBorder);
202241
}
203242
}
204243
}
244+
245+
/* Recent history list shown above the welcome content */
246+
.chat-welcome-history-root {
247+
width: 100%;
248+
padding: 0px 8px 0 8px;
249+
250+
.chat-welcome-history-header {
251+
display: flex;
252+
align-items: center;
253+
justify-content: space-between;
254+
padding: 2px 4px 4px 4px;
255+
font-size: 11px;
256+
text-transform: uppercase;
257+
letter-spacing: 0.5px;
258+
color: var(--vscode-descriptionForeground);
259+
}
260+
261+
.chat-welcome-history-header-title {
262+
font-weight: 600;
263+
font-size: 11px;
264+
padding-left: 8px;
265+
}
266+
267+
.chat-welcome-history-header-actions {
268+
display: flex;
269+
align-items: center;
270+
gap: 4px;
271+
padding-right: 16px;
272+
}
273+
274+
.chat-welcome-history-show-all {
275+
cursor: pointer;
276+
color: var(--vscode-icon-foreground);
277+
padding: 2px;
278+
border-radius: 4px;
279+
}
280+
281+
.chat-welcome-history-show-all:hover {
282+
background: var(--vscode-toolbar-hoverBackground, var(--vscode-list-hoverBackground));
283+
}
284+
285+
.chat-welcome-history-show-all:focus-visible {
286+
outline: 1px solid var(--vscode-focusBorder);
287+
outline-offset: 1px;
288+
}
289+
290+
.chat-welcome-history {
291+
margin: 0 0 12px;
292+
width: 100%;
293+
}
294+
295+
.chat-welcome-history-list {
296+
display: flex;
297+
flex-direction: column;
298+
border-radius: 4px;
299+
overflow: hidden;
300+
box-sizing: border-box;
301+
padding: 0 14px 0 0;
302+
}
303+
304+
.chat-welcome-history-item {
305+
display: flex;
306+
flex-direction: row;
307+
border-radius: 4px;
308+
align-items: center;
309+
justify-content: space-between;
310+
padding: 2px 12px 4px 12px;
311+
line-height: 18px;
312+
gap: 8px;
313+
cursor: pointer;
314+
outline: none;
315+
&:hover { background: var(--vscode-list-hoverBackground); }
316+
.chat-welcome-history-title {
317+
font-size: 13px;
318+
white-space: nowrap;
319+
overflow: hidden;
320+
text-overflow: ellipsis;
321+
flex: 1 1 auto;
322+
}
323+
.chat-welcome-history-date {
324+
font-size: 11px;
325+
color: var(--vscode-descriptionForeground);
326+
flex: 0 0 auto;
327+
margin-left: 8px;
328+
}
329+
}
330+
331+
.chat-welcome-history-more {
332+
margin: 4px 0 0;
333+
padding-left: 12px;
334+
a { color: var(--vscode-textLink-foreground); cursor: pointer; }
335+
}
336+
}
337+

src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,19 +176,19 @@ export class ChatViewWelcomePart extends Disposable {
176176
dom.append(this.element, content.inputPart);
177177

178178
if (typeof content.additionalMessage === 'string') {
179-
const additionalMsg = $('.chat-welcome-view-experimental-additional-message');
179+
const additionalMsg = $('.chat-welcome-view-experimental-additional-message.chat-welcome-view-disclaimer');
180180
additionalMsg.textContent = content.additionalMessage;
181181
dom.append(this.element, additionalMsg);
182182
}
183183
} else {
184184
// Additional message
185185
if (typeof content.additionalMessage === 'string') {
186-
const element = $('');
187-
element.textContent = content.additionalMessage;
188-
dom.append(message, element);
186+
const disclaimers = dom.append(this.element, $('.chat-welcome-view-disclaimer'));
187+
disclaimers.textContent = content.additionalMessage;
189188
} else if (content.additionalMessage) {
189+
const disclaimers = dom.append(this.element, $('.chat-welcome-view-disclaimer'));
190190
const additionalMessageResult = this.renderMarkdownMessageContent(renderer, content.additionalMessage, options);
191-
dom.append(message, additionalMessageResult.element);
191+
disclaimers.appendChild(additionalMessageResult.element);
192192
}
193193
}
194194

src/vs/workbench/contrib/chat/common/chatContextKeys.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ export namespace ChatContextKeys {
102102

103103
export const panelLocation = new RawContextKey<ViewContainerLocation>('chatPanelLocation', undefined, { type: 'number', description: localize('chatPanelLocation', "The location of the chat panel.") });
104104

105+
export const inEmptyStateWithHistoryEnabled = new RawContextKey<boolean>('chatInEmptyStateWithHistoryEnabled', false, { type: 'boolean', description: localize('chatInEmptyStateWithHistoryEnabled', "True when chat empty state history is enabled AND chat is in empty state.") });
106+
105107
export const sessionType = new RawContextKey<string>('chatSessionType', '', { type: 'string', description: localize('chatSessionType', "The type of the current chat session item.") });
106108
export const isHistoryItem = new RawContextKey<boolean>('chatIsHistoryItem', false, { type: 'boolean', description: localize('chatIsHistoryItem', "True when the chat session item is from history.") });
107109
}

src/vs/workbench/contrib/chat/common/constants.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ export enum ChatConfiguration {
1818
AgentSessionsViewLocation = 'chat.agentSessionsViewLocation',
1919
ThinkingStyle = 'chat.agent.thinkingStyle',
2020
UseChatSessionsForCloudButton = 'chat.useChatSessionsForCloudButton',
21-
ShowAgentSessionsViewDescription = 'chat.showAgentSessionsViewDescription'
21+
ShowAgentSessionsViewDescription = 'chat.showAgentSessionsViewDescription',
22+
EmptyStateHistoryEnabled = 'chat.emptyState.history.enabled'
2223
}
2324

2425
/**

0 commit comments

Comments
 (0)