@allmodels/dsh-speech 0.1.0
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/LICENSE +21 -0
- package/README.md +131 -0
- package/cordis.patch.yml +4 -0
- package/lib/client.js +1803 -0
- package/lib/index.d.ts +77 -0
- package/lib/index.js +717 -0
- package/package.json +110 -0
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import z from "@deepseek-ai/schemastery";
|
|
2
|
+
import * as _deepseek_ai_dsh_settings0 from "@deepseek-ai/dsh-settings";
|
|
3
|
+
import { Context } from "@deepseek-ai/cordis";
|
|
4
|
+
|
|
5
|
+
//#region src/shared.d.ts
|
|
6
|
+
|
|
7
|
+
interface SpeechSettings {
|
|
8
|
+
apiKeyEnv: string;
|
|
9
|
+
baseURL: string;
|
|
10
|
+
lowBalanceUsd: number;
|
|
11
|
+
defaultTopUpUsd: number;
|
|
12
|
+
model?: string;
|
|
13
|
+
provider?: string;
|
|
14
|
+
language?: string;
|
|
15
|
+
context?: string;
|
|
16
|
+
}
|
|
17
|
+
type SpeechUserSettings = Pick<SpeechSettings, 'model' | 'provider' | 'language' | 'context'>;
|
|
18
|
+
interface CatalogBinding {
|
|
19
|
+
provider: string;
|
|
20
|
+
model: string;
|
|
21
|
+
canonical: string;
|
|
22
|
+
isProviderDefault: boolean;
|
|
23
|
+
contextSupported: boolean;
|
|
24
|
+
interimResultsSupported: boolean;
|
|
25
|
+
languages?: readonly string[];
|
|
26
|
+
pricePerMinuteUsd?: number;
|
|
27
|
+
}
|
|
28
|
+
interface CatalogResponse {
|
|
29
|
+
bindings: CatalogBinding[];
|
|
30
|
+
fetchedAt: number;
|
|
31
|
+
}
|
|
32
|
+
interface BalanceSummary {
|
|
33
|
+
state?: string;
|
|
34
|
+
paidUsd: number;
|
|
35
|
+
promotionUsd: number;
|
|
36
|
+
usableUsd: number;
|
|
37
|
+
low: boolean;
|
|
38
|
+
exhausted: boolean;
|
|
39
|
+
fetchedAt: number;
|
|
40
|
+
}
|
|
41
|
+
/** Normalize only bindings this client can feed with its fixed PCM16/16 kHz pipeline. */
|
|
42
|
+
declare function normalizeCatalog(raw: unknown, fetchedAt?: number): CatalogResponse;
|
|
43
|
+
declare function selectBinding(bindings: readonly CatalogBinding[], locale: string, preferred?: {
|
|
44
|
+
model?: string;
|
|
45
|
+
provider?: string;
|
|
46
|
+
}): CatalogBinding | undefined;
|
|
47
|
+
declare function summarizeBalance(raw: unknown, lowThresholdUsd: number, selected?: {
|
|
48
|
+
provider?: string;
|
|
49
|
+
model?: string;
|
|
50
|
+
}, now?: number): BalanceSummary;
|
|
51
|
+
declare function appendTranscript(left: string, right: string, language?: string): string;
|
|
52
|
+
interface TranscriptAccumulator {
|
|
53
|
+
base: string;
|
|
54
|
+
finals: string;
|
|
55
|
+
partial: string;
|
|
56
|
+
language?: string;
|
|
57
|
+
lastSequence: number;
|
|
58
|
+
}
|
|
59
|
+
declare function createTranscript(base: string): TranscriptAccumulator;
|
|
60
|
+
declare function transcriptText(state: TranscriptAccumulator): string;
|
|
61
|
+
declare function applyTranscriptEvent(state: TranscriptAccumulator, event: {
|
|
62
|
+
kind: 'partial' | 'final';
|
|
63
|
+
sequence: number;
|
|
64
|
+
text: string;
|
|
65
|
+
languageCode?: string;
|
|
66
|
+
}): TranscriptAccumulator;
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/index.d.ts
|
|
69
|
+
declare const name = "@allmodels/dsh-speech";
|
|
70
|
+
declare const inject: string[];
|
|
71
|
+
declare const SPEECH_SETTINGS_NS: _deepseek_ai_dsh_settings0.SettingsNamespace;
|
|
72
|
+
type Config = SpeechSettings;
|
|
73
|
+
declare const Config: z<Config>;
|
|
74
|
+
declare const UserSettingsConfig: z<SpeechUserSettings>;
|
|
75
|
+
declare function apply(ctx: Context, config: Config): void;
|
|
76
|
+
//#endregion
|
|
77
|
+
export { Config, SPEECH_SETTINGS_NS, UserSettingsConfig, appendTranscript, apply, applyTranscriptEvent, createTranscript, inject, name, normalizeCatalog, selectBinding, summarizeBalance, transcriptText };
|