fix: delete first message then regenerate again will break the thread (#1015)

This commit is contained in:
Louis 2023-12-15 09:57:06 +07:00 committed by GitHub
parent 305d0427a4
commit bcc9bd6997
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -124,7 +124,8 @@ export default class JSONConversationalExtension
await fs.mkdir(threadDirPath)
await fs.writeFile(
threadMessagePath,
messages.map((msg) => JSON.stringify(msg)).join('\n') + '\n'
messages.map((msg) => JSON.stringify(msg)).join('\n') +
(messages.length > 1 ? '\n' : '')
)
Promise.resolve()
} catch (err) {