Path: blob/main/extensions/copilot/src/extension/prompts/node/panel/notebookSummaryChangePrompt.tsx
13405 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 { PromptElement, PromptSizing } from '@vscode/prompt-tsx';6import { INotebookSummaryTracker } from '../../../../platform/notebook/common/notebookSummaryTracker';7import { IPromptPathRepresentationService } from '../../../../platform/prompts/common/promptPathRepresentationService';8import { ToolName } from '../../../tools/common/toolNames';91011export class NotebookSummaryChange extends PromptElement {12constructor(13props: any,14@IPromptPathRepresentationService protected readonly promptPathRepresentationService: IPromptPathRepresentationService,15@INotebookSummaryTracker private readonly notebookStateTracker: INotebookSummaryTracker,16) {17super(props);18}1920public override render(_state: void, _sizing: PromptSizing) {21const changedNotebooks = this.notebookStateTracker.listNotebooksWithChanges();22if (!changedNotebooks.length) {23return <></>;24}25changedNotebooks.forEach(nb => this.notebookStateTracker.clearState(nb));26return (<>27The user has potentially added/removed/reordered or executed some of the cells of the following notebooks between the last request and now.<br />28Ignore previous summary of all these notebooks returned by the tool {ToolName.GetNotebookSummary}.<br />29{changedNotebooks.map(nb => <>- {this.promptPathRepresentationService.getFilePath(nb.uri)}.<br /></>)}30So be sure to use the {ToolName.GetNotebookSummary} to get the latest summary of the above notebooks.<br />31</>);32}33}343536