XiaomiAI.SDK
1.0.0.1
.NET Standard 2.0
.NET Framework 4.5.2
Install-Package XiaomiAI.SDK -Version 1.0.0.1
dotnet add package XiaomiAI.SDK --version 1.0.0.1
<PackageReference Include="XiaomiAI.SDK" Version="1.0.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add XiaomiAI.SDK --version 1.0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: XiaomiAI.SDK, 1.0.0.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install XiaomiAI.SDK as a Cake Addin
#addin nuget:?package=XiaomiAI.SDK&version=1.0.0.1
// Install XiaomiAI.SDK as a Cake Tool
#tool nuget:?package=XiaomiAI.SDK&version=1.0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Xiaomi-ai-skill-converter
Download
Documents
If you aren't a Xiaomi AI developer, please visit the 水滴平台.
System requirement
XaiomiAI.SDK
RequestContent
Convert json from Xiaomi AI server to object.
ResponseContent
Convert object to response json to Xaimi AI server.
Example
[HttpPost]
public async Task<ResponseContent> Post([FromBody]string value)
{
using (StreamReader reader = new StreamReader(Request.Body, Encoding.UTF8))
{
// read json content
string requestJson = await reader.ReadToEndAsync();
// convert to RequestContent
var requestContent = JsonConvert.DeserializeObject<RequestContent>(requestJson);
// identify request type to generate response content
switch (requestContent.Request.Type)
{
case RequestType.Intent:
string displayText = "是的,帮你朗读现在气象";
return new ResponseContent
{
IsSessionEnd = false,
Response = new ResponseData
{
ToSpeak = new ToSpeakData
{
Type = ToSpeakType.TTS,
Text = displayText
},
ToDisplay = new PlainTextToDisplayData
{
Text = displayText
},
Directives = new List<IDirectiveData>
{
new AudioDirectiveData
{
AudioItem = new AudioItemData
{
Stream = new StreamData
{
Url = "http://xxxxx.mp3"
}
}
},
new TTSDirectiveData
{
TTSItem = new TTSItemData
{
Text = displayText
}
}
}
}
};
case RequestType.End:
string endTxt = "期待您再次使用";
return new ResponseContent
{
IsSessionEnd = true,
Response = new ResponseData
{
ToSpeak = new ToSpeakData
{
Type = ToSpeakType.TTS,
Text = endTxt
},
ToDisplay = new PlainTextToDisplayData
{
Text = endTxt
},
}
};
default:
// None, Wakeup
string wakeupTxt = "請問您需要什么服務呢?";
return new ResponseContent
{
IsSessionEnd = false,
Response = new ResponseData
{
ToSpeak = new ToSpeakData
{
Type = ToSpeakType.TTS,
Text = wakeupTxt
},
ToDisplay = new PlainTextToDisplayData
{
Text = wakeupTxt
}
}
};
}
}
}
Enter develop mode of the Xiaomi AI Speaker
If the state of the custom skill is testing or during cerficiation process, you can test it on the Xiaomi AI Speaker.
Steps:
对音箱说:
进入开发者模式
--------------测试中-------------------
用你的技能
调用名称
进行测试,只有处于测试中或者审核中的技能都能够进行测试想要退出请说:
进入用户模式
Product | Versions |
---|---|
.NET | net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows |
.NET Core | netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1 |
.NET Standard | netstandard2.0 netstandard2.1 |
.NET Framework | net452 net46 net461 net462 net463 net47 net471 net472 net48 |
MonoAndroid | monoandroid |
MonoMac | monomac |
MonoTouch | monotouch |
Tizen | tizen40 tizen60 |
Xamarin.iOS | xamarinios |
Xamarin.Mac | xamarinmac |
Xamarin.TVOS | xamarintvos |
Xamarin.WatchOS | xamarinwatchos |
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.5.2
- Newtonsoft.Json (>= 12.0.2)
-
.NETFramework 4.6.1
- Newtonsoft.Json (>= 12.0.2)
-
.NETStandard 2.0
- Newtonsoft.Json (>= 12.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
1.0.0.1: modify some json tag for new version of Xiaomi AI request/response.