able-rocket-15603
01/05/2024, 5:23 AMworkflow.response
.
2) Check if bracket symbol in code is the same as output.
Copy and paste the brackets from your output and replace the ones in the code.
3) If above don't work, create 2 variables, one before change and one after change for trouble shooting.
Print both workflow.responseRaw & workflow.response
> // Extracting the first text value from the response data.
> let responseText = response.data.data[0].content[0].text.value
>
> workflow.responseRaw = responseText
>
> // delete everything between and including【】
> responseText = responseText.replace(/【.*?】/g, "")
>
> workflow.response = responseText
4) If above don't work, @quick-musician-29561 kindly shared the ultimate bug hunter. Link below.
https://discord.com/channels/1108396290624213082/1192699975990259822/1199027713583886406
.wide-oyster-38514
01/05/2024, 7:57 AMcrooked-van-25152
01/05/2024, 2:41 PMfierce-nest-17923
01/08/2024, 12:29 PMbest-army-74344
01/08/2024, 7:04 PMable-rocket-15603
01/09/2024, 1:55 PMfierce-nest-17923
01/09/2024, 4:20 PMfierce-nest-17923
01/09/2024, 4:23 PMfierce-nest-17923
01/09/2024, 4:25 PMable-rocket-15603
01/10/2024, 2:19 AMcrooked-van-25152
01/10/2024, 4:08 AMfierce-nest-17923
01/10/2024, 6:31 PMfierce-nest-17923
01/10/2024, 6:44 PMfierce-nest-17923
01/10/2024, 6:47 PMable-rocket-15603
01/11/2024, 5:41 AMbest-army-74344
01/11/2024, 1:48 PMbest-army-74344
01/11/2024, 1:49 PMfierce-nest-17923
01/11/2024, 8:18 PMtall-energy-47920
01/13/2024, 7:49 PMbest-army-74344
01/15/2024, 1:25 PMbest-army-74344
01/18/2024, 2:23 PMbest-army-74344
01/18/2024, 4:25 PMbest-army-74344
01/18/2024, 4:27 PMfresh-fireman-491
01/18/2024, 5:02 PMfresh-fireman-491
01/18/2024, 5:02 PMfresh-fireman-491
01/18/2024, 5:03 PMbest-army-74344
01/18/2024, 5:04 PMbest-army-74344
01/18/2024, 5:04 PMfresh-fireman-491
01/18/2024, 5:15 PMbest-army-74344
01/18/2024, 5:16 PMfresh-fireman-491
01/18/2024, 5:16 PMbest-army-74344
01/18/2024, 5:16 PMbest-army-74344
01/18/2024, 5:17 PMbest-army-74344
01/19/2024, 4:14 AMable-rocket-15603
01/19/2024, 7:46 AMworkflow.response
.
See image below.
2) If above don't work, check if bracket symbol in code is the same as output.
Copy and paste the brackets from your output and replace the ones in the code?
3) If above don't work, create 2 variables, one before change and one after change.
Print both. This is for trouble shooting.
workflow.responseRaw & workflow.response
> // Extracting the first text value from the response data.
> let responseText = response.data.data[0].content[0].text.value
>
> workflow.responseRaw = responseText
>
> // delete everything between and including【】
> responseText = responseText.replace(/【.*?】/g, "")
>
> workflow.response = responseTextable-rocket-15603
01/19/2024, 7:51 AMbest-army-74344
01/19/2024, 1:22 PMbest-army-74344
01/19/2024, 3:39 PMbest-army-74344
01/19/2024, 3:40 PMable-rocket-15603
01/20/2024, 6:28 AMbest-army-74344
01/22/2024, 3:15 PMquick-musician-29561
01/22/2024, 3:33 PMquick-musician-29561
01/22/2024, 3:44 PMquick-musician-29561
01/22/2024, 3:50 PMquick-musician-29561
01/22/2024, 3:55 PMquick-musician-29561
01/22/2024, 3:56 PMbest-army-74344
01/22/2024, 3:59 PMquick-musician-29561
01/22/2024, 4:03 PMquick-musician-29561
01/22/2024, 4:28 PMquick-musician-29561
01/22/2024, 4:28 PMjs
const response = await listMessages(session.threadID);
workflow.response = response.data.data[0].content[0].text.value
const regexBrackets = /【.?】/g;
workflow.response2 = workflow.response.replace(regexBrackets, "");
quick-musician-29561
01/22/2024, 4:28 PMquick-musician-29561
01/22/2024, 4:28 PMquick-musician-29561
01/22/2024, 4:29 PMjs
response.forEach(message => {
message.content.forEach(content => {
if (content.text && content.text.value) {
content.text.value = content.text.value.replace(/【.*?】/g, "");
}
});
});
quick-musician-29561
01/22/2024, 4:29 PMquick-musician-29561
01/22/2024, 4:30 PMjs
response.forEach(message => {
message.content.forEach(content => {
if (content.text && content.text.value) {
const regexZeroWidthSpace = //g;
content.text.value = content.text.value.replace(regexZeroWidthSpace, "");
const regexBrackets = /【.?】/g;
content.text.value = content.text.value.replace(regexBrackets, "");
}
});
});
mammoth-salesmen-78451
02/12/2024, 2:27 PMmammoth-salesmen-78451
02/12/2024, 5:34 PMmammoth-salesmen-78451
02/12/2024, 5:38 PMfresh-fireman-491
02/12/2024, 6:53 PMmammoth-salesmen-78451
02/13/2024, 7:01 PMable-rocket-15603
02/13/2024, 10:05 PMable-rocket-15603
02/13/2024, 10:05 PMmammoth-salesmen-78451
02/14/2024, 10:06 AMmammoth-salesmen-78451
02/14/2024, 6:56 PMable-rocket-15603
02/15/2024, 8:12 AMmammoth-salesmen-78451
02/16/2024, 7:27 PMmammoth-salesmen-78451
02/16/2024, 7:27 PMmammoth-salesmen-78451
02/16/2024, 7:28 PMmammoth-salesmen-78451
02/16/2024, 7:28 PMmammoth-salesmen-78451
02/16/2024, 7:29 PMenough-cat-65786
02/19/2024, 2:44 PMcrooked-van-25152
02/19/2024, 3:11 PMenough-cat-65786
02/20/2024, 11:13 AMmammoth-salesmen-78451
02/20/2024, 6:23 PMdelightful-ram-2501
03/13/2024, 10:40 PMdelightful-ram-2501
03/13/2024, 10:40 PMdelightful-ram-2501
03/13/2024, 10:40 PMdelightful-ram-2501
03/13/2024, 10:40 PMalert-activity-33578
03/17/2024, 12:38 AMdelightful-ram-2501
03/18/2024, 8:55 AMjolly-policeman-82775
04/04/2024, 11:01 AMjolly-policeman-82775
04/04/2024, 11:01 AMjolly-policeman-82775
04/04/2024, 11:01 AMjolly-policeman-82775
04/04/2024, 11:10 AMbest-army-74344
04/04/2024, 5:11 PMjolly-policeman-82775
04/04/2024, 5:29 PMjolly-policeman-82775
04/05/2024, 4:36 AMquick-musician-29561
04/05/2024, 4:40 AMjolly-policeman-82775
04/05/2024, 5:44 AMjolly-policeman-82775
04/05/2024, 5:44 AMjolly-policeman-82775
04/05/2024, 6:00 AMfresh-fireman-491
04/05/2024, 6:15 AMquick-musician-29561
04/05/2024, 6:18 AMjolly-policeman-82775
04/05/2024, 6:19 AMjolly-policeman-82775
04/05/2024, 6:19 AMquick-musician-29561
04/05/2024, 6:20 AMquick-musician-29561
04/05/2024, 6:20 AMjolly-policeman-82775
04/05/2024, 6:20 AMjolly-policeman-82775
04/05/2024, 6:21 AMjolly-policeman-82775
04/05/2024, 6:21 AMquick-musician-29561
04/05/2024, 6:21 AMjolly-policeman-82775
04/05/2024, 6:21 AMjolly-policeman-82775
04/05/2024, 6:21 AMjolly-policeman-82775
04/05/2024, 6:22 AMjolly-policeman-82775
04/05/2024, 6:23 AMquick-musician-29561
04/05/2024, 6:24 AMquick-musician-29561
04/05/2024, 6:25 AMjolly-policeman-82775
04/05/2024, 6:25 AMjolly-policeman-82775
04/05/2024, 6:25 AMquick-musician-29561
04/05/2024, 6:31 AMjolly-policeman-82775
04/05/2024, 6:32 AMjolly-policeman-82775
04/05/2024, 6:32 AMjolly-policeman-82775
04/05/2024, 6:39 AMjolly-policeman-82775
04/05/2024, 6:39 AMjolly-policeman-82775
04/05/2024, 6:39 AMquick-musician-29561
04/05/2024, 6:41 AMquick-musician-29561
04/05/2024, 6:42 AMquick-musician-29561
04/05/2024, 6:44 AMjolly-policeman-82775
04/05/2024, 6:48 AMquick-musician-29561
04/05/2024, 6:51 AMjs
const response = await bot.retryingAxiosRequest({
method: 'get',
maxBodyLength: Infinity,
url: `https://api.openai.com/v1/threads/${workflow.threadId}/messages`,
headers: {
'OpenAI-Beta': 'assistants=v1',
Authorization: `Bearer ${env.openAIToken}`,
'Content-Type': 'application/json'
}
})
console.log('message', JSON.stringify(response.data))
// CHANGED AFTER THIS
const removeSources = response.data.data[0].content[0].text.value
const regexBrackets = /【.?】/g;
workflow.response = removeSources.replace(regexBrackets, "");
Now it removed the '23+ source' in the end
https://cdn.discordapp.com/attachments/1192699975990259822/1225699365423943720/image.png?ex=6622147d&is=660f9f7d&hm=014de61a3dab5b40d94a7cc29ceea3e38f8affae3f986569c17f1d1225b08814&quick-musician-29561
04/05/2024, 6:52 AMquick-musician-29561
04/05/2024, 6:53 AMquick-musician-29561
04/05/2024, 6:55 AMquick-musician-29561
04/05/2024, 2:20 PMquick-musician-29561
04/05/2024, 2:22 PMjs
workflow.response = response.data.data[0].content[0].text.value
to this
js
const removeSources = response.data.data[0].content[0].text.value
const regexBrackets = /【.?】/g;
workflow.response = removeSources.replace(regexBrackets, "");
best-army-74344
04/22/2024, 1:16 PMbest-army-74344
04/22/2024, 2:02 PMbest-army-74344
04/23/2024, 3:16 AM