日本語が発話されない件の修正案

This commit is contained in:
Akira
2026-03-03 10:05:25 +09:00
parent 1496f4a5e6
commit 0d9b2758e9

View File

@@ -37,6 +37,7 @@ function httpsRequest(path, options, extraCookies) {
extraCookies = extraCookies || '';
return new Promise(function(resolve, reject) {
var allCookies = ALEXA_COOKIE + (extraCookies ? '; ' + extraCookies : '');
var bodyBuf = options.body ? Buffer.from(options.body, 'utf8') : null;
var reqOpts = {
hostname: ALEXA_HOST,
path: path,
@@ -46,7 +47,7 @@ function httpsRequest(path, options, extraCookies) {
'Accept': 'application/json, text/plain, */*',
'Accept-Language': 'ja-JP,ja;q=0.9',
'Cookie': allCookies,
}, options.headers || {}),
}, bodyBuf ? { 'Content-Length': bodyBuf.length } : {}, options.headers || {}),
};
var req = https.request(reqOpts, function(res) {
var body = '';
@@ -54,7 +55,7 @@ function httpsRequest(path, options, extraCookies) {
res.on('end', function() { resolve({ status: res.statusCode, headers: res.headers, body: body }); });
});
req.on('error', reject);
if (options.body) req.write(options.body);
if (bodyBuf) req.write(bodyBuf);
req.end();
});
}
@@ -136,8 +137,9 @@ app.post('/speak', async function(req, res) {
deviceType: target.deviceType,
deviceSerialNumber: target.serialNumber,
customerId: customerId,
locale: '',
locale: 'ja-JP',
textToSpeak: text,
speakType: 'ssml'
},
},
};