Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copilot chat panel for VS Code #2151

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Conversation

minestarks
Copy link
Member

@minestarks minestarks commented Feb 4, 2025

This adds a panel to VS Code that provides Copilot chat functionality.

We define a set of client-side tools to be invoked by the model. These tools interface with the user's Azure Quantum workspace, providing a way to submit jobs, get information about the user's jobs and available targets etc.

The panel isn't yet enabled by default. It requires a special configuration to be defined in VS Code settings.

prompt: "Job name",
value: new Date().toISOString(),
});
if (!jobName) return; // TODO: Log a telemetry event for this?

Check notice

Code scanning / devskim

A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note

Suspicious comment
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not new in this PR

vscode/src/copilot/azqChatService.ts Fixed Show fixed Hide fixed
vscode/src/copilot/copilot.ts Fixed Show fixed Hide fixed
const workspace = await getConversationWorkspace(conversationState);

const recentJobs = (await getRecentJobs(workspace)).map((job) => {
return {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this different filtering of properties that 'responseJobToJob' in 'workspaceActions.ts'?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right. I'll double check this code, but my intention is that GetJobs returns less details than GetJob , most importantly by dropping errorData . errorData can get very large and fills up input tokens very quickly if we include it in GetJobs for every job. But we do want to include it when we get details for a single job using GetJob.

Meanwhile responseJobToJob drops properties we'll never read such as containerUri straight off the bat. They just confuse the copilot.

);
}

class CopilotWebviewViewProvider implements WebviewViewProvider {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this also have a WebviewPanelSerializer? Else do you lose all chat history when you restart VS Code or reload the window? (See WebviewPanel.ts for the existing webviews)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do lose chat history... I meant that to be a "feature" but we can revisit. I figured most often conversations are pretty short, and intended to do a specific task related to current state of your workspace. So I figured that having a conversation history that's from days ago, including stale details about your workspace, will do more harm than help.

}

export function getVisibleQSharpDocumentUri(): vscode.Uri | undefined {
return vscode.window.visibleTextEditors.find((editor) =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there are several visible, will this return the one that has/had focus? Or just the first one it finds?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure it's the first one it finds. Since this is invoked when the user is interacting with the copilot panel, it's actually guaranteed that no Q# editors will have focus. I'll play ground with the multiple-window scenario and see if the behavior makes sense.

The other thought I had is to just give the user an indicator of what the active editor window is, in the copilot panel itself. Like just say "BellState.qs" somewhere in small text. Similar to how the GH Copilot in VS Code shows you which file(s) are in context.

@minestarks minestarks force-pushed the minestarks/copilot-vscode branch from 0cbd900 to 94f8c3d Compare February 10, 2025 21:27
@minestarks minestarks changed the title copilot panel for vs code Copilot chat panel for VS Code Feb 10, 2025
@minestarks minestarks marked this pull request as ready for review February 10, 2025 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants