jina-ai: omit results in context

This commit is contained in:
yanlong.wang
2025-02-19 18:21:12 +08:00
parent bc2f187343
commit 13cfd57dbb

View File

@@ -166,8 +166,13 @@ export const jinaAiMiddleware = (req: Request, res: Response, next: NextFunction
}); });
} }
if (ctx.promptContext) { 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( firebaseDefaultBucket.file(`promptContext/${ctx.traceId}.json`).save(
JSON.stringify(ctx.promptContext), JSON.stringify(patchedCtx),
{ {
metadata: { metadata: {
contentType: 'application/json', contentType: 'application/json',