Python/agent/application/pages/index.py

38 lines
1002 B
Python

# -*- coding: utf-8 -*-
"""
首页
"""
import reflex as rx
from application.components import sidebar
from application.pages import render_conversation, render_library
from application.pages.conversation import render_conversation
from application.states import AuthState, SidebarState
def render_index() -> rx.Component:
"""
首页
"""
return rx.hstack(
# 渲染侧边栏
sidebar(),
# 根据用户所点中的侧边栏图标导航按钮渲染相应页面
rx.match(
SidebarState.get_activated_button,
# 渲染知识库页面
("library", render_library()),
# 渲染会话页面
render_conversation(),
),
width="100%",
height="100vh",
padding="8px 8px 8px 0",
overflow="auto",
box_sizing="border-box",
background="var(--mc-global-bg)",
# 挂载事件:因测试需模拟已认证
on_mount=AuthState.authenticate,
)