MESReport / utils /completion_reward_utils.py
ChenyuRabbitLove's picture
chore: modify few features
f73342b
raw
history blame
2.74 kB
import json
import gradio as gr
def get_llm_response(completion_reward, *args):
return completion_reward.get_llm_response(*args)
def set_player_name(completion_reward, *args):
return completion_reward.set_player_name(*args)
def display_class_info(completion_reward, *args):
return completion_reward.display_class_info(*args)
def set_player_selected_character(completion_reward, *args):
return completion_reward.set_player_selected_character(*args)
def create_certificate(completion_reward, *args):
return completion_reward.create_certificate(*args)
def complete_reward(completion_reward, *args):
return completion_reward.complete_reward(*args)
def check_is_in_completion_reward(player_backend_user_id):
with open("./data/completion_reward_issue_status.json") as f:
completion_reward_issue_status_dict = json.load(f)
if player_backend_user_id in completion_reward_issue_status_dict:
preview_list = [
"[email protected]",
"http://googleid.junyiacademy.org/111939868185365078143",
"http://googleid.junyiacademy.org/107407156051367422051",
]
if player_backend_user_id in preview_list:
value = completion_reward_issue_status_dict[player_backend_user_id]
if value == "not_issued":
return (
gr.update(visible=False),
gr.update(visible=True),
gr.update(visible=True),
gr.update(visible=True),
gr.update(visible=False),
gr.update(visible=False),
gr.update(visible=False),
)
else:
return (
gr.update(visible=False),
gr.update(visible=False),
gr.update(visible=False),
gr.update(visible=False),
gr.update(visible=False),
gr.update(visible=False),
gr.Image(value, visible=True, elem_id="certificate"),
)
else:
return (
gr.update(visible=False),
gr.update(visible=False),
gr.update(visible=False),
gr.update(visible=False),
gr.update(visible=False),
gr.update(visible=True),
gr.update(visible=False),
)
else:
return (
gr.update(visible=False),
gr.update(visible=False),
gr.update(visible=False),
gr.update(visible=False),
gr.update(visible=True),
gr.update(visible=False),
gr.update(visible=False),
)