191 | {isLoading ? (
192 |
193 |
194 |
195 | ) : error ? (
196 |
197 | {error}
198 |
199 | ) : searchResults.length > 0 ? (
200 | <>
201 | {enableAiChat && (
202 |
handleAiQuestionClick(searchQuery)}
205 | role="button"
206 | tabIndex={0}
207 | aria-label="Ask AI about search results"
208 | >
209 |
210 |
211 |
AI
212 |
213 |
214 | Tell me about{' '}
215 |
216 | {searchQuery}
217 |
218 |
219 |
220 |
221 |
222 | {isAiLoading ? (
223 |
224 | ) : aiResponse ? (
225 | 'Response →'
226 | ) : (
227 | 'Ask →'
228 | )}
229 |
230 |
231 | {aiResponse && (
232 |
233 |
234 | }>
235 | {aiResponse}
236 |
237 |
238 |
239 | )}
240 |
241 | )}
242 | {searchResults.map((result) => (
243 |
handleResultClick(result)}
247 | role="button"
248 | tabIndex={0}
249 | aria-label={`Search result: ${result.metadata.title}`}
250 | >
251 |
252 | {result.metadata.title}
253 |
254 |
255 | {result.metadata.documentTitle}
256 |
257 |
258 | {formatContent(result.metadata.content)}
259 |
260 |
261 | ))}
262 | >
263 | ) : searchQuery ? (
264 |
No results found
265 | ) : (
266 |
267 | Start typing to search...
268 |
269 | )}
270 |