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) => ({
|
||||
name: String(option),
|
||||
name: JSON.stringify(option),
|
||||
value: option
|
||||
}))
|
||||
return select({ message: 'Pick one output:', choices })
|
||||
|
@ -66,7 +66,7 @@ export class HumanFeedbackMechanismCLI<
|
|||
}
|
||||
|
||||
const choices = response.map((option) => ({
|
||||
name: String(option),
|
||||
name: JSON.stringify(option),
|
||||
value: option
|
||||
}))
|
||||
return checkbox({ message: 'Select outputs:', choices }) as any
|
||||
|
|
|
@ -82,7 +82,9 @@ export class HumanFeedbackMechanismSlack<
|
|||
await this._slackClient.sendAndWaitForReply({
|
||||
text:
|
||||
'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.',
|
||||
validate: (slackMessage) => {
|
||||
const choice = parseInt(slackMessage.text)
|
||||
|
@ -103,7 +105,9 @@ export class HumanFeedbackMechanismSlack<
|
|||
await this._slackClient.sendAndWaitForReply({
|
||||
text:
|
||||
'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.',
|
||||
validate: (slackMessage) => {
|
||||
const choices = slackMessage.text.split(',')
|
||||
|
|
|
@ -86,7 +86,7 @@ export class HumanFeedbackMechanismTwilio<
|
|||
name: 'human-feedback-select',
|
||||
text:
|
||||
'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.',
|
||||
validate: (message) => {
|
||||
const choice = parseInt(message.body)
|
||||
|
@ -108,7 +108,7 @@ export class HumanFeedbackMechanismTwilio<
|
|||
name: 'human-feedback-select',
|
||||
text:
|
||||
'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.',
|
||||
validate: (message) => {
|
||||
const choices = message.body.split(',')
|
||||
|
|
Ładowanie…
Reference in New Issue