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