Skip to content

Commit

Permalink
Demo app to show example of RasaHQ/rasa#6075
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry.Korotkov authored and Dmitry.Korotkov committed Jun 30, 2020
1 parent 6041b5c commit fb18956
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 156 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

venv/**
66 changes: 6 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,68 +1,14 @@
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
This is a temporary app to show an example for [this issue](https://github.com/RasaHQ/rasa/issues/6075).

## Available Scripts
## Prerequisite

To run this app you need to install [yarn](https://classic.yarnpkg.com/en/docs/install/) first.

## Run app

In the project directory, you can run:

### `yarn start`

Runs the app in the development mode.<br />
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.<br />
You will also see any lint errors in the console.

### `yarn test`

Launches the test runner in the interactive watch mode.<br />
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `yarn build`

Builds the app for production to the `build` folder.<br />
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.<br />
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `yarn eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

### Code Splitting

This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting

### Analyzing the Bundle Size

This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size

### Making a Progressive Web App

This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app

### Advanced Configuration

This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration

### Deployment

This section has moved here: https://facebook.github.io/create-react-app/docs/deployment

### `yarn build` fails to minify

This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"axios": "^0.19.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.1"
Expand Down
38 changes: 0 additions & 38 deletions src/App.css

This file was deleted.

55 changes: 32 additions & 23 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,35 @@
import React from 'react';
import logo from './logo.svg';
import './App.css';
import React, {Component} from 'react';
import axios from 'axios'

function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
);
class App extends Component {

async clickHandler() {
const data = {
domain: "intents:\n - greet\n - goodbye\n - affirm\n - deny\n - mood_great\n - mood_unhappy\n\nactions:\n - utter_greet\n - utter_cheer_up\n - utter_did_that_help\n - utter_happy\n - utter_goodbye\n\ntemplates:\n utter_greet:\n - text: \"Hey! How are you?\"\n\n utter_cheer_up:\n - text: \"Here is something to cheer you up:\"\n image: \"https://i.imgur.com/nGF1K8f.jpg\"\n\n utter_did_that_help:\n - text: \"Did that help you?\"\n\n utter_happy:\n - text: \"Great carry on!\"\n\n utter_goodbye:\n - text: \"Bye\"",
config: "language: en\npipeline: supervised_embeddings\npolicies:\n - name: MemoizationPolicy\n - name: KerasPolicy",
nlu: "## intent:greet\n- hey\n- hello\n- hi\n## intent:goodbye\n- bye\n- goodbye\n- have a nice day\n- see you\n## intent:affirm\n- yes\n- indeed\n## intent:deny\n- no\n- never\n## intent:mood_great\n- perfect\n- very good\n- great\n## intent:mood_unhappy\n- sad\n- not good\n- unhappy",
stories: "## happy path\n* greet\n\n - utter_greet\n\n* mood_great\n\n - utter_happy\n\n## sad path 1\n* greet\n\n - utter_greet\n\n* mood_unhappy\n\n - utter_cheer_up\n\n - utter_did_that_help\n\n* affirm\n\n - utter_happy\n\n## sad path 2\n* greet\n\n - utter_greet\n\n* mood_unhappy\n\n - utter_cheer_up\n\n - utter_did_that_help\n\n* deny\n\n - utter_goodbye\n\n## say goodbye\n* goodbye\n\n - utter_goodbye",
force: false,
save_to_default_model_directory: true
};
try {
const response = await axios.post('http://srv8-mambeala:5005/model/train', data);
console.log(response);
console.log(response.headers);
} catch (e) {
console.log(e);
}
}

render() {
return (
<div>
<header>
<button onClick={this.clickHandler}>Train model</button>
</header>
</div>
);
}
}

export default App;
export default App;
9 changes: 0 additions & 9 deletions src/App.test.js

This file was deleted.

13 changes: 0 additions & 13 deletions src/index.css

This file was deleted.

1 change: 0 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';

Expand Down
7 changes: 0 additions & 7 deletions src/logo.svg

This file was deleted.

5 changes: 0 additions & 5 deletions src/setupTests.js

This file was deleted.

0 comments on commit fb18956

Please sign in to comment.