diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx index 29d0b45ce..2ffe3a89b 100644 --- a/src/components/Header/Header.tsx +++ b/src/components/Header/Header.tsx @@ -107,7 +107,12 @@ export function Header(props: { : null } > -
{t(getSpaceLanguage(customization), 'search')}
++ {t( + getSpaceLanguage(customization), + customization.aiSearch.enabled ? 'search_or_ask' : 'search', + )} +
diff --git a/src/components/Search/SearchButton.tsx b/src/components/Search/SearchButton.tsx index 1bfa4f994..461e5ef31 100644 --- a/src/components/Search/SearchButton.tsx +++ b/src/components/Search/SearchButton.tsx @@ -11,7 +11,6 @@ import { useSearch } from './useSearch'; /** * Button to open the search modal. */ - export function SearchButton(props: { children?: React.ReactNode; style?: ClassValue }) { const { style, children } = props; @@ -61,6 +60,7 @@ export function SearchButton(props: { children?: React.ReactNode; style?: ClassV 'md:[&>span]:flex', 'md:w-full', 'md:px-3.5', + 'text-base', style, )} > @@ -95,7 +95,6 @@ const Shortcut = () => { 'hidden', 'md:inline', 'justify-end', - 'w-full', 'text-xs', 'text-dark/5', 'dark:text-light/5', diff --git a/src/components/Search/SearchModal.tsx b/src/components/Search/SearchModal.tsx index a0ce15e38..015318a98 100644 --- a/src/components/Search/SearchModal.tsx +++ b/src/components/Search/SearchModal.tsx @@ -217,7 +217,10 @@ function SearchModalBody( 'dark:text-light', 'dark:placeholder:text-light/7', )} - placeholder={tString(language, 'search_input_placeholder')} + placeholder={tString( + language, + withAsk ? 'search_ask_input_placeholder' : 'search_input_placeholder', + )} spellCheck="false" autoComplete="off" autoCorrect="off" diff --git a/src/components/Search/server-actions.tsx b/src/components/Search/server-actions.tsx index 18d68d1c7..a4a0f9f0b 100644 --- a/src/components/Search/server-actions.tsx +++ b/src/components/Search/server-actions.tsx @@ -34,11 +34,6 @@ export interface AskAnswerSource { id: string; title: string; href: string; - ancestors: Array<{ - id: string; - title: string; - href: string; - }>; } export interface AskAnswerResult { @@ -79,22 +74,15 @@ export async function searchCollectionContent( */ export const streamAskQuestion = streamResponse(async function* (spaceId: string, query: string) { const stream = api.api().spaces.streamAskInSpace(spaceId, { query, format: 'document' }); - const pages = await api.getRevisionPages({ spaceId }); + const pagesPromise = api.getRevisionPages({ spaceId }); for await (const chunk of stream) { + // We run the AI search and fetch the pages in parallel + const pages = await pagesPromise; yield transformAnswer(chunk.answer, pages); } }); -export async function askQuestion(spaceId: string, query: string): Promise