Skip to content

Commit

Permalink
2023.02
Browse files Browse the repository at this point in the history
1、集成live2d看板娘;
2、修改ngrok穿透是否开启的判断逻辑;
  • Loading branch information
xszyou committed Feb 3, 2023
1 parent ce02f98 commit 732e7e3
Show file tree
Hide file tree
Showing 7 changed files with 213 additions and 11 deletions.
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,33 @@

4、【开源项目FAY——UE工程讲解】https://www.bilibili.com/video/BV1C8411P7Ac?vd_source=64cd9062f5046acba398177b62bea9ad

5、m1机器安装办法(Gason提供):https://www.zhihu.com/question/437075754


目前最新版本是2.0。在新版本里我们提出一个全新的架构。在这个架构下每个人都可以把Fay控制器搭建在自己个人电脑上(未来,或许我们会提供终端),让你电脑成为你数字助理的载体。你的所有设备(手表、手机、眼镜、笔记本)随时可以与你的数字助理通讯,数字助理将通过电脑为你处理数字世界里的所有事情。(贾维斯?Her?)
![](images/20230122074644.png)

2023.01
2023.01
1、控制器pc内网穿透,音频输入输出设备远程直连;
2、提供android 音频输入输出工程示例代码;
3、提供python音频输入输出工程示例代码(远程PC、树莓派等可用);
4、补传1.0语音指令音乐播放模块(暂不支持远程播放);
5、重构及补充若干工具模块:websocket、多线程、缓冲器、音频流录制器等;
6、修复1.x版本的多个bug。
6、修复1.x版本的多个bug;
7、集成看板娘。

2022.12
2022.12
1、上传bin目录(用于直播互动);

2022.11
2022.11
1、更新抖音直播获取粉丝互动数据的xpath;

2022.10.27
2022.10.27
1、更新mac上的麦克风参数;
2、解决mac上无法重启问题;
3、上传brew安装脚本。

2022.10.17
2022.10.17
1、更新语音指令;
2、补充人设语法;

Expand Down Expand Up @@ -220,7 +223,9 @@ python main.py

控制器与采用 WebSocket 方式与 UE 通讯

