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.VoiceProfileConnectionFactory = exports.SpeakerRecognitionConnectionFactory = void 0;\n/* eslint-disable max-classes-per-file */\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 SpeakerRecognitionConnectionFactoryBase extends ConnectionFactoryBase_js_1.ConnectionFactoryBase {\n create(config, authInfo, endpointPath, 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_Region);\n const hostSuffix = ConnectionFactoryBase_js_1.ConnectionFactoryBase.getHostSuffix(region);\n const host = config.parameters.getProperty(Exports_js_2.PropertyId.SpeechServiceConnection_Host, `wss://${region}.spr-frontend.speech${hostSuffix}`);\n const scenario = config.parameters.getProperty(Exports_js_2.PropertyId.SpeechServiceConnection_SpeakerIdMode, \"TextIndependentIdentification\");\n endpoint = `${host}/speaker/ws/${this.scenarioToPath(scenario)}/${endpointPath}`;\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 headers[HeaderNames_js_1.HeaderNames.SpIDAuthKey] = config.parameters.getProperty(Exports_js_2.PropertyId.SpeechServiceConnection_Key);\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 scenarioToPath(mode) {\n switch (mode) {\n case \"TextIndependentVerification\":\n case \"2\":\n return \"verification/text-independent\";\n case \"TextDependentVerification\":\n case \"1\":\n return \"verification/text-dependent\";\n default:\n return \"identification/text-independent\";\n }\n }\n}\nclass SpeakerRecognitionConnectionFactory extends SpeakerRecognitionConnectionFactoryBase {\n create(config, authInfo, connectionId) {\n return super.create(config, authInfo, \"recognition\", connectionId);\n }\n}\nexports.SpeakerRecognitionConnectionFactory = SpeakerRecognitionConnectionFactory;\nclass VoiceProfileConnectionFactory extends SpeakerRecognitionConnectionFactoryBase {\n create(config, authInfo, connectionId) {\n return super.create(config, authInfo, \"profile\", connectionId);\n }\n}\nexports.VoiceProfileConnectionFactory = VoiceProfileConnectionFactory;","map":{"version":3,"names":["Object","defineProperty","exports","value","VoiceProfileConnectionFactory","SpeakerRecognitionConnectionFactory","Exports_js_1","require","Exports_js_2","ConnectionFactoryBase_js_1","Exports_js_3","HeaderNames_js_1","SpeakerRecognitionConnectionFactoryBase","ConnectionFactoryBase","create","config","authInfo","endpointPath","connectionId","endpoint","parameters","getProperty","PropertyId","SpeechServiceConnection_Endpoint","region","SpeechServiceConnection_Region","hostSuffix","getHostSuffix","host","SpeechServiceConnection_Host","scenario","SpeechServiceConnection_SpeakerIdMode","scenarioToPath","queryParams","format","language","SpeechServiceConnection_RecoLanguage","setCommonUrlParams","headers","token","undefined","headerName","HeaderNames","ConnectionId","SpIDAuthKey","SpeechServiceConnection_Key","setProperty","SpeechServiceConnection_Url","enableCompression","WebsocketConnection","WebsocketMessageFormatter","ProxyInfo","fromRecognizerConfig","mode"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/SpeakerRecognitionConnectionFactory.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.VoiceProfileConnectionFactory = exports.SpeakerRecognitionConnectionFactory = void 0;\n/* eslint-disable max-classes-per-file */\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 SpeakerRecognitionConnectionFactoryBase extends ConnectionFactoryBase_js_1.ConnectionFactoryBase {\n create(config, authInfo, endpointPath, 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_Region);\n const hostSuffix = ConnectionFactoryBase_js_1.ConnectionFactoryBase.getHostSuffix(region);\n const host = config.parameters.getProperty(Exports_js_2.PropertyId.SpeechServiceConnection_Host, `wss://${region}.spr-frontend.speech${hostSuffix}`);\n const scenario = config.parameters.getProperty(Exports_js_2.PropertyId.SpeechServiceConnection_SpeakerIdMode, \"TextIndependentIdentification\");\n endpoint = `${host}/speaker/ws/${this.scenarioToPath(scenario)}/${endpointPath}`;\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 headers[HeaderNames_js_1.HeaderNames.SpIDAuthKey] = config.parameters.getProperty(Exports_js_2.PropertyId.SpeechServiceConnection_Key);\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 scenarioToPath(mode) {\n switch (mode) {\n case \"TextIndependentVerification\":\n case \"2\":\n return \"verification/text-independent\";\n case \"TextDependentVerification\":\n case \"1\":\n return \"verification/text-dependent\";\n default:\n return \"identification/text-independent\";\n }\n }\n}\nclass SpeakerRecognitionConnectionFactory extends SpeakerRecognitionConnectionFactoryBase {\n create(config, authInfo, connectionId) {\n return super.create(config, authInfo, \"recognition\", connectionId);\n }\n}\nexports.SpeakerRecognitionConnectionFactory = SpeakerRecognitionConnectionFactory;\nclass VoiceProfileConnectionFactory extends SpeakerRecognitionConnectionFactoryBase {\n create(config, authInfo, connectionId) {\n return super.create(config, authInfo, \"profile\", connectionId);\n }\n}\nexports.VoiceProfileConnectionFactory = VoiceProfileConnectionFactory;\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,6BAA6B,GAAGF,OAAO,CAACG,mCAAmC,GAAG,KAAK,CAAC;AAC5F;AACA,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,MAAMK,uCAAuC,S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