Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/src/extension/prompts/node/panel/notebookSummaryChangePrompt.tsx
13405 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { PromptElement, PromptSizing } from '@vscode/prompt-tsx';
7
import { INotebookSummaryTracker } from '../../../../platform/notebook/common/notebookSummaryTracker';
8
import { IPromptPathRepresentationService } from '../../../../platform/prompts/common/promptPathRepresentationService';
9
import { ToolName } from '../../../tools/common/toolNames';
10
11
12
export class NotebookSummaryChange extends PromptElement {
13
constructor(
14
props: any,
15
@IPromptPathRepresentationService protected readonly promptPathRepresentationService: IPromptPathRepresentationService,
16
@INotebookSummaryTracker private readonly notebookStateTracker: INotebookSummaryTracker,
17
) {
18
super(props);
19
}
20
21
public override render(_state: void, _sizing: PromptSizing) {
22
const changedNotebooks = this.notebookStateTracker.listNotebooksWithChanges();
23
if (!changedNotebooks.length) {
24
return <></>;
25
}
26
changedNotebooks.forEach(nb => this.notebookStateTracker.clearState(nb));
27
return (<>
28
The user has potentially added/removed/reordered or executed some of the cells of the following notebooks between the last request and now.<br />
29
Ignore previous summary of all these notebooks returned by the tool {ToolName.GetNotebookSummary}.<br />
30
{changedNotebooks.map(nb => <>- {this.promptPathRepresentationService.getFilePath(nb.uri)}.<br /></>)}
31
So be sure to use the {ToolName.GetNotebookSummary} to get the latest summary of the above notebooks.<br />
32
</>);
33
}
34
}
35
36