From 9bfce3705444145b316c1f4291dd35bdfb78d9e8 Mon Sep 17 00:00:00 2001 From: Junyan Qin <1010553892@qq.com> Date: Fri, 22 Sep 2023 12:14:09 +0000 Subject: [PATCH] feat: output channel identifier in resp id --- free_one_api/impls/forward/mgr.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/free_one_api/impls/forward/mgr.py b/free_one_api/impls/forward/mgr.py index cf4a448..924e7cd 100644 --- a/free_one_api/impls/forward/mgr.py +++ b/free_one_api/impls/forward/mgr.py @@ -71,7 +71,12 @@ async def __non_stream_query( req: request.Request, ) -> quart.Response: before = time.time() - id_suffix = "".join(random.choices(string.ascii_letters+string.digits, k=29)) + + # id_suffix: channel id(3 chars) + adapter module name(max 10 chars) + random(16 chars) + id_suffix = "" + id_suffix += "{}".format(chan.id).zfill(3) + id_suffix += chan.adapter.__class__.__name__[:10] + id_suffix += "".join(random.choices(string.ascii_letters+string.digits, k=29-len(id_suffix))) normal_message = ""