fix(all): Templates OK.
This commit is contained in:
parent
b9dbf11f61
commit
110083e1c1
4 changed files with 34 additions and 14 deletions
|
@ -453,7 +453,7 @@ export class GBMinService {
|
||||||
.all(`/${min.instance.botId}/whatsapp`, async (req, res) => {
|
.all(`/${min.instance.botId}/whatsapp`, async (req, res) => {
|
||||||
if (req.query['hub.mode'] === 'subscribe') {
|
if (req.query['hub.mode'] === 'subscribe') {
|
||||||
const val = req.query['hub.verify_token'];
|
const val = req.query['hub.verify_token'];
|
||||||
const challenge = min.core.getParam<string>(min.instance, `Meta Challenge`, null);
|
const challenge = (min.core['getParam'] as any)(min.instance, `Meta Challenge`, null, true);
|
||||||
|
|
||||||
if (challenge && val === challenge) {
|
if (challenge && val === challenge) {
|
||||||
res.send(req.query['hub.challenge']);
|
res.send(req.query['hub.challenge']);
|
||||||
|
@ -1086,7 +1086,9 @@ export class GBMinService {
|
||||||
}
|
}
|
||||||
|
|
||||||
let pid = step.context.activity['pid'];
|
let pid = step.context.activity['pid'];
|
||||||
if (!pid) {
|
let recipient = context.activity?.recipient?.id;
|
||||||
|
|
||||||
|
if (!pid && recipient !== min.botId) {
|
||||||
pid = GBVMService.createProcessInfo(user, min, step.context.activity.channelId, null, step);
|
pid = GBVMService.createProcessInfo(user, min, step.context.activity.channelId, null, step);
|
||||||
}
|
}
|
||||||
step.context.activity['pid'] = pid;
|
step.context.activity['pid'] = pid;
|
||||||
|
@ -1151,7 +1153,8 @@ export class GBMinService {
|
||||||
|
|
||||||
if (context.activity.type === 'installationUpdate') {
|
if (context.activity.type === 'installationUpdate') {
|
||||||
GBLogEx.info(min, `Bot installed on Teams.`);
|
GBLogEx.info(min, `Bot installed on Teams.`);
|
||||||
} else if (context.activity.type === 'conversationUpdate' && context.activity.membersAdded.length > 0) {
|
} else if (context.activity.type === 'conversationUpdate' &&
|
||||||
|
context.activity.membersAdded.length > 0) {
|
||||||
// Check if a bot or a human participant is being added to the conversation.
|
// Check if a bot or a human participant is being added to the conversation.
|
||||||
|
|
||||||
const member = context.activity.membersAdded[0];
|
const member = context.activity.membersAdded[0];
|
||||||
|
|
|
@ -57,7 +57,7 @@ import { GBLogEx } from '../../core.gbapp/services/GBLogEx.js';
|
||||||
import { createBot } from 'whatsapp-cloud-api';
|
import { createBot } from 'whatsapp-cloud-api';
|
||||||
import { promisify } from 'util';
|
import { promisify } from 'util';
|
||||||
const stat = promisify(fs.stat);
|
const stat = promisify(fs.stat);
|
||||||
import {createReadStream} from 'fs';
|
import { createReadStream } from 'fs';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Support for Whatsapp.
|
* Support for Whatsapp.
|
||||||
|
@ -123,7 +123,7 @@ export class WhatsappDirectLine extends GBService {
|
||||||
|
|
||||||
switch (this.provider) {
|
switch (this.provider) {
|
||||||
case 'meta':
|
case 'meta':
|
||||||
this.botNumber = this.min.core.getParam<string>(this.min.instance, 'Bot Number', null);
|
this.botNumber = (this.min.core['getParam'] as any)(this.min.instance, 'Bot Number', null, true);
|
||||||
let whatsappServiceNumber, whatsappServiceKey, url;
|
let whatsappServiceNumber, whatsappServiceKey, url;
|
||||||
if (this.botNumber && this.min.instance.whatsappServiceNumber) {
|
if (this.botNumber && this.min.instance.whatsappServiceNumber) {
|
||||||
whatsappServiceNumber = this.min.instance.whatsappServiceNumber;
|
whatsappServiceNumber = this.min.instance.whatsappServiceNumber;
|
||||||
|
@ -529,8 +529,22 @@ export class WhatsappDirectLine extends GBService {
|
||||||
}
|
}
|
||||||
} else if (user.agentMode === 'bot' || user.agentMode === null || user.agentMode === undefined) {
|
} else if (user.agentMode === 'bot' || user.agentMode === null || user.agentMode === undefined) {
|
||||||
if (WhatsappDirectLine.conversationIds[botId + from + group] === undefined) {
|
if (WhatsappDirectLine.conversationIds[botId + from + group] === undefined) {
|
||||||
GBLogEx.info(this.min, `GBWhatsapp: Starting new conversation on Bot.`);
|
const pid = GBVMService.createProcessInfo(user, this.min, 'whatsapp', null);
|
||||||
const response = await client.apis.Conversations.Conversations_StartConversation();
|
GBLogEx.info(this.min, `GBWhatsapp: Starting new conversation on Bot (pid: ${pid}).`);
|
||||||
|
let response;
|
||||||
|
if (GBConfigService.get('STORAGE_NAME')) {
|
||||||
|
response = await client.apis.Conversations.Conversations_StartConversation(
|
||||||
|
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
response = await client.apis.Conversations.Conversations_StartConversation(
|
||||||
|
{
|
||||||
|
userSystemId: user.userSystemId,
|
||||||
|
userName: user.userName,
|
||||||
|
pid: pid
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
const generatedConversationId = response.obj.conversationId;
|
const generatedConversationId = response.obj.conversationId;
|
||||||
|
|
||||||
WhatsappDirectLine.conversationIds[botId + from + group] = generatedConversationId;
|
WhatsappDirectLine.conversationIds[botId + from + group] = generatedConversationId;
|
||||||
|
|
3
templates/default.gbai/default.gbdialog/hello.bas
Normal file
3
templates/default.gbai/default.gbdialog/hello.bas
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
TALK "Hello, what is your name?"
|
||||||
|
HEAR name
|
||||||
|
TALK "Hi, " + name + "."
|
|
@ -1,5 +1,5 @@
|
||||||
name,value
|
name,value
|
||||||
Answer Mode,chart
|
Answer Mode,sql
|
||||||
llm File,northwind.db
|
llm File,northwind.db
|
||||||
llm Driver,sqlite
|
llm Driver,sqlite
|
||||||
Theme Color,red
|
Theme Color,red
|
|
Loading…
Add table
Reference in a new issue