Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
wiki:software:beuthbot:gateway [13.12.2019 10:30] Timo Bruns [Further Development] |
wiki:software:beuthbot:gateway [24.01.2020 15:18] (aktuell) Tolga Karaoglu [Overview] |
||
---|---|---|---|
Zeile 40: | Zeile 40: | ||
[// | [// | ||
+ | |||
+ | |||
=== Telegram Bot === | === Telegram Bot === | ||
Zeile 59: | Zeile 61: | ||
During the implementation of the **gateway** we used [[https:// | During the implementation of the **gateway** we used [[https:// | ||
+ | |||
+ | <WRAP pagebreak></ | ||
==== Overview ==== | ==== Overview ==== | ||
Zeile 100: | Zeile 104: | ||
</ | </ | ||
+ | This class diagram shows the structure around the gateway. Here it is important that there is a StandardizationLayer beforehand, which standsardize the incoming messages. The gateway then directs the message to an NLU service where we get the evaluated object back and compare the scores. The best evaluated message is then forwarded to the registry. | ||
==== Functionalities ==== | ==== Functionalities ==== | ||
=== Variables === | === Variables === | ||
- | < | + | The defined variables are based on '' |
+ | |||
+ | < | ||
var express = require(' | var express = require(' | ||
var app = express() | var app = express() | ||
Zeile 113: | Zeile 120: | ||
=== API-Call === | === API-Call === | ||
- | < | + | Each time our bot is mesaged in the chat, the message will be passed on to the gateway. This is mapped via '' |
+ | |||
+ | < | ||
app.post('/ | app.post('/ | ||
const { message } = req.body | const { message } = req.body | ||
Zeile 123: | Zeile 132: | ||
=== Microsoft Azure - Cognitive Services - Headers === | === Microsoft Azure - Cognitive Services - Headers === | ||
- | < | + | Microsot Azure predetermines its specific header that should be used for '' |
+ | |||
+ | < | ||
const options = { | const options = { | ||
headers: { | headers: { | ||
Zeile 135: | Zeile 146: | ||
=== HTTP-POST === | === HTTP-POST === | ||
- | < | + | This section of code shows a request to the Azure service and generates a response which is sent directly to the bot. The code is shaded like this because Axios processes the messages asyncronous and we have to ensure a response has already been received. The following code snippet shows this more in detail: |
+ | |||
+ | < | ||
axios.post(' | axios.post(' | ||
" | " | ||
Zeile 158: | Zeile 171: | ||
=== Server === | === Server === | ||
- | < | + | The server is listening on port '' |
+ | |||
+ | < | ||
// Finally, start our server | // Finally, start our server | ||
app.listen(3000, | app.listen(3000, | ||
Zeile 187: | Zeile 202: | ||
==== Versioning ==== | ==== Versioning ==== | ||
- | We use [[https://git.ziemers.de/|GitLab]] for versioning. | + | We use [[https://github.com/|GitHub]] for versioning. |
==== Authors ==== | ==== Authors ==== | ||
- | - **Christopher Lehmann** - // | + | - **Christopher Lehmann** - // |
\\ | \\ | ||
- | - **Timo Bruns** - // | + | - **Timo Bruns** - // |
+ | |||
+ | See also the list of [[https:// | ||
+ | <WRAP pagebreak></ |