Skip to content

Commit 4d5e7f8

Browse files
author
Nathan Zylbersztejn
authored
Merge pull request #20 from mrbot-ai/feature/crop-scale
Feature/crop scale
2 parents 55db468 + af0145d commit 4d5e7f8

File tree

13 files changed

+432
-356
lines changed

13 files changed

+432
-356
lines changed

README.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,20 @@ In your `<body/>`:
2929
title: "Title",
3030
subtitle: "Subtitle",
3131
profileAvatar: "http://to.avat.ar",
32+
params: {
33+
images: {
34+
dims: {
35+
width: 300,
36+
height: 200,
37+
}
38+
}
39+
}
3240
})
3341
</script>
3442
```
3543

44+
About images: `width` and `height` define the size in pixels that images in messages are crop-scaled to. If not present, the image will scale to the maximum width of the container and the image.
45+
3646
It is recommended to use a particular version (i.e. "webchat-<version>.js") however the file "webchat-latest.js"
3747
is also available and is updated continuously with the latest version.
3848

@@ -43,8 +53,8 @@ Install the package from GitHub by running:
4353
npm install mrbot-ai/rasa-webchat
4454
```
4555

46-
Then once it is installed it can be implemented as follows. Make sure to have the prop 'embedded'
47-
set to true if you don't want to see the launcher
56+
Then once it is installed it can be implemented as follows.
57+
4858
```javascript
4959
import { Widget } from 'rasa-webchat';
5060

@@ -57,11 +67,22 @@ function CustomWidget = () => {
5767
socketPath={"/socket.io/"}
5868
title={"Title"}
5969
embedded={true}
70+
params={
71+
images: {
72+
dims: {
73+
width: 300,
74+
height: 200
75+
}
76+
}
77+
}
6078
/>
6179
)
6280
}
6381
```
6482

83+
- Make sure to have the prop `embedded`
84+
set to `true` if you don't want to see the launcher.
85+
6586
## In your backend.
6687

6788
Your backend should expose a socket with [socket.io](http://socket.io)

dev/src/index.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,15 @@
1313
initPayload: "/get_started",
1414
socketUrl: "http://localhost:5005/",
1515
socketPath: "/socket.io/",
16-
title:"DEV Test"
16+
title:"DEV Test",
17+
params: {
18+
images: {
19+
dims: {
20+
width: 300,
21+
height: 200
22+
}
23+
}
24+
}
1725
})
1826
</script>
1927

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const plugin = {
1818
showCloseButton={args.showCloseButton}
1919
fullScreenMode={args.fullScreenMode}
2020
badge={args.badge}
21+
params={args.params}
2122
/>, document.querySelector(args.selector)
2223

2324
);

0 commit comments

Comments
 (0)