@webex/internal-plugin-llm 2.60.0 → 2.60.1-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants.js +1 -2
- package/dist/constants.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/llm.js +20 -29
- package/dist/llm.js.map +1 -1
- package/package.json +14 -13
- package/src/llm.ts +6 -21
- package/test/unit/spec/llm.js +4 -1
package/dist/constants.js
CHANGED
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["LLM","exports"],"sources":["constants.ts"],"sourcesContent":["// eslint-disable-next-line import/prefer-default-export\nexport const LLM = 'llm';\n"],"mappings":";;;;;;;AAAA;AACO,IAAMA,GAAG,
|
|
1
|
+
{"version":3,"names":["LLM","exports"],"sources":["constants.ts"],"sourcesContent":["// eslint-disable-next-line import/prefer-default-export\nexport const LLM = 'llm';\n"],"mappings":";;;;;;;AAAA;AACO,IAAMA,GAAG,GAAAC,OAAA,CAAAD,GAAA,GAAG,KAAK"}
|
package/dist/index.js
CHANGED
|
@@ -15,8 +15,8 @@ _Object$defineProperty(exports, "default", {
|
|
|
15
15
|
});
|
|
16
16
|
var WebexCore = _interopRequireWildcard(require("@webex/webex-core"));
|
|
17
17
|
var _llm = _interopRequireWildcard(require("./llm"));
|
|
18
|
-
function _getRequireWildcardCache(
|
|
19
|
-
function _interopRequireWildcard(
|
|
18
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof _WeakMap) return null; var r = new _WeakMap(), t = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
19
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? _Object$getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? _Object$defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
20
|
WebexCore.registerInternalPlugin('llm', _llm.default, {
|
|
21
21
|
config: _llm.config
|
|
22
22
|
});
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["WebexCore","_interopRequireWildcard","require","_llm","_getRequireWildcardCache","
|
|
1
|
+
{"version":3,"names":["WebexCore","_interopRequireWildcard","require","_llm","_getRequireWildcardCache","e","_WeakMap","r","t","__esModule","_typeof","default","has","get","n","__proto__","a","_Object$defineProperty","_Object$getOwnPropertyDescriptor","u","Object","prototype","hasOwnProperty","call","i","set","registerInternalPlugin","LLMChannel","config"],"sources":["index.ts"],"sourcesContent":["import * as WebexCore from '@webex/webex-core';\nimport LLMChannel, {config} from './llm';\n\nWebexCore.registerInternalPlugin('llm', LLMChannel, {\n config,\n});\n\nexport {default} from './llm';\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAF,uBAAA,CAAAC,OAAA;AAAyC,SAAAE,yBAAAC,CAAA,6BAAAC,QAAA,mBAAAC,CAAA,OAAAD,QAAA,IAAAE,CAAA,OAAAF,QAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,gBAAAK,OAAA,CAAAL,CAAA,0BAAAA,CAAA,WAAAM,OAAA,EAAAN,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAI,GAAA,CAAAP,CAAA,UAAAG,CAAA,CAAAK,GAAA,CAAAR,CAAA,OAAAS,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,sBAAA,IAAAC,gCAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAC,MAAA,CAAAC,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAlB,CAAA,EAAAc,CAAA,SAAAK,CAAA,GAAAR,CAAA,GAAAE,gCAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAK,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,IAAAR,sBAAA,CAAAH,CAAA,EAAAK,CAAA,EAAAK,CAAA,IAAAV,CAAA,CAAAK,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAL,CAAA,CAAAH,OAAA,GAAAN,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAiB,GAAA,CAAApB,CAAA,EAAAS,CAAA,GAAAA,CAAA;AAEzCd,SAAS,CAAC0B,sBAAsB,CAAC,KAAK,EAAEC,YAAU,EAAE;EAClDC,MAAM,EAANA;AACF,CAAC,CAAC"}
|
package/dist/llm.js
CHANGED
|
@@ -17,8 +17,10 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/he
|
|
|
17
17
|
var _internalPluginMercury = _interopRequireDefault(require("@webex/internal-plugin-mercury"));
|
|
18
18
|
var _constants = require("./constants");
|
|
19
19
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
20
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
21
|
-
|
|
20
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /* eslint-disable consistent-return */
|
|
21
|
+
// eslint-disable-next-line no-unused-vars
|
|
22
|
+
|
|
23
|
+
var config = exports.config = {
|
|
22
24
|
llm: {
|
|
23
25
|
/**
|
|
24
26
|
* Milliseconds between pings sent up the socket
|
|
@@ -52,32 +54,23 @@ var config = {
|
|
|
52
54
|
/**
|
|
53
55
|
* LLMChannel to provide socket connections
|
|
54
56
|
*/
|
|
55
|
-
exports.
|
|
56
|
-
var LLMChannel = /*#__PURE__*/function (_ref) {
|
|
57
|
+
var LLMChannel = exports.default = /*#__PURE__*/function (_ref) {
|
|
57
58
|
(0, _inherits2.default)(LLMChannel, _ref);
|
|
58
59
|
var _super = _createSuper(LLMChannel);
|
|
59
|
-
/**
|
|
60
|
-
* If the LLM plugin has been registered and listening
|
|
61
|
-
* @instance
|
|
62
|
-
* @type {Boolean}
|
|
63
|
-
* @public
|
|
64
|
-
*/
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Initializes the LLM Plugin
|
|
68
|
-
* @constructor
|
|
69
|
-
* @public
|
|
70
|
-
*/
|
|
71
60
|
function LLMChannel() {
|
|
72
61
|
var _this;
|
|
73
62
|
(0, _classCallCheck2.default)(this, LLMChannel);
|
|
74
63
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
75
64
|
args[_key] = arguments[_key];
|
|
76
65
|
}
|
|
77
|
-
// eslint-disable-next-line constructor-super
|
|
78
66
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
79
67
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "namespace", _constants.LLM);
|
|
80
|
-
|
|
68
|
+
/**
|
|
69
|
+
* If the LLM plugin has been registered and listening
|
|
70
|
+
* @instance
|
|
71
|
+
* @type {Boolean}
|
|
72
|
+
* @public
|
|
73
|
+
*/
|
|
81
74
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "webSocketUrl", void 0);
|
|
82
75
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "binding", void 0);
|
|
83
76
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "locusUrl", void 0);
|
|
@@ -89,7 +82,10 @@ var LLMChannel = /*#__PURE__*/function (_ref) {
|
|
|
89
82
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "register", function (llmSocketUrl) {
|
|
90
83
|
return _this.request({
|
|
91
84
|
method: 'POST',
|
|
92
|
-
url: llmSocketUrl
|
|
85
|
+
url: llmSocketUrl,
|
|
86
|
+
body: {
|
|
87
|
+
deviceUrl: _this.webex.internal.device.url
|
|
88
|
+
}
|
|
93
89
|
}).then(function (res) {
|
|
94
90
|
_this.webSocketUrl = res.body.webSocketUrl;
|
|
95
91
|
_this.binding = res.body.binding;
|
|
@@ -108,21 +104,19 @@ var LLMChannel = /*#__PURE__*/function (_ref) {
|
|
|
108
104
|
return _this.register(datachannelUrl).then(function () {
|
|
109
105
|
if (!locusUrl || !datachannelUrl) return undefined;
|
|
110
106
|
_this.locusUrl = locusUrl;
|
|
111
|
-
_this.connect(_this.webSocketUrl)
|
|
112
|
-
_this.registered = true;
|
|
113
|
-
});
|
|
107
|
+
_this.connect(_this.webSocketUrl);
|
|
114
108
|
});
|
|
115
109
|
});
|
|
116
110
|
/**
|
|
117
111
|
* Tells if LLM socket is connected
|
|
118
|
-
* @returns {boolean}
|
|
112
|
+
* @returns {boolean} connected
|
|
119
113
|
*/
|
|
120
114
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isConnected", function () {
|
|
121
|
-
return _this.
|
|
115
|
+
return _this.connected;
|
|
122
116
|
});
|
|
123
117
|
/**
|
|
124
|
-
* Tells if LLM socket is
|
|
125
|
-
* @returns {
|
|
118
|
+
* Tells if LLM socket is binding
|
|
119
|
+
* @returns {string} binding
|
|
126
120
|
*/
|
|
127
121
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getBinding", function () {
|
|
128
122
|
return _this.binding;
|
|
@@ -140,16 +134,13 @@ var LLMChannel = /*#__PURE__*/function (_ref) {
|
|
|
140
134
|
*/
|
|
141
135
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "disconnectLLM", function () {
|
|
142
136
|
return _this.disconnect().then(function () {
|
|
143
|
-
_this.registered = false;
|
|
144
137
|
_this.locusUrl = undefined;
|
|
145
138
|
_this.binding = undefined;
|
|
146
139
|
_this.webSocketUrl = undefined;
|
|
147
140
|
});
|
|
148
141
|
});
|
|
149
|
-
_this.registered = false;
|
|
150
142
|
return _this;
|
|
151
143
|
}
|
|
152
144
|
return (0, _createClass2.default)(LLMChannel);
|
|
153
145
|
}(_internalPluginMercury.default);
|
|
154
|
-
exports.default = LLMChannel;
|
|
155
146
|
//# sourceMappingURL=llm.js.map
|
package/dist/llm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_internalPluginMercury","_interopRequireDefault","require","_constants","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","default","result","NewTarget","constructor","_Reflect$construct","arguments","apply","_possibleConstructorReturn2","Reflect","sham","Proxy","Boolean","prototype","valueOf","call","e","config","llm","pingInterval","process","env","MERCURY_PING_INTERVAL","pongTimeout","MERCURY_PONG_TIMEOUT","backoffTimeMax","MERCURY_BACKOFF_TIME_MAX","backoffTimeReset","MERCURY_BACKOFF_TIME_RESET","forceCloseDelay","MERCURY_FORCE_CLOSE_DELAY","
|
|
1
|
+
{"version":3,"names":["_internalPluginMercury","_interopRequireDefault","require","_constants","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","default","result","NewTarget","constructor","_Reflect$construct","arguments","apply","_possibleConstructorReturn2","Reflect","sham","Proxy","Boolean","prototype","valueOf","call","e","config","exports","llm","pingInterval","process","env","MERCURY_PING_INTERVAL","pongTimeout","MERCURY_PONG_TIMEOUT","backoffTimeMax","MERCURY_BACKOFF_TIME_MAX","backoffTimeReset","MERCURY_BACKOFF_TIME_RESET","forceCloseDelay","MERCURY_FORCE_CLOSE_DELAY","LLMChannel","_ref","_inherits2","_super","_this","_classCallCheck2","_len","length","args","Array","_key","concat","_defineProperty2","_assertThisInitialized2","LLM","llmSocketUrl","request","method","url","body","deviceUrl","webex","internal","device","then","res","webSocketUrl","binding","catch","error","logger","locusUrl","datachannelUrl","register","undefined","connect","connected","disconnect","_createClass2","Mercury"],"sources":["llm.ts"],"sourcesContent":["/* eslint-disable consistent-return */\n\nimport Mercury from '@webex/internal-plugin-mercury';\n\nimport {LLM} from './constants';\n// eslint-disable-next-line no-unused-vars\nimport {ILLMChannel} from './llm.types';\n\nexport const config = {\n llm: {\n /**\n * Milliseconds between pings sent up the socket\n * @type {number}\n */\n pingInterval: process.env.MERCURY_PING_INTERVAL || 15000,\n /**\n * Milliseconds to wait for a pong before declaring the connection dead\n * @type {number}\n */\n pongTimeout: process.env.MERCURY_PONG_TIMEOUT || 14000,\n /**\n * Maximum milliseconds between connection attempts\n * @type {Number}\n */\n backoffTimeMax: process.env.MERCURY_BACKOFF_TIME_MAX || 32000,\n /**\n * Initial milliseconds between connection attempts\n * @type {Number}\n */\n backoffTimeReset: process.env.MERCURY_BACKOFF_TIME_RESET || 1000,\n /**\n * Milliseconds to wait for a close frame before declaring the socket dead and\n * discarding it\n * @type {[type]}\n */\n forceCloseDelay: process.env.MERCURY_FORCE_CLOSE_DELAY || 2000,\n },\n};\n\n/**\n * LLMChannel to provide socket connections\n */\nexport default class LLMChannel extends (Mercury as any) implements ILLMChannel {\n namespace = LLM;\n\n /**\n * If the LLM plugin has been registered and listening\n * @instance\n * @type {Boolean}\n * @public\n */\n\n private webSocketUrl?: string;\n\n private binding?: string;\n\n private locusUrl?: string;\n\n /**\n * Register to the websocket\n * @param {string} llmSocketUrl\n * @returns {Promise<void>}\n */\n private register = (llmSocketUrl: string): Promise<void> =>\n this.request({\n method: 'POST',\n url: llmSocketUrl,\n body: {deviceUrl: this.webex.internal.device.url},\n })\n .then((res: {body: {webSocketUrl: string; binding: string}}) => {\n this.webSocketUrl = res.body.webSocketUrl;\n this.binding = res.body.binding;\n })\n .catch((error: any) => {\n this.logger.error(`Error connecting to websocket: ${error}`);\n throw error;\n });\n\n /**\n * Register and connect to the websocket\n * @param {string} locusUrl\n * @param {string} datachannelUrl\n * @returns {Promise<void>}\n */\n public registerAndConnect = (locusUrl: string, datachannelUrl: string): Promise<void> =>\n this.register(datachannelUrl).then(() => {\n if (!locusUrl || !datachannelUrl) return undefined;\n this.locusUrl = locusUrl;\n this.connect(this.webSocketUrl);\n });\n\n /**\n * Tells if LLM socket is connected\n * @returns {boolean} connected\n */\n public isConnected = (): boolean => this.connected;\n\n /**\n * Tells if LLM socket is binding\n * @returns {string} binding\n */\n public getBinding = (): string => this.binding;\n\n /**\n * Get Locus URL for the connection\n * @returns {string} locus Url\n */\n public getLocusUrl = (): string => this.locusUrl;\n\n /**\n * Disconnects websocket connection\n * @returns {Promise<void>}\n */\n public disconnectLLM = (): Promise<void> =>\n this.disconnect().then(() => {\n this.locusUrl = undefined;\n this.binding = undefined;\n this.webSocketUrl = undefined;\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAEA,IAAAA,sBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAAgC,SAAAE,aAAAC,OAAA,QAAAC,yBAAA,GAAAC,yBAAA,oBAAAC,qBAAA,QAAAC,KAAA,OAAAC,gBAAA,CAAAC,OAAA,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ACzB9B,KAAA,CAAKuB,OAAO,GAAGO,SAAS;QACxB9B,KAAA,CAAKsB,YAAY,GAAGQ,SAAS;MAC/B,CAAC,CAAC;IAAA;IAAA,OAAA9B,KAAA;EAAA;EAAA,WAAAkC,aAAA,CAAArE,OAAA,EAAA+B,UAAA;AAAA,EA5EmCuC,8BAAO"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webex/internal-plugin-llm",
|
|
3
|
-
"version": "2.60.0",
|
|
4
3
|
"description": "",
|
|
5
4
|
"license": "Cisco EULA (https://www.cisco.com/c/en/us/products/end-user-license-agreement.html)",
|
|
6
5
|
"main": "dist/index.js",
|
|
@@ -11,10 +10,10 @@
|
|
|
11
10
|
"directory": "packages/@webex/internal-plugin-llm"
|
|
12
11
|
},
|
|
13
12
|
"engines": {
|
|
14
|
-
"node": ">=
|
|
13
|
+
"node": ">=16"
|
|
15
14
|
},
|
|
16
15
|
"dependencies": {
|
|
17
|
-
"@webex/internal-plugin-mercury": "2.60.
|
|
16
|
+
"@webex/internal-plugin-mercury": "2.60.1-next.1"
|
|
18
17
|
},
|
|
19
18
|
"browserify": {
|
|
20
19
|
"transform": [
|
|
@@ -24,14 +23,14 @@
|
|
|
24
23
|
},
|
|
25
24
|
"devDependencies": {
|
|
26
25
|
"@babel/core": "^7.17.10",
|
|
27
|
-
"@webex/babel-config-legacy": "
|
|
28
|
-
"@webex/eslint-config-legacy": "
|
|
29
|
-
"@webex/jest-config-legacy": "
|
|
30
|
-
"@webex/legacy-tools": "
|
|
31
|
-
"@webex/test-helper-chai": "2.60.
|
|
32
|
-
"@webex/test-helper-mocha": "2.60.
|
|
33
|
-
"@webex/test-helper-mock-webex": "2.60.
|
|
34
|
-
"@webex/test-helper-test-users": "2.60.
|
|
26
|
+
"@webex/babel-config-legacy": "0.0.0",
|
|
27
|
+
"@webex/eslint-config-legacy": "0.0.0",
|
|
28
|
+
"@webex/jest-config-legacy": "0.0.0",
|
|
29
|
+
"@webex/legacy-tools": "0.0.0",
|
|
30
|
+
"@webex/test-helper-chai": "2.60.1-next.1",
|
|
31
|
+
"@webex/test-helper-mocha": "2.60.1-next.1",
|
|
32
|
+
"@webex/test-helper-mock-webex": "2.60.1-next.1",
|
|
33
|
+
"@webex/test-helper-test-users": "2.60.1-next.1",
|
|
35
34
|
"eslint": "^8.24.0",
|
|
36
35
|
"prettier": "^2.7.1",
|
|
37
36
|
"sinon": "^9.2.4"
|
|
@@ -39,10 +38,12 @@
|
|
|
39
38
|
"scripts": {
|
|
40
39
|
"build": "yarn build:src",
|
|
41
40
|
"build:src": "webex-legacy-tools build -dest \"./dist\" -src \"./src\" -js -ts -maps",
|
|
41
|
+
"deploy:npm": "yarn npm publish",
|
|
42
42
|
"test": "yarn test:style && yarn test:unit && yarn test:integration && yarn test:browser",
|
|
43
43
|
"test:browser": "webex-legacy-tools test --integration --unit --runner karma",
|
|
44
44
|
"test:integration": "webex-legacy-tools test --integration --runner mocha",
|
|
45
45
|
"test:style": "eslint ./src/**/*.*",
|
|
46
46
|
"test:unit": "webex-legacy-tools test --unit --runner jest"
|
|
47
|
-
}
|
|
48
|
-
|
|
47
|
+
},
|
|
48
|
+
"version": "2.60.1-next.1"
|
|
49
|
+
}
|
package/src/llm.ts
CHANGED
|
@@ -49,7 +49,6 @@ export default class LLMChannel extends (Mercury as any) implements ILLMChannel
|
|
|
49
49
|
* @type {Boolean}
|
|
50
50
|
* @public
|
|
51
51
|
*/
|
|
52
|
-
private registered = false;
|
|
53
52
|
|
|
54
53
|
private webSocketUrl?: string;
|
|
55
54
|
|
|
@@ -57,18 +56,6 @@ export default class LLMChannel extends (Mercury as any) implements ILLMChannel
|
|
|
57
56
|
|
|
58
57
|
private locusUrl?: string;
|
|
59
58
|
|
|
60
|
-
/**
|
|
61
|
-
* Initializes the LLM Plugin
|
|
62
|
-
* @constructor
|
|
63
|
-
* @public
|
|
64
|
-
*/
|
|
65
|
-
constructor(...args) {
|
|
66
|
-
// eslint-disable-next-line constructor-super
|
|
67
|
-
super(...args);
|
|
68
|
-
|
|
69
|
-
this.registered = false;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
59
|
/**
|
|
73
60
|
* Register to the websocket
|
|
74
61
|
* @param {string} llmSocketUrl
|
|
@@ -78,6 +65,7 @@ export default class LLMChannel extends (Mercury as any) implements ILLMChannel
|
|
|
78
65
|
this.request({
|
|
79
66
|
method: 'POST',
|
|
80
67
|
url: llmSocketUrl,
|
|
68
|
+
body: {deviceUrl: this.webex.internal.device.url},
|
|
81
69
|
})
|
|
82
70
|
.then((res: {body: {webSocketUrl: string; binding: string}}) => {
|
|
83
71
|
this.webSocketUrl = res.body.webSocketUrl;
|
|
@@ -98,20 +86,18 @@ export default class LLMChannel extends (Mercury as any) implements ILLMChannel
|
|
|
98
86
|
this.register(datachannelUrl).then(() => {
|
|
99
87
|
if (!locusUrl || !datachannelUrl) return undefined;
|
|
100
88
|
this.locusUrl = locusUrl;
|
|
101
|
-
this.connect(this.webSocketUrl)
|
|
102
|
-
this.registered = true;
|
|
103
|
-
});
|
|
89
|
+
this.connect(this.webSocketUrl);
|
|
104
90
|
});
|
|
105
91
|
|
|
106
92
|
/**
|
|
107
93
|
* Tells if LLM socket is connected
|
|
108
|
-
* @returns {boolean}
|
|
94
|
+
* @returns {boolean} connected
|
|
109
95
|
*/
|
|
110
|
-
public isConnected = (): boolean => this.
|
|
96
|
+
public isConnected = (): boolean => this.connected;
|
|
111
97
|
|
|
112
98
|
/**
|
|
113
|
-
* Tells if LLM socket is
|
|
114
|
-
* @returns {
|
|
99
|
+
* Tells if LLM socket is binding
|
|
100
|
+
* @returns {string} binding
|
|
115
101
|
*/
|
|
116
102
|
public getBinding = (): string => this.binding;
|
|
117
103
|
|
|
@@ -127,7 +113,6 @@ export default class LLMChannel extends (Mercury as any) implements ILLMChannel
|
|
|
127
113
|
*/
|
|
128
114
|
public disconnectLLM = (): Promise<void> =>
|
|
129
115
|
this.disconnect().then(() => {
|
|
130
|
-
this.registered = false;
|
|
131
116
|
this.locusUrl = undefined;
|
|
132
117
|
this.binding = undefined;
|
|
133
118
|
this.webSocketUrl = undefined;
|
package/test/unit/spec/llm.js
CHANGED
|
@@ -20,7 +20,9 @@ describe('plugin-llm', () => {
|
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
llmService = webex.internal.llm;
|
|
23
|
-
llmService.connect = sinon.stub().
|
|
23
|
+
llmService.connect = sinon.stub().callsFake(() => {
|
|
24
|
+
llmService.connected = true;
|
|
25
|
+
});
|
|
24
26
|
llmService.disconnect = sinon.stub().resolves(true);
|
|
25
27
|
llmService.request = sinon.stub().resolves({
|
|
26
28
|
headers: {},
|
|
@@ -65,6 +67,7 @@ describe('plugin-llm', () => {
|
|
|
65
67
|
sinon.match({
|
|
66
68
|
method: 'POST',
|
|
67
69
|
url: `${datachannelUrl}`,
|
|
70
|
+
body: {deviceUrl: webex.internal.device.url},
|
|
68
71
|
})
|
|
69
72
|
);
|
|
70
73
|
|