Spaces:
Sleeping
Sleeping
with gr.Accordion("英文段落練習歷程回顧", open=False) as english_grapragh_practice_logs_accordion:
Browse files
app.py
CHANGED
@@ -547,7 +547,8 @@ def generate_paragraph_history(
|
|
547 |
|
548 |
if user_data:
|
549 |
encoded_user_id_url = urllib.parse.quote(user_data, safe='')
|
550 |
-
|
|
|
551 |
content = {
|
552 |
"session_timestamp": session_timestamp,
|
553 |
"request_origin": request_origin,
|
@@ -632,7 +633,7 @@ def get_logs_sessions(user_data, log_type):
|
|
632 |
|
633 |
return paragraph_logs_session_list
|
634 |
|
635 |
-
def
|
636 |
if file_name:
|
637 |
content = GCS_SERVICE.download_as_string("jutor_logs", file_name)
|
638 |
print(f"content: {content}")
|
@@ -2037,13 +2038,13 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
|
|
2037 |
with gr.Row():
|
2038 |
gr.Markdown("# 📚 歷程回顧")
|
2039 |
with gr.Row():
|
2040 |
-
with gr.Accordion("英文段落練習歷程回顧", open=False) as
|
2041 |
with gr.Row():
|
2042 |
with gr.Column(scale=1):
|
2043 |
# 取得英文段落練習 log from GCS
|
2044 |
-
|
2045 |
-
|
2046 |
-
|
2047 |
with gr.Column(scale=3, variant="compact"):
|
2048 |
gr.Markdown("<span style='color:#4e80ee'>主題</span>")
|
2049 |
paragraph_log_topic_input_history = gr.Markdown(label="主題")
|
@@ -2065,15 +2066,15 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
|
|
2065 |
gr.Markdown("<span style='color:#4e80ee'>修改結果</span>")
|
2066 |
paragraph_log_paragraph_save_output = gr.Markdown(label="最後結果")
|
2067 |
|
2068 |
-
|
2069 |
fn=get_logs_sessions,
|
2070 |
-
inputs=[user_data,
|
2071 |
-
outputs=[
|
2072 |
)
|
2073 |
|
2074 |
-
|
2075 |
-
fn=
|
2076 |
-
inputs=[
|
2077 |
outputs=[
|
2078 |
paragraph_log_topic_input_history,
|
2079 |
paragraph_log_points_input_history,
|
@@ -2088,7 +2089,14 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
|
|
2088 |
paragraph_log_paragraph_save_output
|
2089 |
]
|
2090 |
)
|
2091 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2092 |
|
2093 |
english_grapragh_practice_button.click(
|
2094 |
None,
|
|
|
547 |
|
548 |
if user_data:
|
549 |
encoded_user_id_url = urllib.parse.quote(user_data, safe='')
|
550 |
+
log_type_name = "jutor_write_paragraph_practice"
|
551 |
+
file_name = f"{encoded_user_id_url}/{log_type_name}/{session_timestamp}.json"
|
552 |
content = {
|
553 |
"session_timestamp": session_timestamp,
|
554 |
"request_origin": request_origin,
|
|
|
633 |
|
634 |
return paragraph_logs_session_list
|
635 |
|
636 |
+
def get_paragraph_practice_log_session_content(file_name):
|
637 |
if file_name:
|
638 |
content = GCS_SERVICE.download_as_string("jutor_logs", file_name)
|
639 |
print(f"content: {content}")
|
|
|
2038 |
with gr.Row():
|
2039 |
gr.Markdown("# 📚 歷程回顧")
|
2040 |
with gr.Row():
|
2041 |
+
with gr.Accordion("英文段落練習歷程回顧", open=False) as english_grapragh_practice_logs_accordion:
|
2042 |
with gr.Row():
|
2043 |
with gr.Column(scale=1):
|
2044 |
# 取得英文段落練習 log from GCS
|
2045 |
+
paragraph_practice_logs_type = gr.State("jutor_write_paragraph_practice")
|
2046 |
+
get_paragraph_practice_logs_button = gr.Button("取得英文段落練習歷程")
|
2047 |
+
paragraph_practice_logs_session_list = gr.Radio(label="歷程時間列表")
|
2048 |
with gr.Column(scale=3, variant="compact"):
|
2049 |
gr.Markdown("<span style='color:#4e80ee'>主題</span>")
|
2050 |
paragraph_log_topic_input_history = gr.Markdown(label="主題")
|
|
|
2066 |
gr.Markdown("<span style='color:#4e80ee'>修改結果</span>")
|
2067 |
paragraph_log_paragraph_save_output = gr.Markdown(label="最後結果")
|
2068 |
|
2069 |
+
get_paragraph_practice_logs_button.click(
|
2070 |
fn=get_logs_sessions,
|
2071 |
+
inputs=[user_data, paragraph_practice_logs_type],
|
2072 |
+
outputs=[paragraph_practice_logs_session_list]
|
2073 |
)
|
2074 |
|
2075 |
+
paragraph_practice_logs_session_list.select(
|
2076 |
+
fn=get_paragraph_practice_log_session_content,
|
2077 |
+
inputs=[paragraph_practice_logs_session_list],
|
2078 |
outputs=[
|
2079 |
paragraph_log_topic_input_history,
|
2080 |
paragraph_log_points_input_history,
|
|
|
2089 |
paragraph_log_paragraph_save_output
|
2090 |
]
|
2091 |
)
|
2092 |
+
with gr.Row():
|
2093 |
+
with gr.Accordion("英文段落寫作評分歷程回顧", open=False) as english_grapragh_evaluate_logs_accordion:
|
2094 |
+
with gr.Row():
|
2095 |
+
with gr.Column(scale=1):
|
2096 |
+
# 取得英文段落練習 log from GCS
|
2097 |
+
paragraph_evaluate_logs_type = gr.State("jutor_evaluate_paragraph")
|
2098 |
+
get_paragraph_evaluate_logs_button = gr.Button("取得英文段落寫作評分歷程")
|
2099 |
+
paragraph_evaluate_logs_session_list = gr.Radio(label="歷程時間列表")
|
2100 |
|
2101 |
english_grapragh_practice_button.click(
|
2102 |
None,
|