Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

738 B
Raw Blame
import type { RecentItem } from '@lobechat/types';

import { lambdaClient } from '@/libs/trpc/client';

export const RECENT_SIDEBAR_TYPES = [
  'document',
  'task',
] as const satisfies readonly RecentItem['type'][];

class RecentService {
  getAll = (
    limit?: number,
    types?: readonly RecentItem['type'][],
    withTopicPreview?: boolean,
    mineOnly?: boolean,
    /** Drop topics owned by a private agent/group — the team tab's feed. */
    sharedOnly?: boolean,
  ): Promise<RecentItem[]> => {
    return lambdaClient.recent.getAll.query({
      limit,
      mineOnly,
      sharedOnly,
      types: types ? [...types] : undefined,
      withTopicPreview,
    });
  };
}

export const recentService = new RecentService();