mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-24 17:10:12 +08:00
fix(web): exclude <think> reasoning blocks from copied answer (#18371)
This commit is contained in:
@@ -108,6 +108,15 @@ export function replaceThinkToSection(
|
||||
return result;
|
||||
}
|
||||
|
||||
// Strip <think> reasoning blocks so only the answer text remains.
|
||||
// The second replace handles a streaming message whose block is still unclosed.
|
||||
export function removeThinkSection(text: string = '') {
|
||||
return text
|
||||
.replace(/<think>[\s\S]*?<\/think>/g, '')
|
||||
.replace(/<think>[\s\S]*$/, '')
|
||||
.trim();
|
||||
}
|
||||
|
||||
export function replaceRetrievingToSection(text: string = '') {
|
||||
const pattern = /<retrieving>([\s\S]*?)<\/retrieving>/g;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user