mirror of
https://github.com/wassname/chatGPTBox.git
synced 2026-08-14 12:10:31 +08:00
refactor: getConversationPairs and promptBase
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
export function getConversationPairs(records, isChatgpt) {
|
||||
export function getConversationPairs(records, isCompletion) {
|
||||
let pairs
|
||||
if (isChatgpt) {
|
||||
if (isCompletion) {
|
||||
pairs = ''
|
||||
for (const record of records) {
|
||||
pairs += 'Human: ' + record.question + '\nAI: ' + record.answer + '\n'
|
||||
}
|
||||
} else {
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user