Spaces:
Building
Building
Upload 4 files
Browse files
app.py
CHANGED
@@ -80,7 +80,7 @@ class APIKeyManager:
|
|
80 |
def show_all_keys(self):
|
81 |
logger.info(f"当前可用API key个数: {len(self.api_keys)} ")
|
82 |
for i, api_key in enumerate(self.api_keys):
|
83 |
-
logger.info(f"API Key{i}: {api_key[:11]}...")
|
84 |
|
85 |
def blacklist_key(self, key):
|
86 |
logger.warning(f"{key[:11]} → 暂时禁用 {api_key_blacklist_duration} 秒")
|
@@ -97,11 +97,11 @@ def switch_api_key():
|
|
97 |
key = key_manager.get_available_key()
|
98 |
if key:
|
99 |
current_api_key = key
|
100 |
-
logger.info(f"API key 替换为 → {current_api_key[:11]}...")
|
101 |
else:
|
102 |
logger.error("API key 替换失败,所有API key都已耗尽或被暂时禁用,请重新配置或稍后重试")
|
103 |
|
104 |
-
logger.info(f"当前 API key: {current_api_key[:11]}...")
|
105 |
|
106 |
GEMINI_MODELS = [
|
107 |
{"id": "gemini-1.5-flash-8b-latest"},
|
@@ -410,7 +410,7 @@ def chat_completions():
|
|
410 |
return jsonify(response), 503
|
411 |
|
412 |
else:
|
413 |
-
logger.error(f"{MAX_RETRIES}
|
414 |
response = {
|
415 |
'error': {
|
416 |
'message': f'{MAX_RETRIES} 次尝试均失败,请调整配置或向Moonfanz反馈',
|
@@ -482,7 +482,7 @@ if __name__ == '__main__':
|
|
482 |
|
483 |
scheduler.add_job(keep_alive, 'interval', hours=12)
|
484 |
scheduler.start()
|
485 |
-
|
486 |
logger.info(f"最大尝试次数/MaxRetries: {MAX_RETRIES}")
|
487 |
logger.info(f"最大请求次数/MaxRequests: {MAX_REQUESTS}")
|
488 |
logger.info(f"请求限额窗口/LimitWindow: {LIMIT_WINDOW} 秒")
|
|
|
80 |
def show_all_keys(self):
|
81 |
logger.info(f"当前可用API key个数: {len(self.api_keys)} ")
|
82 |
for i, api_key in enumerate(self.api_keys):
|
83 |
+
logger.info(f"API Key{i}: {api_key[:11]}...{api_key[-3:]}")
|
84 |
|
85 |
def blacklist_key(self, key):
|
86 |
logger.warning(f"{key[:11]} → 暂时禁用 {api_key_blacklist_duration} 秒")
|
|
|
97 |
key = key_manager.get_available_key()
|
98 |
if key:
|
99 |
current_api_key = key
|
100 |
+
logger.info(f"API key 替换为 → {current_api_key[:11]}...{current_api_key[-3:]}")
|
101 |
else:
|
102 |
logger.error("API key 替换失败,所有API key都已耗尽或被暂时禁用,请重新配置或稍后重试")
|
103 |
|
104 |
+
logger.info(f"当前 API key: {current_api_key[:11]}...{current_api_key[-3:]}")
|
105 |
|
106 |
GEMINI_MODELS = [
|
107 |
{"id": "gemini-1.5-flash-8b-latest"},
|
|
|
410 |
return jsonify(response), 503
|
411 |
|
412 |
else:
|
413 |
+
logger.error(f"{MAX_RETRIES} 次尝试均失败,请调整配置,或等待官方恢复,或向Moonfanz反馈")
|
414 |
response = {
|
415 |
'error': {
|
416 |
'message': f'{MAX_RETRIES} 次尝试均失败,请调整配置或向Moonfanz反馈',
|
|
|
482 |
|
483 |
scheduler.add_job(keep_alive, 'interval', hours=12)
|
484 |
scheduler.start()
|
485 |
+
logger.info(f"Reminiproxy v2.2.0 启动")
|
486 |
logger.info(f"最大尝试次数/MaxRetries: {MAX_RETRIES}")
|
487 |
logger.info(f"最大请求次数/MaxRequests: {MAX_REQUESTS}")
|
488 |
logger.info(f"请求限额窗口/LimitWindow: {LIMIT_WINDOW} 秒")
|