From 3e384c679ed0328ef2f6537c83f6260b7e8ce18d Mon Sep 17 00:00:00 2001 From: conico974 Date: Wed, 10 Jun 2026 17:29:08 +0200 Subject: [PATCH] Add suggested follow-up questions to AI answer markdown response (#4284) --- packages/gitbook/src/routes/markdownAsk.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/gitbook/src/routes/markdownAsk.ts b/packages/gitbook/src/routes/markdownAsk.ts index ce616b5de..d42ed7ee6 100644 --- a/packages/gitbook/src/routes/markdownAsk.ts +++ b/packages/gitbook/src/routes/markdownAsk.ts @@ -74,6 +74,20 @@ export async function serveAskMarkdown(context: GitBookSiteContext, rawQuestion: result += answerMarkdown.trim(); result += '\n\n'; + const followupQuestions = latestAnswer.followupQuestions ?? []; + if (followupQuestions.length > 0) { + result += '# Suggested Follow-up Questions:\n\n'; + result += + 'If you need more information, consider asking one of these follow-up questions by performing an HTTP GET request on the URL:\n\n'; + result += followupQuestions + .map( + (q) => + `- [${q}](${context.linker.toAbsoluteURL(context.linker.toPathInSite(''))}?ask=${encodeURIComponent(q)})` + ) + .join('\n'); + result += '\n\n'; + } + if (sourcesMarkdown) { result += '# Sources:\n\n'; result += sourcesMarkdown;