@@ -16,6 +16,7 @@ import {
16
16
import { useEffect , useMemo , useRef , useState } from "react" ;
17
17
18
18
import type { FileUploaderService } from "@app/hooks/useFileUploaderService" ;
19
+ import { getConnectorProviderLogoWithFallback } from "@app/lib/connector_providers" ;
19
20
import {
20
21
getLocationForDataSourceViewContentNode ,
21
22
getVisualForDataSourceViewContentNode ,
@@ -115,23 +116,44 @@ export const InputBarAttachmentsPicker = ({
115
116
/>
116
117
</ DropdownMenuTrigger >
117
118
< DropdownMenuContent
118
- className = "w-125 "
119
+ className = "w-100 "
119
120
side = "bottom"
120
121
onInteractOutside = { ( ) => setIsOpen ( false ) }
121
122
>
122
- < div className = "items-end pb-2" >
123
- < DropdownMenuSearchbar
124
- ref = { searchbarRef }
125
- name = "search-files"
126
- placeholder = "Search knowledge or attach files"
127
- value = { search }
128
- onChange = { setSearch }
129
- disabled = { isLoading }
130
- />
131
- < DropdownMenuSeparator />
132
- < ScrollArea className = "flex max-h-96 flex-col" hideScrollBar >
133
- { showSearchResults ? (
134
- < div className = "pt-2" >
123
+ < Input
124
+ type = "file"
125
+ ref = { fileInputRef }
126
+ style = { { display : "none" } }
127
+ onChange = { async ( e ) => {
128
+ setIsOpen ( false ) ;
129
+ await fileUploaderService . handleFileChange ( e ) ;
130
+ if ( fileInputRef . current ) {
131
+ fileInputRef . current . value = "" ;
132
+ }
133
+ } }
134
+ multiple = { true }
135
+ />
136
+ < DropdownMenuItem
137
+ key = "upload-item"
138
+ label = "Upload file"
139
+ icon = { CloudArrowUpIcon }
140
+ onClick = { ( ) => fileInputRef . current ?. click ( ) }
141
+ />
142
+ < DropdownMenuSeparator />
143
+ < DropdownMenuSearchbar
144
+ ref = { searchbarRef }
145
+ name = "search-files"
146
+ placeholder = "Search knowledge or attach files"
147
+ value = { search }
148
+ onChange = { setSearch }
149
+ disabled = { isLoading }
150
+ />
151
+
152
+ { showSearchResults && (
153
+ < >
154
+ < DropdownMenuSeparator />
155
+ < ScrollArea className = "flex max-h-96 flex-col" hideScrollBar >
156
+ < div className = "pt-0" >
135
157
{ unfoldedNodes . length > 0 ? (
136
158
unfoldedNodes . map ( ( item , index ) => (
137
159
< DropdownMenuItem
@@ -142,6 +164,10 @@ export const InputBarAttachmentsPicker = ({
142
164
className : "min-w-4" ,
143
165
} )
144
166
}
167
+ extraIcon = { getConnectorProviderLogoWithFallback ( {
168
+ provider :
169
+ item . dataSourceView . dataSource . connectorProvider ,
170
+ } ) }
145
171
disabled = {
146
172
atachedNodeIds . includes ( item . internalId ) ||
147
173
item . type !== "document"
@@ -164,32 +190,10 @@ export const InputBarAttachmentsPicker = ({
164
190
</ div >
165
191
) }
166
192
</ div >
167
- ) : (
168
- < div className = "flex flex-col items-end gap-4 pr-1" >
169
- < Input
170
- type = "file"
171
- ref = { fileInputRef }
172
- style = { { display : "none" } }
173
- onChange = { async ( e ) => {
174
- setIsOpen ( false ) ;
175
- await fileUploaderService . handleFileChange ( e ) ;
176
- if ( fileInputRef . current ) {
177
- fileInputRef . current . value = "" ;
178
- }
179
- } }
180
- multiple = { true }
181
- />
182
- < Button
183
- onClick = { ( ) => fileInputRef . current ?. click ( ) }
184
- disabled = { isLoading }
185
- icon = { CloudArrowUpIcon }
186
- label = "Upload file"
187
- />
188
- </ div >
189
- ) }
190
- < ScrollBar className = "py-0" />
191
- </ ScrollArea >
192
- </ div >
193
+ < ScrollBar className = "py-0" />
194
+ </ ScrollArea >
195
+ </ >
196
+ ) }
193
197
</ DropdownMenuContent >
194
198
</ DropdownMenu >
195
199
) ;
0 commit comments