Browse Source

fix: AI Assistant panel keeps loading chat history after a failed load, showing the error instead of ignoring every later chat selection until the page reloads

pull/16551/head
Igor Kulikov 1 month ago
parent
commit
4a4e42750d
  1. 13
      ui-ngx/src/app/modules/home/components/ai/ai-assistant-panel.component.ts

13
ui-ngx/src/app/modules/home/components/ai/ai-assistant-panel.component.ts

@ -14,8 +14,8 @@ import {
ViewChild
} from '@angular/core';
import { ApprovalChatMessage, ChatMessage } from '@shared/models/solution-creator.models';
import { Observable, of, Subject, throwError, timer } from 'rxjs';
import { concatMap, finalize, retry, switchMap, takeUntil, tap } from 'rxjs/operators';
import { EMPTY, Observable, of, Subject, throwError, timer } from 'rxjs';
import { catchError, concatMap, finalize, retry, switchMap, takeUntil, tap } from 'rxjs/operators';
import { HttpErrorResponse } from '@angular/common/http';
import { AiChatService } from '@core/http/ai-chat.service';
import {
@ -184,9 +184,12 @@ export class AiAssistantPanelComponent implements OnInit {
ngOnInit() {
this.loadChat$.pipe(
switchMap(id => {
return this.aiChat.getChatMessages(id, {ignoreLoading: true, ignoreErrors: true});
}),
switchMap(id => this.aiChat.getChatMessages(id, {ignoreLoading: true, ignoreErrors: true}).pipe(
catchError(err => {
this.showErrorMessage(err);
return EMPTY;
})
)),
takeUntilDestroyed(this.destroyRef)
).subscribe(messages => {
this.showHistory(messages);

Loading…
Cancel
Save