https://github.com/sango-tech/bot-scenario-maker
Using leader line to make bot scenario
https://github.com/sango-tech/bot-scenario-maker
Last synced: 3 months ago
JSON representation
Using leader line to make bot scenario
- Host: GitHub
- URL: https://github.com/sango-tech/bot-scenario-maker
- Owner: sango-tech
- Created: 2022-01-24T07:26:49.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-02-07T06:25:32.000Z (over 1 year ago)
- Last Synced: 2025-05-05T22:39:00.539Z (about 1 year ago)
- Language: TypeScript
- Size: 273 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Bot Flows Maker
## Development
- Node 16
```
$ yarn
$ yarn watch
$ yarn build
```
## Dev page
```
cd cdn && yarn && yarn start
```
## Usage
```js
const container = document.body;
const chatbotFlow = Sango.ChatBotFlowsMaker(container);
chatbotFlow.setCardTypes([
{
name: 'question',
displayText: 'Question',
},
{
name: 'message',
displayText: 'Message',
},
{
name: 'goal',
displayText: 'Goal',
},
])
chatbotFlow.addCard({
id: '1',
uniqueId: '1',
title: 'Question #1',
titleBadge: 'QA',
left: 100,
top: 100,
answers: [
{
id: '1',
title: 'YES',
nextCards: [
{
nodeIndex: 7,
uniqueId: '2'
},
]
},
{
id: '2',
title: 'NO',
},
]
})
chatbotFlow.addCard({
id: '2',
uniqueId: '2',
title: 'Question #2',
titleBadge: 'QA',
left: 400,
top: 200,
answers: [
{
id: '3',
title: 'YES',
},
{
id: '4',
title: 'NO',
},
]
})
chatbotFlow.onCardEdit((uniqueId) => {
console.log('Card edit clicked', uniqueId)
// After update card
// chatbotFlow.updateCard(uniqueId, {answers: []}).reRender();
})
chatbotFlow.onChange((newValue) => {
console.log('New data', newValue)
})
chatbotFlow.onAddNextClicked((data) => {
console.log('Card add next clicked', data)
})
chatbotFlow.render();
```