This commit is contained in:
39
frontend/src/components/info_panel.py
Normal file
39
frontend/src/components/info_panel.py
Normal file
@@ -0,0 +1,39 @@
|
||||
"""
|
||||
右侧信息面板组件
|
||||
显示会话信息和统计数据
|
||||
"""
|
||||
|
||||
import streamlit as st
|
||||
|
||||
# 使用相对导入
|
||||
from ..state import AppState
|
||||
|
||||
|
||||
def render_info_panel():
|
||||
"""渲染右侧信息面板(现改为侧边栏底部)"""
|
||||
st.caption("📊 会话信息")
|
||||
|
||||
# 消息统计
|
||||
_render_message_stats()
|
||||
|
||||
# 使用提示
|
||||
_render_tips()
|
||||
|
||||
|
||||
def _render_message_stats():
|
||||
"""渲染消息统计"""
|
||||
stats = AppState.get_message_stats()
|
||||
st.markdown(f"<span style='font-size:0.8em;color:#666;'>共 {stats['user']} 问 / {stats['assistant']} 答</span>", unsafe_allow_html=True)
|
||||
|
||||
|
||||
def _render_tips():
|
||||
"""渲染使用提示"""
|
||||
with st.expander("💡 使用提示", expanded=False):
|
||||
st.markdown("""
|
||||
<div style='font-size:0.85em;color:#555;'>
|
||||
- 左侧可切换历史对话<br>
|
||||
- 点击"新对话"开始新话题<br>
|
||||
- 登录后对话历史隔离<br>
|
||||
- 模型可随时切换
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
Reference in New Issue
Block a user