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.

685 B
Raw Blame
import { defineReplica } from '@/libs/replica';
import type { GenerationBatch } from '@/types/generation';

export interface GenerationBatchesParams {
  topicId: string;
}

/**
 * Generation batches are owned by one topic and fetched per topic, so the
 * replica keeps one entry per topic id (`generationBatchesMap[topicId]`) and
 * two topics never share — or reset — one list. The identity scope partitions
 * the entries the same way it partitions the topic list.
 */
export const generationBatchesResource = defineReplica<GenerationBatchesParams, GenerationBatch[]>({
  key: ({ topicId }) => topicId,
  name: 'imageGenerationBatches',
  storage: 'indexedDB',
  version: 1,
});