Skip to content

Commit 0fa4895

Browse files
create agent-chat-input
1 parent a9a15c3 commit 0fa4895

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

components/livekit/agent-control-bar/chat-input.tsx renamed to components/livekit/agent-control-bar/agent-chat-input.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@ const MOTION_PROPS = {
2323
},
2424
};
2525

26-
interface ChatInputProps {
26+
interface AgentChatInputProps {
2727
chatOpen: boolean;
2828
isAgentAvailable?: boolean;
2929
onSend?: (message: string) => void;
3030
}
3131

32-
export function ChatInput({
32+
export function AgentChatInput({
3333
chatOpen,
3434
isAgentAvailable = false,
3535
onSend = async () => {},
36-
}: ChatInputProps) {
37-
const inputRef = useRef<HTMLInputElement>(null);
36+
}: AgentChatInputProps) {
37+
const inputRef = useRef<HTMLTextAreaElement>(null);
3838
const [isSending, setIsSending] = useState(false);
3939
const [message, setMessage] = useState<string>('');
4040

@@ -71,23 +71,22 @@ export function ChatInput({
7171
onSubmit={handleSubmit}
7272
className="mb-3 flex grow items-end gap-2 rounded-md pl-1 text-sm"
7373
>
74-
<input
74+
<textarea
7575
autoFocus
7676
ref={inputRef}
77-
type="text"
7877
value={message}
7978
disabled={!chatOpen}
8079
placeholder="Type something..."
8180
onChange={(e) => setMessage(e.target.value)}
82-
className="h-8 flex-1 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50"
81+
className="field-sizing-content max-h-16 min-h-8 flex-1 py-2 [scrollbar-width:thin] focus:outline-none disabled:cursor-not-allowed disabled:opacity-50"
8382
/>
8483
<Button
8584
size="icon"
8685
type="submit"
8786
disabled={isDisabled}
8887
variant={isDisabled ? 'secondary' : 'default'}
8988
title={isSending ? 'Sending...' : 'Send'}
90-
className="self-start rounded-full"
89+
className="self-end rounded-full disabled:cursor-not-allowed"
9190
>
9291
{isSending ? (
9392
<SpinnerIcon className="animate-spin" weight="bold" />

components/livekit/agent-control-bar/agent-control-bar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { AgentTrackToggle, toggleVariants } from '@/components/livekit/agent-tra
99
import { Button } from '@/components/ui/button';
1010
import { Toggle } from '@/components/ui/toggle';
1111
import { cn } from '@/lib/utils';
12-
import { ChatInput } from './chat-input';
12+
import { AgentChatInput } from './agent-chat-input';
1313
import { UseInputControlsProps, useInputControls } from './hooks/use-input-controls';
1414
import { usePublishPermissions } from './hooks/use-publish-permissions';
1515

@@ -89,7 +89,7 @@ export function AgentControlBar({
8989
>
9090
{/* Chat Input */}
9191
{visibleControls.chat && (
92-
<ChatInput
92+
<AgentChatInput
9393
chatOpen={chatOpen}
9494
isAgentAvailable={isAgentAvailable}
9595
onSend={handleSendMessage}

0 commit comments

Comments
 (0)