diff --git a/agent/application/components/conversation.py b/agent/application/components/conversation.py index 512f672..aa8fa1a 100644 --- a/agent/application/components/conversation.py +++ b/agent/application/components/conversation.py @@ -282,43 +282,62 @@ def render_conversation_box() -> rx.Component: runs = ConversationState.get_runs # 若运行字典为空则渲染品牌图标和名称、预设用户提示词,否则遍历渲染运行项 - return rx.auto_scroll( + return rx.vstack( rx.cond( - ConversationState.is_runs_empty, - # 渲染空运行字典组件 - rx.center( - rx.vstack( - rx.spacer(), - # 智能体图标和名称 - rx.hstack( - rx.icon("info", size=18), - rx.text("智能体"), + runs.length() == 0, + rx.vstack( + # 智能体图标和名称 + rx.hstack( + rx.image( + src="/logo.png", + width="64px", + height="64px", + object_fit="contain", # 等比缩放 ), - # 预设用户提示词 rx.box( - rx.vstack( - # 标题 - rx.text("猜你想问"), - rx.hstack( - rx.button("你可以帮我做什么"), - ), - ) + "Gluballu", + font_size="32px", + font_weight="700", + letter_spacing="1px", ), - spacing="4", - width="min(100%, 40em)", - padding_y="40px", + display="flex", + margin_bottom="12px", + align_items="center", + gap="8px", ), - border="none", + rx.box( + "Gluballu 可辅助产品检索业务资料、开展产品设计与撰写产品方案等。", + line_height="1.5", + ), + # 预设用户提示词 + rx.box( + rx.vstack( + # 标题 + rx.text("猜你想问"), + rx.hstack( + rx.button("你可以帮我做什么"), + ), + ) + ), + color="var(--devui-text)", ), - # 遍历渲染运行组件 - rx.foreach( - runs, - lambda i, _: render_run_component(i[0], i[1]), + # 遍历渲染运行项 + rx.auto_scroll( + rx.foreach( + runs, + lambda i, _: render_run_component(i[0], i[1]), + ), ), ), + display="flex", flex="1", - padding="8px", - overflow_y="auto", + flex_direction="column", + width="100%", + max_height="1200px", + padding="0 12px", + justify_content="flex-start", + gap="24px", + overflow="auto", style={ "&::-webkit-scrollbar": { "display": "none", diff --git a/agent/application/components/frame.py b/agent/application/components/frame.py index 5b4760b..5ae4da6 100644 --- a/agent/application/components/frame.py +++ b/agent/application/components/frame.py @@ -72,14 +72,12 @@ def render_sidebar() -> rx.Component: rx.vstack( # 渲染品牌 LOGO 和名称 rx.vstack( - # 渲染品牌 Logo rx.image( src="/logo.png", width="34px", height="34px", object_fit="contain", # 等比缩放 ), - # 渲染品牌名称 rx.text( "Gluballu", line_height="20px", # 行高 diff --git a/agent/application/state/conversation.py b/agent/application/state/conversation.py index 4759663..29c87c6 100644 --- a/agent/application/state/conversation.py +++ b/agent/application/state/conversation.py @@ -143,18 +143,6 @@ class ConversationState(rx.State): conversation = self.conversations.get(self.conversation_id) return conversation.description if conversation else "新对话" - @rx.var - def is_runs_empty(self) -> bool: - """ - 运行字典是否为空 - :return: 运行字典是否为空 - """ - # 当前对话 - conversation = self.conversations.get(self.conversation_id) - if not conversation: - return True - return not conversation.runs - @rx.var def get_runs(self) -> Dict[str, Run]: """