Skip to content

Commit 28966a9

Browse files
committed
feat: add AI assistant
1 parent c0848ea commit 28966a9

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

next.config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ module.exports = withBundleAnalyzer({
4343
's1.ax1x.com',
4444
'imgse.com',
4545
's3.us-west-1.amazonaws.com',
46-
'file-cdn.openbuild.xyz'
46+
'file-cdn.openbuild.xyz',
47+
'api.runllm.com'
4748
],
4849
},
4950
webpack: config => {

src/app/layout.js

+5
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,16 @@ export const metadata = {
101101
},
102102
};
103103

104+
import { initRunLLM } from './../entry/components/Widget/RunLLM';
105+
104106
export default async function RootLayout({ children }) {
105107
const configRes = await getConfigs();
106108

107109
return (
108110
<html lang="en" data-theme="light" className={`${nunito_sans.className} light`} suppressHydrationWarning>
111+
<head>
112+
<script dangerouslySetInnerHTML={{ __html: `(${initRunLLM.toString()})()` }} />
113+
</head>
109114
<body>
110115
<ClientEntry config={{ static: getAppConfig(), dynamic: configRes }}>
111116
<DefaultLayout>{children}</DefaultLayout>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* Copyright 2024 OpenBuild
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
export function initRunLLM() {
18+
if (typeof document !== 'undefined') {
19+
document.addEventListener('DOMContentLoaded', function () {
20+
var script = document.createElement('script');
21+
script.type = 'module';
22+
script.id = 'runllm-widget-script';
23+
script.src = 'https://widget.runllm.com';
24+
25+
script.setAttribute('version', 'stable');
26+
script.setAttribute('runllm-theme-color', '#64d88b');
27+
script.setAttribute('runllm-brand-logo', '/favicon.svg');
28+
script.setAttribute('runllm-keyboard-shortcut', 'Mod+j');
29+
script.setAttribute('runllm-name', 'OpenBuild');
30+
script.setAttribute('runllm-position', 'BOTTOM_RIGHT');
31+
script.setAttribute('runllm-assistant-id', '328');
32+
33+
script.async = true;
34+
document.head.appendChild(script);
35+
});
36+
}
37+
}

0 commit comments

Comments
 (0)