mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-12-06 02:30:41 -08:00
Improve logging
This commit is contained in:
parent
a31cb50d6a
commit
6106ca95c9
5 changed files with 56 additions and 16 deletions
|
|
@ -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():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue