Spaces:
Building
Building
Upload 4 files
Browse files- Dockerfile +10 -0
- app.py +1 -40
- func.py +1 -1
Dockerfile
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.9-slim
|
2 |
+
EXPOSE 7860
|
3 |
+
WORKDIR /app
|
4 |
+
|
5 |
+
COPY requirements.txt .
|
6 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
7 |
+
|
8 |
+
COPY . .
|
9 |
+
|
10 |
+
CMD ["python", "app.py"]
|
app.py
CHANGED
@@ -232,48 +232,9 @@ GEMINI_MODELS = [
|
|
232 |
{"id": "gemini-2.0-flash-exp"},
|
233 |
{"id": "gemini-2.0-flash-thinking-exp-1219"},
|
234 |
{"id": "gemini-2.0-flash-thinking-exp-01-21"},
|
235 |
-
{"id": "gemini-2.0-pro-exp"}
|
236 |
]
|
237 |
|
238 |
-
@app.route('/')
|
239 |
-
def index():
|
240 |
-
main_content = "Moonfanz Reminiproxy v2.3.5 2025-01-14"
|
241 |
-
html_template = """
|
242 |
-
<!DOCTYPE html>
|
243 |
-
<html>
|
244 |
-
<head>
|
245 |
-
<meta charset="utf-8">
|
246 |
-
<script>
|
247 |
-
function copyToClipboard(text) {
|
248 |
-
var textarea = document.createElement("textarea");
|
249 |
-
textarea.textContent = text;
|
250 |
-
textarea.style.position = "fixed";
|
251 |
-
document.body.appendChild(textarea);
|
252 |
-
textarea.select();
|
253 |
-
try {
|
254 |
-
return document.execCommand("copy");
|
255 |
-
} catch (ex) {
|
256 |
-
console.warn("Copy to clipboard failed.", ex);
|
257 |
-
return false;
|
258 |
-
} finally {
|
259 |
-
document.body.removeChild(textarea);
|
260 |
-
}
|
261 |
-
}
|
262 |
-
function copyLink(event) {
|
263 |
-
event.preventDefault();
|
264 |
-
const url = new URL(window.location.href);
|
265 |
-
const link = url.protocol + '//' + url.host + '/hf/v1';
|
266 |
-
copyToClipboard(link);
|
267 |
-
alert('链接已复制: ' + link);
|
268 |
-
}
|
269 |
-
</script>
|
270 |
-
</head>
|
271 |
-
<body>
|
272 |
-
{{ main_content }}<br/><br/>完全开源、免费且禁止商用<br/><br/>点击复制反向代理: <a href="v1" onclick="copyLink(event)">点击我复制地址(不要自己写地址)</a><br/>聊天来源选择"自定义(兼容 OpenAI)"<br/>将复制的网址填入到自定义端点<br/>将设置password填入自定义API秘钥<br/><br/><br/>
|
273 |
-
</body>
|
274 |
-
</html>
|
275 |
-
"""
|
276 |
-
return render_template_string(html_template, main_content=main_content)
|
277 |
|
278 |
def is_within_rate_limit(api_key):
|
279 |
now = datetime.now()
|
|
|
232 |
{"id": "gemini-2.0-flash-exp"},
|
233 |
{"id": "gemini-2.0-flash-thinking-exp-1219"},
|
234 |
{"id": "gemini-2.0-flash-thinking-exp-01-21"},
|
235 |
+
{"id": "gemini-2.0-pro-exp-02-05"}
|
236 |
]
|
237 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
238 |
|
239 |
def is_within_rate_limit(api_key):
|
240 |
now = datetime.now()
|
func.py
CHANGED
@@ -5,7 +5,7 @@ logger = logging.getLogger(__name__)
|
|
5 |
|
6 |
request_counts = {}
|
7 |
|
8 |
-
password = os.environ['
|
9 |
|
10 |
def authenticate_request(request):
|
11 |
auth_header = request.headers.get('Authorization')
|
|
|
5 |
|
6 |
request_counts = {}
|
7 |
|
8 |
+
password = os.environ['password']
|
9 |
|
10 |
def authenticate_request(request):
|
11 |
auth_header = request.headers.get('Authorization')
|