Skip to content

Commit

Permalink
⚡ Allow memoryId in memory genOption
Browse files Browse the repository at this point in the history
  • Loading branch information
lowczarc committed Oct 18, 2023
1 parent bf7d8a6 commit 3df8e2f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export type ChatOptions = [{ chatId: string }];

export type MemoryOptions = [
{ memoryId: string },
{ memory: Memory },
{ memory: Memory | string },
{ data: [LoaderFunction] | LoaderFunction },
];

Expand Down Expand Up @@ -120,12 +120,12 @@ export type GenerationResult = {
async function getMemoryIds(
dataMemory: string | undefined,
genOptionsMemoryId: string | undefined,
genOptionsMemory: Memory | undefined,
genOptionsMemory: Memory | string | undefined,
): Promise<string[] | string | undefined> {
const memoryIds: (string | undefined)[] = [
dataMemory,
genOptionsMemoryId,
await genOptionsMemory?.memoryId,
typeof genOptionsMemory === "string" ? genOptionsMemory : await genOptionsMemory?.memoryId,
];

const validMemoryIds: string[] = memoryIds.filter((id): id is string => id !== undefined);
Expand Down

0 comments on commit 3df8e2f

Please sign in to comment.