Move the "Ask <query>" to the bottom of search results if query is not a question (#3751)

This commit is contained in:
Zeno Kapitein
2025-10-24 10:58:51 +02:00
committed by GitHub
parent 1b0613e482
commit 758b34d46b
2 changed files with 10 additions and 1 deletions
+5
View File
@@ -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 ?? [])),
];
}