Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/vs/workbench/contrib/chat/browser/actions/chatActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { fromNowByDay } from '../../../../../base/common/date.js';
import { KeyCode, KeyMod } from '../../../../../base/common/keyCodes.js';
import { DisposableStore } from '../../../../../base/common/lifecycle.js';
import { ThemeIcon } from '../../../../../base/common/themables.js';
import { URI } from '../../../../../base/common/uri.js';
import { ICodeEditor } from '../../../../../editor/browser/editorBrowser.js';
import { EditorAction2, ServicesAccessor } from '../../../../../editor/browser/editorExtensions.js';
import { Position } from '../../../../../editor/common/core/position.js';
Expand Down Expand Up @@ -55,6 +56,17 @@ export interface IChatViewOpenOptions {
* Any previous chat requests and responses that should be shown in the chat view.
*/
previousRequests?: IChatViewOpenRequestEntry[];

/**
* The image(s) to include in the request
*/
images?: IChatImageAttachment[];
}

export interface IChatImageAttachment {
id: string;
name: string;
value: URI | Uint8Array;
}

export interface IChatViewOpenRequestEntry {
Expand Down Expand Up @@ -101,6 +113,16 @@ class OpenChatGlobalAction extends Action2 {
chatService.addCompleteRequest(chatWidget.viewModel.sessionId, request, undefined, 0, { message: response });
}
}
if (opts?.images) {
chatWidget.attachmentModel.clear();
for (const image of opts.images) {
chatWidget.attachmentModel.addContext({
...image,
isDynamic: true,
isImage: true
});
}
}
if (opts?.query) {
if (opts.isPartialQuery) {
chatWidget.setInput(opts.query);
Expand Down
3 changes: 3 additions & 0 deletions src/vs/workbench/contrib/chat/common/chatModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ export interface IChatRequestVariableEntry {
references?: IChatContentReference[];

// TODO are these just a 'kind'?
/**
* True if the variable has a value vs being a reference to a variable
*/
isDynamic?: boolean;
isFile?: boolean;
isTool?: boolean;
Expand Down