@@ -427,14 +427,23 @@ func (s *CharacterService) processRegexScriptsFromExtensions(userID, characterID
|
||||
OwnerCharID: &characterID,
|
||||
}
|
||||
|
||||
// 提取字段
|
||||
if name, ok := scriptData["name"].(string); ok {
|
||||
// 提取字段 - 兼容 SillyTavern 的字段名
|
||||
// 脚本名称:优先使用 scriptName,其次 name
|
||||
if scriptName, ok := scriptData["scriptName"].(string); ok {
|
||||
script.Name = scriptName
|
||||
} else if name, ok := scriptData["name"].(string); ok {
|
||||
script.Name = name
|
||||
}
|
||||
|
||||
// 查找正则表达式
|
||||
if findRegex, ok := scriptData["findRegex"].(string); ok {
|
||||
script.FindRegex = findRegex
|
||||
}
|
||||
if replaceWith, ok := scriptData["replaceWith"].(string); ok {
|
||||
|
||||
// 替换字符串:优先使用 replaceString,其次 replaceWith
|
||||
if replaceString, ok := scriptData["replaceString"].(string); ok {
|
||||
script.ReplaceWith = replaceString
|
||||
} else if replaceWith, ok := scriptData["replaceWith"].(string); ok {
|
||||
script.ReplaceWith = replaceWith
|
||||
}
|
||||
if placement, ok := scriptData["placement"].(float64); ok {
|
||||
|
||||
Reference in New Issue
Block a user