debug log
This commit is contained in:
parent
e63870fac6
commit
abb04c5a25
|
@ -17,6 +17,8 @@ export class BalabolaError extends Error { }
|
||||||
const BASE_URL = 'https://yandex.ru/lab/api/yalm/text3';
|
const BASE_URL = 'https://yandex.ru/lab/api/yalm/text3';
|
||||||
|
|
||||||
export async function balabola(query: string, intro: number): Promise<string> {
|
export async function balabola(query: string, intro: number): Promise<string> {
|
||||||
|
logger.debug({ query, intro });
|
||||||
|
|
||||||
const result = await fetch(BASE_URL, {
|
const result = await fetch(BASE_URL, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
@ -26,8 +28,6 @@ export async function balabola(query: string, intro: number): Promise<string> {
|
||||||
})
|
})
|
||||||
}).then(res => res.json()) as BalabolaResponse;
|
}).then(res => res.json()) as BalabolaResponse;
|
||||||
|
|
||||||
logger.debug(result);
|
|
||||||
|
|
||||||
if (result.bad_query === 1) throw new BalabolaError('bad query');
|
if (result.bad_query === 1) throw new BalabolaError('bad query');
|
||||||
|
|
||||||
return result.text;
|
return result.text;
|
||||||
|
|
Loading…
Reference in New Issue