Download gateway/admin.py from deeme/cs: direct link, hf CLI and curl.
- Browser
- Download file 1.71 kB
-
https://huggingface.co/spaces/deeme/cs/resolve/main/gateway/admin.py
- Command line
-
hf download hf://spaces/deeme/cs/gateway/admin.py
-
curl -L -o admin.py https://huggingface.co/spaces/deeme/cs/resolve/main/gateway/admin.py
1.71 kB
| from app import app | |
| from flask import render_template, request, jsonify | |
| import utils.globals as globals | |
| from utils.globals import * | |
| from utils.tools import * | |
| # GPT 主页路由 | |
| def chatgpt(): | |
| if request.method == 'GET': | |
| # 加载并显示 chatToken.json 文件中的内容 | |
| return render_template('GPT.html', retokens=globals.chatToken) | |
| if request.method == 'POST': | |
| # 获取更新后的 retoken 数据 | |
| globals.chatToken = request.json.get('retokens') | |
| # 如果数据格式有效,保存到文件 | |
| if globals.chatToken: | |
| save_retoken(globals.chatToken) | |
| return jsonify({"status": "success", "message": "chatToken.json 已更新!"}), 200 | |
| else: | |
| return jsonify({"status": "error", "message": "无效的数据格式!"}), 400 | |
| # Claude 主页路由 | |
| def claude(): | |
| if request.method == 'GET': | |
| # 加载并显示 chatToken.json 文件中的内容 | |
| return render_template('claude.html', retokens=globals.cluadeToken) | |
| if request.method == 'POST': | |
| # 获取更新后的 cltoken 数据 | |
| globals.cluadeToken = request.json.get('cltokens') | |
| # 如果数据格式有效,保存到文件 | |
| if globals.cluadeToken: | |
| save_cltoken(globals.cluadeToken) | |
| return jsonify({"status": "success", "message": "claudeToken.json 已更新!"}), 200 | |
| else: | |
| return jsonify({"status": "error", "message": "无效的数据格式!"}), 400 | |