palette-media 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/api.js +1 -1
- package/src/video.js +3 -3
package/package.json
CHANGED
package/src/api.js
CHANGED
|
@@ -36,7 +36,7 @@ async function call(method, route, body, { timeoutMs = 900_000, raw = false } =
|
|
|
36
36
|
try {
|
|
37
37
|
const r = await fetch(base + route, {
|
|
38
38
|
method,
|
|
39
|
-
headers: { Authorization: `Bearer ${key}`, "Content-Type": "application/json", "User-Agent": "palette-media/0.1.
|
|
39
|
+
headers: { Authorization: `Bearer ${key}`, "Content-Type": "application/json", "User-Agent": "palette-media/0.1.1" },
|
|
40
40
|
body: body === undefined ? undefined : JSON.stringify(body),
|
|
41
41
|
signal: ctl.signal,
|
|
42
42
|
})
|
package/src/video.js
CHANGED
|
@@ -10,7 +10,7 @@ import { config } from "./api.js"
|
|
|
10
10
|
const OUT_DIR = "palette-media"
|
|
11
11
|
|
|
12
12
|
function run(cmd, args, { cwd, maxBuffer = 64 * 1024 * 1024 } = {}) {
|
|
13
|
-
const r = spawnSync(cmd, args, { cwd, encoding: "utf8", maxBuffer })
|
|
13
|
+
const r = spawnSync(cmd, args, { cwd, encoding: "utf8", maxBuffer, windowsHide: true })
|
|
14
14
|
if (r.error) throw new Error(`${cmd} not found: install it (brew install ${cmd === "yt-dlp" ? "yt-dlp" : "ffmpeg"})`)
|
|
15
15
|
if (r.status !== 0) throw new Error(`${cmd} failed: ${(r.stderr || r.stdout || "").trim().split("\n").slice(-3).join(" ")}`)
|
|
16
16
|
return r.stdout
|
|
@@ -73,7 +73,7 @@ export async function transcribe(audioFile, { language = "ko", prompt = "" } = {
|
|
|
73
73
|
form.append("language", language)
|
|
74
74
|
form.append("response_format", "verbose_json")
|
|
75
75
|
if (prompt) form.append("prompt", prompt)
|
|
76
|
-
const r = await fetch(`${base}/v1/audio/transcriptions`, { method: "POST", headers: { Authorization: `Bearer ${key}`, "User-Agent": "palette-media/0.1.
|
|
76
|
+
const r = await fetch(`${base}/v1/audio/transcriptions`, { method: "POST", headers: { Authorization: `Bearer ${key}`, "User-Agent": "palette-media/0.1.1" }, body: form })
|
|
77
77
|
const text = await r.text()
|
|
78
78
|
if (!r.ok) return { error: `HTTP ${r.status} ${text.slice(0, 200)}` }
|
|
79
79
|
try { return JSON.parse(text) } catch { return { error: "bad STT response" } }
|
|
@@ -108,7 +108,7 @@ export async function describeFrames(frames, { question = "", language = "ko", b
|
|
|
108
108
|
for (const f of group) content.push({ type: "image_url", image_url: { url: `data:image/jpeg;base64,${fs.readFileSync(f.path).toString("base64")}` } })
|
|
109
109
|
const r = await fetch(`${base}/v1/chat/completions`, {
|
|
110
110
|
method: "POST",
|
|
111
|
-
headers: { Authorization: `Bearer ${key}`, "Content-Type": "application/json", "User-Agent": "palette-media/0.1.
|
|
111
|
+
headers: { Authorization: `Bearer ${key}`, "Content-Type": "application/json", "User-Agent": "palette-media/0.1.1" },
|
|
112
112
|
body: JSON.stringify({ model: seat, max_tokens: 1800, reasoning_effort: "low", messages: [{ role: "user", content }] }),
|
|
113
113
|
})
|
|
114
114
|
const j = await r.json().catch(() => ({}))
|