Spaces:
Sleeping
Sleeping
Tuchuanhuhuhu
commited on
Commit
·
c01b032
1
Parent(s):
c2e5d5f
解决登录后历史记录加载无法自动加载的问题
Browse files- ChuanhuChatbot.py +6 -4
ChuanhuChatbot.py
CHANGED
@@ -272,11 +272,13 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
|
272 |
def create_greeting(request: gr.Request):
|
273 |
if hasattr(request, "username") and request.username: # is not None or is not ""
|
274 |
logging.info(f"Get User Name: {request.username}")
|
275 |
-
|
276 |
else:
|
277 |
-
|
278 |
-
|
279 |
-
|
|
|
|
|
280 |
chatgpt_predict_args = dict(
|
281 |
fn=predict,
|
282 |
inputs=[
|
|
|
272 |
def create_greeting(request: gr.Request):
|
273 |
if hasattr(request, "username") and request.username: # is not None or is not ""
|
274 |
logging.info(f"Get User Name: {request.username}")
|
275 |
+
user_info, user_name = gr.Markdown.update(value=f"User: {request.username}"), request.username
|
276 |
else:
|
277 |
+
user_info, user_name = gr.Markdown.update(value=f"", visible=False), ""
|
278 |
+
current_model = get_model(model_name = MODELS[DEFAULT_MODEL], access_key = my_api_key)[0]
|
279 |
+
current_model.set_user_identifier(user_name)
|
280 |
+
return user_info, user_name, current_model, toggle_like_btn_visibility(DEFAULT_MODEL), *current_model.auto_load()
|
281 |
+
demo.load(create_greeting, inputs=None, outputs=[user_info, user_name, current_model, like_dislike_area, systemPromptTxt, chatbot])
|
282 |
chatgpt_predict_args = dict(
|
283 |
fn=predict,
|
284 |
inputs=[
|