suspendHideSidebar: isMediumScreen()

in apps/chat/src/store/conversations/conversations.epics.ts [947:1118]


                  suspendHideSidebar: isMediumScreen(),
                }),
              ),
            );
          }
        }

        return concat(
          zip(
            Array.from(conversationIds).map((id) =>
              !isEntityIdLocal({ id })
                ? ConversationService.deleteConversation(
                    getConversationInfoFromId(id),
                  ).pipe(
                    map(() => null),
                    catchError((err) => {
                      const { name } = getConversationInfoFromId(id);
                      !suppressErrorMessage &&
                        console.error(`Error during deleting "${name}"`, err);
                      return of(name);
                    }),
                  )
                : of(null),
            ),
          ).pipe(
            switchMap((failedNames) =>
              concat(
                iif(
                  () =>
                    failedNames.filter(Boolean).length > 0 &&
                    !suppressErrorMessage,
                  of(
                    UIActions.showErrorToast(
                      translate(
                        `An error occurred while deleting the conversation(s): "${failedNames.filter(Boolean).join('", "')}"`,
                      ),
                    ),
                  ),
                  EMPTY,
                ),
                of(
                  ConversationsActions.deleteConversationsComplete({
                    conversationIds,
                  }),
                ),
              ),
            ),
          ),
          ...actions,
        );
      },
    ),
  );

const rateMessageEpic: AppEpic = (action$, state$) =>
  action$.pipe(
    filter(ConversationsActions.rateMessage.match),
    map(({ payload }) => ({
      payload,
      conversations: ConversationsSelectors.selectConversations(state$.value),
    })),
    switchMap(({ conversations, payload }) => {
      const conversation = conversations.find(
        (conv) => conv.id === payload.conversationId,
      );
      if (!conversation) {
        return of(
          ConversationsActions.rateMessageFail({
            error: translate(
              'No conversation exists for rating with provided conversation id',
            ),
          }),
        );
      }
      const message = (conversation as Conversation).messages[
        payload.messageIndex
      ];

      if (!message || !message.responseId) {
        return of(
          ConversationsActions.rateMessageFail({
            error: translate('Message cannot be rated'),
          }),
        );
      }

      const rateBody: RateBody = {
        responseId: message.responseId,
        modelId: conversation.model.id,
        id: conversation.id,
        value: payload.rate > 0 ? true : false,
      };

      return fromFetch('/api/rate', {
        method: HTTPMethod.POST,
        headers: {
          'Content-Type': 'application/json',
        },
        body: JSON.stringify(rateBody),
      }).pipe(
        switchMap((resp) => {
          if (!resp.ok) {
            return throwError(() => resp);
          }
          return from(resp.json());
        }),
        map(() => {
          return ConversationsActions.rateMessageSuccess(payload);
        }),
        catchError((e: Response) => {
          return of(
            ConversationsActions.rateMessageFail({
              error: e,
            }),
          );
        }),
      );
    }),
  );

const updateMessageEpic: AppEpic = (action$, state$) =>
  action$.pipe(
    filter(ConversationsActions.updateMessage.match),
    map(({ payload }) => ({
      payload,
      conversations: ConversationsSelectors.selectConversations(state$.value),
    })),
    switchMap(({ conversations, payload }) => {
      const conversation = conversations.find(
        (conv) => conv.id === payload.conversationId,
      ) as Conversation;
      if (!conversation || !conversation.messages[payload.messageIndex]) {
        return EMPTY;
      }

      const actions = [];
      const messages = [...conversation.messages];
      messages[payload.messageIndex] = {
        ...messages[payload.messageIndex],
        ...payload.values,
      };

      actions.push(
        of(
          ConversationsActions.updateConversation({
            id: payload.conversationId,
            values: {
              messages: [...messages],
            },
          }),
        ),
      );
      const attachments =
        messages[payload.messageIndex].custom_content?.attachments;

      if (attachments) {
        const attachmentParentFolders = uniq(
          attachments
            .map(
              (attachment) =>
                attachment.url &&
                getParentFolderIdsFromEntityId(
                  decodeURIComponent(attachment.url),
                ),
            )
            .filter(Boolean),
        ).flat();

        if (attachmentParentFolders.length) {
          actions.push(
            of(
              FilesActions.updateFoldersStatus({