chatModel.ts ×5

Frontier kind: Code frontier

unlabeled · c_4aefb5880fff

13 tests · 45077 LOC · 194 files · introduces 0 tests · 40 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
7 ranges40 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
4215 ranges45077 lines · 194 files · Browse complete extent
All tests (intent)
13 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.

2 files ranked by introduced lines: 40 introduced LOC across 7 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/contrib/chat/common/model/chatModel.ts 34 introduced LOC · 5 ranges

Open complete file

2724
2725 private _deserializeRequest(raw: ISerializableChatRequestData): ChatRequestModel {
2726 > const parsedRequest = chatModel.ts
2727 > typeof raw.message === 'string'
2728 ? this.getParsedRequestFromString(raw.message)
2729 > : reviveParsedChatRequest(raw.message); chatModel.ts
2730 >
2731 > // Old messages don't have variableData, or have it in the wrong (non-array) shape
2732 > const variableData: IChatRequestVariableData = this.reviveVariableData(raw.variableData);
2733 > const requestTimestamp = typeof raw.timestamp === 'number' && raw.timestamp > 0 ? raw.timestamp : undefined;
2734 > const request = new ChatRequestModel({
2735 > session: this,
2736 > message: parsedRequest,
2737 > variableData,
2738 > timestamp: requestTimestamp,
2739 > fallbackTimestamp: this._timestamp,
2740 > restoredId: raw.requestId,
2741 > confirmation: raw.confirmation,
2742 > editedFileEvents: raw.editedFileEvents,
2743 > modelId: raw.modelId,
2744 > modeInfo: raw.modeInfo,
2745 > isSystemInitiated: raw.isSystemInitiated,
2746 > systemInitiatedLabel: raw.systemInitiatedLabel,
2747 > terminalExecutionId: raw.terminalExecutionId,
2748 > });
2749 > request.shouldBeRemovedOnSend = raw.isHidden ? { requestId: raw.requestId } : raw.shouldBeRemovedOnSend;
2750 > // eslint-disable-next-line @typescript-eslint/no-explicit-any, local/code-no-any-casts
2751 > if (raw.response || raw.result || (raw as any).responseErrorDetails) {
2752 const agent = (raw.agent && 'metadata' in raw.agent) ? // Check for the new format, ignore entries in the old format
2753 reviveSerializedAgent(raw.agent) : undefined;
2811 raw.codeCitations?.forEach(c => request.response!.applyCodeCitation(revive(c)));
2812 }
2813 > return request; chatModel.ts
2814 > }
2815
2816 private reviveVariableData(raw: IChatRequestVariableData): IChatRequestVariableData {
2817 > const variableData = raw && Array.isArray(raw.variables) chatModel.ts
2818 > ? raw :
2819 { variables: [] };
2820 > chatModel.ts
2821 > variableData.variables = variableData.variables.map<IChatRequestVariableEntry>(IChatRequestVariableEntry.fromExport);
2822 >
2823 > return variableData;
2824 > }
2825
2826 private getParsedRequestFromString(message: string): IParsedChatRequest {
src/vs/workbench/contrib/chat/common/requestParser/chatParserTypes.ts 6 introduced LOC · 2 ranges

Open complete file

229
230 export function reviveParsedChatRequest(serialized: IParsedChatRequest): IParsedChatRequest {
231 > return { chatParserTypes.ts
232 > text: serialized.text,
233 > parts: serialized.parts.map(part => {
234 if (part.kind === ChatRequestTextPart.Kind) {
235 return new ChatRequestTextPart(
310 throw new Error(`Unknown chat request part: ${part.kind}`);
311 }
313 > };
314 > }
315
316 export function extractAgentAndCommand(parsed: IParsedChatRequest): { agentPart: ChatRequestAgentPart | undefined; commandPart: ChatRequestAgentSubcommandPart | undefined } {