Files
ailine/frontend/components/info_panel.py

60 lines
1.2 KiB
Python
Raw Normal View History

2026-04-16 03:21:38 +08:00
"""
右侧信息面板组件
显示会话信息和统计数据
"""
import streamlit as st
# 使用绝对导入
from frontend.state import AppState
def render_info_panel():
"""渲染右侧信息面板"""
st.header("📊 会话信息")
# 当前线程信息
_render_thread_info()
st.divider()
# 消息统计
_render_message_stats()
st.divider()
# 使用提示
_render_tips()
def _render_thread_info():
"""渲染当前线程信息"""
st.subheader("当前对话")
thread_id = AppState.get_current_thread_id()
st.code(thread_id[:8] + "...", language=None)
def _render_message_stats():
"""渲染消息统计"""
st.subheader("消息统计")
stats = AppState.get_message_stats()
col1, col2 = st.columns(2)
with col1:
st.metric("用户消息", stats["user"])
with col2:
st.metric("AI 回复", stats["assistant"])
def _render_tips():
"""渲染使用提示"""
st.subheader("💡 使用提示")
st.markdown("""
- 左侧可切换历史对话
- 点击"新对话"开始新话题
- 登录后对话历史隔离
- 支持流式实时响应
- 模型可随时切换
""")