Auto-sync: 2026-03-03 03:00:01
This commit is contained in:
@@ -1,27 +1,20 @@
|
||||
export async function main(args: {
|
||||
device: string;
|
||||
text: string;
|
||||
}) {
|
||||
export async function main(
|
||||
device: string,
|
||||
text: string,
|
||||
): Promise<{ ok: boolean; device: string; text: string }> {
|
||||
const ALEXA_API_URL = "http://alexa_api:3500";
|
||||
|
||||
console.log("ARGS:", args);
|
||||
|
||||
const ssml = `<speak><lang xml:lang="ja-JP">${args.text}</lang></speak>`;
|
||||
|
||||
const res = await fetch("http://alexa_api:3500/speak", {
|
||||
const res = await fetch(`${ALEXA_API_URL}/speak`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
device: args.device,
|
||||
text: ssml
|
||||
}),
|
||||
body: JSON.stringify({ device, text }), // ← SSMLなし、素のテキスト
|
||||
});
|
||||
|
||||
const body = await res.text();
|
||||
console.log("API RESPONSE:", body);
|
||||
|
||||
if (!res.ok) {
|
||||
throw new Error("alexa-api error " + res.status + ": " + body);
|
||||
const body = await res.json().catch(() => ({}));
|
||||
throw new Error(`alexa-api error ${res.status}: ${JSON.stringify(body)}`);
|
||||
}
|
||||
|
||||
return body;
|
||||
return await res.json();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user