chatModel.ts ×7

Frontier kind: Code frontier

unlabeled · c_deb57d6fb7b5

5 tests · 72452 LOC · 309 files · introduces 0 tests · 41 LOC · 3 files

Introduces — evidence that enters the hierarchy at this concept

Code
15 ranges41 lines · 3 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
6337 ranges72452 lines · 309 files · Browse complete extent
All tests (intent)
5 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.

3 files ranked by introduced lines: 41 introduced LOC across 15 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts 25 introduced LOC · 5 ranges

Open complete file

600
601 private async acquireOrRestoreLocalSession(sessionResource: URI, debugOwner?: string): Promise<IChatModelReference | undefined> {
602 > this.trace('acquireOrRestoreSession', `${sessionResource}`); chatServiceImpl.ts
603 > const existingRef = this.acquireExistingSession(sessionResource, debugOwner);
604 > if (existingRef) {
605 return existingRef;
606 }
608 > let sessionData: ISerializedChatDataReference | undefined;
609 > if (isEqual(this.transferredSessionResource, sessionResource)) {
610 this._transferredSessionResource = undefined;
611 sessionData = await this._chatSessionStore.readTransferredSession(sessionResource);
612 > } else { chatServiceImpl.ts
613 > const localSessionId = LocalChatSessionUri.parseLocalSessionId(sessionResource);
614 > if (localSessionId) {
615 > sessionData = await this._chatSessionStore.readSession(localSessionId);
616 > }
617 > }
618 >
619 > if (!sessionData) {
620 return undefined;
621 }
623 > const sessionRef = this._sessionModels.acquireOrCreate({
624 > initialData: sessionData,
625 > location: sessionData.value.initialLocation ?? ChatAgentLocation.Chat,
626 > sessionResource,
627 > canUseTools: true,
628 > }, debugOwner ?? 'ChatService#acquireOrRestoreLocalSession');
629 >
630 > return sessionRef;
631 > }
632
633 // There are some cases where this returns a real string. What happens if it doesn't?
656 async acquireOrLoadSession(sessionResource: URI, location: ChatAgentLocation, token: CancellationToken, debugOwner?: string): Promise<IChatModelReference | undefined> {
657 if (LocalChatSessionUri.isLocalSession(sessionResource)) {
658 > return this.acquireOrRestoreLocalSession(sessionResource, debugOwner); chatServiceImpl.ts
659 } else {
660 return this.loadRemoteSession(sessionResource, location, token, debugOwner);
src/vs/workbench/contrib/chat/common/model/chatModel.ts 11 introduced LOC · 7 ranges

Open complete file

1346 }
1347 this._completionTimestamp = params.completionTimestamp === null
1348 > ? undefined chatModel.ts
1349 : params.completionTimestamp ?? (params.modelState && 'completedAt' in params.modelState ? params.modelState.completedAt : undefined);
1350 this._timeSpentWaitingAccumulator = params.timeSpentWaiting || 0;
2605 // Hydrate pending requests from serialized data
2606 if (isValidFullData && initialData.pendingRequests) {
2607 > this._pendingRequests = this._deserializePendingRequests(initialData.pendingRequests); chatModel.ts
2608 > }
2609
2610 this._initialLocation = initialData?.initialLocation ?? initialModelProps.initialLocation;
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() }; chatModel.ts
2762 > }
2763
2764 // Mark question carousels as used after
2782 completionTimestamp: raw.modelState && 'completedAt' in raw.modelState && Number.isFinite(raw.modelState.completedAt) && raw.modelState.completedAt > 0
2783 ? raw.modelState.completedAt
2784 > : null, chatModel.ts
2785 vote: raw.vote,
2786 timestamp: typeof raw.responseTimestamp === 'number' && raw.responseTimestamp > 0 ? raw.responseTimestamp : requestTimestamp,
2838 */
2839 private _deserializePendingRequests(pendingRequests: ISerializablePendingRequestData[]): IChatPendingRequest[] {
2840 > try { chatModel.ts
2841 > return pendingRequests.map(pending => ({
2842 id: pending.id,
2843 request: this._deserializeRequest(pending.request),
2849 : undefined,
2850 }
2851 > })); chatModel.ts
2852 > } catch (e) {
2853 this.logService.error('Failed to parse pending chat requests', e);
2854 return [];
2855 }
2856 > } chatModel.ts
2857
2858
src/vs/workbench/contrib/chat/common/model/chatSessionStore.ts 5 introduced LOC · 3 ranges

Open complete file

675 // Revive serialized markdown strings in response data
676 for (const request of session.requests) {
677 > if (Array.isArray(request.response)) { chatSessionStore.ts
678 > request.response = request.response.map((response) => {
679 if (typeof response === 'string') {
680 return new MarkdownString(response);
681 }
682 return response;
684 > } else if (typeof request.response === 'string') {
685 request.response = [new MarkdownString(request.response)];
686 }
688
689 return { value: normalizeSerializableChatData(session), serializer: log };