new(all): New keyword SEE CAPTION and SEE TEXT of for CV.
This commit is contained in:
parent
47d553f8f0
commit
73db528f3b
9 changed files with 27204 additions and 587 deletions
27697
package-lock.json
generated
27697
package-lock.json
generated
File diff suppressed because it is too large
Load diff
23
package.json
23
package.json
|
@ -48,17 +48,18 @@
|
|||
"commit": "git-cz"
|
||||
},
|
||||
"dependencies": {
|
||||
"@azure/cognitiveservices-computervision": "8.1.0",
|
||||
"@azure/ms-rest-js": "2.5.1",
|
||||
"@google-cloud/pubsub": "^2.13.0",
|
||||
"@google-cloud/translate": "^6.2.6",
|
||||
"@google-cloud/pubsub": "2.13.0",
|
||||
"@google-cloud/translate": "6.2.6",
|
||||
"@microsoft/microsoft-graph-client": "2.2.1",
|
||||
"@semantic-release/changelog": "5.0.1",
|
||||
"@semantic-release/exec": "5.0.0",
|
||||
"@semantic-release/git": "9.0.0",
|
||||
"@sendgrid/mail": "^7.4.4",
|
||||
"@sendgrid/mail": "7.4.4",
|
||||
"@types/validator": "13.1.4",
|
||||
"adal-node": "0.2.2",
|
||||
"adm-zip": "^0.5.6",
|
||||
"adm-zip": "0.5.6",
|
||||
"any-shell-escape": "0.1.1",
|
||||
"async-promises": "0.2.3",
|
||||
"azure-arm-cognitiveservices": "3.0.0",
|
||||
|
@ -77,7 +78,7 @@
|
|||
"botlib": "1.9.4",
|
||||
"cli-spinner": "0.2.10",
|
||||
"core-js": "3.14.0",
|
||||
"date-diff": "^0.2.2",
|
||||
"date-diff": "0.2.2",
|
||||
"dotenv-extended": "2.9.0",
|
||||
"exceljs": "4.2.1",
|
||||
"express": "4.17.1",
|
||||
|
@ -87,15 +88,15 @@
|
|||
"googleapis": "75.0.0",
|
||||
"ibm-watson": "6.1.1",
|
||||
"js-beautify": "1.13.13",
|
||||
"luxon": "^2.0.2",
|
||||
"luxon": "2.0.2",
|
||||
"marked": "2.0.7",
|
||||
"momentjs": "^2.0.0",
|
||||
"momentjs": "2.0.0",
|
||||
"ms-rest-azure": "3.0.0",
|
||||
"nexmo": "2.9.1",
|
||||
"node-cron": "3.0.0",
|
||||
"npm": "7.21.0",
|
||||
"opn": "6.0.0",
|
||||
"pdf-extraction": "^1.0.2",
|
||||
"pdf-extraction": "1.0.2",
|
||||
"phone": "2.4.21",
|
||||
"pragmatismo-io-framework": "1.0.20",
|
||||
"prism-media": "1.3.1",
|
||||
|
@ -110,13 +111,13 @@
|
|||
"sequelize": "5.21.5",
|
||||
"sequelize-typescript": "1.1.0",
|
||||
"simple-git": "2.39.1",
|
||||
"speakingurl": "^14.0.1",
|
||||
"speakingurl": "14.0.1",
|
||||
"sppull": "2.7.0",
|
||||
"strict-password-generator": "1.1.2",
|
||||
"swagger-client": "2.1.18",
|
||||
"tedious": "9.2.1",
|
||||
"textract": "2.5.0",
|
||||
"typescript": "3.6.4",
|
||||
"typescript": "3.9.2",
|
||||
"url-join": "4.0.1",
|
||||
"vbscript-to-typescript": "1.0.8",
|
||||
"walk-promise": "0.2.0",
|
||||
|
@ -139,7 +140,7 @@
|
|||
"travis-deploy-once": "5.0.11",
|
||||
"ts-node": "10.0.0",
|
||||
"tslint": "6.1.2",
|
||||
"tslint-microsoft-contrib": "^6.2.0",
|
||||
"tslint-microsoft-contrib": "6.2.0",
|
||||
"typedoc": "0.20.36"
|
||||
},
|
||||
"eslintConfig": {
|
||||
|
|
|
@ -273,6 +273,14 @@ export class GBVMService extends GBService {
|
|||
return `${$1} = sys().sortBy(${$2}, "${$3}")\n`;
|
||||
});
|
||||
|
||||
code = code.replace(/see\s*text\s*of\s*(\w+)\s*as\s*(\w+)\s*/gi, ($0, $1, $2, $3) => {
|
||||
return `${$2} = sys().seeText(${$1})\n`;
|
||||
});
|
||||
|
||||
code = code.replace(/see\s*caption\s*of\s*(\w+)\s*as(.*)/gi, ($0, $1, $2, $3) => {
|
||||
return `${$2} = sys().seeCaption(${$1})\n`;
|
||||
});
|
||||
|
||||
code = code.replace(/(wait)\s*(\d+)/gi, ($0, $1, $2) => {
|
||||
return `sys().wait(${$2})`;
|
||||
});
|
||||
|
|
|
@ -37,11 +37,12 @@ import * as request from 'request-promise-native';
|
|||
import urlJoin = require('url-join');
|
||||
import { GBAdminService } from '../../admin.gbapp/services/GBAdminService';
|
||||
import { GBDeployer } from '../../core.gbapp/services/GBDeployer';
|
||||
import { SecService } from '../../security.gbapp/services/SecService';
|
||||
import { DialogKeywords } from './DialogKeywords';
|
||||
const request = require('request-promise-native');
|
||||
const path = require('path');
|
||||
const sgMail = require('@sendgrid/mail');
|
||||
const ComputerVisionClient = require('@azure/cognitiveservices-computervision').ComputerVisionClient;
|
||||
const ApiKeyCredentials = require('@azure/ms-rest-js').ApiKeyCredentials;
|
||||
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
|
@ -80,6 +81,39 @@ export class SystemKeywords {
|
|||
return array.filter(function (item, pos) { return item; });
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @example SEE CAPTION OF url AS variable
|
||||
*
|
||||
*/
|
||||
public async seeCaption(url) {
|
||||
const computerVisionClient = new ComputerVisionClient(
|
||||
new ApiKeyCredentials({ inHeader: { 'Ocp-Apim-Subscription-Key': process.env.VISION_KEY } }),
|
||||
process.env.VISION_ENDPOINT);
|
||||
|
||||
const caption = (await computerVisionClient.describeImage(url)).captions[0];
|
||||
GBLog.info(`GBVision (caption): '${caption.text}' (Confidence: ${caption.confidence.toFixed(2)})`);
|
||||
return caption.text;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @example SEE TEXT OF url AS variable
|
||||
*
|
||||
*/
|
||||
public async seeText(url) {
|
||||
const computerVisionClient = new ComputerVisionClient(
|
||||
new ApiKeyCredentials({ inHeader: { 'Ocp-Apim-Subscription-Key': process.env.VISION_KEY } }),
|
||||
process.env.VISION_ENDPOINT);
|
||||
|
||||
const result = (await computerVisionClient.recognizePrintedText(true, url));
|
||||
const text = result.regions[0].lines[0].words[0].text;
|
||||
// TODO: Create loop to get entire text.
|
||||
GBLog.info(`GBVision (text): '${text}'`);
|
||||
return text;
|
||||
}
|
||||
|
||||
public async sortBy(array, memberName) {
|
||||
memberName = memberName.trim();
|
||||
const contentLocale = this.min.core.getParam<string>(
|
||||
|
|
|
@ -57,7 +57,6 @@ const { join } = require('path');
|
|||
const shell = require('any-shell-escape');
|
||||
const { exec } = require('child_process');
|
||||
const prism = require('prism-media');
|
||||
const uuidv4 = require('uuid/v4');
|
||||
const request = require('request-promise-native');
|
||||
const fs = require('fs');
|
||||
const SpeechToTextV1 = require('ibm-watson/speech-to-text/v1');
|
||||
|
@ -800,7 +799,7 @@ export class GBConversationalService {
|
|||
'Ocp-Apim-Subscription-Key': key,
|
||||
'Ocp-Apim-Subscription-Region': 'westeurope',
|
||||
'Content-type': 'application/json',
|
||||
'X-ClientTraceId': uuidv4().toString()
|
||||
'X-ClientTraceId': GBAdminService.generateUuid()
|
||||
},
|
||||
body: [
|
||||
{
|
||||
|
|
|
@ -43,7 +43,6 @@ const express = require('express');
|
|||
const child_process = require('child_process');
|
||||
const rimraf = require('rimraf');
|
||||
const request = require('request-promise-native');
|
||||
const uuidv4 = require('uuid/v4');
|
||||
import { GBError, GBLog, GBMinInstance, IGBCoreService, IGBDeployer, IGBInstance, IGBPackage } from 'botlib';
|
||||
import { AzureSearch } from 'pragmatismo-io-framework';
|
||||
import { CollectionUtil } from 'pragmatismo-io-framework';
|
||||
|
@ -58,6 +57,7 @@ import { GBImporter } from './GBImporterService';
|
|||
import { TeamsService } from '../../teams.gblib/services/TeamsService';
|
||||
const MicrosoftGraph = require('@microsoft/microsoft-graph-client');
|
||||
|
||||
|
||||
/**
|
||||
* Deployer service for bots, themes, ai and more.
|
||||
*/
|
||||
|
@ -363,7 +363,8 @@ export class GBDeployer implements IGBDeployer {
|
|||
public async getBotManifest(instance: IGBInstance): Promise<Buffer> {
|
||||
const s = new TeamsService();
|
||||
const manifest = await s.getManifest(instance.marketplaceId, instance.title, instance.description,
|
||||
uuidv4().toString(), instance.botId, "General Bots");
|
||||
GBAdminService.generateUuid(), instance.botId, "General Bots");
|
||||
|
||||
return await s.getAppFile(manifest);
|
||||
}
|
||||
|
||||
|
|
|
@ -212,12 +212,13 @@ export class KBService implements IGBKBService {
|
|||
});
|
||||
}
|
||||
if (!question) {
|
||||
question = await GuaribasQuestion.findOne({
|
||||
where: {
|
||||
instanceId: instanceId,
|
||||
content: { [Op.eq]: `${text}` }
|
||||
}
|
||||
});
|
||||
// TODO: Solve this compilation error.
|
||||
// question = await GuaribasQuestion.findOne({
|
||||
// where: {
|
||||
// instanceId: instanceId,
|
||||
// content: { [Op.eq]: `${text}` }
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
if (question !== null) {
|
||||
|
|
|
@ -80,9 +80,11 @@ export class GBServer {
|
|||
|
||||
public static run() {
|
||||
|
||||
|
||||
GBLog.info(`The Bot Server is in STARTING mode...`);
|
||||
GBServer.globals = new RootData();
|
||||
GBConfigService.init();
|
||||
|
||||
const port = GBConfigService.getServerPort();
|
||||
const server = express();
|
||||
GBServer.globals.server = server;
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
{
|
||||
"defaultSeverity": "warning",
|
||||
"extends": [
|
||||
"tslint:recommended",
|
||||
"tslint-microsoft-contrib"
|
||||
"tslint:recommended"
|
||||
],
|
||||
"linterOptions": {
|
||||
"exclude": [
|
||||
|
@ -13,7 +12,6 @@
|
|||
]
|
||||
},
|
||||
"rulesDirectory": [
|
||||
"node_modules/tslint-microsoft-contrib"
|
||||
],
|
||||
"jsRules": {},
|
||||
"rules": {
|
||||
|
|
Loading…
Add table
Reference in a new issue