kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
fix: serialize object elements to JSON for messages
rodzic
d02af15fbf
commit
fd253b2ef0
|
@ -52,7 +52,7 @@ export class HumanFeedbackMechanismCLI<
|
||||||
}
|
}
|
||||||
|
|
||||||
const choices = response.map((option) => ({
|
const choices = response.map((option) => ({
|
||||||
name: String(option),
|
name: JSON.stringify(option),
|
||||||
value: option
|
value: option
|
||||||
}))
|
}))
|
||||||
return select({ message: 'Pick one output:', choices })
|
return select({ message: 'Pick one output:', choices })
|
||||||
|
@ -66,7 +66,7 @@ export class HumanFeedbackMechanismCLI<
|
||||||
}
|
}
|
||||||
|
|
||||||
const choices = response.map((option) => ({
|
const choices = response.map((option) => ({
|
||||||
name: String(option),
|
name: JSON.stringify(option),
|
||||||
value: option
|
value: option
|
||||||
}))
|
}))
|
||||||
return checkbox({ message: 'Select outputs:', choices }) as any
|
return checkbox({ message: 'Select outputs:', choices }) as any
|
||||||
|
|
|
@ -82,7 +82,9 @@ export class HumanFeedbackMechanismSlack<
|
||||||
await this._slackClient.sendAndWaitForReply({
|
await this._slackClient.sendAndWaitForReply({
|
||||||
text:
|
text:
|
||||||
'Pick one output:' +
|
'Pick one output:' +
|
||||||
response.map((r, idx) => `\n*${idx}* - ${r}`).join('') +
|
response
|
||||||
|
.map((r, idx) => `\n*${idx}* - ${JSON.stringify(r)}`)
|
||||||
|
.join('') +
|
||||||
'\n\nReply with the number of your choice.',
|
'\n\nReply with the number of your choice.',
|
||||||
validate: (slackMessage) => {
|
validate: (slackMessage) => {
|
||||||
const choice = parseInt(slackMessage.text)
|
const choice = parseInt(slackMessage.text)
|
||||||
|
@ -103,7 +105,9 @@ export class HumanFeedbackMechanismSlack<
|
||||||
await this._slackClient.sendAndWaitForReply({
|
await this._slackClient.sendAndWaitForReply({
|
||||||
text:
|
text:
|
||||||
'Select outputs:' +
|
'Select outputs:' +
|
||||||
response.map((r, idx) => `\n*${idx}* - ${r}`).join('') +
|
response
|
||||||
|
.map((r, idx) => `\n*${idx}* - ${JSON.stringify(r)}`)
|
||||||
|
.join('') +
|
||||||
'\n\nReply with a comma-separated list of the output numbers of your choice.',
|
'\n\nReply with a comma-separated list of the output numbers of your choice.',
|
||||||
validate: (slackMessage) => {
|
validate: (slackMessage) => {
|
||||||
const choices = slackMessage.text.split(',')
|
const choices = slackMessage.text.split(',')
|
||||||
|
|
|
@ -86,7 +86,7 @@ export class HumanFeedbackMechanismTwilio<
|
||||||
name: 'human-feedback-select',
|
name: 'human-feedback-select',
|
||||||
text:
|
text:
|
||||||
'Pick one output:' +
|
'Pick one output:' +
|
||||||
response.map((r, idx) => `\n${idx} - ${r}`).join('') +
|
response.map((r, idx) => `\n${idx} - ${JSON.stringify(r)}`).join('') +
|
||||||
'\n\nReply with the number of your choice.',
|
'\n\nReply with the number of your choice.',
|
||||||
validate: (message) => {
|
validate: (message) => {
|
||||||
const choice = parseInt(message.body)
|
const choice = parseInt(message.body)
|
||||||
|
@ -108,7 +108,7 @@ export class HumanFeedbackMechanismTwilio<
|
||||||
name: 'human-feedback-select',
|
name: 'human-feedback-select',
|
||||||
text:
|
text:
|
||||||
'Select outputs:' +
|
'Select outputs:' +
|
||||||
response.map((r, idx) => `\n${idx} - ${r}`).join('') +
|
response.map((r, idx) => `\n${idx} - ${JSON.stringify(r)}`).join('') +
|
||||||
'\n\nReply with a comma-separated list of the output numbers of your choice.',
|
'\n\nReply with a comma-separated list of the output numbers of your choice.',
|
||||||
validate: (message) => {
|
validate: (message) => {
|
||||||
const choices = message.body.split(',')
|
const choices = message.body.split(',')
|
||||||
|
|
Ładowanie…
Reference in New Issue