From e1f57b6f09a5022d82461a3f7a913ac8376967ab Mon Sep 17 00:00:00 2001 From: martsforever Date: Tue, 31 Mar 2026 16:57:56 +0800 Subject: [PATCH] feat: optimize PER_REQ_CONFIG_MODIFIER --- app/utils/PER_REQ_CONFIG_MODIFIER.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/utils/PER_REQ_CONFIG_MODIFIER.py b/app/utils/PER_REQ_CONFIG_MODIFIER.py index ec6ee93..08a6ab1 100644 --- a/app/utils/PER_REQ_CONFIG_MODIFIER.py +++ b/app/utils/PER_REQ_CONFIG_MODIFIER.py @@ -1,6 +1,10 @@ import uuid +def next_thread_id(): + return str(uuid.uuid4()) + + async def PER_REQ_CONFIG_MODIFIER(config, request): body = await request.json() return { @@ -9,6 +13,6 @@ async def PER_REQ_CONFIG_MODIFIER(config, request): body .get("config", {}) .get("configurable", {}) - .get("thread_id", None) or str(uuid.uuid4()) + .get("thread_id", None) or next_thread_id() } }