XiaomiAI.SDK 1.0.0.1

dotnet add package XiaomiAI.SDK --version 1.0.0.1                
NuGet\Install-Package XiaomiAI.SDK -Version 1.0.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<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                
#r "nuget: XiaomiAI.SDK, 1.0.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. 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                

Xiaomi-ai-skill-converter

Download

NuGet

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:

  1. 对音箱说:进入开发者模式

    --------------测试中-------------------

  2. 用你的技能 调用名称 进行测试,只有处于测试中或者审核中的技能都能够进行测试

  3. 想要退出请说:进入用户模式

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net452 is compatible.  net46 was computed.  net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0.1 690 5/5/2019
1.0.0 952 3/15/2018

1.0.0.1: modify some json tag for new version of Xiaomi AI request/response.