Skip to content

Commit

Permalink
GH-10: add count_user count_message
Browse files Browse the repository at this point in the history
  • Loading branch information
rain1024 committed Apr 16, 2019
1 parent bef7032 commit d173011
Show file tree
Hide file tree
Showing 386 changed files with 68,692 additions and 90 deletions.
43 changes: 24 additions & 19 deletions myproject/static/app/chatbot/chatbot.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
<div id="chat-container" class="container">
<!--<div id="chat-container" class="container">-->
<!--<div id="message" ng-show="showMessage">-->
<!--<p>Chào các bạn.</p>-->
<!--<p>Hà Nội nóng quá nên Hoài An đi du lịch đây. ✈✈✈</p>-->
<!--<p>Hẹn gặp lại các bạn.</p>-->
<!--<p><i>Hoài An</i></p>-->
<!--</div>-->
<!--</div>-->

<div id="message" ng-show="showMessage">
<p>Chào các bạn.</p>
<p>Hà Nội nóng quá nên Hoài An đi du lịch đây. ✈✈✈</p>
<p>Hẹn gặp lại các bạn.</p>
<p><i>Hoài An</i></p>
<div class="container-fluid page-body-wrapper" style="min-height: 200px">
<div class="main-panel" style="min-height: 30px; width: calc(100%);">
<div class="content-wrapper">
<div id="chat-dialog" ng-show="!showMessage">
<p ng-repeat="s in sentences track by $index">
<b>{{ s.agent }}:</b> {{ s.text }}
</p>
</div>
<br/>
<input class="form-control" id="chat-input"
ng-model="userText"
placeholder="{{ suggestion }}"
my-enter="addTalk()"
ng-show="!showMessage">
</div>
</div>

