I have created some messages in chatbase using session_id to divide sessions. However, these are not shown as separate flows. They appear as concatenated flows.
Example messages:
[ { api_key: 'xxxx',
type: 'user',
user_id: 'Lee',
time_stamp: 1559340845342,
platform: 'Chat_Test2',
session_id: '200',
message: '_',
intent: 'choice',
not_handled: 'false',
version: '1.1' },
{ api_key: 'xxxx',
type: 'agent',
user_id: 'Lee',
time_stamp: 1559340845341,
platform: 'Chat_Test2',
session_id: '200',
message: 'what_would_you_like',
version: '1.1' } ]
[ { api_key: 'xxxx',
type: 'user',
user_id: 'Lee',
time_stamp: 1559340848284,
platform: 'Chat_Test2',
session_id: '201',
message: 'hello',
intent: 'Welcome',
not_handled: 'false',
version: '1.1' },
{ api_key: 'xxxx',
type: 'agent',
user_id: 'Lee',
time_stamp: 1559340848283,
platform: 'Chat_Test2',
session_id: '201',
message: 'hello_how_can_I_help',
version: '1.1' } ]
Thank you for your question and providing the example JSON payload. I see that are numbering your session id's sequentially. You will need to label each utterance with a given session with the same session id. The utterances within each session will then be sorted by timestamp.
If you continue to experience issues, please contact chatbase-support#google.com with your bot's api key and I will be happy to look into your issue directly.
Related
I have a javascript file on my NodeJS server that runs at 00:00:00 and updates some fields in the database, if that happens I want to send out a push notification to some users. I've set this up in my Javascript file:
https://dev.to/devsmranjan/web-push-notification-with-web-push-angular-node-js-36de
const subscription = {
endpoint: '',
expirationTime: null,
keys: {
auth: '',
p256dh: '',
},
};
const payload = {
notification: {
title: 'Title',
body: 'This is my body',
icon: 'assets/icons/icon-384x384.png',
actions: [
{action: 'bar', title: 'Focus last'},
{action: 'baz', title: 'Navigate last'},
],
data: {
onActionClick: {
default: {operation: 'openWindow'},
bar: {
operation: 'focusLastFocusedOrOpen',
url: '/signin',
},
baz: {
operation: 'navigateLastFocusedOrOpen',
url: '/signin',
},
},
},
},
};
const options = {
vapidDetails: {
subject: 'mailto:example_email#example.com',
publicKey: process.env.REACT_APP_PUBLIC_VAPID_KEY,
privateKey: process.env.REACT_APP_PRIVATE_VAPID_KEY,
},
TTL: 60,
};
webpush.sendNotification(subscription, JSON.stringify(payload), options)
.then((_) => {
console.log(subscription);
console.log('SENT!!!');
console.log(_);
})
.catch((_) => {
console.log(subscription);
console.log(_);
});
But when I run the file I get the message:
{ endpoint: '', expirationTime: null, keys: { auth: '', p256dh: '' } } Error: You must pass in a subscription with at least an endpoint.
Which makes sense since the server has no idea about service workers etc. Any suggestions on how to proceed?
I am making a help command, but I want to disable it when the embed title is the same as the button label. Except this error pops out:
C:\Users\admin\OneDrive\Documents\VSCode\JS\Discord
Bots\Testing3.JS\node_modules\discord.js\src\rest\RequestHandler.js:350
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Invalid Form Body components[0]: The specified
component type is invalid in this context components[1]: The specified
component type is invalid in this context
at RequestHandler.execute (C:\Users\admin\OneDrive\Documents\VSCode\JS\Discord
Bots\Testing3.JS\node_modules\discord.js\src\rest\RequestHandler.js:350:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (C:\Users\admin\OneDrive\Documents\VSCode\JS\Discord
Bots\Testing3.JS\node_modules\discord.js\src\rest\RequestHandler.js:51:14)
at async MessageManager.edit (C:\Users\admin\OneDrive\Documents\VSCode\JS\Discord
Bots\Testing3.JS\node_modules\discord.js\src\managers\MessageManager.js:132:15)
{ method: 'patch', path:
'/channels/956427421073158194/messages/965228940685897748', code:
50035, httpStatus: 400, requestData: {
json: {
content: undefined,
tts: false,
nonce: undefined,
embeds: [
{
title: 'Economy',
type: 'rich',
description: null,
url: null,
timestamp: null,
color: null,
fields: [ [Object], [Object], [Object], [Object] ],
thumbnail: null,
image: null,
author: null,
footer: null
}
],
components: [
{
custom_id: 'econ',
disabled: true,
emoji: { animated: false, name: '💵', id: null },
label: 'Economy',
style: 1,
type: 2,
url: null
},
{
custom_id: 'info',
disabled: false,
emoji: { animated: false, name: '📃', id: null },
label: 'Info',
style: 2,
type: 2,
url: null
}
],
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: 0,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined
},
files: [] } }
Code:
if (cmd === "help") {
const econ = new Discord.MessageButton()
.setCustomId('econ')
.setEmoji('💵')
.setLabel('Economy')
.setStyle('PRIMARY')
const info = new Discord.MessageButton()
.setCustomId('info')
.setEmoji('📃')
.setLabel('Info')
.setStyle('SECONDARY')
const row = new Discord.MessageActionRow().addComponents([econ, info]);
let helpMsg = await message.channel.send({
embeds: [
{
title: "Economy",
fields: [
{
name: `\`${cPrefix}bal | balance [user]\``,
value: 'Displays your balance or a user\'s balance.'
},
{
name: `\`${cPrefix}dep | deposit <amount>\``,
value: 'Deposits a specified amount of cash to your bank.'
},
{
name: `\`${cPrefix}with | withdraw <amount>\``,
value: 'Withdraws a specified amount of cash to your wallet.'
},
{
name: `\`${cPrefix}addcoins <user> <amount>\``,
value: 'Adds a specified amount of cash to a user. (Administrator)'
}
]
}
],
components: [row]
});
const collector = helpMsg.createMessageComponentCollector({
componentType: 'BUTTON',
time: 60000
});
collector.on('collect', async (b) => {
if (b.user.id === message.author.id) {
if (b.customId === 'econ') {
helpMsg.edit({
embeds: [
{
title: "Economy",
fields: [
{
name: `\`${cPrefix}bal | balance [user]\``,
value: 'Displays your balance or a user\'s balance.'
},
{
name: `\`${cPrefix}dep | deposit <amount>\``,
value: 'Deposits a specified amount of cash to your bank.'
},
{
name: `\`${cPrefix}with | withdraw <amount>\``,
value: 'Withdraws a specified amount of cash to your wallet.'
},
{
name: `\`${cPrefix}addcoins <user> <amount>\``,
value: 'Adds a specified amount of cash to a user. (Administrator)'
}
]
},
],
components: [row.components[0].setDisabled(true), row.components[1].setDisabled(false)]
});
}
if (b.customId === 'info') {
helpMsg.edit({
embeds: [
{
title: "Info",
fields: [
{
name: `${cPrefix}info <user|server> <user: user>`,
value: 'Displays an info of the server or a user'
},
{
name: `${cPrefix}ping`,
value: 'Displays the current client ping and the database connection'
},
{
name: `${cPrefix}help`,
value: 'Umm... You used this command'
},
]
}
],
components: [row.components[0].setDisabled(false), row.components[1].setDisabled(true)]
})
}
} else {
b.reply({ content: 'These buttons are not for you.', ephemeral: true })
}
});
collector.on('end', async () => {
helpMsg.edit({ components: [row.components[0].setDisabled(true), row.components[1].setDisabled(true)] })
});
}
Is there anything wrong in this code?
You can create a new MessageActionRow and set everything to disabled. This code is from my bot's help command (discord.js v13.6.0):
let btnraw = new Discord.MessageActionRow().addComponents(
[
new Discord.MessageButton().setCustomId("home").setStyle("SUCCESS").setLabel("Home"),
new Discord.MessageButton().setCustomId("general").setStyle("PRIMARY").setLabel("General"),
new Discord.MessageButton().setCustomId("info").setStyle("PRIMARY").setLabel("Information"),
new Discord.MessageButton().setCustomId("mod").setStyle("PRIMARY").setLabel("Moderation"),
new Discord.MessageButton().setCustomId("fun").setStyle("PRIMARY").setLabel("Fun"),
]
);
let dbtnraw = new Discord.MessageActionRow().addComponents(
[
new Discord.MessageButton().setCustomId("d_home").setStyle("SUCCESS").setLabel("Home").setDisabled(true),
new Discord.MessageButton().setCustomId("d_general").setStyle("PRIMARY").setLabel("General").setDisabled(true),
new Discord.MessageButton().setCustomId("d_info").setStyle("PRIMARY").setLabel("Information").setDisabled(true),
new Discord.MessageButton().setCustomId("d_mod").setStyle("PRIMARY").setLabel("Moderation").setDisabled(true),
new Discord.MessageButton().setCustomId("d_fun").setStyle("PRIMARY").setLabel("Fun").setDisabled(true),
]
);
Then you can edit the message to replace the original row like this:
helpMsg.edit({components: [d_btnraw]});
I am currently using the Google Places API. What I want to do is to receive the user's device lat / long coordinates and find nearby places of a certain type.
Somehow, this works with a wifi connection ie. I get back my list of nearby places and can display them on cards.
But when I disabled wifi and am connected to my 4G connection, I get the "[app name] isn't responding at the moment. Try again soon." message.
I checked my firebase function logs and I got back a response status of 200 with valid data, but at an incorrect location. Even so, shouldn't it display the data even at the wrong location?
Any idea on why this is happening? Google Maps location works fine for me ie. I can get my current location thru clicking on the appropriate button on Google Maps. I've also enabled Mobile Data for Google Maps and Assistant.
EDIT: I dug deeper into my logs.
So turns out that on Google Cloud Platform, I found out that I'm getting a malformed response because of only one item in a Carousel.
MalformedResponse at
expected_inputs[0].input_prompt.rich_initial_prompt.items[1].carousel_browse:
'carousel_browse' requires at least 2 items.
BUT this still doesn't solve the issue of wrong coordinates from the location itself.
This is what I got through a 4G connection (Firebase function logs):
listPolicePost [ { geometry: { location: [Object], viewport: [Object]
},
icon: 'https://maps.gstatic.com/mapfiles/place_api/icons/police-71.png',
id: '0e7b9a2a292b190e98e46bbdcb2c81ad6eb48f5e',
name: 'Serangoon Garden Neighbourhood Police Post',
photos: [ [Object] ],
place_id: 'ChIJFzNrGAAX2jER2PowrtSXY_A',
plus_code:
{ compound_code: '9V78+9G Singapore',
global_code: '6PH59V78+9G' },
rating: 3.5,
reference: 'CmRSAAAA-vgZQmvol1ZcY4srSlQGLRLIErqMGaZPJvgyySiigXxG_O9ysjoAZOjBwIxH99q6fAMnml69NOuogaYzpc84yYgGf6BaNJ7c0QhI4gwqxUUpeYPe9pW4EundAFi4IbTKEhAhCFSAhJeHTmmurQzf55eEGhTYyD6BAiFSZ35QMftDtdehqVhF0Q',
scope: 'GOOGLE',
types: [ 'police', 'point_of_interest', 'establishment' ],
vicinity: '51 Serangoon Garden Way, Singapore' }, { geometry: { location: [Object], viewport: [Object] },
icon: 'https://maps.gstatic.com/mapfiles/place_api/icons/police-71.png',
id: '122baf85e424de14925665be49f5984cf367d61b',
name: 'Serangoon Neighbourhood Police Centre',
photos: [ [Object] ],
place_id: 'ChIJo_ADBqcX2jERaelpKPuk7_0',
plus_code:
{ compound_code: '9V2C+R5 Singapore',
global_code: '6PH59V2C+R5' },
rating: 4.6,
reference: 'CmRSAAAAt4STs5V8zT4-xRBKNU5EAqtLvHE1_CZr_Bk0WbNZqFdQztPT8HSeoRcw-Yksvz8TdiqzfQQGYXnAAqSJxNT6B9nAxhh0XlqkVLJh3Au0hCN8VrBhoSPujE8SBMfhjWPCEhCAgTBiiW9CWycfc9KneqEdGhT9BRJiiWfyx2KzqAJUyjAN3Snhpg',
scope: 'GOOGLE',
types: [ 'police', 'point_of_interest', 'establishment' ],
vicinity: '50 Serangoon Avenue 2, #01-02' } ]
Results with WIFI at the same location:
listPolicePost [ { geometry: { location: [Object], viewport: [Object]
},
icon: 'https://maps.gstatic.com/mapfiles/place_api/icons/police-71.png',
id: '95c157891f885550b39dc74767a1ebc6fc426fa2',
name: 'Alexandra Neighbourhood Police Post',
photos: [ [Object] ],
place_id: 'ChIJ42CR00Aa2jERvHTJPpayEZQ',
plus_code:
{ compound_code: '8Q2X+46 Singapore',
global_code: '6PH58Q2X+46' },
rating: 5,
reference: 'CmRSAAAA6BBPfMynSJdnUhiFv3hGRmJxzSp4P6DGZ9_zAWX36EQEUXpxgmNgQNv1RYcH4B3d3Yxic5CaQK3Ec7UeY3dQW4Us92P8Y29yArsYfRuULrTOjdI4-GquWMzwB2wf6UubEhCHHitSm1_8jKBYWgPoU0vyGhRZUWXrfi9ShbA-dryqFABVCCwsmw',
scope: 'GOOGLE',
types: [ 'police', 'point_of_interest', 'establishment' ],
vicinity: 'Blk 46 Tanglin Halt Rd, #01-328' }, { geometry: { location: [Object], viewport: [Object] },
icon: 'https://maps.gstatic.com/mapfiles/place_api/icons/police-71.png',
id: '8bdb0e2f344ec77efcc198ed410f0a06bc04fbbb',
name: 'Commonwealth Neighbourhood Police Post',
place_id: 'ChIJ39iOiz8a2jER6Wv2o-9yeGs',
plus_code:
{ compound_code: '8Q4X+HF Singapore',
global_code: '6PH58Q4X+HF' },
rating: 5,
reference: 'CmRRAAAAprrqfgGSHVqj2xKP-TgSAagHxEIsWcak0WLiD_hqotMH-_lwWJg0HhlpW0MnxKZ5_yD3UWNkBT_0CjePxvt5Glu8PIC58AdmfDAmQ1fmPYxC64Au1WhwNuskwnS1a2M4EhCiJ7JzCXBGezyKo8HzhMwzGhRmp_Df8vfjWU_vasmr-QtXmWEi3Q',
scope: 'GOOGLE',
types: [ 'police', 'point_of_interest', 'establishment' ],
vicinity: '111 Commonwealth Crescent, Singapore' }, { geometry: { location: [Object], viewport: [Object] },
icon: 'https://maps.gstatic.com/mapfiles/place_api/icons/police-71.png',
id: '34e78e46388c52c814cc5c0858b5f6ad3221511c',
name: 'Buona Vista Police Post',
photos: [ [Object] ],
place_id: 'ChIJzeD5Imoa2jERih3LNGr2MSM',
plus_code:
{ compound_code: '8Q5V+P7 Singapore',
global_code: '6PH58Q5V+P7' },
rating: 2.8,
reference: 'CmRRAAAAqDe2CLznGR81_LoV_7OnWIOne7g-zrP4h1U6ELKlc1zhVBMG15AmyxXJWJlZdys7ILMVUSj6Mv5_gDBsII72NMLHZ97gELkaUbrnKEBu0_o72VXwyJRLvuzcjCK8MqKyEhC6GmBSJYtpY4mSyNUeNk6WGhTwCRXaS5B5Xwx5zyrDE9xapnlRIg',
scope: 'GOOGLE',
types: [ 'police', 'point_of_interest', 'establishment' ],
vicinity: 'block 13 Holland Dr #01-38/40' }, { geometry: { location: [Object], viewport: [Object] },
icon: 'https://maps.gstatic.com/mapfiles/place_api/icons/police-71.png',
id: '434ce574c05e43e70c33b6ba64d7f21c840b132f',
name: 'Dover Neighbourhood Police Post',
place_id: 'ChIJ73qudVwa2jERlggLteLz6nU',
plus_code:
{ compound_code: '8Q3J+GV Singapore',
global_code: '6PH58Q3J+GV' },
rating: 5,
reference: 'CmRRAAAAdXD9jiCrSsH6oBqvxFviOGDBq_KOj08XfSR8mLSgTZhk8FCbt4UVqUUiWnvoLJv5jw5nytcTfellRW8Js_cRvQca_ToDtVbp6nQqaiq9RR408qaJm-9WOJuBZXTui9TQEhCyyQlxS4MRYvjh9dTD0qTmGhS95n1YPfpmR0BDcdYuWFQ6lYKG0A',
scope: 'GOOGLE',
types: [ 'police', 'point_of_interest', 'establishment' ],
vicinity: 'Block 3, Dover Road, #01-368, 130003' }, { geometry: { location: [Object], viewport: [Object] },
icon: 'https://maps.gstatic.com/mapfiles/place_api/icons/police-71.png',
id: 'b2b998513d890ac0061b4b75380f26a3b7c4c81e',
name: 'Special Operations Command',
photos: [ [Object] ],
place_id: 'ChIJH2LnQ8sb2jERA-RABTXay8c',
plus_code:
{ compound_code: '7RW2+76 Singapore',
global_code: '6PH57RW2+76' },
rating: 5,
reference: 'CmRSAAAA8n7968a6h62bOQchkLcjdLGNlcCih7H3pQ1UmojLIXJOOD_RI8v5t3pZJlL0tZtTRBLpnIpgpXtEGu-48dPoELTPRu2Q_aHriAV4l2_YBf-tLR0RSNEQzOivTA7fPPxAEhDXhPRQs18Vfe-Ord4z-i0MGhS3eoucLyTZ504RQROrKrx18OEmGQ',
scope: 'GOOGLE',
types: [ 'police', 'point_of_interest', 'establishment' ],
vicinity: 'Queensway, Singapore' } ]
I'm trying to create a remote method that accepts XML, i define my remote method like this,
WechatModel.remoteMethod('notify', {
description: 'notify',
accepts: [
{
arg: 'response',
type: 'string',
required: true,
http: {
source: 'body',
},
},
],
http: {
verb: 'post',
path: '/notify',
},
});
then i changed my server/config.js like this:
"rest": {
"normalizeHttpPath": false,
"xml": true
},
but,i still got a string with the content "[object Object]"
Hello!
I want this handler "handler: onEventControler (???)" removed from view (it do not belong there)
For grid view set dockedItems this cod:
this.dockedItems = [{
xtype: 'toolbar',
items: [{
xtype: 'newstation'
},{
id: 'add-persone-btn',
xtype: 'button',
itemId: 'add',
text: 'Add',
iconCls: 'icon-add',
handler: onEventControler(???)
}, '-', {
itemId: 'delete',
text: 'Delete',
iconCls: 'icon-delete',
disabled: true,
handler: function(){
var selection = grid.getView().getSelectionModel().getSelection()[0];
if (selection) {
store.remove(selection);
}
}
}]
}]
I also tried to implement a this.control, but I could not ask for a button selectorQuery.
How do I properly respecting the architecture mvc extJs4?
thank you.
You should be able to do something like this inside the controller of this view.
init: function () {
this.control({
'toolbar #add': {
click: this.onAddStation
}
});
}
Handler:
onAddStation: function(button, e, eOpts){
//Handle
}
Alternatively, you could use an "action" config on your button.
action: 'addstation'
Then you could have:
init: function () {
this.control({
'button[action=addstation]': {
click: me.onAddStation
}
});
}
http://docs.sencha.com/ext-js/4-0/#!/api/Ext.button.Button
This is method "initComponent" for view gridd view:
initComponent: function () {
this.plugins = [Ext.create('Ext.grid.plugin.RowEditing')];
this.dockedItems = [{
xtype: 'toolbar',
items: [{
xtype: 'button',
itemId: 'add',
text: 'Add',
iconCls: 'icon-add',
action: 'add-new-persone'
}, '-', {
itemId: 'delete',
text: 'Delete',
iconCls: 'icon-delete',
action: 'delete-persone',
disabled: true
}, '-', {
itemId: 'synch',
text: 'Synchronization',
iconCls: 'icon-synch',
action: 'synch-persone'
}]
}];
// paging bar on the bottom
this.bbar = Ext.create('Ext.PagingToolbar', {
store: this.store,
displayInfo: true,
displayMsg: 'Displaying topics {0} - {1} of {2}',
emptyMsg: "No topics to display",
items:[]
});
this._initColumns();
this._initFilter();
this.callParent(arguments);
},