Auto-sync: 2026-03-03 03:00:01

This commit is contained in:
Windmill Bot
2026-03-03 03:00:01 +00:00
parent 2a81b7ea35
commit 72483e045b
3 changed files with 22 additions and 31 deletions

View File

@@ -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();
}