mirror of
https://github.com/wassname/chatGPTBox.git
synced 2026-06-27 16:29:50 +08:00
18 lines
443 B
JavaScript
18 lines
443 B
JavaScript
export function getConversationPairs(records, isChatgpt) {
|
|
let pairs
|
|
if (isChatgpt) {
|
|
pairs = []
|
|
for (const record of records) {
|
|
pairs.push({ role: 'user', content: record['question'] })
|
|
pairs.push({ role: 'assistant', content: record['answer'] })
|
|
}
|
|
} else {
|
|
pairs = ''
|
|
for (const record of records) {
|
|
pairs += 'Human:' + record.question + '\nAI:' + record.answer + '\n'
|
|
}
|
|
}
|
|
|
|
return pairs
|
|
}
|