Jiana commited on
Commit
11e2019
·
1 Parent(s): fb18038

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -1
app.py CHANGED
@@ -5,7 +5,17 @@ import logging
5
 
6
  # 请记得要把 api 的 key 放到 settings 下面的 Repository Secrets 里。
7
  openai.api_key = os.getenv("openai_key")
8
- logging.info(f"openai.api_key: {openai.api_key}")
 
 
 
 
 
 
 
 
 
 
9
 
10
 
11
  # 如果你只打算通过 prompt 来定制机器人的行为,只需要修改这段 prompt 就够了。
@@ -30,6 +40,9 @@ def chat(p, qid, uid):
30
 
31
  response = callapi(p, msgs)
32
  history[uid] = msgs + [[p, response]]
 
 
 
33
  return ["text", response]
34
 
35
 
 
5
 
6
  # 请记得要把 api 的 key 放到 settings 下面的 Repository Secrets 里。
7
  openai.api_key = os.getenv("openai_key")
8
+
9
+ logging.basicConfig(filename=train_log, format='%(asctime)s - %(name)s - %(levelname)s -%(module)s: %(message)s',
10
+ datefmt='%Y-%m-%d %H:%M:%S ',
11
+ level=logging.INFO)
12
+ logger = logging.getLogger()
13
+ KZT = logging.StreamHandler()
14
+ KZT.setLevel(logging.DEBUG)
15
+ logger.addHandler(KZT)
16
+ logger.info('Start logging...')
17
+
18
+ logger.info(f"openai.api_key: {openai.api_key}")
19
 
20
 
21
  # 如果你只打算通过 prompt 来定制机器人的行为,只需要修改这段 prompt 就够了。
 
40
 
41
  response = callapi(p, msgs)
42
  history[uid] = msgs + [[p, response]]
43
+ logger.info(f"history: {msgs}")
44
+ logger.info(f"p: {p}")
45
+ logger.info(f"response: {response}")
46
  return ["text", response]
47
 
48