Auto-sync: 2026-03-03 03:00:01
This commit is contained in:
@@ -5,18 +5,16 @@ kind: script
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
args:
|
||||
type: object
|
||||
device:
|
||||
type: string
|
||||
description: ''
|
||||
default: null
|
||||
properties:
|
||||
device:
|
||||
type: string
|
||||
description: ''
|
||||
originalType: string
|
||||
text:
|
||||
type: string
|
||||
description: ''
|
||||
originalType: string
|
||||
originalType: string
|
||||
text:
|
||||
type: string
|
||||
description: ''
|
||||
default: null
|
||||
originalType: string
|
||||
required:
|
||||
- args
|
||||
- device
|
||||
- text
|
||||
|
||||
@@ -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