增加会话标题支持,优化聊天头部展示
This commit is contained in:
@@ -18,6 +18,7 @@ import CloseRounded from "@mui/icons-material/CloseRounded";
|
||||
import HistoryRounded from "@mui/icons-material/HistoryRounded";
|
||||
|
||||
type AgentHeaderProps = {
|
||||
sessionTitle?: string;
|
||||
isStreaming: boolean;
|
||||
isHistoryOpen: boolean;
|
||||
onHistoryToggle: () => void;
|
||||
@@ -26,6 +27,7 @@ type AgentHeaderProps = {
|
||||
};
|
||||
|
||||
export const AgentHeader = ({
|
||||
sessionTitle,
|
||||
isStreaming,
|
||||
isHistoryOpen,
|
||||
onHistoryToggle,
|
||||
@@ -33,6 +35,7 @@ export const AgentHeader = ({
|
||||
onClose,
|
||||
}: AgentHeaderProps) => {
|
||||
const theme = useTheme();
|
||||
const displayTitle = sessionTitle?.trim() || "TJWater Agent";
|
||||
|
||||
return (
|
||||
<Box
|
||||
@@ -91,7 +94,7 @@ export const AgentHeader = ({
|
||||
/>
|
||||
</Box>
|
||||
</motion.div>
|
||||
<Box>
|
||||
<Box sx={{ minWidth: 0 }}>
|
||||
<Typography
|
||||
variant="h6"
|
||||
fontWeight={800}
|
||||
@@ -100,12 +103,20 @@ export const AgentHeader = ({
|
||||
backgroundClip: "text",
|
||||
color: "transparent",
|
||||
letterSpacing: -0.3,
|
||||
overflow: "hidden",
|
||||
textOverflow: "ellipsis",
|
||||
whiteSpace: "nowrap",
|
||||
maxWidth: { xs: "calc(100vw - 220px)", sm: 320 },
|
||||
}}
|
||||
>
|
||||
TJWater Agent
|
||||
{displayTitle}
|
||||
</Typography>
|
||||
<Typography variant="caption" color="text.secondary" fontWeight={500}>
|
||||
{isStreaming ? "正在思考分析任务..." : "基于大模型的水力分析引擎"}
|
||||
{isStreaming
|
||||
? "正在思考分析任务..."
|
||||
: displayTitle === "TJWater Agent"
|
||||
? "基于大模型的水力分析引擎"
|
||||
: "当前会话标题"}
|
||||
</Typography>
|
||||
</Box>
|
||||
</Stack>
|
||||
|
||||
@@ -58,6 +58,7 @@ export const GlobalChatbox: React.FC<Props> = ({ open, onClose }) => {
|
||||
branchTransition,
|
||||
isHydrating,
|
||||
isStreaming,
|
||||
sessionTitle,
|
||||
sendPrompt,
|
||||
regenerate,
|
||||
editAndResubmit,
|
||||
@@ -220,6 +221,7 @@ export const GlobalChatbox: React.FC<Props> = ({ open, onClose }) => {
|
||||
<Blob color={alpha(theme.palette.success.light, 0.18)} size={200} top="80%" left="-10%" delay={4} />
|
||||
|
||||
<AgentHeader
|
||||
sessionTitle={sessionTitle}
|
||||
isStreaming={isStreaming}
|
||||
isHistoryOpen={isHistoryOpen}
|
||||
onHistoryToggle={handleHistoryToggle}
|
||||
|
||||
@@ -767,6 +767,7 @@ export const useAgentChatSession = ({
|
||||
branchTransition,
|
||||
isHydrating,
|
||||
isStreaming,
|
||||
sessionTitle,
|
||||
sessionId,
|
||||
sendPrompt,
|
||||
regenerate,
|
||||
|
||||
Reference in New Issue
Block a user