Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Cancel last autoplay audio #2431

Merged
merged 1 commit into from
Feb 27, 2025
Merged

Conversation

shaohuzhang1
Copy link
Contributor

refactor: Cancel last autoplay audio --story=1017953 --user=刘瑞斌 【优化】多轮对话,语音识别自动播放,会重叠播放 https://www.tapd.cn/57709429/s/1660001

--story=1017953 --user=刘瑞斌 【优化】多轮对话,语音识别自动播放,会重叠播放 https://www.tapd.cn/57709429/s/1660001
Copy link

f2c-ci-robot bot commented Feb 27, 2025

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link

f2c-ci-robot bot commented Feb 27, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

pausePlayAnswerText()
// console.log(1234)
})
bus.emit('pause-autoplay')
// 第一次回答后自动播放, 打开历史记录不自动播放
if (props.tts && props.tts_autoplay && buttonData.value.write_ed && !buttonData.value.update_time) {
playAnswerText(buttonData.value.answer_text)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no irregularities in the provided code, but there is one potential issue related to the handling of onMounted:

if (props.tts && props.tts_autoplay && buttonData.value.write_ed && !buttonData.value.update_time) {

This line checks conditions that might lead to unexpected behavior when used with asynchronous functions or if buttonData changes later on. It would be more robust to place this logic inside an effect (watch, computed, etc.) instead.

Additionally, ensure that bus.emit('pause-autoplay') doesn't cause issues with event listeners already attached. If multiple components are listening for the same event, it's important to make sure you're not overwriting existing listeners unintentionally.

Optimization suggestions could include avoiding unnecessary operations within lifecycle hooks like onMounted.

@liuruibin liuruibin merged commit 18fa066 into main Feb 27, 2025
4 of 5 checks passed
@liuruibin liuruibin deleted the pr@main@refactor_last_auto branch February 27, 2025 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants