simondby
commited on
Commit
·
d3d045c
1
Parent(s):
da20658
update
Browse files
app.py
CHANGED
|
@@ -16,8 +16,7 @@ user_key = "" # 在这里输入你的 API 密钥
|
|
| 16 |
# password = os.environ.get('pass')
|
| 17 |
|
| 18 |
initial_prompt = "你的目的是解答用户问题,并且你会如实回答,对于不知道的问题,你需要回复你不知道。"
|
| 19 |
-
|
| 20 |
-
API_URL = "https://openai.hex.im/v1/chat/completions"
|
| 21 |
HISTORY_DIR = "history"
|
| 22 |
TEMPLATES_DIR = "templates"
|
| 23 |
|
|
@@ -53,10 +52,12 @@ def fetch_data(query):
|
|
| 53 |
# get user_tuple
|
| 54 |
try:
|
| 55 |
user_tuple = fetch_data("SELECT username, password FROM credentials")
|
|
|
|
| 56 |
except:
|
| 57 |
user_tuple = eval(os.environ.get('user_tuple'))
|
|
|
|
| 58 |
|
| 59 |
-
print(user_tuple)
|
| 60 |
|
| 61 |
# auth check
|
| 62 |
def auth_check(username, password):
|
|
|
|
| 16 |
# password = os.environ.get('pass')
|
| 17 |
|
| 18 |
initial_prompt = "你的目的是解答用户问题,并且你会如实回答,对于不知道的问题,你需要回复你不知道。"
|
| 19 |
+
API_URL = "https://api.openai.com/v1/chat/completions"
|
|
|
|
| 20 |
HISTORY_DIR = "history"
|
| 21 |
TEMPLATES_DIR = "templates"
|
| 22 |
|
|
|
|
| 52 |
# get user_tuple
|
| 53 |
try:
|
| 54 |
user_tuple = fetch_data("SELECT username, password FROM credentials")
|
| 55 |
+
source = "db"
|
| 56 |
except:
|
| 57 |
user_tuple = eval(os.environ.get('user_tuple'))
|
| 58 |
+
source = "env"
|
| 59 |
|
| 60 |
+
print(f"{source}: {user_tuple}")
|
| 61 |
|
| 62 |
# auth check
|
| 63 |
def auth_check(username, password):
|