|
508 | 508 | autoScrollLog = true; |
509 | 509 | clearInstantLogs(); |
510 | 510 | renewUserSentMessages(msgText); |
| 511 | + const agentId = params.agentId; |
| 512 | + const convId = conversationId || params.conversationId; |
511 | 513 |
|
512 | 514 | let postback = data?.postback; |
513 | 515 | if (!postback) { |
|
530 | 532 | if (files?.length > 0 && !!!messageData.inputMessageId) { |
531 | 533 | const filePayload = buildFilePayload(files); |
532 | 534 | return new Promise((resolve, reject) => { |
533 | | - uploadConversationFiles(params.agentId, conversationId || params.conversationId, files).then(resMessageId => { |
| 535 | + uploadConversationFiles(agentId, convId, files).then(resMessageId => { |
534 | 536 | messageData = { ...messageData, inputMessageId: resMessageId }; |
535 | 537 | if (!!filePayload) { |
536 | 538 | messageData = { |
|
543 | 545 | }; |
544 | 546 | } |
545 | 547 |
|
546 | | - sendMessageToHub(params.agentId, conversationId || params.conversationId, msgText, messageData).then(res => { |
| 548 | + sendMessageToHub(agentId, convId, msgText, messageData).then(res => { |
547 | 549 | resolve(res); |
548 | 550 | }).catch(err => { |
549 | 551 | reject(err); |
|
556 | 558 | } else { |
557 | 559 | return new Promise((resolve, reject) => { |
558 | 560 | if (!!messageData?.inputMessageId) { |
559 | | - getConversationFiles(params.conversationId, messageData.inputMessageId, FileSourceType.User).then(retFiles => { |
| 561 | + getConversationFiles(convId, messageData.inputMessageId, FileSourceType.User).then(retFiles => { |
560 | 562 | const filePayload = buildFilePayload(retFiles); |
561 | 563 | if (!!filePayload) { |
562 | 564 | messageData = { |
|
569 | 571 | }; |
570 | 572 | } |
571 | 573 |
|
572 | | - sendMessageToHub(params.agentId, conversationId || params.conversationId, msgText, messageData).then(res => { |
| 574 | + sendMessageToHub(agentId, convId, msgText, messageData).then(res => { |
573 | 575 | resolve(res); |
574 | 576 | }).catch(err => { |
575 | 577 | reject(err); |
|
579 | 581 | }); |
580 | 582 | }); |
581 | 583 | } else { |
582 | | - sendMessageToHub(params.agentId, conversationId || params.conversationId, msgText, messageData).then(res => { |
| 584 | + sendMessageToHub(agentId, convId, msgText, messageData).then(res => { |
583 | 585 | resolve(res); |
584 | 586 | }).catch(err => { |
585 | 587 | reject(err); |
|
0 commit comments