Files
ailine/frontend/src/components/info_panel.py
root 726236eaff
Some checks failed
构建并部署 AI Agent 服务 / deploy (push) Failing after 5m26s
重构代码,实现相对导入
2026-04-21 10:26:37 +08:00

40 lines
1010 B
Python

"""
右侧信息面板组件
显示会话信息和统计数据
"""
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)