重构聊天会话管理,支持会话历史和存储

This commit is contained in:
2026-04-30 15:02:08 +08:00
parent c5b0f43a0d
commit e0e78cd95a
11 changed files with 1247 additions and 221 deletions
+7 -4
View File
@@ -25,6 +25,7 @@ import AttachFileRounded from "@mui/icons-material/AttachFileRounded";
type AgentComposerProps = {
input: string;
inputRef: React.RefObject<HTMLInputElement | null>;
isHydrating?: boolean;
isStreaming: boolean;
isListening: boolean;
isSttSupported: boolean;
@@ -40,6 +41,7 @@ type AgentComposerProps = {
export const AgentComposer = ({
input,
inputRef,
isHydrating = false,
isStreaming,
isListening,
isSttSupported,
@@ -52,7 +54,7 @@ export const AgentComposer = ({
onPresetSelect,
}: AgentComposerProps) => {
const theme = useTheme();
const canSend = input.trim().length > 0 && !isStreaming;
const canSend = input.trim().length > 0 && !isStreaming && !isHydrating;
const [isPresetOpen, setIsPresetOpen] = React.useState(false);
return (
@@ -160,11 +162,12 @@ export const AgentComposer = ({
onSend();
}
}}
placeholder="描述你的分析目标,或点击上方指令库..."
placeholder={isHydrating ? "正在加载对话记录..." : "描述你的分析目标,或点击上方指令库..."}
fullWidth
multiline
maxRows={5}
variant="standard"
disabled={isHydrating}
InputProps={{
disableUnderline: true,
sx: { px: 1, py: 0.5, fontSize: "1rem", lineHeight: 1.6, fontWeight: 500, color: "text.primary" },
@@ -199,7 +202,7 @@ export const AgentComposer = ({
) : (
<IconButton
onClick={onStartListening}
disabled={isStreaming}
disabled={isStreaming || isHydrating}
aria-label="语音输入"
size="small"
sx={{ color: "text.secondary", width: 36, height: 36, bgcolor: alpha("#fff", 0.6) }}
@@ -262,7 +265,7 @@ export const AgentComposer = ({
style={{ width: 14, height: 14 }}
/>
<Typography variant="caption" sx={{ fontSize: "0.65rem", color: "text.secondary", fontWeight: 500, letterSpacing: 0.5 }}>
Powered by DeepSeek V3 · TJWater Agent Intelligence
Powered by DeepSeek V4 · TJWater Agent Intelligence
</Typography>
</Box>
</Box>