@@ -7,6 +7,25 @@ import PublishNew from "./icons/publish-new.svg";
7
7
import QuickStop from "./icons/quick-stop.svg" ;
8
8
import type { Backend } from "./utils" ;
9
9
10
+ export interface InputCountProps extends React . ComponentProps < "span" > {
11
+ count : number ;
12
+ limit : number ;
13
+ className : string ;
14
+ }
15
+
16
+ export function InputCount ( {
17
+ count,
18
+ limit,
19
+ className,
20
+ ...props
21
+ } : InputCountProps ) {
22
+ return (
23
+ < span className = { className } { ...props } >
24
+ { count } / { limit }
25
+ </ span >
26
+ ) ;
27
+ }
28
+
10
29
export interface SenderButtonProps extends React . ComponentProps < "button" > {
11
30
/**
12
31
* Icon to display in the button.
@@ -86,6 +105,7 @@ export interface SenderProps extends React.ComponentProps<"div"> {
86
105
* @param controller - The AbortController to abort the request.
87
106
*/
88
107
onSend ?: ( controller : AbortController ) => void ;
108
+ toolbar ?: React . ReactNode ;
89
109
}
90
110
export function Sender ( {
91
111
className,
@@ -94,6 +114,7 @@ export function Sender({
94
114
onMessageChange,
95
115
input,
96
116
onSend,
117
+ toolbar,
97
118
...props
98
119
} : SenderProps ) {
99
120
const textareaRef = useRef < HTMLTextAreaElement > ( null ) ;
@@ -164,11 +185,13 @@ export function Sender({
164
185
className = "w-full pt-4 px-4 border-0 rounded-2xl resize-none focus:ring-0 focus:outline-none text-gray-700 placeholder-gray-400"
165
186
rows = { 2 }
166
187
/>
167
- < div className = "flex items-center justify-between w-full px-4 py-2" >
168
- < div className = "flex items-center gap-2" >
169
- < span className = "text-sm text-gray-500" > { message . length } / 500</ span >
170
- </ div >
171
- < SenderButton onClick = { handleSend } isSending = { isSending } />
188
+ < div className = "flex items-center w-full px-4 py-2 gap-4" >
189
+ { toolbar }
190
+ < SenderButton
191
+ onClick = { handleSend }
192
+ isSending = { isSending }
193
+ className = "ml-auto"
194
+ />
172
195
</ div >
173
196
</ div >
174
197
) ;
0 commit comments