Commit dc67c855 authored by Yorrd's avatar Yorrd
Browse files

feat: general update

parent 77e73438
Pipeline #1739 passed with stages
in 10 minutes and 21 seconds
......@@ -4,6 +4,8 @@
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
<script src="https://botpress.customer.adornis.de/assets/modules/channel-web/inject.js"></script>
<link href="https://fonts.googleapis.com/css?family=Barlow" rel="stylesheet" />
<style>
body {
......
......@@ -13,6 +13,9 @@ import '@adornis/users/client/auto-relogin';
import '@adornis/design/generate-base/molecules';
window.botpressWebChat.init({ host: 'https://botpress.customer.adornis.de', botId: 'corona-legal-chatbot' });
window.botpressWebChat.sendEvent({ type: 'show' });
generateBase(spacing);
generateFontResets();
......
Subproject commit df2cb9e5ef90a521027b1705d3f8a50901b04f11
Subproject commit f2bed28387c69d19fcd6334151016e2c026cff6b
Subproject commit ada1a32d42002ea8e9c922c467db756d18e23a06
Subproject commit aafdf1efa8b9a8694bdac4623145ba9b54a53f7c
Subproject commit 86a6f8fca90a4dbdaafd9aba99cc0eab22d1927e
Subproject commit f2d39616359b01a454d002ff428f75e5c3cba5cc
Subproject commit e75c1b0d3552fdcd3499521cfecb99c51646bb79
Subproject commit 89d454ba8355a9b476b4527f7f123425a15729eb
Subproject commit 887fef22a7906b6ab5583c2f4e0464e7f8316b8e
Subproject commit 647c7feed509f7dc6802409d0c2299264ab8e0fd
......@@ -187,4 +187,60 @@ expressApp.post('/api/dialogflow-webhook', (request, response, next) => {
});
});
expressApp.get('/api/botpress-webhook', async (request, response, next) => {
let content: Content | null = null;
const text = request.query.search;
let json = {} as object;
const foundContents = await (files.rawCollection() as Collection)
.find({ $text: { $search: text } })
.project({ score: { $meta: 'textScore' } })
// .filter({ score: { $gte: 0.7 } })
.sort({ score: { $meta: 'textScore' } })
.toArray();
console.log(
'scores',
foundContents.map(x => x.score),
);
content = foundContents[0];
if (!content) {
response.status(404);
response.end('nothing here');
return;
}
const antwortText = (content?.Antwort || '')
.replace(/<[^>]*>/gi, '')
.replace(/[\s]+$|^[\s]+/g, '')
.replace(/&nbsp;/gi, '');
const slicedAntwort = antwortText.slice(0, 400);
json = {
...json,
title: content.Frage || 'kein Titel',
// // imageUrl: 'https://developers.google.com/actions/images/badges/XPM_BADGING_GoogleAssistant_VER.png',
text: slicedAntwort,
buttonText: 'Weiterführende Informationen',
buttonUrl:
antwortText.length > 400
? Meteor.absoluteUrl() + 'content/' + content._id
: content.Quelle || Meteor.absoluteUrl() + 'content/' + content._id,
};
const creator = (await AdornisUser.findOne({ _id: content.createdBy }).result) as CCBUser;
if (!!creator && !!creator.verified) {
json = {
...json,
creatorMessage:
'bereitgestellt von ' + creator.contactName + ' (' + creator.contactMail + ', ' + creator.organization + ')',
};
} else {
json = { ...json, creatorMessage: 'Diese Nachricht wurde aus automatisch generierten Inhalten erzeugt' };
}
response.json(json);
response.end();
});
WebApp.connectHandlers.use(expressApp);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment