diff --git a/run.py b/run.py index afd5578..d6f90a7 100644 --- a/run.py +++ b/run.py @@ -560,34 +560,55 @@ def markdown_to_plain_text(text: str) -> str: return cleaned.strip() -def render_copy_button(label: str, text: str, key: str) -> None: - copy_text = markdown_to_plain_text(text) - button_id = f"copy-btn-{key}" +def render_copy_buttons( + plain_label: str, + raw_label: str, + text: str, + key: str, +) -> None: + copy_text_plain = markdown_to_plain_text(text) + copy_text_raw = text or "" + + plain_button_id = f"copy-btn-plain-{key}" + raw_button_id = f"copy-btn-raw-{key}" status_id = f"copy-status-{key}" + st_html( f""" -
- +
+
+ + +
""", - height=44, + height=74, ) @@ -888,8 +909,9 @@ def render() -> None: ) render_usage(st.session_state[PHASE1_USAGE], phase1_usage_placeholder) with phase1_copy_placeholder.container(): - render_copy_button( - "Copy Output (plain text)", + render_copy_buttons( + "Copy Plain Text", + "Copy Markdown", st.session_state[PHASE1_OUTPUT], key="phase1_copy_button", ) @@ -941,7 +963,12 @@ def render() -> None: phase1_selected_tags, ) with phase1_copy_placeholder.container(): - render_copy_button("Copy Output (plain text)", answer, key="phase1_copy_button") + render_copy_buttons( + "Copy Plain Text", + "Copy Markdown", + answer, + key="phase1_copy_button", + ) st.session_state[PHASE1_DONE] = True st.session_state[PHASE1_OUTPUT] = answer @@ -1095,8 +1122,9 @@ def render() -> None: ) render_usage(st.session_state[PHASE2_USAGE], phase2_usage_placeholder) with phase2_copy_placeholder.container(): - render_copy_button( - "Copy Updated Analysis (plain text)", + render_copy_buttons( + "Copy Plain Text", + "Copy Markdown", st.session_state[PHASE2_OUTPUT], key="phase2_copy_button", ) @@ -1147,8 +1175,9 @@ def render() -> None: phase2_selected_tags, ) with phase2_copy_placeholder.container(): - render_copy_button( - "Copy Updated Analysis (plain text)", + render_copy_buttons( + "Copy Plain Text", + "Copy Markdown", answer, key="phase2_copy_button", )