转译控制字符

This commit is contained in:
Pan Qiancheng 2025-04-15 15:31:28 +08:00
parent 3d3a3cee40
commit 9c14e806dc
1 changed files with 6 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import (
"encoding/binary"
"net"
"os"
"strings"
"time"
)
@ -179,6 +180,11 @@ func (t *UnixSocketTask) handleConnection(conn net.Conn) {
loading = false // 停止加载动画
t.writeMessage(conn, "\r")
}
// 替换控制标记
question = strings.ReplaceAll(question, "[end]", "[/end]")
question = strings.ReplaceAll(question, "[sthttp]", "[/sthttp]")
// 当收到非空question时发送[res]响应
res := constants.ColorGreen + question + constants.ColorBlue
logger.Debug("write: %s", res)