Skip to content

Commit 95c047f

Browse files
authored
Update seed trainings and add origin flag to training data (#14)
1 parent 9288956 commit 95c047f

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

src/plugins/home.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React from 'react';
33
export default function (sam) {
44
sam.action('home', function (el) {
55
return sam.render(<img style={{ width: '50%' }}
6-
src='assets/svg/mysam-logo.svg'
6+
src='//unpkg.com/mysam-ui/assets/svg/mysam-logo.svg'
77
className='logo' alt='MySam Logo' />, el);
88
});
99

src/plugins/learn/learner.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ class Learner extends React.Component {
2727
const action = omit(merge({}, this.store.action, base), '_id');
2828

2929
const data = toObject({
30-
text: this.store.classification.text, action
30+
text: this.store.classification.text,
31+
type: 'custom',
32+
action
3133
});
3234

3335
this.store.sam.service('trainings').create(data).then(training => {

src/sam.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ export default class MySamUi {
8686
previous.confidence < confidence.certain) {
8787
const training = {
8888
text: previous.text,
89-
action: previous.action._id
89+
action: previous.action._id,
90+
type: 'reinforcement'
9091
};
9192
debug('Creating new training from previous classification', training);
9293
this.service('trainings').create(training);

src/seed-trainings.js

+23-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
export default [{
2+
text: 'hi',
3+
action: {
4+
type: 'hi'
5+
}
6+
}, {
7+
text: 'hello',
8+
action: {
9+
type: 'hi'
10+
}
11+
}, {
212
text: 'hi my name is david',
313
action: {
414
type: 'hi',
@@ -61,6 +71,12 @@ export default [{
6171
type: 'help',
6272
reply: 'I am great! Here is what I can do:'
6373
}
74+
}, {
75+
text: 'how\'re you',
76+
action: {
77+
type: 'help',
78+
reply: 'I am great! Here is what I can do:'
79+
}
6480
}, {
6581
text: 'how is it going',
6682
action: {
@@ -71,6 +87,12 @@ export default [{
7187
text: 'what is happening',
7288
action: {
7389
type: 'help',
74-
reply: 'I am great! Here is what I can do:'
90+
reply: 'Not too much. Here is what I can do:'
91+
}
92+
}, {
93+
text: 'what\'s up',
94+
action: {
95+
type: 'help',
96+
reply: 'Not too much. Here is what I can do:'
7597
}
7698
}];

0 commit comments

Comments
 (0)