feature/worker #111

Merged
primakov merged 190 commits from feature/worker into master 2025-12-05 16:59:42 +03:00
Showing only changes of commit 7b9e7d0a99 - Show all commits

View File

@@ -1,14 +1,25 @@
const axios = require('axios');
const makeLinks = require('../../shared/hateoas');
const { v4: uuidv4 } = require('uuid');
const qs = require('qs');
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
// 获取access_token
async function fetchAccessToken(apiKey) {
try {
console.log('请求token参数:', {
url: 'https://ngw.devices.sberbank.ru:9443/api/v2/oauth',
data: qs.stringify({ scope: 'GIGACHAT_API_PERS' }),
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Accept': 'application/json',
'Authorization': `Basic ${apiKey}`,
'RqUID': uuidv4()
}
});
const tokenResp = await axios.post(
'https://ngw.devices.sberbank.ru:9443/api/v2/oauth',
{ scope: 'GIGACHAT_API_PERS' },
qs.stringify({ scope: 'GIGACHAT_API_PERS' }),
{
headers: {
'Content-Type': 'application/x-www-form-urlencoded',