chatModel.ts ×10

Frontier kind: Code frontier

unlabeled · c_56f896bdcae9

12 tests · 45400 LOC · 194 files · introduces 0 tests · 47 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
10 ranges47 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
4310 ranges45400 lines · 194 files · Browse complete extent
All tests (intent)
12 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: 47 introduced LOC across 10 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/contrib/chat/common/model/chatModel.ts 47 introduced LOC · 10 ranges

Open complete file

1182
1183 public set shouldBeRemovedOnSend(disablement: IChatRequestDisablement | undefined) {
1184 > if (this._shouldBeRemovedOnSend === disablement) { chatModel.ts
1185 > return;
1186 > }
1187
1188 this._shouldBeRemovedOnSend = disablement;
1189 this._onDidChange.fire(defaultChatResponseModelChangeReason);
1190 > } chatModel.ts
1191
1192 public get isCanceled(): boolean {
1343 this._timestamp = params.timestamp || Date.now();
1344 if (params.modelState) {
1345 > this._modelState.set(params.modelState, undefined); chatModel.ts
1346 > }
1347 this._completionTimestamp = params.completionTimestamp === null
1348 ? undefined
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 chatModel.ts
2753 > reviveSerializedAgent(raw.agent) : undefined;
2754 >
2755 > // Port entries from old format
2756 > const result = 'responseErrorDetails' in raw ?
2757 // eslint-disable-next-line local/code-no-dangerous-type-assertions
2758 > { errorDetails: raw.responseErrorDetails } as IChatAgentResult : raw.result; chatModel.ts
2759 > let modelState = raw.modelState || { value: raw.isCanceled ? ResponseModelState.Cancelled : ResponseModelState.Complete, completedAt: Date.now() };
2760 > if (modelState.value === ResponseModelState.Pending || modelState.value === ResponseModelState.NeedsInput) {
2761 modelState = { value: ResponseModelState.Cancelled, completedAt: Date.now() };
2762 }
2763 > chatModel.ts
2764 > // Mark question carousels as used after
2765 > // deserialization. After a reload, the extension is no longer listening for
2766 > // their responses, so they cannot be interacted with.
2767 > if (raw.response) {
2768 > for (const part of raw.response) {
2769 if (hasKey(part, { kind: true }) && (part.kind === 'questionCarousel' || part.kind === 'planReview')) {
2770 part.isUsed = true;
2771 }
2772 }
2773 > } chatModel.ts
2774 >
2775 > request.response = new ChatResponseModel({
2776 > responseContent: raw.response ?? [new MarkdownString(raw.response)],
2777 > session: this,
2778 > agent,
2779 > slashCommand: raw.slashCommand,
2780 > requestId: request.id,
2781 > modelState,
2782 > completionTimestamp: raw.modelState && 'completedAt' in raw.modelState && Number.isFinite(raw.modelState.completedAt) && raw.modelState.completedAt > 0
2783 ? raw.modelState.completedAt
2784 : null,
2785 > vote: raw.vote, chatModel.ts
2786 > timestamp: typeof raw.responseTimestamp === 'number' && raw.responseTimestamp > 0 ? raw.responseTimestamp : requestTimestamp,
2787 > result,
2788 > followups: raw.followups,
2789 > restoredId: raw.responseId,
2790 > timeSpentWaiting: raw.timeSpentWaiting,
2791 > elapsedMs: raw.elapsedMs,
2792 > shouldBeBlocked: request.shouldBeBlocked.get(),
2793 > codeBlockInfos: raw.responseMarkdownInfo?.map<ICodeBlockInfo>(info => ({ suggestionId: info.suggestionId })),
2794 > });
2795 > request.response.shouldBeRemovedOnSend = raw.isHidden ? { requestId: raw.requestId } : raw.shouldBeRemovedOnSend;
2796 > if (typeof raw.completionTokens === 'number' || typeof raw.promptTokens === 'number' || typeof raw.copilotCredits === 'number') {
2797 request.response.setUsage({
2798 kind: 'usage',
2804 });
2805 }
2806 > if (raw.usedContext) { // @ulugbekna: if this's a new vscode sessions, doc versions are incorrect anyway? chatModel.ts
2807 request.response.applyReference(revive(raw.usedContext));
2808 }
2809 > chatModel.ts
2810 > raw.contentReferences?.forEach(r => request.response!.applyReference(revive(r)));
2811 > raw.codeCitations?.forEach(c => request.response!.applyCodeCitation(revive(c)));
2812 > }
2813 return request;
2814 }