Skip to content

Commit

Permalink
Merge pull request #43 from SkywardAI/json-output-fix
Browse files Browse the repository at this point in the history
fix json output bugs
  • Loading branch information
cbh778899 authored Jul 17, 2024
2 parents 49d1227 + a5dfa88 commit aa705b8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/conversationFormat.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ export function formatJSON(conversation, {createdAt, name}) {
"createdAt": "${createdAt}",
"title": "${name}",
"history": [
${conversation.history.map(({type, message})=>{
return `{ "type": "${type}", "message": "${message.replaceAll('"', '\\"').replaceAll("\n", "\\n")}" }`
${conversation.history.map(({role, message})=>{
return `{ "role": "${role}", "message": "${message.replaceAll('\\', '\\\\').replaceAll('"', '\\"').replaceAll("\n", "\\n")}" }`
}).join(`,\n${" ".repeat(12)}`)}
]
}
Expand Down

0 comments on commit aa705b8

Please sign in to comment.