Skip to content

Commit

Permalink
Merge branch 'master' into raymond
Browse files Browse the repository at this point in the history
  • Loading branch information
raymzag committed Jun 2, 2017
2 parents 3b9e0a6 + 874e1ac commit 88d7882
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# CSM Bot

---
[Heroku Deployment](https://postalcsbot.herokuapp.com/)

## Short
Expand All @@ -14,18 +14,18 @@ The proliferation of offshore customer service operations has distanced users fr
## Framework
We chose the [React on Rails](https://github.com/shakacode/react_on_rails) by Shakacode. Like the react-rails gem, React on Rails is capable of server-side rendering with fragment caching and is compatible with turbolinks. Unlike react-rails, which depends heavily on sprockets and jquery-ujs, React on Rails uses webpack and does not depend on jQuery. While the initial setup is slightly more involved, it allows for advanced functionality such as:

### Pros
1. Redux (for action cables)
2. Webpack optimization functionality
3. React Router
4. Ability to use **both** ruby gems and npm packages
3. Choose between rails or React routers
4. Ability to use **both** ruby gems and npm packages(yarn)
5. Can optimize for SEO (through use of pre-renders)

Cons
### Cons
1. Native modules tend to break down on some module installations - cost us a lot of time
2. Debugging was difficult because of webpack

## Built with
------
* React
* Rails
* Node.js
Expand Down Expand Up @@ -206,6 +206,7 @@ We opened a number of issues, and gave some recommendations for modest improveme
### Points of Interest
* Chatbots are very, very useful --- especially when used with the ReactDOM router. It can help to direct you to relevant pages.
* Introducing dynamic chat routing increases your code complexity exponentially
* Training models with Wit.ai was relatively straightforward and easy -- and allows for capture and validation of responses that is not predicted in your workflow

### Performance
* There are definitely performance issues -- particular with new initializing new sessions and large chat sessions. We've noticed that all the previous chat messages are re-rendered each update, and finding shouldComponentUpdate conditions that limit needless re-rendering and not break the code is **very challenging**
Expand Down
5 changes: 3 additions & 2 deletions app/views/layouts/landing.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<%= csrf_meta_tags %>
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
Expand Down Expand Up @@ -57,8 +58,8 @@
<p class="slider-p"> A customer service robot that seamlessly integrates a clean and light-weight React chatbot with real-time interaction analysis powered by the IBM Watson Tone Analyzer and trained Wit.Ai decision-aggregation models.<br> </p>

<p class="slider-p"> Sign up now! No email verification is needed</p>
<a href="/signup"><button type="button" class="btn btn-default edit-button-1">SIGN UP</button></a>
<a href="/login"><button type="button" class="btn btn-default edit-button-1">LOGIN</button></a>
<a href="/users/sign_up"><button type="button" class="btn btn-default edit-button-1">SIGN UP</button></a>
<a href="/users/sign_in"><button type="button" class="btn btn-default edit-button-1">LOGIN</button></a>
</div>
</div>
</div>
Expand Down
13 changes: 13 additions & 0 deletions client/app/bundles/Main/components/MainApp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,16 @@ export default class MainApp extends React.Component {
}

handleEnd ({ steps, values }) {
// convert to jsonstring
let stepsObjArr = []
for(let id in steps) {
stepsObjArr.push(steps[id])
}
$.ajax({
url : "/bot_histories",
type : "post",
data : { "bot_history[steps]": JSON.stringify(stepsObjArr), "bot_history[values]": JSON.stringify(values) }
});
// console.log(steps);
// console.log(values);
// setTimeout(() => {
Expand Down Expand Up @@ -368,6 +378,9 @@ export default class MainApp extends React.Component {
{ this.props.isadmin && <h2 style={{
textAlign: 'center'
}}>Sentiment Analysis</h2> }
{ this.props.isadmin && <div style={{
textAlign: 'center'
}}><a href="https://www.ibm.com/watson/developercloud/doc/tone-analyzer/understand-tone.html" target="_blank">Sentiment Score Guide</a></div> }
<SentimentBot response={this.state.inputValue} handleLoadingDone={(tonesArr) => this.handleLoadingDone(tonesArr)} isadmin={this.props.isadmin} />
</div>
<div className='col-md-12'>
Expand Down
Binary file added graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 88d7882

Please sign in to comment.