diff --git a/components/canvas/CanvasChatPanel.tsx b/components/canvas/CanvasChatPanel.tsx index 2e9fc2ad0..924889e78 100644 --- a/components/canvas/CanvasChatPanel.tsx +++ b/components/canvas/CanvasChatPanel.tsx @@ -324,6 +324,12 @@ const CLAWD_TABLE_ACCEPT = const CLAWD_TABLE_ALLOWED_EXTENSIONS = new Set(["xlsx", "csv", "tsv"]); const CLAWD_TABLE_MAX_FILES = 3; const CLAWD_TABLE_MAX_BYTES = 10 * 1024 * 1024; +const CLAWD_PROCESSING_HINT = + "已收到,这个任务稍微繁重一些,处理时间可能会长一点,请耐心等候。"; +const CLAWD_SIMPLE_PROMPT_PATTERNS = [ + /^(hi|hello|hey|你好|您好|哈喽|嗨|在吗|早上好|下午好|晚上好)[\s!.。!??~~]*$/i, + /^(你是谁|你叫什么|你叫什么名字|你能做什么|你可以做什么|有什么功能|介绍一下自己|帮我介绍一下你)[\s!.。!??~~]*$/, +]; function getClawdTableFileExtension(fileName: string) { return String(fileName || "") @@ -339,6 +345,29 @@ function isClawdTableFile(file: File) { ); } +function shouldShowClawdProcessingHint( + message: string, + hasTableFiles: boolean, + hasImageAttachments: boolean +) { + if (hasTableFiles || hasImageAttachments) { + return true; + } + + const normalizedMessage = String(message || "") + .replace(/\u200b/g, " ") + .replace(/\s+/g, " ") + .trim(); + + if (!normalizedMessage) { + return false; + } + + return !CLAWD_SIMPLE_PROMPT_PATTERNS.some((pattern) => + pattern.test(normalizedMessage) + ); +} + function formatClawdTableFileSize(bytes: number) { if (!Number.isFinite(bytes) || bytes <= 0) { return "0KB"; @@ -986,7 +1015,7 @@ function CanvasTypewriterText({ return
{displayText}
; } -function CanvasAssistantTypingPlaceholder() { +function CanvasAssistantTypingPlaceholder({ hint }: { hint?: string | null }) { return (
-
- {[0, 1, 2].map((index) => ( - - ))} +
+ {hint ? ( +
+ {hint} +
+ ) : null} +
+ {[0, 1, 2].map((index) => ( + + ))} +
); @@ -1363,6 +1399,7 @@ export function CanvasChatPanel({ const [detailGenerationMode, setDetailGenerationMode] = useState("classic"); const [isDetailGenerating, setIsDetailGenerating] = useState(false); const [isClawdSubmitting, setIsClawdSubmitting] = useState(false); + const [clawdProcessingHint, setClawdProcessingHint] = useState(null); const [detailSections, setDetailSections] = useState>({ required: true, strategy: false, @@ -8884,6 +8921,13 @@ export function CanvasChatPanel({ return; } + const nextProcessingHint = shouldShowClawdProcessingHint( + textContent, + hasTableFiles, + hasImageAttachments + ) + ? CLAWD_PROCESSING_HINT + : null; const userMessageId = generateUUID(); const latestMessageTimestamp = messages.reduce( (latest, message) => Math.max(latest, getMessageTimestamp(message) ?? 0), @@ -8905,6 +8949,7 @@ export function CanvasChatPanel({ signature: sendSignature, timestamp: Date.now(), }); + setClawdProcessingHint(nextProcessingHint); setIsClawdSubmitting(true); setMessages((previousMessages) => sortCanvasMessagesByCreatedAt([ @@ -8998,6 +9043,7 @@ export function CanvasChatPanel({ } } finally { setIsClawdSubmitting(false); + setClawdProcessingHint(null); releaseSendGuard(activeChatId); } return; @@ -11351,7 +11397,7 @@ export function CanvasChatPanel({ )} {isClawdMode && isClawdSubmitting ? ( - + ) : null} {isLoading && !shouldRenderImageLoading && (