diff --git a/README.md b/README.md index 5ec6245954..e5b57e36c0 100644 --- a/README.md +++ b/README.md @@ -949,14 +949,6 @@ print("run[CQ:image,file="+j["img"]+"]") - [x] 符号说明: C5是中央C,后面不写数字,默认接5,Cb6<1,b代表降调,#代表升调,6比5高八度,<1代表音长×2,<3代表音长×8,<-1代表音长×0.5,<-3代表音长×0.125,R是休止符 - -
- 日韩 VITS 模型拟声 - - `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/moegoe"` - - - [x] 让[派蒙|空|荧|阿贝多|枫原万叶|温迪|八重神子|纳西妲|钟离|诺艾尔|凝光|托马|北斗|莫娜|荒泷一斗|提纳里|芭芭拉|艾尔海森|雷电将军|赛诺|琴|班尼特|五郎|神里绫华|迪希雅|夜兰|辛焱|安柏|宵宫|云堇|妮露|烟绯|鹿野院平藏|凯亚|达达利亚|迪卢克|可莉|早柚|香菱|重云|刻晴|久岐忍|珊瑚宫心海|迪奥娜|戴因斯雷布|魈|神里绫人|丽莎|优菈|凯瑟琳|雷泽|菲谢尔|九条裟罗|甘雨|行秋|胡桃|迪娜泽黛|柯莱|申鹤|砂糖|萍姥姥|奥兹|罗莎莉亚|式大将|哲平|坎蒂丝|托克|留云借风真君|昆钧|塞琉斯|多莉|大肉丸|莱依拉|散兵|拉赫曼|杜拉夫|阿守|玛乔丽|纳比尔|海芭夏|九条镰治|阿娜耶|阿晃|阿扎尔|七七|博士|白术|埃洛伊|大慈树王|女士|丽塔|失落迷迭|缭乱星棘|伊甸|伏特加女孩|狂热蓝调|莉莉娅|萝莎莉娅|八重樱|八重霞|卡莲|第六夜想曲|卡萝尔|姬子|极地战刃|布洛妮娅|次生银翼|理之律者|迷城骇兔|希儿|魇夜星渊|黑希儿|帕朵菲莉丝|天元骑英|幽兰黛尔|德丽莎|月下初拥|朔夜观星|暮光骑士|明日香|李素裳|格蕾修|梅比乌斯|渡鸦|人之律者|爱莉希雅|爱衣|天穹游侠|琪亚娜|空之律者|薪炎之律者|云墨丹心|符华|识之律者|维尔薇|芽衣|雷之律者|阿波尼亚]说(中文) -
摸鱼 diff --git a/go.mod b/go.mod index a42030ec69..82e5c91946 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/Baidu-AIP/golang-sdk v1.1.1 - github.com/FloatTech/AnimeAPI v1.7.1-0.20241106140713-04a12240c99c + github.com/FloatTech/AnimeAPI v1.7.1-0.20241106152938-2a63f2f5f8ce github.com/FloatTech/floatbox v0.0.0-20241106130736-5aea0a935024 github.com/FloatTech/gg v1.1.3 github.com/FloatTech/imgfactory v0.2.2-0.20230413152719-e101cc3606ef diff --git a/go.sum b/go.sum index ed1950d772..6c3888e2e7 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ github.com/Baidu-AIP/golang-sdk v1.1.1 h1:RQsAmgDSAkiq22I6n7XJ2t3afgzFeqjY46FGhvrx4cw= github.com/Baidu-AIP/golang-sdk v1.1.1/go.mod h1:bXnGw7xPeKt8aF7UCELKrV6UZ/46spItONK1RQBQj1Y= github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= -github.com/FloatTech/AnimeAPI v1.7.1-0.20241106140713-04a12240c99c h1:AxcdfANP8yzj6FTRZwVPOIZdep1NZs2t6ypzt9hd82A= -github.com/FloatTech/AnimeAPI v1.7.1-0.20241106140713-04a12240c99c/go.mod h1:PLvoLJU+v3/44UXtixfcjVrnXeK4H9m9cRCsmXA4+l8= +github.com/FloatTech/AnimeAPI v1.7.1-0.20241106152938-2a63f2f5f8ce h1:qdCHsbiClRabCgaqlnpnwzgCZhJLzc5jxhRgpNbe4Uc= +github.com/FloatTech/AnimeAPI v1.7.1-0.20241106152938-2a63f2f5f8ce/go.mod h1:PLvoLJU+v3/44UXtixfcjVrnXeK4H9m9cRCsmXA4+l8= github.com/FloatTech/floatbox v0.0.0-20241106130736-5aea0a935024 h1:mrvWpiwfRklt9AyiQjKgDGJjf4YL6FZ3yC+ydbkuF2o= github.com/FloatTech/floatbox v0.0.0-20241106130736-5aea0a935024/go.mod h1:+P3hs+Cvl10/Aj3SNE96TuBvKAXCe+XD1pKphTZyiwk= github.com/FloatTech/gg v1.1.3 h1:+GlL02lTKsxJQr4WCuNwVxC1/eBZrCvypCIBtxuOFb4= diff --git a/main.go b/main.go index 28ebcdae61..9bf8b1f493 100644 --- a/main.go +++ b/main.go @@ -108,7 +108,6 @@ import ( _ "github.com/FloatTech/ZeroBot-Plugin/plugin/magicprompt" // magicprompt吟唱提示 _ "github.com/FloatTech/ZeroBot-Plugin/plugin/mcfish" // 钓鱼模拟器 _ "github.com/FloatTech/ZeroBot-Plugin/plugin/midicreate" // 简易midi音乐制作 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/moegoe" // 日韩 VITS 模型拟声 _ "github.com/FloatTech/ZeroBot-Plugin/plugin/moyu" // 摸鱼 _ "github.com/FloatTech/ZeroBot-Plugin/plugin/moyucalendar" // 摸鱼人日历 _ "github.com/FloatTech/ZeroBot-Plugin/plugin/music" // 点歌 diff --git a/plugin/aireply/ai_tts.go b/plugin/aireply/ai_tts.go index 5706cfb42b..51f230bab8 100644 --- a/plugin/aireply/ai_tts.go +++ b/plugin/aireply/ai_tts.go @@ -10,7 +10,6 @@ import ( "github.com/FloatTech/AnimeAPI/aireply" "github.com/FloatTech/AnimeAPI/tts" "github.com/FloatTech/AnimeAPI/tts/baidutts" - "github.com/FloatTech/AnimeAPI/tts/genshin" "github.com/FloatTech/AnimeAPI/tts/lolimi" "github.com/FloatTech/AnimeAPI/tts/ttscn" ctrl "github.com/FloatTech/zbpctrl" @@ -118,15 +117,15 @@ func (r replymode) getReplyMode(ctx *zero.Ctx) aireply.AIReply { var ttsins = func() map[string]tts.TTS { m := make(map[string]tts.TTS, 512) - for _, mode := range append(genshin.SoundList[:], extrattsname...) { + for _, mode := range extrattsname { m[mode] = nil } return m }() var ttsModes = func() []string { - s := append(genshin.SoundList[:], make([]string, baiduttsindex-len(genshin.SoundList))...) // 0-200 - s = append(s, extrattsname...) // 201 202 ... + s := make([]string, baiduttsindex) // 0-200 + s = append(s, extrattsname...) // 201 202 ... return s }() @@ -169,23 +168,15 @@ func (t *ttsmode) setSoundMode(ctx *zero.Ctx, name string, character int) error return errors.New("不支持设置语音人物" + name) } var index = int64(-1) - for i, s := range genshin.SoundList { - if s == name { - index = int64(i + 1) - break - } - } - if index == -1 { - switch name { - case extrattsname[0]: - index = baiduttsindex - case extrattsname[1]: - index = ttscnttsindex - case extrattsname[2]: - index = lolimittsindex - default: - return errors.New("语音人物" + name + "未注册index") - } + switch name { + case extrattsname[0]: + index = baiduttsindex + case extrattsname[1]: + index = ttscnttsindex + case extrattsname[2]: + index = lolimittsindex + default: + return errors.New("语音人物" + name + "未注册index") } m := ctx.State["manager"].(*ctrl.Control[*zero.Ctx]) // 按原来的逻辑map存的是前16位 @@ -229,13 +220,7 @@ func (t *ttsmode) getSoundMode(ctx *zero.Ctx) (tts.TTS, error) { case extrattsname[2]: ins = lolimi.NewLolimi(int(i&0xff00) >> 8) default: // 原神 - k := 原.k - if k != "" { - ins = genshin.NewGenshin(int(m-1), 原.k) - ttsins[mode] = ins - } else { - ins = lolimi.NewLolimi(int(i&0xff00) >> 8) - } + return nil, errors.New("no such mode") } } return ins, nil @@ -258,23 +243,15 @@ func (t *ttsmode) setDefaultSoundMode(name string, character int) error { return errors.New("不支持设置语音人物" + name) } index := int64(-1) - for i, s := range genshin.SoundList { - if s == name { - index = int64(i + 1) - break - } - } - if index == -1 { - switch name { - case extrattsname[0]: - index = baiduttsindex - case extrattsname[1]: - index = ttscnttsindex - case extrattsname[2]: - index = lolimittsindex - default: - return errors.New("语音人物" + name + "未注册index") - } + switch name { + case extrattsname[0]: + index = baiduttsindex + case extrattsname[1]: + index = ttscnttsindex + case extrattsname[2]: + index = lolimittsindex + default: + return errors.New("语音人物" + name + "未注册index") } m, ok := control.Lookup("tts") if !ok { diff --git a/plugin/aireply/main.go b/plugin/aireply/main.go index 638e321501..6ad8d84641 100644 --- a/plugin/aireply/main.go +++ b/plugin/aireply/main.go @@ -8,7 +8,6 @@ import ( "strings" "time" - "github.com/FloatTech/AnimeAPI/tts/genshin" ctrl "github.com/FloatTech/zbpctrl" "github.com/FloatTech/zbputils/control" "github.com/FloatTech/zbputils/ctxext" @@ -26,13 +25,11 @@ func init() { // 插件主体 DisableOnDefault: true, Brief: "人工智能语音回复", Help: "- @Bot 任意文本(任意一句话回复)\n" + - "- 设置语音模式[原神人物/百度/TTSCN/桑帛云] 数字(百度/TTSCN说话人/桑帛云)\n" + - "- 设置默认语音模式[原神人物/百度/TTSCN/桑帛云] 数字(百度/TTSCN说话人/桑帛云)\n" + + "- 设置语音模式[百度/TTSCN/桑帛云] 数字(百度/TTSCN说话人/桑帛云)\n" + + "- 设置默认语音模式[百度/TTSCN/桑帛云] 数字(百度/TTSCN说话人/桑帛云)\n" + "- 恢复成默认语音模式\n" + "- 设置语音回复模式[沫沫|婧枫|青云客|小爱|ChatGPT]\n" + - "- 设置原神语音 api key xxxxxx (key请加开发群获得)\n" + "- 设置百度语音 api id xxxxxx secret xxxxxx (请自行获得)\n" + - "当前适用的原神人物含有以下: \n" + list(genshin.SoundList[:], 5) + "\n当前适用的TTSCN人物含有以下(以数字顺序代表): \n" + list(ttscnspeakers[:], 5), PrivateDataFolder: "tts", }) @@ -153,10 +150,7 @@ func init() { // 插件主体 ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(err)) return } - banner := genshin.TestRecord[param] - if banner == "" { - banner = genshin.TestRecord["默认"] - } + banner := "这是一段测试语音" logrus.Debugln("[tts] banner:", banner, "get sound mode...") // 设置验证 speaker, err := ttsmd.getSoundMode(ctx) diff --git a/plugin/moegoe/main.go b/plugin/moegoe/main.go deleted file mode 100644 index fa8038edc1..0000000000 --- a/plugin/moegoe/main.go +++ /dev/null @@ -1,48 +0,0 @@ -// Package moegoe 日韩中 VITS 模型拟声 -package moegoe - -import ( - "crypto/md5" - "encoding/hex" - "fmt" - "net/url" - - zero "github.com/wdvxdr1123/ZeroBot" - "github.com/wdvxdr1123/ZeroBot/message" - - "github.com/FloatTech/AnimeAPI/tts/genshin" - "github.com/FloatTech/floatbox/binary" - "github.com/FloatTech/floatbox/file" - ctrl "github.com/FloatTech/zbpctrl" - "github.com/FloatTech/zbputils/control" - "github.com/FloatTech/zbputils/ctxext" -) - -var 原 = newapikeystore("./data/tts/o.txt") - -func init() { - en := control.AutoRegister(&ctrl.Options[*zero.Ctx]{ - DisableOnDefault: false, - Brief: "日韩中 VITS 模型拟声", - Help: "- 让[空|荧|派蒙|纳西妲|阿贝多|温迪|枫原万叶|钟离|荒泷一斗|八重神子|艾尔海森|提纳里|迪希雅|卡维|宵宫|莱依拉|赛诺|诺艾尔|托马|凝光|莫娜|北斗|神里绫华|雷电将军|芭芭拉|鹿野院平藏|五郎|迪奥娜|凯亚|安柏|班尼特|琴|柯莱|夜兰|妮露|辛焱|珐露珊|魈|香菱|达达利亚|砂糖|早柚|云堇|刻晴|丽莎|迪卢克|烟绯|重云|珊瑚宫心海|胡桃|可莉|流浪者|久岐忍|神里绫人|甘雨|戴因斯雷布|优菈|菲谢尔|行秋|白术|九条裟罗|雷泽|申鹤|迪娜泽黛|凯瑟琳|多莉|坎蒂丝|萍姥姥|罗莎莉亚|留云借风真君|绮良良|瑶瑶|七七|奥兹|米卡|夏洛蒂|埃洛伊|博士|女士|大慈树王|三月七|娜塔莎|希露瓦|虎克|克拉拉|丹恒|希儿|布洛妮娅|瓦尔特|杰帕德|佩拉|姬子|艾丝妲|白露|星|穹|桑博|伦纳德|停云|罗刹|卡芙卡|彦卿|史瓦罗|螺丝咕姆|阿兰|银狼|素裳|丹枢|黑塔|景元|帕姆|可可利亚|半夏|符玄|公输师傅|奥列格|青雀|大毫|青镞|费斯曼|绿芙蓉|镜流|信使|丽塔|失落迷迭|缭乱星棘|伊甸|伏特加女孩|狂热蓝调|莉莉娅|萝莎莉娅|八重樱|八重霞|卡莲|第六夜想曲|卡萝尔|姬子|极地战刃|布洛妮娅|次生银翼|理之律者|真理之律者|迷城骇兔|希儿|魇夜星渊|黑希儿|帕朵菲莉丝|天元骑英|幽兰黛尔|德丽莎|月下初拥|朔夜观星|暮光骑士|明日香|李素裳|格蕾修|梅比乌斯|渡鸦|人之律者|爱莉希雅|爱衣|天穹游侠|琪亚娜|空之律者|终焉之律者|薪炎之律者|云墨丹心|符华|识之律者|维尔薇|始源之律者|芽衣|雷之律者|苏莎娜|阿波尼亚|陆景和|莫弈|夏彦|左然|标贝]说(中文)", - }).ApplySingle(ctxext.DefaultSingle) - en.OnRegex("^让(空|荧|派蒙|纳西妲|阿贝多|温迪|枫原万叶|钟离|荒泷一斗|八重神子|艾尔海森|提纳里|迪希雅|卡维|宵宫|莱依拉|赛诺|诺艾尔|托马|凝光|莫娜|北斗|神里绫华|雷电将军|芭芭拉|鹿野院平藏|五郎|迪奥娜|凯亚|安柏|班尼特|琴|柯莱|夜兰|妮露|辛焱|珐露珊|魈|香菱|达达利亚|砂糖|早柚|云堇|刻晴|丽莎|迪卢克|烟绯|重云|珊瑚宫心海|胡桃|可莉|流浪者|久岐忍|神里绫人|甘雨|戴因斯雷布|优菈|菲谢尔|行秋|白术|九条裟罗|雷泽|申鹤|迪娜泽黛|凯瑟琳|多莉|坎蒂丝|萍姥姥|罗莎莉亚|留云借风真君|绮良良|瑶瑶|七七|奥兹|米卡|夏洛蒂|埃洛伊|博士|女士|大慈树王|三月七|娜塔莎|希露瓦|虎克|克拉拉|丹恒|希儿|布洛妮娅|瓦尔特|杰帕德|佩拉|姬子|艾丝妲|白露|星|穹|桑博|伦纳德|停云|罗刹|卡芙卡|彦卿|史瓦罗|螺丝咕姆|阿兰|银狼|素裳|丹枢|黑塔|景元|帕姆|可可利亚|半夏|符玄|公输师傅|奥列格|青雀|大毫|青镞|费斯曼|绿芙蓉|镜流|信使|丽塔|失落迷迭|缭乱星棘|伊甸|伏特加女孩|狂热蓝调|莉莉娅|萝莎莉娅|八重樱|八重霞|卡莲|第六夜想曲|卡萝尔|姬子|极地战刃|布洛妮娅|次生银翼|理之律者|真理之律者|迷城骇兔|希儿|魇夜星渊|黑希儿|帕朵菲莉丝|天元骑英|幽兰黛尔|德丽莎|月下初拥|朔夜观星|暮光骑士|明日香|李素裳|格蕾修|梅比乌斯|渡鸦|人之律者|爱莉希雅|爱衣|天穹游侠|琪亚娜|空之律者|终焉之律者|薪炎之律者|云墨丹心|符华|识之律者|维尔薇|始源之律者|芽衣|雷之律者|苏莎娜|阿波尼亚|陆景和|莫弈|夏彦|左然|标贝)说([\\s\u4e00-\u9fa5\\pP]+)$").Limit(ctxext.LimitByGroup).SetBlock(true). - Handle(func(ctx *zero.Ctx) { - if 原.k == "" { - return - } - text := ctx.State["regex_matched"].([]string)[2] - name := ctx.State["regex_matched"].([]string)[1] - rec := fmt.Sprintf(genshin.CNAPI, url.QueryEscape(name), url.QueryEscape(text), url.QueryEscape(原.k)) - b := md5.Sum(binary.StringToBytes(rec)) - fn := hex.EncodeToString(b[:]) - fp := "data/tts/" + fn - if file.IsNotExist(fp) { - if file.DownloadTo(rec, fp) != nil { - return - } - } - rec = "file:///" + file.BOTPATH + "/" + fp - ctx.SendChain(message.Record(rec)) - }) -} diff --git a/plugin/moegoe/model.go b/plugin/moegoe/model.go deleted file mode 100644 index cd09b72acd..0000000000 --- a/plugin/moegoe/model.go +++ /dev/null @@ -1,24 +0,0 @@ -package moegoe - -import ( - "os" - - "github.com/FloatTech/floatbox/binary" - "github.com/FloatTech/floatbox/file" -) - -type apikeystore struct { - k string - p string -} - -func newapikeystore(p string) (s apikeystore) { - s.p = p - if file.IsExist(p) { - data, err := os.ReadFile(p) - if err == nil { - s.k = binary.BytesToString(data) - } - } - return -}