- Refactor 6000+ line web_server.py into server/ module - Create separate modules: auth, chat, conversation, files, admin, etc. - Keep web_server.py as backward-compatible entry point - Add container running status field in user_container_manager - Improve admin dashboard API with credentials and debug support 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
14 lines
421 B
Python
14 lines
421 B
Python
@app.route('/api/usage', methods=['GET'])
|
|
@api_login_required
|
|
def get_usage_stats():
|
|
"""返回当前用户的模型/搜索调用统计。"""
|
|
username = get_current_username()
|
|
tracker = get_or_create_usage_tracker(username)
|
|
if not tracker:
|
|
return jsonify({"success": False, "error": "未找到用户"}), 404
|
|
return jsonify({
|
|
"success": True,
|
|
"data": tracker.get_stats()
|
|
})
|
|
|