https://github.com/kingwingfly/rxiaoaillm
Call LLM from XiaoAi rewritten in Rust. [WIP] 小爱同学调用大语言模型
https://github.com/kingwingfly/rxiaoaillm
mi miiot xiaoai xiaomi
Last synced: 3 months ago
JSON representation
Call LLM from XiaoAi rewritten in Rust. [WIP] 小爱同学调用大语言模型
- Host: GitHub
- URL: https://github.com/kingwingfly/rxiaoaillm
- Owner: kingwingfly
- Created: 2025-03-23T15:19:54.000Z (about 1 year ago)
- Default Branch: dev
- Last Pushed: 2025-04-09T04:47:08.000Z (about 1 year ago)
- Last Synced: 2025-09-02T04:20:43.200Z (9 months ago)
- Topics: mi, miiot, xiaoai, xiaomi
- Language: Rust
- Homepage: https://crates.io/crates/xiaoai
- Size: 213 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
```rust ignore
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.
```sh
ACCOUNT_ID=
ACCOUNT_PASSWORD=
```
Supported operations:
- speak
- volume
- pause and resume
- play url
- status query
- query chat history or record
# Acknowledgement
- [MiGPT](https://github.com/Afool4U/MIGPT)
- [MiService](https://github.com/Yonsm/MiService)