Skip to content

Commit

Permalink
chore: hash markdown records for turbopuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
dsinghvi committed Feb 11, 2025
1 parent 0d87c1a commit 71e3b05
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { decode } from "html-entities";
import { maybePrepareMdxContent } from "../../utils/prepare-mdx-content";
import { FernTurbopufferRecordWithoutVector } from "../types";
import { BaseRecord } from "./create-base-record";
import { createHash } from "crypto";

interface CreateMarkdownRecordsOptions {
base: BaseRecord;
Expand Down Expand Up @@ -180,7 +181,7 @@ export async function createMarkdownRecords({
return chunked_content.map((chunk, i) => {
const record: FernTurbopufferRecordWithoutVector = {
...base_markdown_record,
id: `${base.id}-${heading.id}-chunk:${i}`, // theoretically this is unique, but we'll see
id: createHash("sha256").update(`${base.id}-${heading.id}-chunk:${i}`).digest("hex"),
attributes: {
...base_markdown_record.attributes,
...hierarchy,
Expand Down

0 comments on commit 71e3b05

Please sign in to comment.