fix(all): TRUE multicloud.

This commit is contained in:
Rodrigo Rodriguez 2024-08-27 15:32:03 -03:00
parent 0b5a7f0863
commit 442def7fbb
27 changed files with 262 additions and 273 deletions

View file

@ -492,7 +492,7 @@ export class ChatServices {
});
} else {
dataSource = new DataSource({
type: dialect === 'mariadb'? 'mysql': dialect as any,
type: dialect === dialect as any,
host: host,
port: port,
database: storageName,

View file

@ -0,0 +1,14 @@
REM General Bots: Your Prompt Engineering Gets Done.
PARAM location AS "The city and state, e.g. San Francisco, CA"
PARAM unit AS "celsius", "fahrenheit"
DESCRIPTION "Get the current weather in a given location"
REM 'TODO: Call your favorite wheather API here and return it to LLM.
weather_info = NEW OBJECT
weather_info.location = location
weather_info. Temperature = "72"
weather_info. Unit = unit
weather_info. forecast = ["sunny", "windy"]
RETURN weather_info

View file

@ -0,0 +1,117 @@
REM Set SCHEDULE "1 * * * * *"
REM Obtém token Do Partner Center via token Do AD.
Set HEADER "return-client-request-id" As "True"
Set HEADER "Content-Type" As "application/x-www-form-urlencoded; charset=utf-8"
REM pcToken = POST "https://login.microsoftonline.com/" + tenantId + "/oauth2/token", "resource=https%3A%2F%2Fgraph.windows.net&client_id=" + clientId + "&client_secret=" + clientSecret + "&grant_type=client_credentials"
REM repara chamada de Billing.
REM Set HEADER "Authorization" As "Bearer " + pcToken.access_token
Set HEADER "MS-Contract-Version" As "v1"
Set HEADER "MS-CorrelationId" As uuid()
Set HEADER "MS-RequestId" As uuid()
Set HEADER "MS-PartnerCenter-Application" As "VPN General Bots"
Set HEADER "X-Locale" As "en-US"
REM Syncs Customers and Subscriptions.
Set PAGE MODE "none"
list = Get host + "/v1/customers?size=20000"
MERGE "Customers" With list.items BY "Id"
FOR EACH item IN list
subs = Get host + "/v1/customers/" + item.id + "/subscriptions"
MERGE "Subscriptions" With subs.items BY "Id"
END For
REM Check period.
If today = dueDay Then
If period = "previous" And Not CONTINUATION TOKEN Then
period = "current"
Else
period = "previous"
End If
Else
period = "current"
End If
REM Perform the Call And Loop through the billing items.
Set PAGE MODE "auto"
list = Get host + "/v1/invoices/unbilled/lineitems?provider=onetime&invoicelineitemtype=usagelineitems&currencycode=" + currency + "&period=previous&idparceiro=" + idparceiro
For EACH item IN list
SAVE "Billing", item.alternateId, item.availabilityId, item.billableQuantity, item.billingFrequency, item.chargeEndDate, item.chargeStartDate, item.chargeType, item.currency, item.customerCountry, item.customerDomainName, item.customerId, item.customerName, item.effectiveUnitPrice, item.invoiceNumber, item.meterDescription, item.mpnId, item.orderDate, item.orderId, item.partnerId, item.pCToBCExchangeRate, item.pCToBCExchangeRateDate, item.priceAdjustmentDescription, item.pricingCurrency, item.productId, item.productName, item.publisherId, item.publisherName, item.quantity, item.resellerMpnId, item.reservationOrderId, item.skuId, item.skuName, item.subscriptionDescription, item.subscriptionId, item.subtotal, item.taxTotal, item.termAndBillingCycle, item.totalForCustomer, item.unitPrice, item.unitType
END For
END FOR
TABLE Billing
CustomerId Customers
ResourceGroup string(200)
ResourceUri string(1000)
Tags string(max)
AdditionalInfo string(max)
ServiceInfo1 string(max)
ServiceInfo2 string(max)
CustomerCountry string(6)
MpnId string(50)
ResellerMpnId string(50)
ChargeType string(200)
UnitPrice* double
Quantity* double
UnitType string(max)
BillingPreTaxTotal double
BillingCurrency string(6)
PricingPreTaxTotal double
PricingCurrency string(6)
EntitlementId string(50)
EntitlementDescription string(400)
PCToBCExchangeRate double
PCToBCExchangeRateDate date
EffectiveUnitPrice* double
RateOfPartnerEarnedCredit double
ConsumedService string(200)
ResourceLocation string(100)
MeterRegion string(100)
PartnerId string(50)
PartnerName string(400)
CustomerName string(400)
CustomerDomainName string(400)
InvoiceNumber string(400)
ProductId string(50)
SkuId string(50)
AvailabilityId string(50)
SkuName string(200)
ProductName string(400)
PublisherName string(200)
PublisherId string(200)
SubscriptionId string(50)
SubscriptionDescription string(400)
ChargeStartDate* date
ChargeEndDate* date
UsageDate date
MeterType string(400)
MeterCategory string(100)
MeterId string(50)
MeterSubCategory string(100)
MeterName string(200)
UnitOfMeasure string(100)
Reprocess boolean
END TABLE
TABLE Customers
TenantId guid
CompanyName string(100)
Id guid
END TABLE
TABLE Subscriptions
CustomerId Customers
Id guid
OfferName string(50)
END TABLE

View file

@ -1,121 +0,0 @@
REM SET SCHEDULE "1 * * * * *"
REM Obtém token do Partner Center via token do AD.
SET HEADER "return-client-request-id" AS "true"
SET HEADER "Content-Type" As "application/x-www-form-urlencoded; charset=utf-8"
pcToken = POST "https://login.microsoftonline.com/" + tenantId + "/oauth2/token", "resource=https%3A%2F%2Fgraph.windows.net&client_id=" + clientId + "&client_secret=" + clientSecret + "&grant_type=client_credentials"
REM repara chamada de Billing.
SET HEADER "Authorization" AS "Bearer " + pcToken.access_token
SET HEADER "MS-Contract-Version" AS "v1"
SET HEADER "MS-CorrelationId" AS uuid()
SET HEADER "MS-RequestId" AS uuid()
SET HEADER "MS-PartnerCenter-Application" AS "General Bots"
SET HEADER "X-Locale" AS "en-US"
REM Sincroniza Customers e Subscriptions
SET PAGE MODE "none"
list = GET host + "/v1/customers?size=20000"
MERGE "Customers" WITH list.items BY "Id"
FOR EACH item IN list
subs = GET host + "/v1/customers/" + item.id + "/subscriptions"
MERGE "Subscriptions" WITH subs.items BY "Id"
END FOR
REM Determina período.
IF today = dueDay THEN
IF period = "previous" AND NOT CONTINUATION TOKEN THEN
period = "current"
ELSE
period = "previous"
END IF
ELSE
period = "current"
END IF
REM Perform the call and loop through the billing items.
SET PAGE MODE "auto"
list = GET host + "/v1/invoices/unbilled/lineitems?provider=onetime&invoicelineitemtype=usagelineitems&currencycode=" + currency + "&period=previous&idparceiro=" + idparceiro
FOR EACH item IN list
SAVE "Billing", item.alternateId, item.availabilityId, item.billableQuantity, item.billingFrequency, item.chargeEndDate, item.chargeStartDate, item.chargeType, item.currency, item.customerCountry, item.customerDomainName, item.customerId, item.customerName, item.effectiveUnitPrice, item.invoiceNumber, item.meterDescription, item.mpnId, item.orderDate, item.orderId, item.partnerId, item.pCToBCExchangeRate, item.pCToBCExchangeRateDate, item.priceAdjustmentDescription, item.pricingCurrency, item.productId, item.productName, item.publisherId, item.publisherName, item.quantity, item.resellerMpnId, item.reservationOrderId, item.skuId, item.skuName, item.subscriptionDescription, item.subscriptionId, item.subtotal, item.taxTotal, item.termAndBillingCycle, item.totalForCustomer, item.unitPrice, item.unitType
END FOR
TABLE Billing
CustomerId Customers
ResourceGroup string(200)
ResourceUri string(1000)
Tags string(max)
AdditionalInfo string(max)
ServiceInfo1 string(max)
ServiceInfo2 string(max)
CustomerCountry string(6)
MpnId string(50)
ResellerMpnId string(50)
ChargeType string(200)
UnitPrice* double
Quantity* double
UnitType string(max)
BillingPreTaxTotal double
BillingCurrency string(6)
PricingPreTaxTotal double
PricingCurrency string(6)
EntitlementId string(50)
EntitlementDescription string(400)
PCToBCExchangeRate double
PCToBCExchangeRateDate date
EffectiveUnitPrice* double
RateOfPartnerEarnedCredit double
ConsumedService string(200)
ResourceLocation string(100)
MeterRegion string(100)
PartnerId string(50)
PartnerName string(400)
CustomerName string(400)
CustomerDomainName string(400)
InvoiceNumber string(400)
ProductId string(50)
SkuId string(50)
AvailabilityId string(50)
SkuName string(200)
ProductName string(400)
PublisherName string(200)
PublisherId string(200)
SubscriptionId string(50)
SubscriptionDescription string(400)
ChargeStartDate* date
ChargeEndDate* date
UsageDate date
MeterType string(400)
MeterCategory string(100)
MeterId string(50)
MeterSubCategory string(100)
MeterName string(200)
UnitOfMeasure string(100)
Reprocess boolean
END TABLE
TABLE Customers
TenantId guid
CompanyName string(100)
Id guid
END TABLE
TABLE Subscriptions
CustomerId Customers
Id guid
OfferName string(50)
END TABLE

View file

@ -1,4 +1,4 @@
REM 302 / 1234
PARAM barraca AS number LIKE Código da barraca
PARAM operador AS number LIKE Código do operador
DESCRIPTION Esta função (tool) nunca é chamada pelo GPT. É um WebService do GB.
@ -7,11 +7,11 @@ REM Login como Garçom
data = NEW OBJECT
data.IdentificadorOperador = operador
data.BarracaId = barraca
login = POST "https://api.server.com.br/api/Operadores/Login", data
login = POST host + "/login", data
SET HEADER "Authorization" AS login.accessToken
REM Obter o cardápio da Barraca - Utilizar o token recuperado acima.
data = GET "https://api.server.com.br/api/Item/Barraca/${barraca}/Cliente"
data = GET host + "/Barraca/${barraca}"
produtos = NEW ARRAY
FOR EACH item IN data[0].itens

View file

@ -0,0 +1,18 @@
list = DIR "default.gbdrive"
FOR EACH item IN list
TALK "Checking: " + item.name
oldDays = DATEDIFF date, item.modified, "day"
IF oldDays > 3 THEN
TALK "The file ${item.name} will be archived as it is expired."
blob = UPLOAD item
TALK "Upload to server completed."
SAVE "log.xlsx", "archived", today, now, item.path, item.name, item.size, item.modified, blob.md5
DELETE item
TALK "File removed from storage."
ELSE
TALK "The file ${item.name} does not need to be archived."
END IF
NEXT

View file

@ -0,0 +1 @@
This is to be backed up.

View file

@ -0,0 +1,16 @@
REM SET SCHEDULE "1 * * * * *"
billing = FIND "Orders"
REM Monthly consumption of bars.
data = SELECT SUM(UnitPrice * Quantity) as Value, MONTH(OrderDate)+'/'+YEAR(OrderDate) from billing GROUP BY MONTH(OrderDate), YEAR(OrderDate)
img = CHART "timseries", data
SEND FILE img, "Monthly Consumption"
REM Product Category
data = SELECT SUM(UnitPrice * Quantity) as Value, CategoryName from billing JOIN Products ON billing.ProductID = Products.ProductID JOIN Categories ON Products.CategoryID = Categories.CategoryID GROUP BY CategoryName
img = CHART "donut", data
SEND FILE img, "Product Category"

View file

@ -0,0 +1,11 @@
REM Monthly consumption of bars (Individual sending to each customer)
customers = FIND "Customers"
FOR EACH c IN customers
data = SELECT SUM(UnitPrice * Quantity) as Value, MONTH(OrderDate)+'/'+YEAR(OrderDate) from billing
JOIN Customers ON billing.CustomerID = Customers.CustomerID
GROUP BY MONTH(OrderDate), YEAR(OrderDate)
WHERE Customers.CustomerID = c.CustomerID
img = CHART "timseries", data
SEND FILE img, "Monthly Consumption"
END FOR

View file

@ -0,0 +1,10 @@
list = FIND "broadcast.csv"
index = 1
DO WHILE index < UBOUND(list)
row = list[index]
TALK TO row.mobile, "Hi, " + row.name + ". How are you? How about *General Bots* deployed?"
WAIT 5
SAVE "Log.xlsx", TODAY, NOW, USERNAME, FROM, row.mobile, row.name
index = index + 1
LOOP
TALK "The broadcast has been sent."

View file

@ -1,19 +0,0 @@
list = DIR "QCARobot.gbdrive"
FOR EACH item IN list
TALK "Verificando: " + item.name
DEBUG item
oldDays = DATEDIFF date, item.modified, "day"
IF oldDays > 3 THEN
TALK "O arquivo ${item.name} será arquivado, pois está expirado."
blob = UPLOAD item
TALK Upload para o Azure realizado.
SAVE "log.xlsx", "archived",today,now, item.path, item.name, item.size, item.modified, blob.md5
REM DELETE item
REM TALK Arquivo removido do SharePoint.
ELSE
TALK "O arquivo ${item.name} não precisa de arquivamento."
END IF
NEXT

View file

@ -1,42 +0,0 @@
REM SET SCHEDULE "1 * * * * *"
billing = FIND "Billing"
REM Consumo Mensal de barras.
data = SELECT SUM(effectiveUnitPrice) as Value, MONTH(usageDate)+'/'+YEAR(usageDate) from billing GROUP BY MONTH(date), YEAR(date)
img = CHART "timseries", data
SEND FILE img, "Consumo Mensal"
REM Categoria do Produto
data = SELECT SUM(effectiveUnitPrice) as Value, meterCategory from billing GROUP BY meterCategory
img = CHART "donut", data
SEND FILE img, "Categoria do Produto"
REM Sub Categoria do Produto
data = SELECT SUM(effectiveUnitPrice) as Value, meterSubCategory from billing GROUP BY meterCategory
img = CHART "donut", data
SEND FILE img, "Subcategoria do Produto"
REM Nome do Produto (Resumido)
REM productName
REM Região do Recurso
REM resourceLocation
REM Grupo do Recurso
REM resourceGroup
REM Consumo Mensal de barras (Envio individual para cada cliente)
customers = FIND "Customers"
FOR EACH c IN customers
data = SELECT SUM(effectiveUnitPrice) as Value, MONTH(usageDate)+'/'+YEAR(usageDate) from billing GROUP BY MONTH(date), YEAR(date) WHERE customerId = c.id
img = CHART "timseries", data
SEND FILE img, "Consumo Mensal"
END FOR

View file

@ -1,10 +0,0 @@
lista = find "broadcast.csv"
indice = 1
do while indice < ubound(lista)
linha = lista[indice]
TALK TO linha.mobile, "Oi, " + linha.name + ". Tudo bem? How about *General Bots* deployed? "
wait 5
save Log.xlsx, today, now, username, from,linha.mobile, linha.name
indice = indice + 1
loop
talk O envio foi realizado.

View file

@ -1,16 +0,0 @@
TALK "Olá, por favor, qual seu nome completo?"
HEAR nome
TALK "Qual o seu email para contato? "
HEAR email
TALK "Qual o seu telefone para contato? "
HEAR telefone
TALK "Função? "
HEAR funcao
TALK "Qual empresa que estará representando? "
HEAR empresa
TALK "É freelancer?"
HEAR freelancer AS BOOLEAN
TALK "Você pretende participar do evento em qual cidade? "
HEAR cidade AS "São Paulo", "Rio de Janeiro"
TALK "Você deseja receber outras informações do mailing da Quanta?"
SAVE "pessoas.xlsx", nome, email, telefone, funcao, empresa, freelancer

View file

@ -0,0 +1,17 @@
TALK "Hello, could you please tell me your full name?"
HEAR name
TALK "What is your contact email?"
HEAR email
TALK "What is your contact phone number?"
HEAR phone
TALK "Job title?"
HEAR job
TALK "Which company will you be representing?"
HEAR company
TALK "Are you a freelancer?"
HEAR freelancer AS BOOLEAN
TALK "Which city do you plan to attend the event in?"
HEAR city AS "São Paulo", "Rio de Janeiro"
TALK "Would you like to receive other information from Quanta's mailing list?"
SAVE "event-guests.xlsx", name, email, phone, job, company, freelancer

View file

@ -1,12 +0,0 @@
SET MAX LINES 1000
list = FIND "Mailing Global.xlsx"
indice = 1
do while indice < ubound(list)
row = list[indice]
valid = IS VALID row.email
indice = indice + 1
IF valid THEN
Set "Mailing Global.xlsx", "B" + indice , "x"
END IF
loop
talk Validate OK.

View file

@ -1,16 +1,15 @@
# Desenvolvimento Personalizado
# Custom Development
General Bots usa linguagem natural para entender o que as pessoas querem, facilitando o desenvolvimento de código. Quando alguém diz: "Preciso do relatório mensal" ou "Imprima o relatório do mês", General Bots entende o mesmo. Utilize o nosso desenvolvimento para estender a conversa com suas próprias regras e intenções.
General Bots uses natural language to understand what people want, making code development easier. When someone says, "I need the monthly report" or "Print the report for the month," General Bots understands the same thing. Use our development tools to extend the conversation with your own rules and intents.
# Descoberta
# Discovery
General Bots pode pró-ativamente sugerir suas habilidades para os usuários baseada no contexto, como solicitação de um pedido, envio de uma mensagem, agendamento de uma conferência telefônica ou qualquer ação definida na sua aplicação.
General Bots can proactively suggest its abilities to users based on context, such as requesting an order, sending a message, scheduling a conference call, or any action defined in your application.
# Torne pessoal
# Make it Personal
Entregue experiências únicas através do conhecimento que a General Bots possui sobre seus usuários e preferências, para ajudar a tomar decisões e apresentar sempre o melhor cenário.
Deliver unique experiences through the knowledge that General Bots has about your users and their preferences, helping to make decisions and always presenting the best scenario.
# Sem downloads adicionais
A interface da sua aplicação é automaticamente integrada à General Bots, de modo que não seja necessário realizar download ou instalações.
# No Additional Downloads
Your application's interface is automatically integrated with General Bots, so theres no need for additional downloads or installations.

View file

@ -47,7 +47,7 @@ Twitter Access Token,
Twitter Access Token Secret,
Twitter Consumer Key,
Twitter Consumer Key Secret,
Website,
Website, https://www.iochpe.com.br/en
Welcome Article,
WhatsApp Admins,
WhatsApp Group ID,

1 name value
47 Twitter Access Token Secret
48 Twitter Consumer Key
49 Twitter Consumer Key Secret
50 Website https://www.iochpe.com.br/en
51 Welcome Article
52 WhatsApp Admins
53 WhatsApp Group ID

View file

@ -1,7 +1,7 @@
REM SEND FILE “colegioinovar.PNG
REM SEND FILE “logo.png
SAVE Log.xlsx, from, mobile, today, now, "start"
TALK "Olá " + username + , eu sou o *InovarBot*, uma inteligência artificial criada para facilitar o seu contato conosco (instituição de ensino) e auxiliar em seu crescimento/progresso/evolução educacional."
TALK "Olá " + username + , eu sou o *Bot*.
row = FIND People.xlsx, mobile= + from
IF row = null THEN

View file

@ -1,8 +1,12 @@
PARAM NomeDoCliente AS STRING LIKE Nome do cliente finalizando venda.
PARAM pedidos AS OBJECT LIKE O JSON de pedidos montado com base no que foi informado pelo cliente.
DESCRIPTION Chamada quando a venda é finalizada. Recebendo o JSON dos produtos como jsonProdutos selecionados pelo cliente no carrinho de compras e o nome do cliente. Se a lista de produtos da venda estiver vazio, ela não pode ser finalizada. Nunca referencie diretamente
esta função em si, apenas atue sua funcionalidade de modo oculto.
DEBUG NomeDoCliente
DEBUG pedidos
SAVE "maria.Pedidos", nomeDocliente, jsonProdutos.valor
RETURN "OK"

View file

@ -0,0 +1 @@
SEND TEMPLATE TO "122233333333", "newsletter-zap.txt"

View file

@ -1 +0,0 @@
SEND TEMPLATE TO "55219999999999", "bot_02082028-zap.docx"

View file

@ -0,0 +1,2 @@
logo-gb.png
Welcome to General Bots in WhatsApp templating system!

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB