Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Space Station Chatbot
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dominic Daniel Krämer
Space Station Chatbot
Commits
4bb59533
Commit
4bb59533
authored
1 year ago
by
Dominic Daniel Krämer
Browse files
Options
Downloads
Patches
Plain Diff
add basic integration into html
parent
13835660
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
app/app.py
+20
-0
20 additions, 0 deletions
app/app.py
app/static/javascript/frontend.js
+15
-0
15 additions, 0 deletions
app/static/javascript/frontend.js
app/templates/index.html
+5
-0
5 additions, 0 deletions
app/templates/index.html
rasa/endpoints.yml
+2
-2
2 additions, 2 deletions
rasa/endpoints.yml
with
42 additions
and
2 deletions
app/app.py
+
20
−
0
View file @
4bb59533
from
flask
import
Flask
from
flask
import
render_template
from
flask
import
request
from
flask
import
jsonify
import
requests
app
=
Flask
(
__name__
)
...
...
@@ -7,5 +10,22 @@ app = Flask(__name__)
def
home
():
return
render_template
(
"
index.html
"
)
@app.route
(
'
/sendmessage
'
,
methods
=
[
'
POST
'
])
def
sendmessage
():
message
=
request
.
form
[
'
message
'
]
print
(
message
)
rasa_response
=
requests
.
post
(
'
http://localhost:5005/webhooks/rest/webhook
'
,
json
=
{
"
message
"
:
message
})
responses
=
[]
for
resp
in
rasa_response
.
json
():
if
"
text
"
in
resp
:
responses
.
append
({
"
type
"
:
"
text
"
,
"
content
"
:
resp
[
"
text
"
]})
if
"
image
"
in
resp
:
responses
.
append
({
"
type
"
:
"
image
"
,
"
content
"
:
resp
[
"
image
"
]})
if
"
buttons
"
in
resp
:
responses
.
append
({
"
type
"
:
"
buttons
"
,
"
content
"
:
resp
[
"
buttons
"
]})
return
jsonify
(
responses
)
if
__name__
==
'
__main__
'
:
app
.
run
(
debug
=
True
)
This diff is collapsed.
Click to expand it.
app/static/javascript/frontend.js
0 → 100644
+
15
−
0
View file @
4bb59533
function
sendMessage
()
{
message
=
document
.
getElementById
(
"
inputField
"
).
value
;
message
=
"
message=
"
+
message
;
fetch
(
"
http://localhost:5000/sendmessage
"
,
{
method
:
"
POST
"
,
headers
:
{
"
Content-Type
"
:
"
application/x-www-form-urlencoded
"
},
body
:
message
})
.
then
((
response
)
=>
response
.
json
())
.
then
((
json
)
=>
{
console
.
log
(
json
[
0
].
content
);
});
};
\ No newline at end of file
This diff is collapsed.
Click to expand it.
app/templates/index.html
+
5
−
0
View file @
4bb59533
...
...
@@ -8,5 +8,10 @@
<body>
<h1>
Welcome to the Space Station Chatbot!
</h1>
<div>
<input
type=
"text"
id=
"inputField"
placeholder=
"Gib etwas ein"
>
<button
onclick=
"sendMessage()"
>
CLICK ME
</button>
</div>
<script
src=
"static/javascript/frontend.js"
type=
"application/javascript"
></script>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
rasa/endpoints.yml
+
2
−
2
View file @
4bb59533
...
...
@@ -10,8 +10,8 @@
# Server which runs your custom actions.
# https://rasa.com/docs/rasa/custom-actions
#
action_endpoint:
#
url: "http://localhost:5055/webhook"
action_endpoint
:
url
:
"
http://localhost:5055/webhook"
# Tracker store which is used to store the conversations.
# By default the conversations are stored in memory.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment