Last active
August 18, 2023 07:34
-
-
Save FredrikOseberg/7fad0e5c1458559c544de6f0dd41e602 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// in config | |
... | |
import Overview from "../components/widgets/Overview/Overview"; | |
import MessageParser from "../components/widgets/MessageParser/MessageParser"; | |
import ActionProviderDocs from "../components/widgets/ActionProvider/ActionProviderDocs"; | |
const config = { | |
..., | |
state: { | |
gist: "", | |
}, | |
widgets: [ | |
{ | |
widgetName: "overview", | |
widgetFunc: (props) => <Overview {...props} />, | |
mapStateToProps: ["gist"], | |
props: {} | |
}, | |
{ | |
widgetName: "messageParser", | |
widgetFunc: (props) => <MessageParser {...props} />, | |
mapStateToProps: ["gist"], | |
props: {} | |
}, | |
{ | |
widgetName: "actionProviderDocs", | |
widgetFunc: (props) => <ActionProviderDocs {...props} />, | |
mapStateToProps: ["gist"], | |
props: {} | |
}, | |
], | |
}; | |
export default config; | |
// Use the widget in actionProvider | |
this.createChatBotMessage("Hi", { widget: "overview" }) |
Thank you for your quick response, Sir! Yep, I have a functional flask python backend, with NLP and CV models in it, so now, I'm sending each user input to the flask backend using a "POST" request, and the chatbot front end receives each response from the backend. For texts (strings), it's straightforward (currently I'm accessing user input in the state), but for image files, I imagine maybe they should be handled differently in MessagePraser or somewhere along the process? And lastly, I probably should create another function in the ActionProvider for Posting multipart and form-data.
How to show date before every message and add props to widget?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Should be pretty straight forward as you just implement a regular react component as widgets. Or did you have another use case in mind?