new(basic.gblib): CHART PROMPT and chart mode.
This commit is contained in:
parent
58b7127491
commit
c51ceb649c
4 changed files with 23 additions and 31 deletions
|
@ -341,7 +341,6 @@ export class GBConversationalService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async sendEvent(min: GBMinInstance, step: GBDialogStep, name: string, value: Object): Promise<any> {
|
public async sendEvent(min: GBMinInstance, step: GBDialogStep, name: string, value: Object): Promise<any> {
|
||||||
|
|
||||||
if (step.context.activity.channelId !== 'msteams' && step.context.activity.channelId !== 'omnichannel') {
|
if (step.context.activity.channelId !== 'msteams' && step.context.activity.channelId !== 'omnichannel') {
|
||||||
GBLogEx.info(
|
GBLogEx.info(
|
||||||
min,
|
min,
|
||||||
|
@ -642,30 +641,32 @@ export class GBConversationalService {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async fillAndBroadcastTemplate(min: GBMinInstance, template, mobile: string, text) {
|
public async fillAndBroadcastTemplate(min: GBMinInstance, template, mobile: string, text) {
|
||||||
|
template = template.replace(/\-/gi, '_');
|
||||||
template = template.replace(/\-/gi, '_')
|
template = template.replace(/\./gi, '_');
|
||||||
template = template.replace(/\./gi, '_')
|
|
||||||
|
|
||||||
let isMedia =
|
let isMedia =
|
||||||
text.toLowerCase().endsWith('.jpg') ||
|
text.toLowerCase().endsWith('.jpg') ||
|
||||||
text.toLowerCase().endsWith('.jpeg') ||
|
text.toLowerCase().endsWith('.jpeg') ||
|
||||||
text.toLowerCase().endsWith('.png');
|
text.toLowerCase().endsWith('.png') ||
|
||||||
|
text.toLowerCase().endsWith('.mp4') ||
|
||||||
|
text.toLowerCase().endsWith('.mov');
|
||||||
|
|
||||||
let image = !isMedia ? /(.*)\n/gim.exec(text)[0].trim() : text;
|
let mediaFile = !isMedia ? /(.*)\n/gim.exec(text)[0].trim() : text;
|
||||||
|
|
||||||
const gbaiName = DialogKeywords.getGBAIPath(min.botId);
|
const gbaiName = DialogKeywords.getGBAIPath(min.botId);
|
||||||
const fileUrl = urlJoin(process.env.BOT_URL, 'kb', gbaiName, `${min.botId}.gbkb`, 'images', image);
|
const fileUrl = urlJoin(process.env.BOT_URL, 'kb', gbaiName, `${min.botId}.gbkb`, 'media', mediaFile);
|
||||||
|
|
||||||
let urlImage = image.startsWith('http') ? image : fileUrl;
|
let urlMedia = mediaFile.startsWith('http') ? mediaFile : fileUrl;
|
||||||
|
|
||||||
if (!isMedia) {
|
if (!isMedia) {
|
||||||
text = text.substring(image.length + 1).trim();
|
text = text.substring(mediaFile.length + 1).trim();
|
||||||
text = text.replace(/\n/g, '\\n');
|
text = text.replace(/\n/g, '\\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
template = isMedia ? image.replace(/\.[^/.]+$/, '') : template;
|
template = isMedia ? mediaFile.replace(/\.[^/.]+$/, '') : template;
|
||||||
|
|
||||||
|
let mediaType = text.toLowerCase().endsWith('.mp4') || text.toLowerCase().endsWith('.mov') ? 'video' : 'image';
|
||||||
|
|
||||||
let data: any = {
|
let data: any = {
|
||||||
name: template,
|
name: template,
|
||||||
|
@ -674,9 +675,9 @@ export class GBConversationalService {
|
||||||
type: 'header',
|
type: 'header',
|
||||||
parameters: [
|
parameters: [
|
||||||
{
|
{
|
||||||
type: 'image',
|
type: mediaType,
|
||||||
image: {
|
media: {
|
||||||
link: urlImage
|
link: urlMedia
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -685,8 +686,9 @@ export class GBConversationalService {
|
||||||
};
|
};
|
||||||
|
|
||||||
await this.sendToMobile(min, mobile, data, null);
|
await this.sendToMobile(min, mobile, data, null);
|
||||||
GBLogEx.info(min, `Sending answer file to mobile: ${mobile}. Header: ${urlImage}`);
|
GBLogEx.info(min, `Sending answer file to mobile: ${mobile}. Header: ${urlMedia}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// tslint:enable:no-unsafe-any
|
// tslint:enable:no-unsafe-any
|
||||||
|
|
||||||
public async sendMarkdownToMobile(min: GBMinInstance, step: GBDialogStep, mobile: string, text: string) {
|
public async sendMarkdownToMobile(min: GBMinInstance, step: GBDialogStep, mobile: string, text: string) {
|
||||||
|
|
|
@ -16,5 +16,5 @@ POST TO INSTAGRAM username, password, image, caption
|
||||||
# Postar no Facebook
|
# Postar no Facebook
|
||||||
POST TO FACEBOOK username, password, image, caption
|
POST TO FACEBOOK username, password, image, caption
|
||||||
|
|
||||||
# Postar no Twitter
|
# Postar no BlueSky
|
||||||
TWEET username, password, image, caption
|
BLUESKY username, password, image, caption
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
|
|
||||||
data = FIND "products.csv"
|
|
||||||
BEGIN SYSTEM PROMPT
|
|
||||||
Engage users effectively as if you're a sales assistant in the virtual store.
|
|
||||||
Begin by welcoming them warmly and encouraging them to explore our range of products.
|
|
||||||
Provide clear instructions on how to inquire about specific items or browse
|
|
||||||
categories. Ensure the tone is friendly, helpful, and inviting to encourage
|
|
||||||
interaction. Use prompts to guide users through the purchasing process and offer
|
|
||||||
assistance whenever needed. Offer them this products: ${ TOJSON (data) }
|
|
||||||
END SYSTEM PROMPT
|
|
|
@ -1,4 +1,4 @@
|
||||||
name,value
|
name,value
|
||||||
Answer Mode,chart
|
Answer Mode,sql
|
||||||
llm File,northwind.db
|
llm File,northwind.db
|
||||||
llm Driver,sqlite
|
llm Driver,sqlite
|
|
Loading…
Add table
Reference in a new issue