| } | } | ||||
| export const preprocessThinkTag = (content: string) => { | export const preprocessThinkTag = (content: string) => { | ||||
| const thinkOpenTagRegex = /<think>\n/g | |||||
| const thinkOpenTagRegex = /(<think>\n)+/g | |||||
| const thinkCloseTagRegex = /\n<\/think>/g | const thinkCloseTagRegex = /\n<\/think>/g | ||||
| return flow([ | return flow([ | ||||
| (str: string) => str.replace(thinkOpenTagRegex, '<details data-think=true>\n'), | (str: string) => str.replace(thinkOpenTagRegex, '<details data-think=true>\n'), |