Skip to content

Commit 98acc4b

Browse files
authored
Check if kapa.ai can also be integrated into dstack Sky #296 (#2990)
* dstackai/dstack-cloud#296 * Move tour button
1 parent 6423818 commit 98acc4b

4 files changed

Lines changed: 150 additions & 7 deletions

File tree

frontend/public/index.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,19 @@
2222
<noscript>You need to enable JavaScript to run this app.</noscript>
2323
<div class="b-page-header" id="header"></div>
2424
<div id="root"></div>
25+
26+
<script src="https://widget.kapa.ai/kapa-widget.bundle.js"
27+
data-website-id="1c028b8e-609e-40e3-b792-f3939a461850"
28+
data-project-name="dstack"
29+
data-project-color="rgba(0, 0, 0, 0.87)"
30+
data-font-size-lg="0.78rem"
31+
data-button-hide="true"
32+
data-modal-image="/logo-notext.svg"
33+
data-modal-z-index="1100"
34+
data-modal-title="Ask me anything"
35+
data-project-logo="/assets/images/kapa.svg"
36+
data-modal-disclaimer="This is a custom LLM for dstack with access to Documentation, API references and GitHub issues. This feature is experimental - Give it a try!"
37+
data-user-analytics-fingerprint-enabled="true"
38+
async></script>
2539
</body>
2640
</html>

frontend/public/logo-notext.svg

Lines changed: 116 additions & 0 deletions
Loading

frontend/src/layouts/AppLayout/index.tsx

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ const AppLayout: React.FC<{ children: React.ReactNode }> = ({ children }) => {
137137

138138
const ThemeIcon = THEME_ICON_MAP[systemMode];
139139

140+
const askAi = () => {
141+
window.document.body.focus();
142+
window?.Kapa?.open();
143+
};
144+
140145
return (
141146
<AnnotationContext>
142147
<HeaderPortal>
@@ -148,12 +153,6 @@ const AppLayout: React.FC<{ children: React.ReactNode }> = ({ children }) => {
148153
logo: { src: logo, alt: 'Dstack logo' },
149154
}}
150155
utilities={[
151-
process.env.UI_VERSION === 'sky' && {
152-
type: 'button',
153-
iconName: 'gen-ai',
154-
title: t('common.tutorial_other'),
155-
onClick: toggleTutorialPanel,
156-
},
157156
{
158157
type: 'button',
159158
text: t('common.docs'),
@@ -172,6 +171,19 @@ const AppLayout: React.FC<{ children: React.ReactNode }> = ({ children }) => {
172171
iconSvg: <ThemeIcon />,
173172
onClick: onChangeSystemModeToggle,
174173
},
174+
process.env.UI_VERSION === 'sky' && {
175+
type: 'button',
176+
iconName: 'gen-ai',
177+
text: t('common.ask_ai'),
178+
title: t('common.ask_ai'),
179+
onClick: askAi,
180+
},
181+
process.env.UI_VERSION === 'sky' && {
182+
type: 'button',
183+
iconName: 'suggestions',
184+
title: t('common.tutorial_other'),
185+
onClick: toggleTutorialPanel,
186+
},
175187
{
176188
'data-class': 'user-menu',
177189
type: 'menu-dropdown',

frontend/src/locale/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@
4848
"danger_zone": "Danger Zone",
4949
"control_plane": "Control plane",
5050
"refresh": "Refresh",
51-
"quickstart": "Quickstart"
51+
"quickstart": "Quickstart",
52+
"ask_ai": "Ask AI"
5253
},
5354

5455
"auth": {

0 commit comments

Comments
 (0)