mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-21 01:53:26 +00:00
Move the "Ask <query>" to the bottom of search results if query is not a question (#3751)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
---
|
||||
|
||||
Move the "Ask <query>" to the bottom of search results if query is not a question
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
|
||||
import { type Assistant, useAI } from '@/components/AI';
|
||||
import { useTrackEvent } from '../Insights';
|
||||
import { isQuestion } from './isQuestion';
|
||||
import type { SearchScope } from './useSearch';
|
||||
|
||||
export type ResultType =
|
||||
@@ -198,13 +199,16 @@ function withAskTriggers(
|
||||
return without;
|
||||
}
|
||||
|
||||
const queryIsQuestion = isQuestion(query);
|
||||
|
||||
return [
|
||||
...(queryIsQuestion ? [] : (without ?? [])),
|
||||
...assistants.map((assistant, index) => ({
|
||||
type: 'question' as const,
|
||||
id: `question-${index}`,
|
||||
query,
|
||||
assistant,
|
||||
})),
|
||||
...(without ?? []),
|
||||
...(!queryIsQuestion ? [] : (without ?? [])),
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user