new(basic.gblib): New REWRITE keyword.

This commit is contained in:
Rodrigo Rodriguez 2023-08-03 15:15:13 -03:00
parent 20c13c1a4a
commit 85f6449ca4
2 changed files with 30 additions and 0 deletions

View file

@ -327,6 +327,15 @@ export class KeywordsExpressions {
}
];
keywords[i++] = [
/^\s*(.*)\=\s*(REWRITE)(\s*)(.*)/gim,
($0, $1, $2, $3, $4) => {
const params = this.getParams($4, ['text']);
return `await sys.rewrite ({pid: pid, ${params}})`;
}
];
keywords[i++] = [
/^\s*hear (\w+\$*) as (\w+( \w+)*.xlsx)/gim,
($0, $1, $2) => {

View file

@ -59,6 +59,7 @@ import * as MSAL from '@azure/msal-node';
import { GBConversationalService } from '../../core.gbapp/services/GBConversationalService.js';
import { WebAutomationServices } from './WebAutomationServices.js';
import { KeywordsExpressions } from './KeywordsExpressions.js';
import { ChatServices } from '../../gpt.gblib/services/ChatServices.js';
/**
* @fileoverview General Bots server core.
@ -1873,6 +1874,26 @@ export class SystemKeywords {
GBLog.info(`Twitter Automation: ${text}.`);
}
/**
* HEAR description
* text = REWRITE description
* SAVE "logs.xlsx", username, text
*/
public async rewrite({ pid, text }) {
const { min, user } = await DialogKeywords.getProcessInfo(pid);
const prompt = `rewrite this sentence in a better way: ${text}`;
const answer = await ChatServices.continue(min, prompt, 0);
GBLog.info(`BASIC: REWRITE ${text} TO ${answer}`);
return answer;
}
/**
*
* qrcode = PAY "10000", "Name", 100
* SEND FILE qrcode
*
*/
public async pay({ pid, orderId, customerName, ammount }) {
const { min, user } = await DialogKeywords.getProcessInfo(pid);