mirror of
https://github.com/lanqian528/chat2api.git
synced 2026-06-13 21:02:46 +08:00
v1.7.0-beta2
This commit is contained in:
parent
4e02d7cd21
commit
997ea02a3a
@ -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))
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -1 +1 @@
|
||||
1.7.0-beta1
|
||||
1.7.0-beta2
|
||||
Loading…
Reference in New Issue
Block a user