Path: blob/main/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWelcomePage.ts
13406 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import * as DOM from '../../../../../base/browser/dom.js';6import { Disposable, IDisposable } from '../../../../../base/common/lifecycle.js';7import { ICommandService } from '../../../../../platform/commands/common/commands.js';8import { AICustomizationManagementSection } from './aiCustomizationManagement.js';9import { IAICustomizationWorkspaceService, IWelcomePageFeatures } from '../../common/aiCustomizationWorkspaceService.js';10import { PromptLaunchersAICustomizationWelcomePage } from './aiCustomizationWelcomePagePromptLaunchers.js';11import { IHoverService } from '../../../../../platform/hover/browser/hover.js';1213const $ = DOM.$;1415export interface IWelcomePageCallbacks {16selectSection(section: AICustomizationManagementSection): void;17selectSectionWithMarketplace(section: AICustomizationManagementSection): void;18closeEditor(): void;19/**20* Prefill the chat input with a query. In the sessions window this21* uses the sessions chat widget; in core VS Code it opens the chat view.22*23* @param options.newChat When true, always opens a new chat instead of24* reusing the active one.25*/26prefillChat(query: string, options?: { isPartialQuery?: boolean; newChat?: boolean }): void;27}2829export interface IAICustomizationWelcomePageImplementation extends IDisposable {30readonly container: HTMLElement;31rebuildCards(visibleSectionIds: ReadonlySet<AICustomizationManagementSection>): void;32focus(): void;33/** Called when the welcome page becomes visible after navigation — clears any transient state. */34reset?(): void;35}3637/**38* Renders the welcome page for the AI Customization Management Editor.39*/40export class AICustomizationWelcomePage extends Disposable {4142private readonly implementation: IAICustomizationWelcomePageImplementation;4344readonly container: HTMLElement;4546constructor(47parent: HTMLElement,48welcomePageFeatures: IWelcomePageFeatures | undefined,49callbacks: IWelcomePageCallbacks,50commandService: ICommandService,51workspaceService: IAICustomizationWorkspaceService,52hoverService: IHoverService,53) {54super();5556this.container = DOM.append(parent, $('.welcome-page-host'));57this.container.style.height = '100%';58this.container.style.overflow = 'hidden';59this.implementation = this._register(new PromptLaunchersAICustomizationWelcomePage(this.container, welcomePageFeatures, callbacks, commandService, workspaceService, hoverService));60}6162rebuildCards(visibleSectionIds: ReadonlySet<AICustomizationManagementSection>): void {63this.implementation.rebuildCards(visibleSectionIds);64}6566focus(): void {67this.implementation.focus();68}6970reset(): void {71this.implementation.reset?.();72}73}747576