feat: optimize PER_REQ_CONFIG_MODIFIER
This commit is contained in:
@@ -1,6 +1,10 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
|
|
||||||
|
def next_thread_id():
|
||||||
|
return str(uuid.uuid4())
|
||||||
|
|
||||||
|
|
||||||
async def PER_REQ_CONFIG_MODIFIER(config, request):
|
async def PER_REQ_CONFIG_MODIFIER(config, request):
|
||||||
body = await request.json()
|
body = await request.json()
|
||||||
return {
|
return {
|
||||||
@@ -9,6 +13,6 @@ async def PER_REQ_CONFIG_MODIFIER(config, request):
|
|||||||
body
|
body
|
||||||
.get("config", {})
|
.get("config", {})
|
||||||
.get("configurable", {})
|
.get("configurable", {})
|
||||||
.get("thread_id", None) or str(uuid.uuid4())
|
.get("thread_id", None) or next_thread_id()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user