Hmjz100 commited on
Commit
bf0606e
·
1 Parent(s): 37ba5c3

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -12,15 +12,18 @@ API_URL = "https://ai.fakeopen.com/v1/chat/completions" # 用户需要提供自
12
  # 推断函数
13
  def predict(openai_gptapi_key, model, system_msg, inputs, top_p, temperature, max_tokens, presence_penalty, frequency_penalty, chat_counter, chatbot=[], history=[]):
14
 
15
- print(f"——————————————————————————————")
16
  # 获取当前中国时间
17
  current_time = datetime.datetime.now(pytz.timezone('Asia/Shanghai')).strftime("%Y年-%m月-%d日 %H时:%M分:%S秒")
18
 
19
  if inputs.strip() == '':
20
  inputs = "你好呀,使用英语与中文简单介绍下你自己吧!"
 
 
 
21
  if openai_gptapi_key.strip() == '':
22
  openai_gptapi_key = "pk-this-is-a-real-free-pool-token-for-everyone"
23
- print(f"[{current_time}] 聊天:API密钥 - Fake Open 服务提供的免费共享密钥")
24
  else:
25
  print(f"[{current_time}] 聊天:API密钥 - {openai_gptapi_key}")
26
 
@@ -29,8 +32,6 @@ def predict(openai_gptapi_key, model, system_msg, inputs, top_p, temperature, ma
29
  "Authorization": f"Bearer {openai_gptapi_key}" # 用户将提供自己的 OPENAI_API_KEY
30
  }
31
 
32
- print(f"[{current_time}] 聊天:用户消息 - {inputs}")
33
-
34
 
35
  if system_msg.strip() == '':
36
  initial_message = [{"role": "user", "content": f"{inputs}"},]
 
12
  # 推断函数
13
  def predict(openai_gptapi_key, model, system_msg, inputs, top_p, temperature, max_tokens, presence_penalty, frequency_penalty, chat_counter, chatbot=[], history=[]):
14
 
15
+ print(f"————————————————————————————————————————————————————————————————————————————————————————————————————")
16
  # 获取当前中国时间
17
  current_time = datetime.datetime.now(pytz.timezone('Asia/Shanghai')).strftime("%Y年-%m月-%d日 %H时:%M分:%S秒")
18
 
19
  if inputs.strip() == '':
20
  inputs = "你好呀,使用英语与中文简单介绍下你自己吧!"
21
+
22
+ print(f"[{current_time}] 聊天:用户消息 - {inputs}")
23
+
24
  if openai_gptapi_key.strip() == '':
25
  openai_gptapi_key = "pk-this-is-a-real-free-pool-token-for-everyone"
26
+ print(f"[{current_time}] 聊天:API密钥 - Fake Open 服务提供")
27
  else:
28
  print(f"[{current_time}] 聊天:API密钥 - {openai_gptapi_key}")
29
 
 
32
  "Authorization": f"Bearer {openai_gptapi_key}" # 用户将提供自己的 OPENAI_API_KEY
33
  }
34
 
 
 
35
 
36
  if system_msg.strip() == '':
37
  initial_message = [{"role": "user", "content": f"{inputs}"},]