重构会话标题编辑和删除确认逻辑;重构历史会话时间记录
This commit is contained in:
@@ -129,10 +129,9 @@ export const AgentHeader = ({
|
||||
/>
|
||||
</Box>
|
||||
</motion.div>
|
||||
<Box sx={{ minWidth: 0, minHeight: 52, display: "flex", flexDirection: "column", justifyContent: "center" }}>
|
||||
<Box sx={{ minWidth: 0 }}>
|
||||
{isEditingTitle ? (
|
||||
<Box>
|
||||
<Stack direction="row" spacing={0.75} alignItems="center" sx={{ width: { xs: "calc(100vw - 256px)", sm: 280 }, transform: "translateY(2px)" }}>
|
||||
<Stack direction="row" spacing={0.75} alignItems="center" sx={{ width: { xs: "calc(100vw - 256px)", sm: 280 } }}>
|
||||
<TextField
|
||||
value={draftTitle}
|
||||
onChange={(event) => setDraftTitle(event.target.value)}
|
||||
@@ -152,27 +151,35 @@ export const AgentHeader = ({
|
||||
flex: 1,
|
||||
minWidth: 0,
|
||||
"& .MuiOutlinedInput-root": {
|
||||
height: 34,
|
||||
bgcolor: alpha("#fff", 0.7),
|
||||
padding: "6px 8px",
|
||||
bgcolor: "transparent",
|
||||
borderRadius: 1.5,
|
||||
transition: "all 0.2s ease-in-out",
|
||||
"&.Mui-focused": {
|
||||
bgcolor: alpha("#fff", 0.6),
|
||||
boxShadow: `0 2px 10px ${alpha("#000", 0.05)}`,
|
||||
},
|
||||
"& fieldset": {
|
||||
borderColor: alpha("#000", 0.08),
|
||||
borderColor: "transparent",
|
||||
},
|
||||
"&:hover fieldset": {
|
||||
borderColor: alpha(theme.palette.primary.main, 0.4),
|
||||
borderColor: alpha(theme.palette.primary.main, 0.2),
|
||||
},
|
||||
"&.Mui-focused fieldset": {
|
||||
borderColor: theme.palette.primary.main,
|
||||
borderWidth: "1.5px",
|
||||
boxShadow: `0 0 0 3px ${alpha(theme.palette.primary.main, 0.1)}`,
|
||||
borderColor: alpha(theme.palette.primary.main, 0.5),
|
||||
borderWidth: "1px",
|
||||
},
|
||||
},
|
||||
"& .MuiInputBase-input": {
|
||||
padding: "4px 12px",
|
||||
fontSize: "1.05rem",
|
||||
fontWeight: 700,
|
||||
color: theme.palette.text.primary,
|
||||
padding: 0,
|
||||
height: "auto",
|
||||
fontSize: "1.25rem",
|
||||
fontWeight: 800,
|
||||
letterSpacing: -0.3,
|
||||
lineHeight: "1.2",
|
||||
background: `linear-gradient(90deg, #01579b, #00838f)`,
|
||||
WebkitBackgroundClip: "text",
|
||||
WebkitTextFillColor: "transparent",
|
||||
}
|
||||
}}
|
||||
/>
|
||||
@@ -206,22 +213,22 @@ export const AgentHeader = ({
|
||||
<CloseRounded sx={{ fontSize: 18 }} />
|
||||
</IconButton>
|
||||
</Stack>
|
||||
</Box>
|
||||
) : (
|
||||
<>
|
||||
<Stack direction="row" spacing={0.75} alignItems="center" sx={{ minWidth: 0 }}>
|
||||
<Typography
|
||||
<Stack direction="row" spacing={0.75} alignItems="center" sx={{ minWidth: 0 }}>
|
||||
<Typography
|
||||
variant="h6"
|
||||
fontWeight={800}
|
||||
sx={{
|
||||
background: `linear-gradient(90deg, #01579b, #00838f)`,
|
||||
backgroundClip: "text",
|
||||
color: "transparent",
|
||||
WebkitBackgroundClip: "text",
|
||||
WebkitTextFillColor: "transparent",
|
||||
letterSpacing: -0.3,
|
||||
overflow: "hidden",
|
||||
textOverflow: "ellipsis",
|
||||
whiteSpace: "nowrap",
|
||||
maxWidth: { xs: "calc(100vw - 256px)", sm: 284 },
|
||||
px: "8px",
|
||||
lineHeight: 1.2,
|
||||
}}
|
||||
>
|
||||
{displayTitle}
|
||||
@@ -235,8 +242,8 @@ export const AgentHeader = ({
|
||||
onClick={handleStartEditing}
|
||||
disabled={isHydrating || isStreaming}
|
||||
sx={{
|
||||
width: 24,
|
||||
height: 24,
|
||||
width: 30,
|
||||
height: 30,
|
||||
color: "text.secondary",
|
||||
bgcolor: alpha("#fff", 0.45),
|
||||
"&:hover": {
|
||||
@@ -245,20 +252,12 @@ export const AgentHeader = ({
|
||||
},
|
||||
}}
|
||||
>
|
||||
<EditRounded sx={{ fontSize: 16 }} />
|
||||
<EditRounded sx={{ fontSize: 18 }} />
|
||||
</IconButton>
|
||||
</span>
|
||||
</Tooltip>
|
||||
) : null}
|
||||
</Stack>
|
||||
<Typography variant="caption" color="text.secondary" fontWeight={500}>
|
||||
{isStreaming
|
||||
? "正在思考分析任务..."
|
||||
: displayTitle === "TJWater Agent"
|
||||
? "基于大模型的水力分析引擎"
|
||||
: "当前会话标题"}
|
||||
</Typography>
|
||||
</>
|
||||
</Stack>
|
||||
)}
|
||||
</Box>
|
||||
</Stack>
|
||||
|
||||
Reference in New Issue
Block a user