Skip to content

Commit 0056bd7

Browse files
refactor(api): reorganize STT providers into directory structure (#2149)
Restructure apps/api/src/stt to follow the pattern from owhisper-client/src/adapter: - Create provider directories: deepgram/, assemblyai/, soniox/ - Move live streaming code to <provider>/live.ts - Move batch transcription code to <provider>/batch.ts - Add index.ts for each provider to export both modules - Update main index.ts to import from provider directories Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 6420965 commit 0056bd7

File tree

10 files changed

+36
-24
lines changed

10 files changed

+36
-24
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { env } from "../env";
1+
import { env } from "../../env";
22
import type {
33
BatchAlternatives,
44
BatchChannel,
55
BatchParams,
66
BatchResponse,
77
BatchResults,
88
BatchWord,
9-
} from "./batch-types";
9+
} from "../batch-types";
1010

1111
const ASSEMBLYAI_API_URL = "https://api.assemblyai.com/v2";
1212
const POLL_INTERVAL_MS = 3000;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { buildAssemblyAIUrl, createAssemblyAIProxy } from "./live";
2+
export { transcribeWithAssemblyAI } from "./batch";
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { env } from "../env";
2-
import { WsProxyConnection } from "./connection";
1+
import { env } from "../../env";
2+
import { WsProxyConnection } from "../connection";
33

44
const CONTROL_MESSAGE_TYPES = new Set(["Terminate"]);
55

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { env } from "../env";
2-
import type { BatchParams, BatchResponse } from "./batch-types";
1+
import { env } from "../../env";
2+
import type { BatchParams, BatchResponse } from "../batch-types";
33

44
const DEEPGRAM_BATCH_URL = "https://api.deepgram.com/v1/listen";
55

apps/api/src/stt/deepgram/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { buildDeepgramUrl, createDeepgramProxy } from "./live";
2+
export { transcribeWithDeepgram } from "./batch";
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { env } from "../env";
2-
import { WsProxyConnection } from "./connection";
1+
import { env } from "../../env";
2+
import { WsProxyConnection } from "../connection";
33

44
const CONTROL_MESSAGE_TYPES = new Set(["KeepAlive", "CloseStream", "Finalize"]);
55

apps/api/src/stt/index.ts

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
1-
import { createAssemblyAIProxy } from "./assemblyai";
2-
import { transcribeWithAssemblyAI } from "./batch-assemblyai";
3-
import { transcribeWithDeepgram } from "./batch-deepgram";
4-
import { transcribeWithSoniox } from "./batch-soniox";
1+
import { createAssemblyAIProxy, transcribeWithAssemblyAI } from "./assemblyai";
52
import type { BatchParams, BatchProvider, BatchResponse } from "./batch-types";
63
import { WsProxyConnection } from "./connection";
7-
import { createDeepgramProxy } from "./deepgram";
8-
import { createSonioxProxy } from "./soniox";
4+
import { createDeepgramProxy, transcribeWithDeepgram } from "./deepgram";
5+
import { createSonioxProxy, transcribeWithSoniox } from "./soniox";
96

107
export { WsProxyConnection, type WsProxyOptions } from "./connection";
118
export { normalizeWsData, type WsPayload } from "./utils";
12-
export { buildDeepgramUrl, createDeepgramProxy } from "./deepgram";
13-
export { buildAssemblyAIUrl, createAssemblyAIProxy } from "./assemblyai";
14-
export { buildSonioxUrl, createSonioxProxy } from "./soniox";
9+
export {
10+
buildDeepgramUrl,
11+
createDeepgramProxy,
12+
transcribeWithDeepgram,
13+
} from "./deepgram";
14+
export {
15+
buildAssemblyAIUrl,
16+
createAssemblyAIProxy,
17+
transcribeWithAssemblyAI,
18+
} from "./assemblyai";
19+
export {
20+
buildSonioxUrl,
21+
createSonioxProxy,
22+
transcribeWithSoniox,
23+
} from "./soniox";
1524
export type { BatchParams, BatchProvider, BatchResponse } from "./batch-types";
16-
export { transcribeWithDeepgram } from "./batch-deepgram";
17-
export { transcribeWithAssemblyAI } from "./batch-assemblyai";
18-
export { transcribeWithSoniox } from "./batch-soniox";
1925

2026
export const UPSTREAM_URL_HEADER = "x-owh-upstream-url";
2127
export const UPSTREAM_AUTH_HEADER = "x-owh-upstream-auth";
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { env } from "../env";
1+
import { env } from "../../env";
22
import type {
33
BatchAlternatives,
44
BatchChannel,
55
BatchParams,
66
BatchResponse,
77
BatchResults,
88
BatchWord,
9-
} from "./batch-types";
9+
} from "../batch-types";
1010

1111
const SONIOX_API_HOST = "api.soniox.com";
1212
const POLL_INTERVAL_MS = 3000;

apps/api/src/stt/soniox/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { buildSonioxUrl, createSonioxProxy } from "./live";
2+
export { transcribeWithSoniox } from "./batch";
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { env } from "../env";
2-
import { WsProxyConnection } from "./connection";
1+
import { env } from "../../env";
2+
import { WsProxyConnection } from "../connection";
33

44
const CONTROL_MESSAGE_TYPES = new Set(["keepalive", "finalize"]);
55

0 commit comments

Comments
 (0)