mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-11-01 07:02:55 +00:00
22 lines
747 B
TypeScript
22 lines
747 B
TypeScript
/**
|
||
* Fixes incorrectly escaped HTML entities in AI model outputs
|
||
* @param text String potentially containing incorrectly escaped HTML entities from AI models
|
||
* @returns String with HTML entities converted back to normal characters
|
||
*/
|
||
export function fixModelHtmlEscaping(text: string): string {
|
||
return text
|
||
.replace(/>/g, ">")
|
||
.replace(/</g, "<")
|
||
.replace(/"/g, '"')
|
||
.replace(/&/g, "&")
|
||
.replace(/'/g, "'")
|
||
}
|
||
|
||
/**
|
||
* Removes invalid characters (like the replacement character <20>) from a string
|
||
* @param text String potentially containing invalid characters
|
||
* @returns String with invalid characters removed
|
||
*/
|
||
export function removeInvalidChars(text: string): string {
|
||
return text.replace(/\uFFFD/g, "")
|
||
}
|