refactor: improve error handling and response formatting in API

This commit is contained in:
yusing
2025-05-03 17:41:10 +08:00
parent 82c829de18
commit 98e90d7a0b
31 changed files with 657 additions and 185 deletions

View File

@@ -1,6 +1,8 @@
package ansi
import "regexp"
import (
"regexp"
)
var ansiRegexp = regexp.MustCompile(`\x1b\[[0-9;]*m`)
@@ -43,11 +45,3 @@ func WithANSI(s string, ansi string) string {
func StripANSI(s string) string {
return ansiRegexp.ReplaceAllString(s, "")
}
var ToHTMLClass = map[string]string{
"[91": "log-red",
"[92": "log-green",
"[93": "log-yellow",
"[96": "log-cyan",
"[97": "log-white",
}