File tree Expand file tree Collapse file tree 3 files changed +10
-2
lines changed
packages/gitbook/src/components Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " gitbook " : patch
3
+ ---
4
+
5
+ Fix markdownPageURL for PageActions
Original file line number Diff line number Diff line change @@ -171,14 +171,17 @@ export function ActionOpenInLLM(props: {
171
171
172
172
const providerLabel = provider === 'chatgpt' ? 'ChatGPT' : 'Claude' ;
173
173
174
+ // Remove the .md extension from the URL to avoid sending a bad request to the LLM.
175
+ const urlWithoutExtension = url . replace ( / \. m d $ / , '' ) ;
176
+
174
177
return (
175
178
< PageActionWrapper
176
179
type = { type }
177
180
icon = { provider }
178
181
label = { tString ( language , 'open_in' , providerLabel ) }
179
182
shortLabel = { providerLabel }
180
183
description = { tString ( language , 'ai_chat_ask_about_page' , providerLabel ) }
181
- href = { getLLMURL ( provider , url , language ) }
184
+ href = { getLLMURL ( provider , urlWithoutExtension , language ) }
182
185
/>
183
186
) ;
184
187
}
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ export async function PageHeader(props: {
40
40
// Show page actions if *any* of the actions are enabled
41
41
< PageActionsDropdown
42
42
siteTitle = { context . site . title }
43
- markdownPageURL = { `${ context . linker . toAbsoluteURL ( context . linker . toPathInSpace ( page . path ) ) } ` }
43
+ markdownPageURL = { `${ context . linker . toAbsoluteURL ( context . linker . toPathInSpace ( page . path ) ) } .md ` }
44
44
editOnGit = {
45
45
context . customization . git . showEditLink &&
46
46
context . space . gitSync ?. url &&
You can’t perform that action at this time.
0 commit comments