1 |
- {"ast":null,"code":"\"use strict\";\n\n// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.IntentConnectionFactory = void 0;\nconst Exports_js_1 = require(\"../common.browser/Exports.js\");\nconst Exports_js_2 = require(\"../sdk/Exports.js\");\nconst ConnectionFactoryBase_js_1 = require(\"./ConnectionFactoryBase.js\");\nconst Exports_js_3 = require(\"./Exports.js\");\nconst HeaderNames_js_1 = require(\"./HeaderNames.js\");\nclass IntentConnectionFactory extends ConnectionFactoryBase_js_1.ConnectionFactoryBase {\n create(config, authInfo, connectionId) {\n let endpoint = config.parameters.getProperty(Exports_js_2.PropertyId.SpeechServiceConnection_Endpoint);\n if (!endpoint) {\n const region = config.parameters.getProperty(Exports_js_2.PropertyId.SpeechServiceConnection_IntentRegion);\n const hostSuffix = ConnectionFactoryBase_js_1.ConnectionFactoryBase.getHostSuffix(region);\n const host = config.parameters.getProperty(Exports_js_2.PropertyId.SpeechServiceConnection_Host, \"wss://\" + region + \".sr.speech\" + hostSuffix);\n endpoint = host + \"/speech/recognition/interactive/cognitiveservices/v1\";\n }\n const queryParams = {\n format: \"simple\",\n language: config.parameters.getProperty(Exports_js_2.PropertyId.SpeechServiceConnection_RecoLanguage)\n };\n this.setCommonUrlParams(config, queryParams, endpoint);\n const headers = {};\n if (authInfo.token !== undefined && authInfo.token !== \"\") {\n headers[authInfo.headerName] = authInfo.token;\n }\n headers[HeaderNames_js_1.HeaderNames.ConnectionId] = connectionId;\n config.parameters.setProperty(Exports_js_2.PropertyId.SpeechServiceConnection_Url, endpoint);\n const enableCompression = config.parameters.getProperty(\"SPEECH-EnableWebsocketCompression\", \"false\") === \"true\";\n return new Exports_js_1.WebsocketConnection(endpoint, queryParams, headers, new Exports_js_3.WebsocketMessageFormatter(), Exports_js_1.ProxyInfo.fromRecognizerConfig(config), enableCompression, connectionId);\n }\n getSpeechRegionFromIntentRegion(intentRegion) {\n switch (intentRegion) {\n case \"West US\":\n case \"US West\":\n case \"westus\":\n return \"uswest\";\n case \"West US 2\":\n case \"US West 2\":\n case \"westus2\":\n return \"uswest2\";\n case \"South Central US\":\n case \"US South Central\":\n case \"southcentralus\":\n return \"ussouthcentral\";\n case \"West Central US\":\n case \"US West Central\":\n case \"westcentralus\":\n return \"uswestcentral\";\n case \"East US\":\n case \"US East\":\n case \"eastus\":\n return \"useast\";\n case \"East US 2\":\n case \"US East 2\":\n case \"eastus2\":\n return \"useast2\";\n case \"West Europe\":\n case \"Europe West\":\n case \"westeurope\":\n return \"europewest\";\n case \"North Europe\":\n case \"Europe North\":\n case \"northeurope\":\n return \"europenorth\";\n case \"Brazil South\":\n case \"South Brazil\":\n case \"southbrazil\":\n return \"brazilsouth\";\n case \"Australia East\":\n case \"East Australia\":\n case \"eastaustralia\":\n return \"australiaeast\";\n case \"Southeast Asia\":\n case \"Asia Southeast\":\n case \"southeastasia\":\n return \"asiasoutheast\";\n case \"East Asia\":\n case \"Asia East\":\n case \"eastasia\":\n return \"asiaeast\";\n default:\n return intentRegion;\n }\n }\n}\nexports.IntentConnectionFactory = IntentConnectionFactory;","map":{"version":3,"names":["Object","defineProperty","exports","value","IntentConnectionFactory","Exports_js_1","require","Exports_js_2","ConnectionFactoryBase_js_1","Exports_js_3","HeaderNames_js_1","ConnectionFactoryBase","create","config","authInfo","connectionId","endpoint","parameters","getProperty","PropertyId","SpeechServiceConnection_Endpoint","region","SpeechServiceConnection_IntentRegion","hostSuffix","getHostSuffix","host","SpeechServiceConnection_Host","queryParams","format","language","SpeechServiceConnection_RecoLanguage","setCommonUrlParams","headers","token","undefined","headerName","HeaderNames","ConnectionId","setProperty","SpeechServiceConnection_Url","enableCompression","WebsocketConnection","WebsocketMessageFormatter","ProxyInfo","fromRecognizerConfig","getSpeechRegionFromIntentRegion","intentRegion"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/IntentConnectionFactory.js"],"sourcesContent":["\"use strict\";\n// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.IntentConnectionFactory = void 0;\nconst Exports_js_1 = require(\"../common.browser/Exports.js\");\nconst Exports_js_2 = require(\"../sdk/Exports.js\");\nconst ConnectionFactoryBase_js_1 = require(\"./ConnectionFactoryBase.js\");\nconst Exports_js_3 = require(\"./Exports.js\");\nconst HeaderNames_js_1 = require(\"./HeaderNames.js\");\nclass IntentConnectionFactory extends ConnectionFactoryBase_js_1.ConnectionFactoryBase {\n create(config, authInfo, connectionId) {\n let endpoint = config.parameters.getProperty(Exports_js_2.PropertyId.SpeechServiceConnection_Endpoint);\n if (!endpoint) {\n const region = config.parameters.getProperty(Exports_js_2.PropertyId.SpeechServiceConnection_IntentRegion);\n const hostSuffix = ConnectionFactoryBase_js_1.ConnectionFactoryBase.getHostSuffix(region);\n const host = config.parameters.getProperty(Exports_js_2.PropertyId.SpeechServiceConnection_Host, \"wss://\" + region + \".sr.speech\" + hostSuffix);\n endpoint = host + \"/speech/recognition/interactive/cognitiveservices/v1\";\n }\n const queryParams = {\n format: \"simple\",\n language: config.parameters.getProperty(Exports_js_2.PropertyId.SpeechServiceConnection_RecoLanguage),\n };\n this.setCommonUrlParams(config, queryParams, endpoint);\n const headers = {};\n if (authInfo.token !== undefined && authInfo.token !== \"\") {\n headers[authInfo.headerName] = authInfo.token;\n }\n headers[HeaderNames_js_1.HeaderNames.ConnectionId] = connectionId;\n config.parameters.setProperty(Exports_js_2.PropertyId.SpeechServiceConnection_Url, endpoint);\n const enableCompression = config.parameters.getProperty(\"SPEECH-EnableWebsocketCompression\", \"false\") === \"true\";\n return new Exports_js_1.WebsocketConnection(endpoint, queryParams, headers, new Exports_js_3.WebsocketMessageFormatter(), Exports_js_1.ProxyInfo.fromRecognizerConfig(config), enableCompression, connectionId);\n }\n getSpeechRegionFromIntentRegion(intentRegion) {\n switch (intentRegion) {\n case \"West US\":\n case \"US West\":\n case \"westus\":\n return \"uswest\";\n case \"West US 2\":\n case \"US West 2\":\n case \"westus2\":\n return \"uswest2\";\n case \"South Central US\":\n case \"US South Central\":\n case \"southcentralus\":\n return \"ussouthcentral\";\n case \"West Central US\":\n case \"US West Central\":\n case \"westcentralus\":\n return \"uswestcentral\";\n case \"East US\":\n case \"US East\":\n case \"eastus\":\n return \"useast\";\n case \"East US 2\":\n case \"US East 2\":\n case \"eastus2\":\n return \"useast2\";\n case \"West Europe\":\n case \"Europe West\":\n case \"westeurope\":\n return \"europewest\";\n case \"North Europe\":\n case \"Europe North\":\n case \"northeurope\":\n return \"europenorth\";\n case \"Brazil South\":\n case \"South Brazil\":\n case \"southbrazil\":\n return \"brazilsouth\";\n case \"Australia East\":\n case \"East Australia\":\n case \"eastaustralia\":\n return \"australiaeast\";\n case \"Southeast Asia\":\n case \"Asia Southeast\":\n case \"southeastasia\":\n return \"asiasoutheast\";\n case \"East Asia\":\n case \"Asia East\":\n case \"eastasia\":\n return \"asiaeast\";\n default:\n return intentRegion;\n }\n }\n}\nexports.IntentConnectionFactory = IntentConnectionFactory;\n\n"],"mappings":"AAAA,YAAY;;AACZ;AACA;AACAA,MAAM,CAACC,cAAc,CAACC,OAAO,EAAE,YAAY,EAAE;EAAEC,KAAK,EAAE;AAAK,CAAC,CAAC;AAC7DD,OAAO,CAACE,uBAAuB,GAAG,KAAK,CAAC;AACxC,MAAMC,YAAY,GAAGC,OAAO,CAAC,8BAA8B,CAAC;AAC5D,MAAMC,YAAY,GAAGD,OAAO,CAAC,mBAAmB,CAAC;AACjD,MAAME,0BAA0B,GAAGF,OAAO,CAAC,4BAA4B,CAAC;AACxE,MAAMG,YAAY,GAAGH,OAAO,CAAC,cAAc,CAAC;AAC5C,MAAMI,gBAAgB,GAAGJ,OAAO,CAAC,kBAAkB,CAAC;AACpD,MAAMF,uBAAuB,SAASI,0BAA0B,CAACG,qBAAqB,CAAC;EACnFC,MAAMA,CAACC,MAAM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