feat(rain): add date preset picker and reduce time clarification prompts.
Memind CI / Test, build, and release guards (push) Successful in 5m5s

Default to last 3 days in UI and backend, only ask when time is truly ambiguous, and treat「做成页面」as HTML report pages without follow-up questions.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-09-07 16:54:11 +08:00
parent 7cc3fb7f8a
commit d2d463b1db
11 changed files with 230 additions and 24 deletions
+27
View File
@@ -33,6 +33,7 @@ import {
import { AvatarPicker } from './AvatarPicker';
import { ChatSkillPicker } from './ChatSkillPicker';
import { ChatSkillIcon } from './ChatSkillIcons';
import { RainTimeRangeBar } from './RainTimeRangeBar';
import { PageTemplateShopModal } from './PageTemplateShopModal';
import { ChatLoadingSpinner } from './ChatLoadingSpinner';
import { ChatSharePreviewModal } from './ChatSharePreviewModal';
@@ -42,6 +43,11 @@ import { PageSaveDialog } from './PageSaveDialog';
import { VoiceInputButton } from './VoiceInputButton';
import type { CapabilityMap, ChatFileAttachment, ChatState, Message, PortalUser, Session, ToolConfirmation } from '../types';
import type { MindSpaceSaveCategory } from '../types';
import {
DEFAULT_RAIN_TIME_PRESET,
RAIN_SKILL_ID,
type RainTimePresetId,
} from '../utils/rainTimeRange';
const CHAT_PLACEHOLDER_PROMPTS = [
'帮我写一篇温柔一点的小短文',
@@ -202,6 +208,7 @@ export function ChatPanel({
pgRequired?: boolean;
imageGenerationMode?: ImageGenerationMode;
selectedChatSkill?: string;
rainTimePreset?: RainTimePresetId;
fileAttachments?: ChatFileAttachment[];
},
) => void | Promise<void>;
@@ -241,6 +248,8 @@ export function ChatPanel({
const [deepReasoningTipVisible, setDeepReasoningTipVisible] = useState(false);
const [chatControlOnboardingStep, setChatControlOnboardingStep] = useState<0 | 1 | null>(null);
const [templateShopOpen, setTemplateShopOpen] = useState(false);
const [activeRainSkill, setActiveRainSkill] = useState(false);
const [rainTimePreset, setRainTimePreset] = useState<RainTimePresetId>(DEFAULT_RAIN_TIME_PRESET);
const [activeTemplatePrefill, setActiveTemplatePrefill] = useState<{
skillId: string;
label: string;
@@ -840,8 +849,12 @@ export function ChatPanel({
pgRequired: false,
imageGenerationMode: 'auto',
selectedChatSkill,
...(selectedChatSkill === RAIN_SKILL_ID ? { rainTimePreset } : {}),
fileAttachments: fileAttachmentsToSend,
});
if (selectedChatSkill === RAIN_SKILL_ID) {
setActiveRainSkill(false);
}
uploadedImages.forEach(revokePendingImage);
setPendingImages([]);
setPendingFiles([]);
@@ -868,6 +881,7 @@ export function ChatPanel({
}, [
activeTemplatePrefill,
forceDeepReasoning,
rainTimePreset,
input,
onSubmit,
onUploadFile,
@@ -1255,6 +1269,13 @@ export function ChatPanel({
</button>
</div>
)}
{activeRainSkill && !taskInputStatusText && (
<RainTimeRangeBar
value={rainTimePreset}
disabled={voiceDisabled}
onChange={setRainTimePreset}
/>
)}
<div className={`chat-input-row${showHomeWelcome ? ' chat-input-row-home' : ''}`}>
<div className={`chat-input-shell${showHomeWelcome ? ' chat-input-shell-home' : ''}`}>
{canUpload && (
@@ -1343,6 +1364,12 @@ export function ChatPanel({
}
pendingSkillRef.current = skillId ?? null;
setActiveTemplatePrefill(null);
if (skillId === RAIN_SKILL_ID) {
setActiveRainSkill(true);
setRainTimePreset(DEFAULT_RAIN_TIME_PRESET);
} else {
setActiveRainSkill(false);
}
setInput((current) => mergeChatSkillPromptWithInput(prompt, current));
}}
/>
+1
View File
@@ -588,6 +588,7 @@ export function ChatView({
pgRequired: options?.pgRequired,
imageGenerationMode: options?.imageGenerationMode,
selectedChatSkill: options?.selectedChatSkill,
rainTimePreset: options?.rainTimePreset,
fileAttachments: options?.fileAttachments,
},
imageUrls,
+37
View File
@@ -0,0 +1,37 @@
import {
DEFAULT_RAIN_TIME_PRESET,
RAIN_TIME_PRESET_OPTIONS,
type RainTimePresetId,
} from '../utils/rainTimeRange';
export function RainTimeRangeBar({
value,
disabled,
onChange,
}: {
value?: RainTimePresetId;
disabled?: boolean;
onChange: (preset: RainTimePresetId) => void;
}) {
const active = value ?? DEFAULT_RAIN_TIME_PRESET;
return (
<div className="rain-time-range-bar" role="group" aria-label="Rain 分析时间范围">
<span className="rain-time-range-bar-label"></span>
<div className="rain-time-range-bar-options">
{RAIN_TIME_PRESET_OPTIONS.map((option) => (
<button
key={option.id}
type="button"
className={`rain-time-range-option${active === option.id ? ' is-active' : ''}`}
disabled={disabled}
aria-pressed={active === option.id}
onClick={() => onChange(option.id)}
>
{option.label}
</button>
))}
</div>
</div>
);
}