@@ -2824,6 +2824,7 @@ export class ChatWidget extends Disposable implements IChatWidget {
28242824 welcomeOffset = Math . max ( welcomeOffset - this . input . attachmentsHeight , 0 ) ;
28252825 this . welcomeMessageContainer . style . height = `${ contentHeight - welcomeOffset } px` ;
28262826 this . welcomeMessageContainer . style . paddingBottom = `${ welcomeOffset } px` ;
2827+ this . updateWelcomeElementVisibility ( contentHeight - welcomeOffset ) ;
28272828
28282829 this . renderer . layout ( width ) ;
28292830
@@ -2836,6 +2837,54 @@ export class ChatWidget extends Disposable implements IChatWidget {
28362837 this . _onDidChangeHeight . fire ( height ) ;
28372838 }
28382839
2840+ private updateWelcomeElementVisibility ( availableHeight : number ) : void {
2841+ const container = this . welcomeMessageContainer ;
2842+ if ( ! container || container . offsetHeight === 0 ) {
2843+ return ;
2844+ }
2845+
2846+ const suggestedPrompts = container . querySelector < HTMLElement > ( '.chat-welcome-view-suggested-prompts' ) ;
2847+ if ( ! suggestedPrompts ) {
2848+ return ;
2849+ }
2850+
2851+ if ( this . container . classList . contains ( 'new-welcome-view' ) ) {
2852+ return ;
2853+ }
2854+
2855+ const selectors = [
2856+ '.chat-welcome-history-root' ,
2857+ '.chat-welcome-view-message' ,
2858+ '.chat-welcome-view-disclaimer' ,
2859+ '.chat-welcome-view-title' ,
2860+ '.chat-welcome-view-icon'
2861+ ] ;
2862+
2863+ const elements = selectors
2864+ . map ( sel => container . querySelector < HTMLElement > ( sel ) )
2865+ . filter ( ( el ) : el is HTMLElement => el !== null ) ;
2866+
2867+ elements . forEach ( el => {
2868+ if ( el . style . display === 'none' ) {
2869+ el . style . display = '' ;
2870+ }
2871+ } ) ;
2872+
2873+ const suggestedPromptsHeight = suggestedPrompts . offsetHeight ;
2874+ const adjustedAvailableHeight = availableHeight - suggestedPromptsHeight ;
2875+
2876+ let totalHeight = 0 ;
2877+ for ( const elem of elements ) {
2878+ if ( elem . style . display !== 'none' ) {
2879+ totalHeight += elem . offsetHeight ;
2880+ if ( totalHeight > adjustedAvailableHeight ) {
2881+ elem . style . display = 'none' ;
2882+ totalHeight -= elem . offsetHeight ;
2883+ }
2884+ }
2885+ }
2886+ }
2887+
28392888 private _dynamicMessageLayoutData ?: { numOfMessages : number ; maxHeight : number ; enabled : boolean } ;
28402889
28412890 // An alternative to layout, this allows you to specify the number of ChatTreeItems
0 commit comments