remove the tailing 。for text generated by ai

This commit is contained in:
geekgeekrun
2025-04-19 14:52:13 +08:00
parent f7fb551582
commit dc293f4f91

View File

@@ -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}`)
}