xiaoai

Crates.ioxiaoai
lib.rsxiaoai
version0.1.2
created_at2025-03-25 16:50:53.363982+00
updated_at2025-03-28 19:01:35.648813+00
descriptionUtils to remote XiaoAi; 远程操作小爱同学(小爱音箱)
homepage
repositoryhttps://github.com/kingwingfly/rXiaoAiLLM
max_upload_size
id1605495
size78,499
王翼翔 (kingwingfly)

documentation

https://docs.rs/xiaoai

README

use xiaoai::{load_or_login_and_save_with_env, device_by_alias, OpPayloadBuilder, OpResponse, OpApi, ApiCaller as _};

let auth_data = load_or_login_and_save_with_env("auth_data.json").await.unwrap();
let device = device_by_alias(&auth_data, "卧室的小爱/XiaoAi in bedroom").await.unwrap();
let payload = OpPayloadBuilder::new(&auth_data, &device.device_id).volume(50);
let resp: OpResponse = OpApi::request(payload).await.unwrap();
let payload = OpPayloadBuilder::new(&auth_data, &device.device_id).speak("Hello world!");
let resp: OpResponse = OpApi::request(payload).await.unwrap();

let payload = LastAskPayload::new(&auth_data, &device, 2);
let resp: LastAskResponse = RecordApi::request(payload).await.unwrap();

account_id and account_password can be loaded from env var.

ACCOUNT_ID=
ACCOUNT_PASSWORD=

Supported operations:

  • speak
  • volume
  • pause and resume
  • play url
  • status query
  • query chat history or record

Acknowledgement

Commit count: 32

cargo fmt