Skip to content

Commit

Permalink
minor change
Browse files Browse the repository at this point in the history
  • Loading branch information
iceljc committed Oct 1, 2024
1 parent 5ee7678 commit 0f51dac
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/routes/chat/[agentId]/[conversationId]/chat-box.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,8 @@
autoScrollLog = true;
clearInstantLogs();
renewUserSentMessages(msgText);
const agentId = params.agentId;
const convId = conversationId || params.conversationId;
let postback = data?.postback;
if (!postback) {
Expand All @@ -530,7 +532,7 @@
if (files?.length > 0 && !!!messageData.inputMessageId) {
const filePayload = buildFilePayload(files);
return new Promise((resolve, reject) => {
uploadConversationFiles(params.agentId, conversationId || params.conversationId, files).then(resMessageId => {
uploadConversationFiles(agentId, convId, files).then(resMessageId => {
messageData = { ...messageData, inputMessageId: resMessageId };
if (!!filePayload) {
messageData = {
Expand All @@ -543,7 +545,7 @@
};
}
sendMessageToHub(params.agentId, conversationId || params.conversationId, msgText, messageData).then(res => {
sendMessageToHub(agentId, convId, msgText, messageData).then(res => {
resolve(res);
}).catch(err => {
reject(err);
Expand All @@ -556,7 +558,7 @@
} else {
return new Promise((resolve, reject) => {
if (!!messageData?.inputMessageId) {
getConversationFiles(params.conversationId, messageData.inputMessageId, FileSourceType.User).then(retFiles => {
getConversationFiles(convId, messageData.inputMessageId, FileSourceType.User).then(retFiles => {
const filePayload = buildFilePayload(retFiles);
if (!!filePayload) {
messageData = {
Expand All @@ -569,7 +571,7 @@
};
}
sendMessageToHub(params.agentId, conversationId || params.conversationId, msgText, messageData).then(res => {
sendMessageToHub(agentId, convId, msgText, messageData).then(res => {
resolve(res);
}).catch(err => {
reject(err);
Expand All @@ -579,7 +581,7 @@
});
});
} else {
sendMessageToHub(params.agentId, conversationId || params.conversationId, msgText, messageData).then(res => {
sendMessageToHub(agentId, convId, msgText, messageData).then(res => {
resolve(res);
}).catch(err => {
reject(err);
Expand Down

0 comments on commit 0f51dac

Please sign in to comment.