-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'illiar/feat/document-field-variant' into illiar/feat/co…
…llection-flow-customization
- Loading branch information
Showing
17 changed files
with
1,620 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
{ | ||
"jest.jestCommandLine": "node_modules/.bin/jest" | ||
"jest.jestCommandLine": "node_modules/.bin/jest", | ||
"eslint.workingDirectories": [ | ||
"apps/backoffice-v2", | ||
"apps/workflows-dashboard", | ||
"packages/workflow-core", | ||
"services/workflows-service" | ||
] | ||
} |
113 changes: 113 additions & 0 deletions
113
apps/backoffice-v2/src/domains/chat/chatbot-opengpt.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
import { Webchat, WebchatProvider, getClient } from '@botpress/webchat'; | ||
import { buildTheme } from '@botpress/webchat-generator'; | ||
import { useState, useEffect } from 'react'; | ||
import { useAuthenticatedUserQuery } from '../../domains/auth/hooks/queries/useAuthenticatedUserQuery/useAuthenticatedUserQuery'; | ||
|
||
// declare const themeNames: readonly ["prism", "galaxy", "dusk", "eggplant", "dawn", "midnight"]; | ||
const { theme, style } = buildTheme({ | ||
themeName: 'galaxy', | ||
themeColor: 'blue', | ||
}); | ||
|
||
const clientId = '8f29c89d-ec0e-494d-b18d-6c3590b28be6'; | ||
|
||
const Chatbot = () => { | ||
const client = getClient({ clientId }); | ||
const [isWebchatOpen, setIsWebchatOpen] = useState(false); | ||
const { data: session } = useAuthenticatedUserQuery(); | ||
|
||
useEffect(() => { | ||
if (session?.user) { | ||
const { firstName, lastName, email } = session.user; | ||
void client.updateUser({ | ||
data: { | ||
firstName, | ||
lastName, | ||
email, | ||
}, | ||
}); | ||
} | ||
}, [session, client]); | ||
|
||
const toggleWebchat = () => { | ||
setIsWebchatOpen(prevState => !prevState); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<style>{style}</style> | ||
<WebchatProvider | ||
theme={theme} | ||
client={client} | ||
configuration={{ | ||
botName: 'AI Analyst', | ||
botAvatar: 'https://cdn.ballerine.io/logos/ballerine-logo.png', | ||
botDescription: 'Your intelligent AI Analyst', | ||
composerPlaceholder: 'Ask the AI Analyst anything...', | ||
website: { | ||
title: 'Visit AI Analyst', | ||
link: 'https://ballerine.ai', | ||
}, | ||
email: { | ||
title: 'Contact Support', | ||
link: 'mailto:support@ballerine.com', | ||
}, | ||
privacyPolicy: { | ||
title: 'Privacy Policy', | ||
link: 'https://ballerine.com/privacy', | ||
}, | ||
termsOfService: { | ||
title: 'Terms of Service', | ||
link: 'https://ballerine.com/terms', | ||
}, | ||
}} | ||
> | ||
<button | ||
onClick={toggleWebchat} | ||
style={{ | ||
width: '60px', | ||
height: '60px', | ||
borderRadius: '50%', | ||
background: 'none', | ||
border: 'none', | ||
cursor: 'pointer', | ||
position: 'fixed', | ||
bottom: '20px', | ||
right: '20px', | ||
zIndex: 1000, | ||
padding: 0, | ||
overflow: 'hidden', | ||
}} | ||
aria-label="Toggle AI Analyst chat" | ||
> | ||
<img | ||
src="https://cdn.ballerine.io/logos/ballerine-logo.png" | ||
alt="AI Analyst" | ||
style={{ width: '100%', height: '100%', objectFit: 'cover' }} | ||
/> | ||
</button> | ||
{isWebchatOpen && ( | ||
<div | ||
style={{ | ||
width: '400px', | ||
height: '600px', | ||
maxWidth: '90vw', | ||
maxHeight: '90vh', | ||
position: 'fixed', | ||
bottom: '90px', // Increased to leave space for the open button | ||
right: '20px', | ||
zIndex: 999, // Decreased to ensure it's below the open button | ||
boxShadow: '0 5px 40px rgba(0,0,0,0.16)', | ||
borderRadius: '8px', | ||
overflow: 'hidden', | ||
}} | ||
> | ||
<Webchat /> | ||
</div> | ||
)} | ||
</WebchatProvider> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Chatbot; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.