fix(core.gbapp): Fix in undeploy and markdown processsing.

This commit is contained in:
Rodrigo Rodriguez 2020-04-03 02:50:33 -03:00
parent 134cf31695
commit b477c46d9c
2 changed files with 38 additions and 14 deletions

View file

@ -151,6 +151,8 @@ export class GBConversationalService implements IGBConversationalService {
InEmbedAddressBegin, InEmbedAddressBegin,
InEmbedAddressEnd, InEmbedAddressEnd,
InLineBreak, InLineBreak,
InLineBreak1,
InLineBreak2,
}; };
let state = State.InText; let state = State.InText;
let currentImage = ''; let currentImage = '';
@ -164,35 +166,57 @@ export class GBConversationalService implements IGBConversationalService {
switch (state) { switch (state) {
case State.InText: case State.InText:
if (c === '!') { if (c === '!') {
state = State.InImageBegin; state = State.InImageBegin;
} }
else if (c === '[') { else if (c === '[') {
state = State.InEmbedBegin; state = State.InEmbedBegin;
} }
else if (c === '\n') { else if (c === '\n') {
state = State.InLineBreak; state = State.InLineBreak;
} }
else { else {
state = State.InText;
currentText = currentText.concat(c); currentText = currentText.concat(c);
} }
break; break;
case State.InLineBreak: case State.InLineBreak:
if (c === '\n') { if (c === '\n') {
if (currentText !== '') { state = State.InLineBreak1;
if (mobile === null) { }
await step.context.sendActivity(currentText); else if (c === '!') {
} state = State.InImageBegin;
else { }
this.sendToMobile(min, mobile, currentText); else if (c === '[') {
} state = State.InEmbedBegin;
await sleep(3000); } else {
currentText = currentText.concat('\n', c);
state = State.InText;
}
break;
case State.InLineBreak1:
if (c === '\n') {
if (mobile === null) {
await step.context.sendActivity(currentText);
} }
else {
this.sendToMobile(min, mobile, currentText);
}
await sleep(3000);
currentText = ''; currentText = '';
state = State.InText; state = State.InText;
} }
break; else if (c === '!') {
state = State.InImageBegin;
}
else if (c === '[') {
state = State.InEmbedBegin;
} else {
currentText = currentText.concat('\n', '\n', c);
state = State.InText;
}
break;
case State.InEmbedBegin: case State.InEmbedBegin:
if (c === '=') { if (c === '=') {
if (currentText !== '') { if (currentText !== '') {
@ -207,7 +231,7 @@ export class GBConversationalService implements IGBConversationalService {
currentText = ''; currentText = '';
state = State.InEmbedAddressBegin; state = State.InEmbedAddressBegin;
} }
break; break;
case State.InEmbedAddressBegin: case State.InEmbedAddressBegin:
if (c === ']') { if (c === ']') {
@ -217,7 +241,7 @@ export class GBConversationalService implements IGBConversationalService {
await sleep(5000); await sleep(5000);
currentEmbedUrl = ''; currentEmbedUrl = '';
} }
else{ else {
currentEmbedUrl = currentEmbedUrl.concat(c); currentEmbedUrl = currentEmbedUrl.concat(c);
} }
break; break;

View file

@ -338,7 +338,7 @@ export class GBDeployer implements IGBDeployer {
case '.gbkb': case '.gbkb':
const service = new KBService(this.core.sequelize); const service = new KBService(this.core.sequelize);
return service.undeployKbFromStorage(instance, this, p.packageId); return await service.undeployKbFromStorage(instance, this, p.packageId);
case '.gbui': case '.gbui':