Skip to content

Commit

Permalink
v1.3.3 fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
lanqian528 committed Jun 20, 2024
1 parent d37454e commit f9800ff
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
images: lanqian528/chat2api
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=v1.3.2
type=raw,value=v1.3.3
- name: Build and push
uses: docker/build-push-action@v5
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

## 功能

### 最新版 v1.3.2
### 最新版 v1.3.3

> 已完成
> - [x] 流式、非流式传输
Expand Down
6 changes: 6 additions & 0 deletions chatgpt/chatFormat.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import pybase64
import websockets
from fastapi import HTTPException

from api.files import get_file_content
from api.models import model_system_fingerprint
Expand Down Expand Up @@ -260,6 +261,11 @@ async def stream_response(service, response, model, max_tokens):
else:
continue
except Exception as e:
if chunk.startswith("data: "):
chunk_data = json.loads(chunk[6:])
if chunk_data.get("error"):
logger.error(f"Error: {chunk_data.get('error')}")
raise HTTPException(status_code=403, detail=chunk_data.get('error'))
logger.error(f"Error: {chunk}, details: {str(e)}")
continue

Expand Down
2 changes: 1 addition & 1 deletion utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def is_true(x):
proxy_url_list = proxy_url.split(',') if proxy_url else []

logger.info("-" * 60)
logger.info("Chat2Api v1.3.2 | https://github.com/lanqian528/chat2api")
logger.info("Chat2Api v1.3.3 | https://github.com/lanqian528/chat2api")
logger.info("-" * 60)
logger.info("Environment variables:")
logger.info("API_PREFIX: " + str(api_prefix))
Expand Down

0 comments on commit f9800ff

Please sign in to comment.