@@ -147,12 +147,9 @@ async fn on_event(event: Event) -> Result<(), AppError> {
|
||||
|
||||
async fn on_stream(stream: Stream) -> Result<(), AppError> {
|
||||
let Stream { tag, bytes, .. } = stream;
|
||||
match tag.as_str() {
|
||||
"play" => {
|
||||
// 播放接收到的音频流
|
||||
let _ = AudioPlayer::instance().play(bytes).await;
|
||||
}
|
||||
_ => {}
|
||||
if tag.as_str() == "play" {
|
||||
// 播放接收到的音频流
|
||||
let _ = AudioPlayer::instance().play(bytes).await;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ async fn on_keyword(_keyword: String) {
|
||||
.split("\n")
|
||||
.filter(|line| !line.trim().is_empty())
|
||||
.collect::<Vec<&str>>();
|
||||
if replies.len() > 0 {
|
||||
if !replies.is_empty() {
|
||||
wakeup_sounds.clear();
|
||||
wakeup_sounds.extend(replies.iter().map(|s| s.to_string()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user