Skip to content
Snippets Groups Projects
Unverified Commit 265976df authored by Philipp Serrer's avatar Philipp Serrer Committed by GitHub
Browse files

fix: incorrect hash because of missing params in decorator (#891)

parent 7e1b96a2
No related branches found
No related tags found
No related merge requests found
---
"llamaindex": minor
---
fix bug with node decorator
......@@ -4,12 +4,19 @@ import { getChunkSize } from "../settings/chunk-size.js";
const emitOnce = false;
export function chunkSizeCheck(
contentGetter: () => string,
_context: ClassMethodDecoratorContext | ClassGetterDecoratorContext,
export function chunkSizeCheck<
This extends BaseNode,
Args extends any[],
Return,
>(
contentGetter: (this: This, ...args: Args) => string,
_context: ClassMethodDecoratorContext<
This,
(this: This, ...args: Args) => Return
>,
) {
return function <Node extends BaseNode>(this: Node) {
const content = contentGetter.call(this);
return function (this: This, ...args: Args) {
const content = contentGetter.call(this, ...args);
const chunkSize = getChunkSize();
const enableChunkSizeCheck = getEnv("ENABLE_CHUNK_SIZE_CHECK") === "true";
if (
......
......@@ -53,7 +53,7 @@ describe("TextNode", () => {
"endCharIdx": undefined,
"excludedEmbedMetadataKeys": [],
"excludedLlmMetadataKeys": [],
"hash": "nTSKdUTYqR52MPv/brvb4RTGeqedTEqG9QN8KSAj2Do=",
"hash": "Z6SWgFPlalaeblMGQGw0KS3qKgmZdEWXKfzEp/K+QN0=",
"id_": Any<String>,
"metadata": {
"something": 1,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment