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
No known key found for this signature in database
GPG Key ID: C0A623C0BADF9F37

View File

@ -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',