mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-10-05 08:16:58 +08:00
Improve logging
This commit is contained in:
@@ -214,6 +214,13 @@ class Backend_Api(Api):
|
||||
with cache_file.open("a" if cache_file.exists() else "w") as f:
|
||||
f.write(f"{json.dumps(request.json)}\n")
|
||||
return {}
|
||||
|
||||
@app.route('/backend-api/v2/usage/<date>', methods=['GET'])
|
||||
def get_usage(date: str):
|
||||
cache_dir = Path(get_cookies_dir()) / ".usage"
|
||||
cache_file = cache_dir / f"{date}.jsonl"
|
||||
print(f"Loading usage data from {cache_file}")
|
||||
return cache_file.read_text() if cache_file.exists() else (jsonify({"error": {"message": "No usage data found for this date"}}), 404)
|
||||
|
||||
@app.route('/backend-api/v2/log', methods=['POST'])
|
||||
def add_log():
|
||||
|
Reference in New Issue
Block a user