Commit 19dc6853 by Ford

修改了WorldChat支持高并发,加了协程。

parent 03e12793
...@@ -1084,6 +1084,7 @@ func ExtractRating(response WorldEchoResponse) (int, error) { ...@@ -1084,6 +1084,7 @@ func ExtractRating(response WorldEchoResponse) (int, error) {
return 0, fmt.Errorf("未找到评分信息") return 0, fmt.Errorf("未找到评分信息")
} }
func ExtractRating1(response WorldEchoResponse) string { func ExtractRating1(response WorldEchoResponse) string {
endStr, ok := response.WObj["EndStr"].(string) endStr, ok := response.WObj["EndStr"].(string)
...@@ -1127,7 +1128,7 @@ func ParseEndStrAndReformat(response *WorldSoulReplyMsg) *WorldSoulReplyMsg { ...@@ -1127,7 +1128,7 @@ func ParseEndStrAndReformat(response *WorldSoulReplyMsg) *WorldSoulReplyMsg {
// 解析 "EndStr" 中的详细字段 // 解析 "EndStr" 中的详细字段
title := strings.Split(endStr, "@")[0] // 提取 '@' 前的标题 title := strings.Split(endStr, "@")[0] // 提取 '@' 前的标题
overallScore := extractBetween(endStr, "【整体评分】:", "\n") // 提取整体评分 overallScore := extractBetween(endStr, "【整体评分】:", "\n") // 提取整体评分
objectiveEvaluation := extractToEnd(endStr, "【客观评价】:") // 提取客观评价至字符串末尾 objectiveEvaluation := extractBetween(endStr, "【客观评价】:", "## 【整体评分】") // 提取客观评价至字符串末尾
// 将 "EndStr" 结构化为 JSON 对象 // 将 "EndStr" 结构化为 JSON 对象
endStrObj := map[string]interface{}{ endStrObj := map[string]interface{}{
...@@ -1152,7 +1153,10 @@ func ParseEndStrAndReformat(response *WorldSoulReplyMsg) *WorldSoulReplyMsg { ...@@ -1152,7 +1153,10 @@ func ParseEndStrAndReformat(response *WorldSoulReplyMsg) *WorldSoulReplyMsg {
newResponse.WObj["emotion"] = emotion newResponse.WObj["emotion"] = emotion
delete(newResponse.WObj, "表情") delete(newResponse.WObj, "表情")
} }
if chatTime, exists := newResponse.WObj["时间"]; exists {
newResponse.WObj["time"] = chatTime
delete(newResponse.WObj, "时间")
}
return &newResponse // 返回修改后的新响应体 return &newResponse // 返回修改后的新响应体
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment