Spaces:
Runtime error
Runtime error
Claude commited on
UI: 실시간 의견 통계를 항상 표시 (expander 제거)
Browse fileshttps://claude.ai/code/session_018WXW8M8SMsWcHtj1RynUi4
- components/chat_board.py +19 -19
components/chat_board.py
CHANGED
|
@@ -14,25 +14,25 @@ def _live_chat_board_core(supabase, room_name, user_role, teacher_auth, student_
|
|
| 14 |
opinion_df = all_df.head(LIVE_BOARD_FETCH_LIMIT) if not all_df.empty else all_df
|
| 15 |
stats_opinion_df = all_df
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
|
| 37 |
col_board_title, col_board_ref = st.columns([8, 2])
|
| 38 |
with col_board_title:
|
|
|
|
| 14 |
opinion_df = all_df.head(LIVE_BOARD_FETCH_LIMIT) if not all_df.empty else all_df
|
| 15 |
stats_opinion_df = all_df
|
| 16 |
|
| 17 |
+
st.subheader("📊 실시간 의견 통계")
|
| 18 |
+
if not stats_opinion_df.empty:
|
| 19 |
+
left_col, right_col = st.columns(2)
|
| 20 |
+
with left_col:
|
| 21 |
+
st.caption("감정 분포 그래프")
|
| 22 |
+
live_pie_fig = px.pie(stats_opinion_df, names="sentiment", hole=0.4, height=320)
|
| 23 |
+
live_pie_fig.update_layout(font={"family": UI_FONT_FAMILY})
|
| 24 |
+
st.plotly_chart(live_pie_fig, use_container_width=True, config={'displayModeBar': False, 'scrollZoom': False})
|
| 25 |
+
with right_col:
|
| 26 |
+
st.caption("누적 토의/토론 워드클라우드")
|
| 27 |
+
frequencies = build_word_frequencies(stats_opinion_df["content"])
|
| 28 |
+
if frequencies:
|
| 29 |
+
st.markdown(build_circular_wordcloud_html(frequencies), unsafe_allow_html=True)
|
| 30 |
+
top_words = ", ".join([f"{word}({count})" for word, count in frequencies.most_common(8)])
|
| 31 |
+
st.caption(f"상위 키워드: {top_words}")
|
| 32 |
+
else:
|
| 33 |
+
st.info("워드클라우드를 만들 단어가 아직 부족합니다.")
|
| 34 |
+
else:
|
| 35 |
+
st.write("데이터 수집 중...")
|
| 36 |
|
| 37 |
col_board_title, col_board_ref = st.columns([8, 2])
|
| 38 |
with col_board_title:
|