From 13cfd57dbb43a7cdfb5444d9a4d5c34ca46909a6 Mon Sep 17 00:00:00 2001 From: "yanlong.wang" Date: Wed, 19 Feb 2025 18:21:12 +0800 Subject: [PATCH] jina-ai: omit results in context --- jina-ai/src/patch-express.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/jina-ai/src/patch-express.ts b/jina-ai/src/patch-express.ts index b6d71df8..53cad847 100644 --- a/jina-ai/src/patch-express.ts +++ b/jina-ai/src/patch-express.ts @@ -166,8 +166,13 @@ export const jinaAiMiddleware = (req: Request, res: Response, next: NextFunction }); } if (ctx.promptContext) { + const patchedCtx = { ...ctx.promptContext }; + if (Array.isArray(patchedCtx.context)) { + patchedCtx.context = patchedCtx.context.map((x: object) => ({ ...x, result: undefined })) + } + firebaseDefaultBucket.file(`promptContext/${ctx.traceId}.json`).save( - JSON.stringify(ctx.promptContext), + JSON.stringify(patchedCtx), { metadata: { contentType: 'application/json',