Moonfanz commited on
Commit
3edcf79
·
verified ·
1 Parent(s): fb5c2f5

Upload 4 files

Browse files
Files changed (1) hide show
  1. app.py +21 -4
app.py CHANGED
@@ -57,7 +57,24 @@ safety_settings = [
57
  "threshold": "BLOCK_NONE"
58
  }
59
  ]
60
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  class APIKeyManager:
62
  def __init__(self):
63
  self.api_keys = re.findall(r"AIzaSy[a-zA-Z0-9_-]{33}", os.environ.get('KeyArray'))
@@ -121,7 +138,7 @@ GEMINI_MODELS = [
121
 
122
  @app.route('/')
123
  def index():
124
- main_content = "Moonfanz Reminiproxy v2.2.0 2025-01-11"
125
  html_template = """
126
  <!DOCTYPE html>
127
  <html>
@@ -318,7 +335,7 @@ def chat_completions():
318
  gen_model = genai.GenerativeModel(
319
  model_name=model,
320
  generation_config=generation_config,
321
- safety_settings=safety_settings,
322
  system_instruction=system_instruction
323
  )
324
 
@@ -482,7 +499,7 @@ if __name__ == '__main__':
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} 秒")
 
57
  "threshold": "BLOCK_NONE"
58
  }
59
  ]
60
+ safety_settings_g2 = [
61
+ {
62
+ "category": "HARM_CATEGORY_HARASSMENT",
63
+ "threshold": "OFF"
64
+ },
65
+ {
66
+ "category": "HARM_CATEGORY_HATE_SPEECH",
67
+ "threshold": "OFF"
68
+ },
69
+ {
70
+ "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
71
+ "threshold": "OFF"
72
+ },
73
+ {
74
+ "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
75
+ "threshold": "OFF"
76
+ }
77
+ ]
78
  class APIKeyManager:
79
  def __init__(self):
80
  self.api_keys = re.findall(r"AIzaSy[a-zA-Z0-9_-]{33}", os.environ.get('KeyArray'))
 
138
 
139
  @app.route('/')
140
  def index():
141
+ main_content = "Moonfanz Reminiproxy v2.2.1 2025-01-11"
142
  html_template = """
143
  <!DOCTYPE html>
144
  <html>
 
335
  gen_model = genai.GenerativeModel(
336
  model_name=model,
337
  generation_config=generation_config,
338
+ safety_settings=safety_settings_g2 if model == 'gemini-2.0-flash-exp' else safety_settings,
339
  system_instruction=system_instruction
340
  )
341
 
 
499
 
500
  scheduler.add_job(keep_alive, 'interval', hours=12)
501
  scheduler.start()
502
+ logger.info(f"Reminiproxy v2.2.1 启动")
503
  logger.info(f"最大尝试次数/MaxRetries: {MAX_RETRIES}")
504
  logger.info(f"最大请求次数/MaxRequests: {MAX_REQUESTS}")
505
  logger.info(f"请求限额窗口/LimitWindow: {LIMIT_WINDOW} 秒")