Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
lanqian528 committed May 22, 2024
1 parent 757939c commit 8c284ad
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 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.1.3
type=raw,value=v1.1.4
- name: Build and push
uses: docker/build-push-action@v5
Expand Down
4 changes: 2 additions & 2 deletions chat2api.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ async def upload_post(request: Request, text: str = Form(...)):
f.write(line.strip() + "\n")
logger.info(f"Token list count: {len(token_list)}")
tokens_count = len(token_list)
return templates.TemplateResponse("tokens.html", {"request": request, "api_prefix": api_prefix, "tokens_count": tokens_count})
return {"status": "success", "tokens_count": tokens_count}


@app.post(f"/{api_prefix}/tokens/clear" if api_prefix else "/tokens/clear")
Expand All @@ -96,7 +96,7 @@ async def upload_post(request: Request):
pass
logger.info(f"Token list count: {len(token_list)}")
tokens_count = len(token_list)
return templates.TemplateResponse("tokens.html", {"request": request, "api_prefix": api_prefix, "tokens_count": tokens_count})
return {"status": "success", "tokens_count": tokens_count}


@app.api_route("/{path:path}", methods=["GET", "POST", "PUT", "DELETE", "OPTIONS", "HEAD", "PATCH", "TRACE"])
Expand Down
8 changes: 4 additions & 4 deletions templates/tokens.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
const uploadForm = document.getElementById('uploadForm');
const clearForm = document.getElementById('clearForm');

if (apiPrefix) {
uploadForm.action = `/${apiPrefix}/tokens/upload`;
clearForm.action = `/${apiPrefix}/tokens/clear`;
} else {
if (apiPrefix === "None") {
uploadForm.action = "/tokens/upload";
clearForm.action = "/tokens/clear";
} else {
uploadForm.action = `/${apiPrefix}/tokens/upload`;
clearForm.action = `/${apiPrefix}/tokens/clear`;
}
});
</script>
Expand Down
2 changes: 1 addition & 1 deletion utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def is_true(x):
proxy_url_list = proxy_url.split(',') if proxy_url else []

logger.info("-" * 60)
logger.info("Chat2Api v1.1.3 | https://github.com/lanqian528/chat2api")
logger.info("Chat2Api v1.1.4 | 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 8c284ad

Please sign in to comment.