From 73b8e2b16588bd0c2020dd345dc74a7072fac257 Mon Sep 17 00:00:00 2001 From: lanqian528 <5499636+lanqian528@users.noreply.github.com> Date: Sat, 10 Aug 2024 19:00:52 +0800 Subject: [PATCH] v1.4.1 fix bugs --- chat2api.py | 1 + chatgpt/chatFormat.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/chat2api.py b/chat2api.py index 66da6dd..ff3d4bb 100644 --- a/chat2api.py +++ b/chat2api.py @@ -64,6 +64,7 @@ async def process(request_data, req_token): res = await chat_service.send_conversation() return chat_service, res + @app.post(f"/{api_prefix}/v1/chat/completions" if api_prefix else "/v1/chat/completions") async def send_conversation(request: Request, req_token: str = Depends(oauth2_scheme)): try: diff --git a/chatgpt/chatFormat.py b/chatgpt/chatFormat.py index 1a54873..1f3c1ed 100644 --- a/chatgpt/chatFormat.py +++ b/chatgpt/chatFormat.py @@ -133,7 +133,7 @@ async def stream_response(service, response, model, max_tokens): system_fingerprint_list = model_system_fingerprint.get(model, None) system_fingerprint = random.choice(system_fingerprint_list) if system_fingerprint_list else None created_time = int(time.time()) - completion_tokens = -1 + completion_tokens = 0 len_last_content = 0 len_last_citation = 0 last_message_id = None