Spaces:
Sleeping
Sleeping
File size: 1,498 Bytes
194aaa5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | import React from 'react';
interface ChatInputProps {
inputText: string;
isStreaming: boolean;
selectedDocId: string | null;
activeDocName: string | undefined;
onChange: (value: string) => void;
onSubmit: (e: React.FormEvent) => void;
}
export function ChatInput({
inputText,
isStreaming,
selectedDocId,
activeDocName,
onChange,
onSubmit,
}: ChatInputProps) {
return (
<div className="chat-input-container">
<form className="chat-input-form" onSubmit={onSubmit}>
<input
type="text"
className="chat-input"
value={inputText}
onChange={(e) => onChange(e.target.value)}
placeholder={
selectedDocId
? `Ask a question about ${activeDocName}...`
: 'Ask about all uploaded documents...'
}
disabled={isStreaming}
/>
<button
type="submit"
className={`send-btn ${inputText.trim() && !isStreaming ? 'active' : ''}`}
disabled={!inputText.trim() || isStreaming}
>
<svg
width="20"
height="20"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
>
<line x1="22" y1="2" x2="11" y2="13"></line>
<polygon points="22 2 15 22 11 13 2 9 22 2"></polygon>
</svg>
</button>
</form>
</div>
);
}
|