Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
/**
* Notebook cell context renderer. Used by Generate and Edit intents.
* It includes the document context of the notebook. It' using legacy prompt technique to include the examples and the cell position and content.
*/
'InlineChatNotebookSelectionRenderer should be used only with a notebook!'
)
;
}
const
{
:
,
:
}
=
this
.
props
;
const
=
this
.
props
.
documentContext
.
language
;
return
(
<>
{
(
.
length
>
0
||
.
length
>
0
)
&&
<UserMessage>
I am working on a Jupyter notebook.
<br/>
This Jupyter Notebook already contains multiple cells.
<br/>
The content of cells are listed below, each cell starts with CELL INDEX and a code block started with ```{lang.languageId}<br />
Each cell is a block of code that can be executed independently.<br />
Since it is Jupyter Notebook, if a module is already imported in a cell, it can be used in other cells as well.<br />
For the same reason, if a variable is defined in a cell, it can be used in other cells as well.<br />
We should not repeat the same import or variable definition in multiple cells, unless we want to overwrite the previous definition.<br />
Do not generate CELL INDEX in your answer, it is only used to help you understand the context.<br />
<br />
<>Below you will find a set of examples of what you should respond with. Please follow the exmaples on how to avoid repeating code.<br />
## Examples starts here<br />
Here are the cells in this Jupyter Notebook:<br />
`CELL INDEX: 0<br />
```python<br />
import pandas as pd<br />
<br />
# create a dataframe with sample data<br />
df = pd.DataFrame({'Name': ['Alice', 'Bob', 'Charlie'], 'Age': [25, 30, 35], 'Gender': ['F', 'M', 'M']})<br />
print(df)<br />
```
<br/>
---------------------------------
<br/>
USER:
<br/>
Now I create a new cell in this Jupyter Notebook document at index 1.
<br/>
In this new cell, I am working with the following code:
<NotebookCellListcells={aboveCellsInfo}title={'Here are the cells in this Jupyter Notebook:\n'}/>
}
{
.
length
>
0
&&
<NotebookCellListcells={belowCellsInfo}cellIndexDelta={aboveCellsInfo.length+1}title={'Here are the cells below the current cell that I am editing in this Jupyter Notebook:\n'}/>
'InlineChatNotebookSelectionRenderer should be used only with a notebook!'
)
;
}
const
{
:
,
:
}
=
this
.
props
;
const
=
this
.
props
.
documentContext
.
language
;
return
(
<>
{
(
.
length
>
0
||
.
length
>
0
)
&&
<UserMessage>
I am working on a Jupyter notebook.
<br/>
This Jupyter Notebook already contains multiple cells.
<br/>
The content of cells are listed below, source code is contained in ```{lang.languageId} blocks<br />
Each cell is a block of code that can be executed independently.<br />
Below you will find a set of examples of what you should respond with. Please follow the exmaples on how to avoid repeating code.<br />
<Tag name='example'>
<Tag name='cellsAbove'>
Here are the cells above the current cell that I am editing in this Jupyter Notebook:<br />
<IndexedTag name='cell' index={0}>
<TextChunk>
```python<br />
import pandas as pd<br />
```
</TextChunk>
</IndexedTag>
</Tag>
<Tag name='UserRequest'>
Now I create a new cell in this Jupyter Notebook document at index 1.<br />
<TextChunk>
```python<br />
```<br />
</TextChunk>
plot the data frame<br />
</Tag>
<Tag name='Response'>
To plot the dataframe, we can use the `plot()` method of pandas dataframe. Here's the code:<br />
```python<br />
df.plot(x='Name', y='Age', kind='bar')
<br/>
```<br />
</Tag>
</Tag>
{aboveCellsInfo.length > 0 &&
<Tag name='cellsAbove'>
Here are the cells above the current cell that I am editing in this Jupyter Notebook:<br />
{aboveCellsInfo.map((cell, index) => (this._renderCellContent(cell, index)))}
</Tag>
}
{
belowCellsInfo.length > 0 &&
<Tag name='cellsBelow'>
Here are the cells below the current cell that I am editing in this Jupyter Notebook:<br />
{belowCellsInfo.map((cell, index) => (this._renderCellContent(cell, index + aboveCellsInfo.length + 1)))}
</Tag>
}
</UserMessage>
}
</>
);
}
private _renderCellContent(cell: CodeContextRegion, index: number) {
const code = createFencedCodeBlock(cell.language.languageId, cell.lines.join('\n'));
return <IndexedTag name='cell' index={index}>
<TextChunk>
{code}
</TextChunk>
</IndexedTag>;
}
}
export type IndexedTagProps = PromptElementProps<{
name: string;
index: number;
}>;
export class IndexedTag extends PromptElement<IndexedTagProps> {
private static readonly _regex = /^[a-zA-Z_][\w\.\-]*$/;
render() {
const { name, index } = this.props;
if (!IndexedTag._regex.test(name)) {
throw new Error(`Invalid tag name: $
```
</>
))
}
</UserMessage>
);
}
}
function findNotebookType(
workspaceService: IWorkspaceService,
uri: vscode.Uri
) {
const notebook = workspaceService.notebookDocuments.find(
doc =>
doc.uri.fsPath === uri.fsPath
);
return notebook?.notebookType;
}
export class InlineChatCustomNotebookInfoRenderer extends PromptElement<InlineChatNotebookSelectionCommonProps> {
constructor(
props: InlineChatNotebookSelectionCommonProps,
@IWorkspaceService private readonly workspaceService: IWorkspaceService
) {
super(props);
}
render(state: void, sizing: PromptSizing) {
if (!isNotebookCellOrNotebookChatInput(this.props.documentContext.document.uri)) {
throw illegalArgument('InlineChatCustomNotebookInfoRenderer should be used only with a notebook!');
}
const notebookType = findNotebookType(this.workspaceService, this.props.documentContext.document.uri);
const matchedExample = CustomNotebookExamples.find(example => example.viewType === notebookType);
const notebookTypeName = matchedExample ? notebookType : 'custom';
return (
<>
{
<UserMessage>
I am working on a {notebookTypeName} notebook in VS Code.<br />
{notebookTypeName} notebooks in VS Code are documents that contain a mix of rich Markdown, executable code snippets, <br />
and accompanying rich output. These are all separated into distinct cells and can be interleaved in any order <br />
A {notebookTypeName} notebook contains multiple cells.<br />
</UserMessage>
}
{
matchedExample &&
<CustomNotebookExampleRenderer viewType={matchedExample.viewType} />
}
</>
);
}
}
export interface InlineChatCustomNotebookCellsContextRendererProps extends InlineChatNotebookSelectionCommonProps {
aboveCells?: CodeContextRegion[];
belowCells?: CodeContextRegion[];
}
export class InlineChatCustomNotebookCellsContextRenderer extends PromptElement<InlineChatCustomNotebookCellsContextRendererProps> {
render(state: void, sizing: PromptSizing) {
if (!isNotebookCellOrNotebookChatInput(this.props.documentContext.document.uri)) {
throw illegalArgument('InlineChatCustomNotebookCellsContextRenderer should be used only with a notebook!');
}
const { aboveCells, belowCells, documentContext } = this.props;
const aboveCellsInfo = aboveCells || [];
const belowCellsInfo = belowCells || [];
const lang = documentContext.language;
return (
<>
{
(aboveCellsInfo.length > 0 || belowCellsInfo.length > 0) &&
<UserMessage>
The content of cells are listed below, each cell starts with CELL INDEX and a code block started with ```
{
.
languageId
}
<br/>
Each cell is a block of code that can be executed independently.
<br/>
Do not generate CELL INDEX in your answer, it is only used to help you understand the context.
<br/>
<br/>
Below you will find a set of examples of what you should respond with. Please follow the exmaples on how to avoid repeating code.
<br/>
{
.
length
>
0
&&
<NotebookCellListcells={aboveCellsInfo}title={'Here are the cells in this custom notebook:\n'}/>
}
{
.
length
>
0
&&
<NotebookCellListcells={belowCellsInfo}cellIndexDelta={aboveCellsInfo.length+1}title={'Here are the cells below the current cell that I am editing in this custom notebook:\n'}/>