Python/agent/application/pages/index.py

37 lines
906 B
Python

# -*- coding: utf-8 -*-
"""
首页
"""
import reflex as rx
from application.components import sidebar
from application.pages import conversation, library
from application.states import AuthState, SidebarState
def index() -> rx.Component:
"""
首页
"""
return rx.hstack(
# 渲染侧边栏
sidebar(),
# 根据用户所点中的侧边栏图标导航按钮渲染相应页面
rx.match(
SidebarState.get_activated_button,
# 渲染知识库页面
("library", library()),
# 渲染会话页面
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(),
)