aboutsummaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorDhravya <[email protected]>2024-06-22 17:43:16 -0500
committerDhravya <[email protected]>2024-06-22 17:43:16 -0500
commita2f8a27e771f59380719f2e9997cd926d5d8e83e (patch)
tree58da4ba7bbfc8885d01d79ba01e173f1d1f7906e /packages
parentadded multi-turn conversations (diff)
downloadsupermemory-a2f8a27e771f59380719f2e9997cd926d5d8e83e.tar.xz
supermemory-a2f8a27e771f59380719f2e9997cd926d5d8e83e.zip
addeed chathistory functionality
Diffstat (limited to 'packages')
-rw-r--r--packages/shared-types/index.ts25
1 files changed, 15 insertions, 10 deletions
diff --git a/packages/shared-types/index.ts b/packages/shared-types/index.ts
index d3f466e1..318684b7 100644
--- a/packages/shared-types/index.ts
+++ b/packages/shared-types/index.ts
@@ -1,18 +1,20 @@
import { z } from "zod";
+export const SourceZod = z.object({
+ type: z.string(),
+ source: z.string(),
+ title: z.string(),
+ content: z.string(),
+ numChunks: z.number().optional().default(1),
+});
+
+export type Source = z.infer<typeof SourceZod>;
+
export const ChatHistoryZod = z.object({
question: z.string(),
answer: z.object({
- parts: z.array(z.object({ text: z.string() })),
- sources: z.array(
- z.object({
- type: z.enum(["note", "page", "tweet"]),
- source: z.string(),
- title: z.string(),
- content: z.string(),
- numChunks: z.number().optional().default(1),
- }),
- ),
+ parts: z.array(z.object({ text: z.string().optional() })),
+ sources: z.array(SourceZod),
justification: z.string().optional(),
}),
});
@@ -52,5 +54,8 @@ export function convertChatHistoryList(
);
});
+ // THE LAST ASSISTANT CONTENT WILL ALWAYS BE EMPTY, so we remove it
+ convertedChats.pop();
+
return convertedChats;
}