下载: [https://pan.baidu.com/s/1L6yUR5cRFuNBiuPaXcmHaQ?pwd=8s8d](https://pan.baidu.com/s/1L6yUR5cRFuNBiuPaXcmHaQ?pwd=8s8d)
下载工程: [https://pan.baidu.com/s/1RBo2Pie6A5yTrCf1cn_Tuw?pwd=ck99](https://pan.baidu.com/s/1RBo2Pie6A5yTrCf1cn_Tuw?pwd=ck99)

下载工程: [https://pan.baidu.com/s/1CsJ647uV5rS2NjQH3QT0Iw?pwd=s9s8](https://pan.baidu.com/s/1CsJ647uV5rS2NjQH3QT0Iw?pwd=s9s8)

通讯地址: [`ws://127.0.0.1:10002`](ws://127.0.0.1:10002)(已接通)

Expand Down
2 changes: 1 addition & 1 deletion fay_booter.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def __init__(self, fei):

def run(self):
#启动ngork
if config_util.key_ngrok_cc_id is not None:
if not config_util.key_ngrok_cc_id:
MyThread(target=self.start_ngrok, args=[config_util.key_ngrok_cc_id]).start()

self.streamCache = stream_util.StreamCache(1024*1024*20)
Expand Down
14 changes: 14 additions & 0 deletions gui/static/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,20 @@ new Vue({
let panelMsg = data.panelMsg
if (panelMsg !== undefined) {
_this.panel_msg = panelMsg

//Edit by xszyou in 2022/2/3:同步到看板娘
text = panelMsg;
if (panelMsg != ""){
sessionStorage.setItem("waifu-text", 8);
const tips = document.getElementById("waifu-tips");
tips.innerHTML = text;
tips.classList.add("waifu-tips-active");
messageTimer = setTimeout(() => {
sessionStorage.removeItem("waifu-text");
tips.classList.remove("waifu-tips-active");
}, 7000);
}

}
}
},
Expand Down
62 changes: 62 additions & 0 deletions gui/static/live2d/autoload.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// live2d_path 参数建议使用绝对路径
const live2d_path = "https://fastly.jsdelivr.net/gh/stevenjoezhang/live2d-widget@latest/";
//const live2d_path = "/live2d-widget/";

// 封装异步加载资源的方法
function loadExternalResource(url, type) {
return new Promise((resolve, reject) => {
let tag;

if (type === "css") {
tag = document.createElement("link");
tag.rel = "stylesheet";
tag.href = url;
}
else if (type === "js") {
tag = document.createElement("script");
tag.src = url;
}
if (tag) {
tag.onload = () => resolve(url);
tag.onerror = () => reject(url);
document.head.appendChild(tag);
}
});
}

// 加载 waifu.css live2d.min.js waifu-tips.js
if (screen.width >= 768) {
Promise.all([
loadExternalResource(live2d_path + "waifu.css", "css"),
loadExternalResource(live2d_path + "live2d.min.js", "js"),
loadExternalResource(live2d_path + "waifu-tips.js", "js")
]).then(() => {
// 配置选项的具体用法见 README.md
initWidget({
waifuPath: "/static/live2d/waifu-tips.json",
//apiPath: "https://live2d.fghrsh.net/api/",
cdnPath: "https://fastly.jsdelivr.net/gh/fghrsh/live2d_api/",
tools: ["switch-model", "quit"]
});
});
}

console.log(`
く__,.ヘヽ. / ,ー、 〉
\ ', !-─‐-i / /´
/`ー' L//`ヽ、
/ /, /| , , ',
イ / /-‐/ i L_ ハ ヽ! i
レ ヘ 7イ`ト レ'ァ-ト、!ハ| |
!,/7 '0' ´0iソ| |
|.从" _ ,,,, / |./ |
レ'| i>.、,,__ _,.イ / .i |
レ'| | / k_7_/レ'ヽ, ハ. |
| |/i 〈|/ i ,.ヘ | i |
.|/ / i: ヘ! \ |
kヽ>、ハ _,.ヘ、 /、!
!'〈//`T´', \ `'7'ーr'
レ'ヽL__|___i,___,ンレ|ノ
ト-,/ |___./
'ー' !_,.:
`);
120 changes: 120 additions & 0 deletions gui/static/live2d/waifu-tips.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
{
"mouseover": [{
"selector": "#live2d",
"text": ["干嘛呢你,快把手拿开~~", "鼠…鼠标放错地方了!", "你要干嘛呀?", "喵喵喵?", "怕怕(ノ≧∇≦)ノ", "非礼呀!救命!", "这样的话,只能使用武力了!", "我要生气了哦", "不要动手动脚的!", "真…真的是不知羞耻!", "Hentai!"]
}, {
"selector": "#waifu-tool-hitokoto",
"text": ["猜猜我要说些什么?", "我从青蛙王子那里听到了不少人生经验。"]
}, {
"selector": "#waifu-tool-asteroids",
"text": ["要不要来玩飞机大战?", "这个按钮上写着「不要点击」。", "怎么,你想来和我玩个游戏?", "听说这样可以蹦迪!"]
}, {
"selector": "#waifu-tool-switch-model",
"text": ["你是不是不爱人家了呀,呜呜呜~", "要见见我的姐姐嘛?", "想要看我妹妹嘛?", "要切换看板娘吗?"]
}, {
"selector": "#waifu-tool-switch-texture",
"text": ["喜欢换装 PLAY 吗?", "这次要扮演什么呢?", "变装!", "让我们看看接下来会发生什么!"]
}, {
"selector": "#waifu-tool-photo",
"text": ["你要给我拍照呀?一二三~茄子~", "要不,我们来合影吧!", "保持微笑就好了~"]
}, {
"selector": "#waifu-tool-info",
"text": ["想要知道更多关于我的事么?", "这里记录着我搬家的历史呢。", "你想深入了解我什么呢?"]
}, {
"selector": "#waifu-tool-quit",
"text": ["到了要说再见的时候了吗?", "呜呜 QAQ 后会有期……", "不要抛弃我呀……", "我们,还能再见面吗……", "哼,你会后悔的!"]
}, {
"selector": ".character_left",
"text": ["这是我的人设,修改之后记得重新启动哦"]
}, {
"selector": ".character_right",
"text": ["这是我的性格,修改之后记得重新启动哦"]
}, {
"selector": ".right_main",
"text": ["我可以做你的售货员了"]
}, {
"selector": ".btn_close",
"text": ["你是不想和我说话了吗"]
}, {
"selector": ".btn_open",
"text": ["快点击,我可以和你谈谈心了"]
}],
"click": [{
"selector": "#live2d",
"text": ["是…是不小心碰到了吧…", "萝莉控是什么呀?", "你看到我的小熊了吗?", "再摸的话我可要报警了!⌇●﹏●⌇", "110 吗,这里有个变态一直在摸我(ó﹏ò。)", "不要摸我了,我会告诉老婆来打你的!", "干嘛动我呀!小心我咬你!", "别摸我,有什么好摸的!"]
},{
"selector": ".btn_close",
"text": ["再见!"]
}, {
"selector": ".btn_open",
"text": ["我要上线了"]
}],
"seasons": [{
"date": "01/01",
"text": "<span>元旦</span>了呢,新的一年又开始了,今年是{year}年~"
}, {
"date": "02/14",
"text": "又是一年<span>情人节</span>,{year}年找到对象了嘛~"
}, {
"date": "03/08",
"text": "今天是<span>国际妇女节</span>!"
}, {
"date": "03/12",
"text": "今天是<span>植树节</span>,要保护环境呀!"
}, {
"date": "04/01",
"text": "悄悄告诉你一个秘密~<span>今天是愚人节,不要被骗了哦~</span>"
}, {
"date": "05/01",
"text": "今天是<span>五一劳动节</span>,计划好假期去哪里了吗~"
}, {
"date": "06/01",
"text": "<span>儿童节</span>了呢,快活的时光总是短暂,要是永远长不大该多好啊…"
}, {
"date": "09/03",
"text": "<span>中国人民抗日战争胜利纪念日</span>,铭记历史、缅怀先烈、珍爱和平、开创未来。"
}, {
"date": "09/10",
"text": "<span>教师节</span>,在学校要给老师问声好呀~"
}, {
"date": "10/01",
"text": "<span>国庆节</span>到了,为祖国母亲庆生!"
}, {
"date": "11/05-11/12",
"text": "今年的<span>双十一</span>是和谁一起过的呢~"
}, {
"date": "12/20-12/31",
"text": "这几天是<span>圣诞节</span>,主人肯定又去剁手买买买了~"
}],
"time": [{
"hour": "6-7",
"text": "早上好!一日之计在于晨,美好的一天就要开始了~"
}, {
"hour": "8-11",
"text": "上午好!工作顺利嘛,不要久坐,多起来走动走动哦!"
}, {
"hour": "12-13",
"text": "中午了,工作了一个上午,现在是午餐时间!"
}, {
"hour": "14-17",
"text": "午后很容易犯困呢,今天的运动目标完成了吗?"
}, {
"hour": "18-19",
"text": "傍晚了!窗外夕阳的景色很美丽呢,最美不过夕阳红~"
}, {
"hour": "20-21",
"text": "晚上好,今天过得怎么样?"
}, {
"hour": "22-23",
"text": ["已经这么晚了呀,早点休息吧,晚安~", "深夜时要爱护眼睛呀!"]
}, {
"hour": "0-5",
"text": "你是夜猫子呀?这么晚还不睡觉,明天起的来嘛?"
}],
"message": {
"default": ["好久不见,日子过得好快呢……", "大坏蛋!你都多久没理人家了呀,嘤嘤嘤~", "嗨~快来逗我玩吧!", "拿小拳拳锤你胸口!", "记得把小家加入收藏夹哦!"],
"console": "哈哈,你打开了控制台,是想要看看我的小秘密吗?",
"copy": "你都复制了些什么呀,转载要记得加上出处哦!",
"visibilitychange": "哇,你终于回来了~"
}
}
7 changes: 4 additions & 3 deletions gui/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<!-- <link rel="stylesheet" href="./css/element.css"> -->
<link rel="stylesheet" href="{{ url_for('static',filename='css/element.css') }}"></link>
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<script src="/static/live2d/autoload.js"></script>

<title>自动商品介绍控制器</title>

Expand Down Expand Up @@ -129,7 +130,7 @@ <h2>Fay控制器2.0</h2>
</div>
</div>
<div class="left_box">
<p>接收来源:</p>
<p>&nbsp;</p>
<div class="source">
<ul>
<li class="url">
Expand All @@ -154,10 +155,10 @@ <h2>Fay控制器2.0</h2>
<el-input v-model="panel_msg" :disabled="true"></el-input>
</li>
<li class="but">
<el-button v-if="live_state == 1" type="success" style="width:200px" @click=postStopLive()>关闭(运行中)</el-button>
<el-button v-if="live_state == 1" type="success" class="btn_close" style="width:200px" @click=postStopLive()>关闭(运行中)</el-button>
<el-button v-else-if="live_state == 2" type="primary" plain disabled style="width:200px">正在开启...</el-button>
<el-button v-else-if="live_state == 3" type="success" plain disabled style="width:200px">正在关闭...</el-button>
<el-button v-else type="primary" style="width:200px" @click=postStartLive()>开启</el-button>
<el-button v-else type="primary" style="width:200px" class="btn_open" @click=postStartLive()>开启</el-button>
<el-button type="button" style="width:200px" @click=postData()>保存配置</el-button>
</li>
<li class="p_red">
Expand Down
Binary file modified images/controller.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 732e7e3

Please sign in to comment.