<div id="chat-dialog" ng-show="!showMessage">
<p ng-repeat="s in sentences track by $index">
<b>{{ s.agent }}:</b> {{ s.text }}
</p>
</div>
<br/>
<input class="form-control" id="chat-input"
ng-model="userText"
placeholder="{{ suggestion }}"
my-enter="addTalk()"
ng-show="!showMessage">
</div>
</div>
78 changes: 45 additions & 33 deletions myproject/static/app/common/nav.html
Original file line number Diff line number Diff line change
@@ -1,34 +1,46 @@
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">underthesea<sup>
<span id="live-label" class="label label-info">
<span id="live-icon"></span> chatbot</span>
</sup></a>
<!--<nav class="navbar navbar-default navbar-fixed-top">-->
<!--<div class="container">-->
<!--<div class="navbar-header">-->
<!--<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"-->
<!--aria-expanded="false" aria-controls="navbar">-->
<!--<span class="sr-only">Toggle navigation</span>-->
<!--<span class="icon-bar"></span>-->
<!--<span class="icon-bar"></span>-->
<!--<span class="icon-bar"></span>-->
<!--</button>-->
<!--<a class="navbar-brand" href="/">underthesea<sup>-->
<!--<span id="live-label" class="label label-info">-->
<!--<span id="live-icon">•</span> chatbot</span>-->
<!--</sup></a>-->
<!--</div>-->
<!--<div id="navbar" class="navbar-collapse collapse">-->
<!--<ul class="nav navbar-nav">-->
<!--<li ui-sref-active="active"><a ui-sref="dashboard">Dashboard</a></li>-->
<!--</ul>-->
<!--<ul class="nav navbar-nav navbar-right">-->
<!--<li>-->
<!--<a target="_blank" href="https://github.com/undertheseanlp/chatbot">-->
<!--<i class="fa fa-github" aria-hidden="true"></i>-->
<!--Github-->
<!--</a>-->
<!--</li>-->
<!--</ul>-->
<!--</div>&lt;!&ndash;/.nav-collapse &ndash;&gt;-->
<!--</div>-->
<!--</nav>-->
<nav class="navbar default-layout col-lg-12 col-12 p-0 fixed-top d-flex flex-row">
<div class="navbar-menu-wrapper d-flex align-items-center">
<ul class="navbar-nav navbar-nav-left header-links d-none d-md-flex">
<li class="nav-item">
<a href="#" class="nav-link">Hoai An
<span class="badge badge-primary ml-1">v0.1.0</span>
</a>
</li>
<li class="nav-item active" ui-sref-active="active">
<a class="nav-link" ui-sref="dashboard">
<i class="mdi mdi-elevation-rise"></i>Dashboard
</a>
</li>
</ul>
</div>
<div id="navbar" class="navbar-collapse collapse">
<!--<ul class="nav navbar-nav">-->
<!--<li ui-sref-active="active"><a ui-sref="syntax">Syntax</a></li>-->
<!--<li ui-sref-active="active"><a ui-sref="ner">Named Entity Recognition</a></li>-->
<!--<li ui-sref-active="active"><a ui-sref="classification">Text Classification</a></li>-->
<!--<li ui-sref-active="active"><a ui-sref="sentiment">Sentiment</a></li>-->
<!--<li ui-sref-active="active"><a ui-sref="dictionary">Dictionary</a></li>-->
<!--</ul>-->
<ul class="nav navbar-nav navbar-right">
<li>
<a target="_blank" href="https://github.com/undertheseanlp/chatbot">
<i class="fa fa-github" aria-hidden="true"></i>
Github
</a>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
</nav>
83 changes: 83 additions & 0 deletions myproject/static/app/dashboard/dashboard.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<div class="container-fluid page-body-wrapper">
<!-- partial -->
<div class="main-panel" style="width: calc(100%);">
<div class="content-wrapper">
<div class="content-header d-flex flex-column flex-md-row" style="margin-bottom: 10px;">
<div class="content-header-actions">
<h4>Chatbot Dashboard</h4>
<small class="text-muted ml-0">Dashboard &gt; Chatbot Dashboard</small>
</div>
<div
class="wrapper ml-0 ml-md-auto my-auto d-flex justify-content-md-end flex-wrap align-items-center pt-4 pt-md-0">
<nav class="mt-3">
<ul class="pagination mb-0">
<li class="page-item">
<a class="page-link text-black" href="#"><i class="mdi mdi-chevron-left"></i></a>
</li>
<li class="page-item"><a class="page-link text-black" href="#">{{ dateDisplay }}</a></li>
<li class="page-item"><a class="page-link text-black" href="#"><i
class="mdi mdi-chevron-right"></i></a></li>
</ul>
</nav>
</div>
</div>
<div class="row">
<div class="col-xl-4 col-lg-4 col-md-4 col-sm-6 grid-margin stretch-card">
<div class="card card-statistics">
<div class="card-body">
<div class="clearfix">
<div class="float-left">
<i class="mdi mdi-cube text-danger icon-lg"></i>
</div>
<div class="float-right">
<p class="mb-0 text-right">Total Users</p>
<div class="fluid-container">
<h3 class="font-weight-medium text-right mb-0">{{ count_user }}</h3>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-4 col-lg-4 col-md-4 col-sm-6 grid-margin stretch-card">
<div class="card card-statistics">
<div class="card-body">
<div class="clearfix">
<div class="float-left">
<i class="mdi mdi-receipt text-warning icon-lg"></i>
</div>
<div class="float-right">
<p class="mb-0 text-right">Total Messages</p>
<div class="fluid-container">
<h3 class="font-weight-medium text-right mb-0">{{ count_message }}</h3>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-4 col-lg-4 col-md-4 col-sm-6 grid-margin stretch-card">
<div class="card card-statistics">
<div class="card-body">
<div class="clearfix">
<div class="float-left">
<i class="mdi mdi-poll-box text-success icon-lg"></i>
</div>
<div class="float-right">
<p class="mb-0 text-right">Total Seconds</p>
<div class="fluid-container">
<h3 class="font-weight-medium text-right mb-0">5693</h3>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- content-wrapper ends -->
</div>
<!-- main-panel ends -->
</div>
<!-- page-body-wrapper ends -->
</div>
20 changes: 20 additions & 0 deletions myproject/static/app/dashboard/dashboard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
app.controller("DashboardCtrl", function ($scope) {
console.log("hihi")
$scope.dateDisplay = moment().format("MMM DD, YYYY");
$.ajax({
type: "GET",
url: "./chatbot_analyze",
data: {},
contentType: 'application/json'
}).done(function (data) {
try {
$scope.count_user = data["count_user"];
$scope.count_message = data["count_message"];
$scope.$apply();
$scope.afterTalk();
// $scope.talk("bot", text);
} catch (e) {
console.log("Cannot get reply from bot.");
}
});
});
32 changes: 4 additions & 28 deletions myproject/static/app/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,10 @@ app.config(function ($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/');
$stateProvider
.state({
url: '/syntax',
name: 'syntax',
controller: 'WordSentCtrl',
templateUrl: "./static/app/syntax/syntax.html"
})
.state({
url: '/ner',
name: 'ner',
controller: 'NERTagCtrl',
templateUrl: "./static/app/named_entity_recognition/ner.html"
})
.state({
url: '/dictionary',
name: 'dictionary',
controller: 'DictionaryCtrl',
templateUrl: "./static/app/dictionary/dictionary.html"
})
.state({
url: '/classification',
name: 'classification',
controller: 'ClassificationCtrl',
templateUrl: "./static/app/classification/classification.html"
})
.state({
url: '/sentiment',
name: 'sentiment',
controller: 'SentimentCtrl',
templateUrl: "./static/app/sentiment/sentiment.html"
url: '/dashboard',
name: 'dashboard',
controller: 'DashboardCtrl',
templateUrl: "./static/app/dashboard/dashboard.html"
})
.state({
url: '/',
Expand Down
20 changes: 20 additions & 0 deletions myproject/static/bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "chatbot",
"homepage": "https://github.com/undertheseanlp/chatbot",
"authors": [
"anhv <[email protected]>"
],
"description": "",
"main": "",
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"moment": "^2.24.0"
}
}
38 changes: 38 additions & 0 deletions myproject/static/bower_components/moment/.bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "moment",
"license": "MIT",
"main": "moment.js",
"ignore": [
"**/.*",
"benchmarks",
"bower_components",
"meteor",
"node_modules",
"scripts",
"tasks",
"test",
"component.json",
"composer.json",
"CONTRIBUTING.md",
"ender.js",
"Gruntfile.js",
"Moment.js.nuspec",
"package.js",
"package.json",
"ISSUE_TEMPLATE.md",
"typing-tests",
"min/tests.js"
],
"homepage": "https://github.com/moment/moment",
"version": "2.24.0",
"_release": "2.24.0",
"_resolution": {
"type": "version",
"tag": "2.24.0",
"commit": "8a6b2e11207a3856bd858d4d65d4b0822571e6c3"
},
"_source": "https://github.com/moment/moment.git",
"_target": "^2.24.0",
"_originalSource": "moment",
"_direct": true
}
Loading

0 comments on commit d173011

Please sign in to comment.