From 997ea02a3ab09c3cf410d55c8939409c30626b30 Mon Sep 17 00:00:00 2001 From: lanqian528 <5499636+lanqian528@users.noreply.github.com> Date: Wed, 6 Nov 2024 18:44:49 +0800 Subject: [PATCH] v1.7.0-beta2 --- api/chat2api.py | 8 ++++---- gateway/share.py | 2 +- version.txt | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/chat2api.py b/api/chat2api.py index f71e7dd..c76fa3e 100644 --- a/api/chat2api.py +++ b/api/chat2api.py @@ -2,7 +2,7 @@ import asyncio import types from apscheduler.schedulers.asyncio import AsyncIOScheduler -from fastapi import Request, Depends, HTTPException, Form, Security +from fastapi import Request, HTTPException, Form, Security from fastapi.responses import HTMLResponse, StreamingResponse, JSONResponse from fastapi.security import HTTPAuthorizationCredentials from starlette.background import BackgroundTask @@ -89,7 +89,7 @@ async def upload_post(text: str = Form(...)): for line in lines: if line.strip() and not line.startswith("#"): globals.token_list.append(line.strip()) - with open("../data/token.txt", "a", encoding="utf-8") as f: + with open(globals.TOKENS_FILE, "a", encoding="utf-8") as f: f.write(line.strip() + "\n") logger.info(f"Token count: {len(globals.token_list)}, Error token count: {len(globals.error_token_list)}") tokens_count = len(set(globals.token_list) - set(globals.error_token_list)) @@ -100,7 +100,7 @@ async def upload_post(text: str = Form(...)): async def upload_post(): globals.token_list.clear() globals.error_token_list.clear() - with open("../data/token.txt", "w", encoding="utf-8") as f: + with open(globals.TOKENS_FILE, "w", encoding="utf-8") as f: pass logger.info(f"Token count: {len(globals.token_list)}, Error token count: {len(globals.error_token_list)}") tokens_count = len(set(globals.token_list) - set(globals.error_token_list)) @@ -117,7 +117,7 @@ async def error_tokens(): async def add_token(token: str): if token.strip() and not token.startswith("#"): globals.token_list.append(token.strip()) - with open("../data/token.txt", "a", encoding="utf-8") as f: + with open(globals.TOKENS_FILE, "a", encoding="utf-8") as f: f.write(token.strip() + "\n") logger.info(f"Token count: {len(globals.token_list)}, Error token count: {len(globals.error_token_list)}") tokens_count = len(set(globals.token_list) - set(globals.error_token_list)) diff --git a/gateway/share.py b/gateway/share.py index 06a3ea1..860cd80 100644 --- a/gateway/share.py +++ b/gateway/share.py @@ -1,7 +1,7 @@ import json import random -from fastapi import Request, HTTPException, Depends, Security +from fastapi import Request, HTTPException, Security from fastapi.responses import Response from fastapi.security import HTTPAuthorizationCredentials diff --git a/version.txt b/version.txt index a5eb41c..3321830 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.7.0-beta1 \ No newline at end of file +1.7.0-beta2 \ No newline at end of file