@@ -12,18 +12,20 @@ import { DropdownMenu } from '@/components/primitives/DropdownMenu';
12
12
import { Icon } from '@gitbook/icons' ;
13
13
import { useRef } from 'react' ;
14
14
15
- /**
16
- * Dropdown menu for the AI Actions (Ask Docs Assistant, Copy page, View as Markdown, Open in LLM).
17
- */
18
- export function AIActionsDropdown ( props : {
15
+ interface AIActionsDropdownProps {
19
16
markdownPageUrl : string ;
20
- /**
21
- * Whether to include the "Ask Docs Assistant" entry in the dropdown menu.
22
- */
23
17
withAIChat ?: boolean ;
24
- pageURL : string ;
25
18
trademark : boolean ;
26
- } ) {
19
+ /**
20
+ * Whether to include the "Open in LLM" entries in the dropdown menu.
21
+ */
22
+ withLLMActions ?: boolean ;
23
+ }
24
+
25
+ /**
26
+ * Dropdown menu for the AI Actions (Ask Docs Assistant, Copy page, View as Markdown, Open in LLM).
27
+ */
28
+ export function AIActionsDropdown ( props : AIActionsDropdownProps ) {
27
29
const ref = useRef < HTMLDivElement > ( null ) ;
28
30
29
31
return (
@@ -56,13 +58,8 @@ export function AIActionsDropdown(props: {
56
58
/**
57
59
* The content of the dropdown menu.
58
60
*/
59
- function AIActionsDropdownMenuContent ( props : {
60
- markdownPageUrl : string ;
61
- withAIChat ?: boolean ;
62
- pageURL : string ;
63
- trademark : boolean ;
64
- } ) {
65
- const { markdownPageUrl, withAIChat, pageURL, trademark } = props ;
61
+ function AIActionsDropdownMenuContent ( props : AIActionsDropdownProps ) {
62
+ const { markdownPageUrl, withAIChat, trademark, withLLMActions } = props ;
66
63
67
64
return (
68
65
< >
@@ -77,20 +74,20 @@ function AIActionsDropdownMenuContent(props: {
77
74
/>
78
75
< ViewAsMarkdown markdownPageUrl = { markdownPageUrl } type = "dropdown-menu-item" />
79
76
80
- < OpenInLLM provider = "chatgpt" url = { pageURL } type = "dropdown-menu-item" />
81
- < OpenInLLM provider = "claude" url = { pageURL } type = "dropdown-menu-item" />
77
+ { withLLMActions ? (
78
+ < >
79
+ < OpenInLLM provider = "chatgpt" url = { markdownPageUrl } type = "dropdown-menu-item" />
80
+ < OpenInLLM provider = "claude" url = { markdownPageUrl } type = "dropdown-menu-item" />
81
+ </ >
82
+ ) : null }
82
83
</ >
83
84
) ;
84
85
}
85
86
86
87
/**
87
88
* A default action shown as a quick-access button beside the dropdown menu
88
89
*/
89
- function DefaultAction ( props : {
90
- markdownPageUrl : string ;
91
- withAIChat ?: boolean ;
92
- trademark : boolean ;
93
- } ) {
90
+ function DefaultAction ( props : AIActionsDropdownProps ) {
94
91
const { markdownPageUrl, withAIChat, trademark } = props ;
95
92
96
93
if ( withAIChat ) {
0 commit comments