mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-05-25 10:10:13 +08:00
remove the tailing 。for text generated by ai
This commit is contained in:
@@ -204,6 +204,7 @@ export const sendGptContent = async (page: Page, chatRecords) => {
|
||||
try {
|
||||
const rawMarkdownText = res?.message?.content
|
||||
textToSend = JSON.parse(rawMarkdownText.replace(/^```json/m, '').replace(/```$/m, ''))?.response
|
||||
textToSend = textToSend?.replace(/。$/, '')
|
||||
if (!textToSend) {
|
||||
throw new Error(`empty content. ${err?.message} ${res?.message?.content}`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user