new(basic.gblib): SEND FILE pdf as temporary images ViewOnce.
This commit is contained in:
parent
ac6e7bc28c
commit
d68feec33b
18 changed files with 21 additions and 35805 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -30,3 +30,4 @@ yarn-lock.json
|
||||||
logo.svg
|
logo.svg
|
||||||
screenshot.png
|
screenshot.png
|
||||||
data.db
|
data.db
|
||||||
|
.wwebjs_cache
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -650,7 +650,7 @@ export class DialogKeywords {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public async sendTemplateTo({ pid, mobile, filename }) {
|
public async sendTemplateTo({ pid, mobile, filename }) {
|
||||||
const { min, user, proc } = await DialogKeywords.getProcessInfo(pid);
|
const { min } = await DialogKeywords.getProcessInfo(pid);
|
||||||
GBLogEx.info(min, `SEND TEMPLATE TO '${mobile}',filename '${filename}'.`);
|
GBLogEx.info(min, `SEND TEMPLATE TO '${mobile}',filename '${filename}'.`);
|
||||||
const service = new GBConversationalService(min.core);
|
const service = new GBConversationalService(min.core);
|
||||||
|
|
||||||
|
|
|
@ -1378,7 +1378,7 @@ export class GBMinService {
|
||||||
// a upload with no Dialog, so run Auto Save to .gbdrive.
|
// a upload with no Dialog, so run Auto Save to .gbdrive.
|
||||||
|
|
||||||
const t = new SystemKeywords();
|
const t = new SystemKeywords();
|
||||||
GBLogEx.info(min, `BASIC (${min.botId}): Upload done for ${attachmentData.filename}.`);
|
GBLogEx.info(min, `BASIC (${min.botId}): Upload2 done for ${attachmentData.filename}.`);
|
||||||
const handle = WebAutomationServices.cyrb53({ pid: 0, str: min.botId + attachmentData.filename });
|
const handle = WebAutomationServices.cyrb53({ pid: 0, str: min.botId + attachmentData.filename });
|
||||||
let data = await fs.readFile(attachmentData.filename);
|
let data = await fs.readFile(attachmentData.filename);
|
||||||
|
|
||||||
|
|
|
@ -108,9 +108,11 @@ export class GBLLMOutputParser extends BaseLLMOutputParser<ExpectedOutput> {
|
||||||
|
|
||||||
private toolChain: RunnableSequence;
|
private toolChain: RunnableSequence;
|
||||||
private min;
|
private min;
|
||||||
|
private user;
|
||||||
|
|
||||||
constructor(min, toolChain: RunnableSequence, documentChain: RunnableSequence) {
|
constructor(min, user, toolChain: RunnableSequence, documentChain: RunnableSequence) {
|
||||||
super();
|
super();
|
||||||
|
this.user = user;
|
||||||
this.min = min;
|
this.min = min;
|
||||||
this.toolChain = toolChain;
|
this.toolChain = toolChain;
|
||||||
}
|
}
|
||||||
|
@ -150,8 +152,18 @@ export class GBLLMOutputParser extends BaseLLMOutputParser<ExpectedOutput> {
|
||||||
|
|
||||||
if (localName) {
|
if (localName) {
|
||||||
const pngs = await GBUtil.pdfPageAsImage(this.min, localName, source.page);
|
const pngs = await GBUtil.pdfPageAsImage(this.min, localName, source.page);
|
||||||
text = `
|
|
||||||
${text}`;
|
if (!isNaN(this.user.userSystemId)){
|
||||||
|
await this.min.whatsAppDirectLine.sendFileToDevice(
|
||||||
|
this.user.userSystemId, pngs[0].url,
|
||||||
|
localName, null, undefined, true);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
text = `
|
||||||
|
${text}`;
|
||||||
|
}
|
||||||
found = true;
|
found = true;
|
||||||
source.file = localName;
|
source.file = localName;
|
||||||
}
|
}
|
||||||
|
@ -495,7 +507,7 @@ export class ChatServices {
|
||||||
},
|
},
|
||||||
combineDocumentsPrompt,
|
combineDocumentsPrompt,
|
||||||
model,
|
model,
|
||||||
new GBLLMOutputParser(min, null, null)
|
new GBLLMOutputParser(min, user, null, null)
|
||||||
] as any);
|
] as any);
|
||||||
|
|
||||||
const conversationalToolChain = RunnableSequence.from([
|
const conversationalToolChain = RunnableSequence.from([
|
||||||
|
@ -508,7 +520,7 @@ export class ChatServices {
|
||||||
},
|
},
|
||||||
questionGeneratorTemplate,
|
questionGeneratorTemplate,
|
||||||
modelWithTools,
|
modelWithTools,
|
||||||
new GBLLMOutputParser(min, callToolChain, docsContext?.docstore?._docs.length > 0 ? combineDocumentsChain : null),
|
new GBLLMOutputParser(min, user, callToolChain, docsContext?.docstore?._docs.length > 0 ? combineDocumentsChain : null),
|
||||||
new StringOutputParser()
|
new StringOutputParser()
|
||||||
] as any);
|
] as any);
|
||||||
|
|
||||||
|
|
|
@ -743,7 +743,7 @@ export class WhatsappDirectLine extends GBService {
|
||||||
to = to + '@c.us';
|
to = to + '@c.us';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GBLogEx.info(this.min, `WhatsApp isViewOnce 2${isViewOnce}`);
|
GBLogEx.info(this.min, `WhatsApp isViewOnce ${isViewOnce}`);
|
||||||
await this.customClient.sendMessage(to, attachment, { caption: caption, isViewOnce });
|
await this.customClient.sendMessage(to, attachment, { caption: caption, isViewOnce });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
BIN
templates/ai-search.gbai/ai-search.gbkb/docs/CT-029.pdf
Normal file
BIN
templates/ai-search.gbai/ai-search.gbkb/docs/CT-029.pdf
Normal file
Binary file not shown.
BIN
templates/ai-search.gbai/ai-search.gbkb/docs/CT-046.pdf
Normal file
BIN
templates/ai-search.gbai/ai-search.gbkb/docs/CT-046.pdf
Normal file
Binary file not shown.
BIN
templates/ai-search.gbai/ai-search.gbkb/docs/T-ELE-009.pdf
Normal file
BIN
templates/ai-search.gbai/ai-search.gbkb/docs/T-ELE-009.pdf
Normal file
Binary file not shown.
BIN
templates/ai-search.gbai/ai-search.gbkb/docs/T-OUT-002.pdf
Normal file
BIN
templates/ai-search.gbai/ai-search.gbkb/docs/T-OUT-002.pdf
Normal file
Binary file not shown.
BIN
templates/ai-search.gbai/ai-search.gbkb/docs/T-OUT-015.pdf
Normal file
BIN
templates/ai-search.gbai/ai-search.gbkb/docs/T-OUT-015.pdf
Normal file
Binary file not shown.
BIN
templates/ai-search.gbai/ai-search.gbkb/docs/T-OUT-035.pdf
Normal file
BIN
templates/ai-search.gbai/ai-search.gbkb/docs/T-OUT-035.pdf
Normal file
Binary file not shown.
Binary file not shown.
Loading…
Add table
Reference in a new issue