mirror of
https://github.com/lanqian528/chat2api.git
synced 2026-06-13 21:02:46 +08:00
fix bugs
This commit is contained in:
parent
f6565ac817
commit
fba399b2b5
@ -38,6 +38,10 @@ async def to_send_conversation(request_data, access_token):
|
||||
except HTTPException as e:
|
||||
await chat_service.close_client()
|
||||
raise HTTPException(status_code=e.status_code, detail=e.detail)
|
||||
except Exception as e:
|
||||
await chat_service.close_client()
|
||||
logger.error(f"Server error, {str(e)}")
|
||||
raise HTTPException(status_code=500, detail="Server error")
|
||||
|
||||
|
||||
@app.post(f"/{api_prefix}/v1/chat/completions" if api_prefix else "/v1/chat/completions")
|
||||
|
||||
@ -48,6 +48,8 @@ class ChatService:
|
||||
self.api_messages = self.data.get("messages", [])
|
||||
self.prompt_tokens = 0
|
||||
self.max_tokens = self.data.get("max_tokens", 2147483647)
|
||||
if not isinstance(self.max_tokens, int):
|
||||
self.max_tokens = 2147483647
|
||||
|
||||
self.chat_headers = None
|
||||
self.chat_request = None
|
||||
|
||||
Loading…
Reference in New Issue
Block a user