n8n-nodes-gigachat
Version:
A user-friendly GigaChat AI (Sber) nodes for n8n
23 lines • 975 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.chatLoadGigaChatModels = chatLoadGigaChatModels;
const GigaChatApiClient_1 = require("../../shared/GigaChatApiClient");
async function chatLoadGigaChatModels() {
const credentials = await this.getCredentials('gigaChatApi');
const scope = credentials.scope ? String(credentials.scope) : 'GIGACHAT_API_PERS';
await GigaChatApiClient_1.GigaChatApiClient.updateConfig({
credentials: credentials.authorizationKey,
scope: scope,
authUrl: credentials.base_url
? `${credentials.base_url}/api/v2/oauth`
: 'https://ngw.devices.sberbank.ru:9443/api/v2/oauth',
});
const response = await GigaChatApiClient_1.GigaChatApiClient.getModels();
return response.data
.filter((model) => model.type === 'chat')
.map((model) => ({
name: model.id,
value: model.id,
}));
}
//# sourceMappingURL=utils.js.map