Skip to content

Commit c56d82e

Browse files
MingTianSangwehos
andauthored
修复语音状态下开启主动视觉无法触发主动截图的问题 (#214)
Co-authored-by: Hongzhi Wen <wenguanjung@aliyun.com>
1 parent c140861 commit c56d82e

2 files changed

Lines changed: 22 additions & 6 deletions

File tree

static/app.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5204,6 +5204,8 @@ function init_app() {
52045204
// 暴露函数到全局作用域,供 live2d.js 调用
52055205
window.resetProactiveChatBackoff = resetProactiveChatBackoff;
52065206
window.stopProactiveChatSchedule = stopProactiveChatSchedule;
5207+
window.startProactiveVisionDuringSpeech = startProactiveVisionDuringSpeech;
5208+
window.stopProactiveVisionDuringSpeech = stopProactiveVisionDuringSpeech;
52075209

52085210
// 保存设置到localStorage
52095211
function saveSettings() {

static/live2d-ui-popup.js

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -465,12 +465,26 @@ Live2DManager.prototype._createSettingsToggleItem = function (toggle, popup) {
465465
window.saveNEKOSettings();
466466
}
467467

468-
if (isChecked && typeof window.resetProactiveChatBackoff === 'function') {
469-
window.resetProactiveChatBackoff();
470-
} else if (!isChecked && typeof window.stopProactiveChatSchedule === 'function') {
471-
// 只有当主动搭话也关闭时才停止调度
472-
if (!window.proactiveChatEnabled) {
473-
window.stopProactiveChatSchedule();
468+
if (isChecked) {
469+
if (typeof window.resetProactiveChatBackoff === 'function') {
470+
window.resetProactiveChatBackoff();
471+
}
472+
// 如果正在语音对话中,启动15秒1帧定时器
473+
if (typeof window.isRecording !== 'undefined' && window.isRecording) {
474+
if (typeof window.startProactiveVisionDuringSpeech === 'function') {
475+
window.startProactiveVisionDuringSpeech();
476+
}
477+
}
478+
} else {
479+
if (typeof window.stopProactiveChatSchedule === 'function') {
480+
// 只有当主动搭话也关闭时才停止调度
481+
if (!window.proactiveChatEnabled) {
482+
window.stopProactiveChatSchedule();
483+
}
484+
}
485+
// 停止语音期间的主动视觉定时器
486+
if (typeof window.stopProactiveVisionDuringSpeech === 'function') {
487+
window.stopProactiveVisionDuringSpeech();
474488
}
475489
}
476490
console.log(`主动视觉已${isChecked ? '开启' : '关闭'}`);

0 commit comments

Comments
 (0)