-
Notifications
You must be signed in to change notification settings - Fork 36.4k
Support for creating new chat with metadata #268236
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for creating new chat sessions with metadata by introducing a new command and updating the chat session infrastructure to handle metadata throughout the chat lifecycle.
- Adds a new action
OpenNewChatSessionEditorWithMetadatato create chat editors with custom metadata - Updates chat session types and interfaces to properly type metadata as
Record<string, any> - Enhances the chat session service to extract and pass metadata from existing editors when resolving sessions
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/browser/actions/chatSessionActions.ts | Adds new OpenNewChatSessionEditorWithMetadata action class |
| src/vs/workbench/contrib/chat/browser/chat.contribution.ts | Registers the new metadata action and updates imports |
| src/vs/workbench/contrib/chat/browser/chatEditor.ts | Extends IChatEditorOptions interface to include optional metadata field |
| src/vs/workbench/contrib/chat/browser/chatSessions.contribution.ts | Updates metadata type definition and adds metadata extraction logic |
| for (const editor of group.editors) { | ||
| if (editor instanceof ChatEditorInput) { | ||
| try { | ||
| if (editor.sessionId === request.sessionId) { |
Copilot
AI
Sep 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The metadata assignment should be placed after the null check for editor.options. If editor.options is undefined, accessing editor.options.metadata will throw a runtime error.
| if (editor.sessionId === request.sessionId) { | |
| if (editor.sessionId === request.sessionId && editor.options) { |
| }); | ||
| } | ||
|
|
||
| async run(accessor: ServicesAccessor, chatSessionType: string, metadata: Record<string, any>) { |
Copilot
AI
Sep 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The chatSessionType and metadata parameters lack input validation. Consider adding validation to ensure chatSessionType is not empty and metadata is a valid object to prevent runtime errors.
| request, | ||
| prompt: request.message, | ||
| history, | ||
| metadata |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am deleting this dynamic agent with #268089
Related to: #268219
This adds a new command to support creating new chats with metadata