chatImageExtraction.ts ×6

Frontier kind: Code frontier

unlabeled · c_976fbd79c067

6 tests · 41840 LOC · 180 files · introduces 0 tests · 28 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
6 ranges28 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
3662 ranges41840 lines · 180 files · Browse complete extent
All tests (intent)
6 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 28 introduced LOC across 6 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/contrib/chat/common/chatImageExtraction.ts 28 introduced LOC · 6 ranges

Open complete file

190
191 export function coerceImageBuffer(value: unknown): Uint8Array | undefined {
192 > if (value instanceof Uint8Array) { chatImageExtraction.ts
193 return value;
194 }
196 return new Uint8Array(value);
197 }
198 > if (!value || typeof value !== 'object' || Array.isArray(value)) { chatImageExtraction.ts
199 return undefined;
200 }
221 */
222 export function extractImagesFromChatRequest(
223 > request: IChatRequestViewModel, chatImageExtraction.ts
224 > ): IChatExtractedImage[] {
225 > return extractImagesFromChatVariables(request.variables);
226 > }
227
228 export function extractImagesFromChatVariables(
229 > variables: readonly IChatRequestVariableEntry[], chatImageExtraction.ts
230 > ): IChatExtractedImage[] {
231 > const images: IChatExtractedImage[] = [];
232 > for (const variable of variables) {
233 > if (!isImageVariableEntry(variable)) {
234 continue;
235 }
236 > const buffer = coerceImageBuffer(variable.value); chatImageExtraction.ts
237 > if (!buffer) {
238 continue;
239 }
240 > const mimeType = variable.mimeType ?? getMediaMime(variable.name) ?? 'image/png'; chatImageExtraction.ts
241 > const uri = variable.references?.[0]?.reference;
242 > const imageUri = URI.isUri(uri) ? uri : URI.from({ scheme: 'data', path: `${variable.id}/${encodeURIComponent(variable.name)}` });
243 > images.push({
244 > id: imageUri.toString(),
245 > uri: imageUri,
246 > name: variable.name,
247 > mimeType,
248 > data: VSBuffer.wrap(buffer),
249 > source: localize('chatImageExtraction.userAttachment', "Attachment"),
250 > caption: undefined,
251 > });
252 > }
253 > return images;
254 > }