always transcribe in the source language, and let tasks call the API
Three changes that Transcribe Audio needs. Whisper's translate mode only ever outputs English, so it cannot honour "translate into <language>" for anything else — it answered Portuguese audio with a rough English rendering instead of a transcript. The translate decision is gone and transcription is always faithful to the detected language; spokenLanguages now only breaks ties on clips Whisper is unsure about. Script tasks get OFFICER_API_URL / OFFICER_API_HOST / OFFICER_AUTH_TOKEN so they can call Officer's own endpoints rather than reimplementing server-side work. Requests go to 127.0.0.1 so nothing depends on DNS or the proxy, but origin validation matches Host against PUBLIC_URL, hence the separate host variable. `inline` accepts "ask", which offers both affordances in the runner — Run here streams into the modal, Run as job queues it. Useful when the same task can take a second or an hour depending on whether it was pointed at a file or a library. Existing true/false values behave exactly as before. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
5f7d574dec
commit
06aac5478f
@@ -4,6 +4,7 @@ import { tmpdir } from 'node:os';
|
||||
import { getTaskByDirName } from './task-files';
|
||||
import { getOwnerHomeDir, DATA_PATH } from '../../data-path';
|
||||
import { killTree } from './process-tree';
|
||||
import { buildTaskApiEnv } from './task-api-env';
|
||||
|
||||
// Script-job event stream. `stdout`/`stderr` are high-frequency (live-only + persisted to the log
|
||||
// file); `started`/`exit`/`error` are structural and get buffered for viewer replay.
|
||||
@@ -16,7 +17,9 @@ export type ScriptEvent =
|
||||
|
||||
export type ExecuteScriptParams = {
|
||||
jobId: string;
|
||||
userId: number;
|
||||
email: string;
|
||||
username?: string | null;
|
||||
taskDirName: string;
|
||||
inputs: Record<string, string>;
|
||||
cwd?: string;
|
||||
@@ -66,7 +69,7 @@ export const jobLogPath = (jobId: string) => join(DATA_PATH, 'jobs', `${jobId}.l
|
||||
// output to a durable log file. Resolves with the process exit code; throws only on spawn failure or
|
||||
// when aborted (the manager maps those to failed/stopped).
|
||||
export async function executeScript(params: ExecuteScriptParams): Promise<{ exitCode: number }> {
|
||||
const { jobId, email, inputs, abortSignal, emit } = params;
|
||||
const { jobId, userId, email, username, inputs, abortSignal, emit } = params;
|
||||
|
||||
const task = await getTaskByDirName(params.taskDirName);
|
||||
if (!task) throw new Error(`Task not found: ${params.taskDirName}`);
|
||||
@@ -83,7 +86,8 @@ export async function executeScript(params: ExecuteScriptParams): Promise<{ exit
|
||||
const cwd = params.cwd ? (isAbsolute(params.cwd) ? params.cwd : join(homeDir, params.cwd)) : homeDir;
|
||||
|
||||
const spawnCmd = cmd;
|
||||
const spawnEnv = { ...(process.env as Record<string, string>), ...inputEnv };
|
||||
const apiEnv = await buildTaskApiEnv({ id: userId, email, username });
|
||||
const spawnEnv = { ...(process.env as Record<string, string>), ...apiEnv, ...inputEnv };
|
||||
const spawnCwd = cwd;
|
||||
|
||||
mkdirSync(join(DATA_PATH, 'jobs'), { recursive: true });
|
||||
|
||||
Reference in New Issue
Block a user