Spaces:
Sleeping
Sleeping
Keldos Tuchuanhuhuhu commited on
Commit ·
eb4ccf0
1
Parent(s): 27fbd0c
WIP fix: 修复登录用户下载错误
Browse filesCo-authored-by: Tuchuanhuhuhu <gzblog@hdu.edu.cn>
- ChuanhuChatbot.py +1 -1
- web_assets/javascript/utils.js +1 -2
ChuanhuChatbot.py
CHANGED
|
@@ -31,7 +31,7 @@ def create_new_model():
|
|
| 31 |
|
| 32 |
|
| 33 |
with gr.Blocks(theme=small_and_beautiful_theme) as demo:
|
| 34 |
-
user_name = gr.
|
| 35 |
promptTemplates = gr.State(load_template(get_template_names()[0], mode=2))
|
| 36 |
user_question = gr.State("")
|
| 37 |
assert type(my_api_key) == str
|
|
|
|
| 31 |
|
| 32 |
|
| 33 |
with gr.Blocks(theme=small_and_beautiful_theme) as demo:
|
| 34 |
+
user_name = gr.Textbox("", visible=False)
|
| 35 |
promptTemplates = gr.State(load_template(get_template_names()[0], mode=2))
|
| 36 |
user_question = gr.State("")
|
| 37 |
assert type(my_api_key) == str
|
web_assets/javascript/utils.js
CHANGED
|
@@ -17,12 +17,11 @@ function isImgUrl(url) {
|
|
| 17 |
|
| 18 |
function downloadHistory(gradioUsername, historyname, format=".json") {
|
| 19 |
let fileUrl;
|
| 20 |
-
if (gradioUsername === null ||
|
| 21 |
fileUrl = `/file=./history/${historyname}`;
|
| 22 |
} else {
|
| 23 |
fileUrl = `/file=./history/${gradioUsername}/${historyname}`;
|
| 24 |
}
|
| 25 |
-
console.log("gradioUsername",gradioUsername, "fileUrl ",fileUrl, "historyname", historyname, "format", format);
|
| 26 |
downloadFile(fileUrl, historyname, format);
|
| 27 |
}
|
| 28 |
|
|
|
|
| 17 |
|
| 18 |
function downloadHistory(gradioUsername, historyname, format=".json") {
|
| 19 |
let fileUrl;
|
| 20 |
+
if (gradioUsername === null || gradioUsername.trim() === "") {
|
| 21 |
fileUrl = `/file=./history/${historyname}`;
|
| 22 |
} else {
|
| 23 |
fileUrl = `/file=./history/${gradioUsername}/${historyname}`;
|
| 24 |
}
|
|
|
|
| 25 |
downloadFile(fileUrl, historyname, format);
|
| 26 |
}
|
| 27 |
|