UNPKG

n8n-nodes-gigachat

Version:

A user-friendly GigaChat AI (Sber) nodes for n8n

29 lines 1.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GigaChatLcClient = void 0; const langchain_gigachat_1 = require("langchain-gigachat"); const HttpsAgent_1 = require("./HttpsAgent"); const GigaChatApiClient_1 = require("./GigaChatApiClient"); class GigaChatLcClientInstance extends langchain_gigachat_1.GigaChat { constructor(config) { var _a, _b; super({ ...config, httpsAgent: HttpsAgent_1.HttpsAgent, model: (_a = config.model) !== null && _a !== void 0 ? _a : '' }); this.authorizationKey = null; this.model = ''; this.model = (_b = config.model) !== null && _b !== void 0 ? _b : ''; } async updateConfig(config) { var _a, _b, _c; const modelChanged = this.model !== ((_a = config.model) !== null && _a !== void 0 ? _a : ''); const credentialsChanged = this.authorizationKey !== config.credentials; if (credentialsChanged || modelChanged) { this.authorizationKey = (_b = config.credentials) !== null && _b !== void 0 ? _b : null; this.model = (_c = config.model) !== null && _c !== void 0 ? _c : ''; await GigaChatApiClient_1.GigaChatApiClient.updateConfig(config); this._settings = { ...this._settings, ...config, model: this.model }; this._client = GigaChatApiClient_1.GigaChatApiClient; } } } exports.GigaChatLcClient = new GigaChatLcClientInstance({}); //# sourceMappingURL=GigaChatLcClient.js.map