Merge pull request #359 from FlowiseAI/feature/EmbedCustomization

Feature/EmbedChat Customization
This commit is contained in:
Henry Heng 2023-06-18 14:56:57 +01:00 committed by GitHub
commit ba22b36af1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 0 deletions

View File

@ -135,6 +135,9 @@ const embedCodeCustomization = (chatflowid) => {
Chatbot.init({ Chatbot.init({
chatflowid: "${chatflowid}", chatflowid: "${chatflowid}",
apiHost: "${baseURL}", apiHost: "${baseURL}",
chatflowConfig: {
// topK: 2
},
theme: { theme: {
button: { button: {
backgroundColor: "#3B81F6", backgroundColor: "#3B81F6",
@ -149,6 +152,7 @@ const embedCodeCustomization = (chatflowid) => {
backgroundColor: "#ffffff", backgroundColor: "#ffffff",
height: 700, height: 700,
width: 400, width: 400,
fontSize: 16,
poweredByTextColor: "#303235", poweredByTextColor: "#303235",
botMessage: { botMessage: {
backgroundColor: "#f7f8ff", backgroundColor: "#f7f8ff",
@ -189,6 +193,7 @@ const APICodeDialog = ({ show, dialogProps, onCancel }) => {
const getAllAPIKeysApi = useApi(apiKeyApi.getAllAPIKeys) const getAllAPIKeysApi = useApi(apiKeyApi.getAllAPIKeys)
const updateChatflowApi = useApi(chatflowsApi.updateChatflow) const updateChatflowApi = useApi(chatflowsApi.updateChatflow)
const getIsChatflowStreamingApi = useApi(chatflowsApi.getIsChatflowStreaming)
const getConfigApi = useApi(configApi.getConfig) const getConfigApi = useApi(configApi.getConfig)
const onCheckBoxChanged = (newVal) => { const onCheckBoxChanged = (newVal) => {
@ -553,6 +558,7 @@ query({
useEffect(() => { useEffect(() => {
if (show) { if (show) {
getAllAPIKeysApi.request() getAllAPIKeysApi.request()
getIsChatflowStreamingApi.request(dialogProps.chatflowid)
} }
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
@ -665,6 +671,15 @@ query({
wrapLines wrapLines
/> />
)} )}
{value !== 0 && getIsChatflowStreamingApi.data?.isStreaming && (
<p>
Read&nbsp;
<a rel='noreferrer' target='_blank' href='https://docs.flowiseai.com/how-to-use#streaming'>
here
</a>
&nbsp;on how to stream response back to application
</p>
)}
</TabPanel> </TabPanel>
))} ))}
</DialogContent> </DialogContent>