Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FullPageChat - Unable to assign type theme={{}} #2

Open
KazeroG opened this issue Feb 17, 2024 · 6 comments
Open

FullPageChat - Unable to assign type theme={{}} #2

KazeroG opened this issue Feb 17, 2024 · 6 comments

Comments

@KazeroG
Copy link

KazeroG commented Feb 17, 2024

is because the FullPageChat component doesn't have a theme prop defined in its API. Therefore you cannot pass it a theme object.

@hoacode96
Copy link

Got the same issue. Is there any way to customize ?

@dollypizzle
Copy link

dollypizzle commented Mar 26, 2024

Got the same issue. Is there any way to customize ?

Put the theme regardless, it will work

const chatTheme = {
    button: {
      backgroundColor: '#3B81F6',
      right: 20,
      bottom: 20,
      size: 'medium',
      iconColor: 'white',
      customIconSrc: 'https://raw.githubusercontent.com/walkxcode/dashboard-icons/main/svg/google-messages.svg',
    },
    chatWindow: {
      showTitle: false,
      title: 'Flowise Bot',
      titleAvatarSrc: 'https://raw.githubusercontent.com/walkxcode/dashboard-icons/main/svg/google-messages.svg',
      welcomeMessage: 'Hello! This is custom welcome message',
      backgroundColor: '#ffffff',
      fontSize: 16,
      poweredByTextColor: 'red',
      userMessage: {
        backgroundColor: '#3B81F6',
        textColor: '#ffffff',
        showAvatar: true,
        avatarSrc: 'https://raw.githubusercontent.com/zahidkhawaja/langchain-chat-nextjs/main/public/usericon.png',
      }
    },
  };

  return (
      <FullPageChat
        theme={chatTheme}
        chatflowid="fkfkffkkfkfk"
      />
  )

@mirensookdeo22
Copy link

You can add it and it will work but will fail to build a docker image

36.13 Type error: Type '{ chatflowid: string; apiHost: string | undefined; theme: { button: { backgroundColor: string; size: string; iconColor: string; customIconSrc: string; }; chatWindow: { welcomeMessage: string; backgroundColor: string; ... 6 more ...; textInput: { ...; }; }; }; }' is not assignable to type 'IntrinsicAttributes & BotProps & { style?: CSSProperties | undefined; className?: string | undefined; }'.
36.13 Property 'theme' does not exist on type 'IntrinsicAttributes & BotProps & { style?: CSSProperties | undefined; className?: string | undefined; }'.

Any planned updates to the react-embed component to address this issue?

@tgonzales
Copy link

I solved it by creating a typing in d.ts

declare module 'flowise-embed-react' {
interface BotProps {
chatflowid: string
apiHost: string
theme?: {
chatWindow: {
showTitle: boolean
title: string
titleAvatarSrc: string
welcomeMessage: string
errorMessage: string
backgroundColor: string
height: number
width: number
fontSize: number
poweredByTextColor: string
botMessage: {
backgroundColor: string
textColor: string
showAvatar: boolean
avatarSrc: string
}
userMessage: {
backgroundColor: string
textColor: string
showAvatar: boolean
avatarSrc: string
}
textInput: {
placeholder: string
backgroundColor: string
textColor: string
sendButtonColor: string
maxChars: number
maxCharsWarningMessage: string
autoFocus: boolean
}
feedback: {
color: string
}
footer: {
textColor: string
text: string
company: string
companyLink: string
}
}
}
}

export const FullPageChat: React.FC
}

@rapidstartup
Copy link

After adding this, I get the following error now (wasnt there before)
Type '{ chatflowid: string; apiHost: string; theme: { chatWindow: { showTitle: boolean; title: string; titleAvatarSrc: string; showAgentMessages: boolean; welcomeMessage: string; errorMessage: string; ... 9 more ...; footer: { ...; }; }; }; }' is not assignable to type 'IntrinsicAttributes'.
Property 'chatflowid' does not exist on type 'IntrinsicAttributes'.

@kaptainkangaroo
Copy link

kaptainkangaroo commented Sep 5, 2024

Its working for me like this:


  

import React from 'react';

import { FullPageChat } from "flowise-embed-react"; // Import the FullPageChat component

  

// Define the props type including the theme

interface ExtendedBotProps {

chatflowid: string;

apiHost: string;

theme?: {

chatWindow: {

showTitle: boolean;

title: string;

titleAvatarSrc: string;

showAgentMessages: boolean;

welcomeMessage: string;

errorMessage: string;

backgroundColor: string;

height: number;

width: string;

fontSize: number;

poweredByTextColor: string;

botMessage: {

backgroundColor: string;

textColor: string;

showAvatar: boolean;

avatarSrc: string;

};

userMessage: {

backgroundColor: string;

textColor: string;

showAvatar: boolean;

avatarSrc: string;

};

textInput: {

placeholder: string;

backgroundColor: string;

textColor: string;

sendButtonColor: string;

maxChars: number;

maxCharsWarningMessage: string;

autoFocus: boolean;

sendMessageSound: boolean;

receiveMessageSound: boolean;

};

feedback: {

color: string;

};

footer: {

textColor: string;

text: string;

company: string;

companyLink: string;

};

};

};

}

  

const FlowisePage: React.FC = () => {

const botProps: ExtendedBotProps = {

chatflowid: "xxx",

apiHost: "xxx",

theme: {

chatWindow: {

showTitle: true,

title: 'Flowise Bot',

titleAvatarSrc: 'https://raw.githubusercontent.com/walkxcode/dashboard-icons/main/svg/google-messages.svg',

showAgentMessages: false,

welcomeMessage: 'Hello! This is custom welcome message',

errorMessage: 'This is a custom error message',

backgroundColor: "#ffffff",

height: 900,

width: "80%",

fontSize: 16,

poweredByTextColor: "#303235",

botMessage: {

backgroundColor: "#f7f8ff",

textColor: "#303235",

showAvatar: true,

avatarSrc: "https://raw.githubusercontent.com/zahidkhawaja/langchain-chat-nextjs/main/public/parroticon.png",

},

userMessage: {

backgroundColor: "#3B81F6",

textColor: "#ffffff",

showAvatar: true,

avatarSrc: "https://raw.githubusercontent.com/zahidkhawaja/langchain-chat-nextjs/main/public/usericon.png",

},

textInput: {

placeholder: 'Type your question',

backgroundColor: '#ffffff',

textColor: '#303235',

sendButtonColor: '#3B81F6',

maxChars: 50,

maxCharsWarningMessage: 'You exceeded the characters limit. Please input less than 50 characters.',

autoFocus: true,

sendMessageSound: true,

receiveMessageSound: true,

},

feedback: {

color: '#303235',

},

footer: {

textColor: '#303235',

text: 'Powered by',

company: 'xxx',

companyLink: 'xxx',

}

}

}

};

  

return (

<FullPageChat {...botProps as any} />

);

};

  

export default FlowisePage; // Ensure the component is exported as default```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants