Spaces:
Runtime error
Runtime error
Claude commited on
feat: 실시간 의견 통계 숨기기/보이기 토글 (기본값: 숨김)
Browse filesexpander로 감싸 기본적으로 통계가 숨겨진 상태로 시작
학생이 의견에 영향받지 않고 자유롭게 발언할 수 있도록
https://claude.ai/code/session_016DE3uHLsVmA5Uv7gZGGaKT
- components/chat_board.py +19 -19
components/chat_board.py
CHANGED
|
@@ -24,25 +24,25 @@ def _live_chat_board_core(supabase, room_name, user_role, teacher_auth, student_
|
|
| 24 |
)
|
| 25 |
stats_opinion_df = opinion_df
|
| 26 |
|
| 27 |
-
st.
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
|
| 47 |
col_board_title, col_board_ref = st.columns([8, 2])
|
| 48 |
with col_board_title:
|
|
|
|
| 24 |
)
|
| 25 |
stats_opinion_df = opinion_df
|
| 26 |
|
| 27 |
+
with st.expander("📊 실시간 의견 통계", expanded=False):
|
| 28 |
+
if not stats_opinion_df.empty:
|
| 29 |
+
left_col, right_col = st.columns(2)
|
| 30 |
+
with left_col:
|
| 31 |
+
st.caption("의견 유형 분포 그래프")
|
| 32 |
+
live_pie_fig = px.pie(stats_opinion_df, names="sentiment", hole=0.4, height=320)
|
| 33 |
+
live_pie_fig.update_layout(font={"family": UI_FONT_FAMILY})
|
| 34 |
+
st.plotly_chart(live_pie_fig, use_container_width=True, config={'displayModeBar': False, 'scrollZoom': False})
|
| 35 |
+
with right_col:
|
| 36 |
+
st.caption("누적 토의/토론 워드클라우드")
|
| 37 |
+
frequencies = build_word_frequencies(stats_opinion_df["content"])
|
| 38 |
+
if frequencies:
|
| 39 |
+
st.markdown(build_circular_wordcloud_html(frequencies), unsafe_allow_html=True)
|
| 40 |
+
top_words = ", ".join([f"{word}({count})" for word, count in frequencies.most_common(8)])
|
| 41 |
+
st.caption(f"상위 키워드: {top_words}")
|
| 42 |
+
else:
|
| 43 |
+
st.info("워드클라우드를 만들 단어가 아직 부족합니다.")
|
| 44 |
+
else:
|
| 45 |
+
st.write("데이터 수집 중...")
|
| 46 |
|
| 47 |
col_board_title, col_board_ref = st.columns([8, 2])
|
| 48 |
with col_board_title:
|