mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-06 16:07:17 +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 {
|
try {
|
||||||
const rawMarkdownText = res?.message?.content
|
const rawMarkdownText = res?.message?.content
|
||||||
textToSend = JSON.parse(rawMarkdownText.replace(/^```json/m, '').replace(/```$/m, ''))?.response
|
textToSend = JSON.parse(rawMarkdownText.replace(/^```json/m, '').replace(/```$/m, ''))?.response
|
||||||
|
textToSend = textToSend?.replace(/。$/, '')
|
||||||
if (!textToSend) {
|
if (!textToSend) {
|
||||||
throw new Error(`empty content. ${err?.message} ${res?.message?.content}`)
|
throw new Error(`empty content. ${err?.message} ${res?.message?.content}`)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user