@fugood/buttress-server 2.25.0-beta.26 → 2.25.0-beta.35
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/lib/chunk-C7Qqr4sF.mjs +2 -0
- package/lib/index.d.mts +117 -4
- package/lib/index.mjs +819 -51
- package/package.json +5 -3
- package/public/status.html +162 -1
- package/lib/chunk-C8PTHxhX.mjs +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i=(e,t)=>()=>(e&&(t=e(e=0)),t),a=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),o=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n&&e(r,Symbol.toStringTag,{value:`Module`}),r},s=(i,a,o,s)=>{if(a&&typeof a==`object`||typeof a==`function`)for(var c=n(a),l=0,u=c.length,d;l<u;l++)d=c[l],!r.call(i,d)&&d!==o&&e(i,d,{get:(e=>a[e]).bind(null,d),enumerable:!(s=t(a,d))||s.enumerable});return i},c=t=>r.call(t,`module.exports`)?t[`module.exports`]:s(e({},`__esModule`,{value:!0}),t);export{c as i,i as n,o as r,a as t};
|
package/lib/index.d.mts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
import { AnyElysia, Elysia } from "elysia";
|
|
3
3
|
import crypto from "node:crypto";
|
|
4
|
+
import * as node_stream_web0 from "node:stream/web";
|
|
4
5
|
import { ReadableStream } from "node:stream/web";
|
|
5
6
|
import { EventEmitter } from "node:events";
|
|
7
|
+
import { estimateOnnxRuntimeMemory as estimateRuntimeMemory } from "@fugood/buttress-hardware-guardrails";
|
|
6
8
|
|
|
7
9
|
//#region ../buttress-backend-core/lib/types/caps.d.ts
|
|
8
10
|
declare function getCapabilities(type: any, currentClientCapabilities?: any, options?: {}): Promise<any>;
|
|
@@ -101,8 +103,80 @@ declare function testGgmlSttCapabilities({
|
|
|
101
103
|
modelId: string | null;
|
|
102
104
|
defaultConfig: any | null;
|
|
103
105
|
}): Promise<void>;
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region ../buttress-backend-core/lib/types/utils/onnx.d.ts
|
|
108
|
+
declare function resolveModelCacheDir(cacheDir: string, repoId: string, revision?: string): string;
|
|
109
|
+
declare function estimateOnnxModelSize({
|
|
110
|
+
repoId,
|
|
111
|
+
revision,
|
|
112
|
+
modelType,
|
|
113
|
+
dtype,
|
|
114
|
+
cacheDir,
|
|
115
|
+
baseUrl,
|
|
116
|
+
subfolder,
|
|
117
|
+
headers,
|
|
118
|
+
configJson
|
|
119
|
+
}: {
|
|
120
|
+
repoId: string;
|
|
121
|
+
revision?: string;
|
|
122
|
+
modelType?: string;
|
|
123
|
+
dtype?: string | Record<string, string>;
|
|
124
|
+
cacheDir?: string;
|
|
125
|
+
baseUrl?: string;
|
|
126
|
+
subfolder?: string;
|
|
127
|
+
headers?: Record<string, string>;
|
|
128
|
+
configJson?: Record<string, any>;
|
|
129
|
+
}): Promise<{
|
|
130
|
+
totalBytes: number;
|
|
131
|
+
files: Array<{
|
|
132
|
+
name: string;
|
|
133
|
+
dtype: string;
|
|
134
|
+
bytes: number;
|
|
135
|
+
}>;
|
|
136
|
+
warnings: string[];
|
|
137
|
+
source: "local" | "remote";
|
|
138
|
+
}>;
|
|
139
|
+
declare function resolveOnnxDownloadManifest({
|
|
140
|
+
repoId,
|
|
141
|
+
revision,
|
|
142
|
+
modelType,
|
|
143
|
+
dtype,
|
|
144
|
+
cacheDir,
|
|
145
|
+
baseUrl,
|
|
146
|
+
subfolder,
|
|
147
|
+
headers,
|
|
148
|
+
configJson
|
|
149
|
+
}: {
|
|
150
|
+
repoId: string;
|
|
151
|
+
revision?: string;
|
|
152
|
+
modelType?: string;
|
|
153
|
+
dtype?: string | Record<string, string>;
|
|
154
|
+
cacheDir: string;
|
|
155
|
+
baseUrl?: string;
|
|
156
|
+
subfolder?: string;
|
|
157
|
+
headers?: Record<string, string>;
|
|
158
|
+
configJson?: Record<string, any>;
|
|
159
|
+
}): Promise<{
|
|
160
|
+
modelDir: string;
|
|
161
|
+
files: Array<{
|
|
162
|
+
rfilename: string;
|
|
163
|
+
url: string;
|
|
164
|
+
localPath: string;
|
|
165
|
+
size: number;
|
|
166
|
+
}>;
|
|
167
|
+
config: Record<string, any> | null;
|
|
168
|
+
}>;
|
|
169
|
+
declare function startOnnxModelDownload(config: object, globalDownloadManager: object, options?: {
|
|
170
|
+
onProgress?: (p: number) => void;
|
|
171
|
+
onComplete?: (info: object) => void;
|
|
172
|
+
onError?: (err: Error) => void;
|
|
173
|
+
}): Promise<{
|
|
174
|
+
started: boolean;
|
|
175
|
+
localPath: string | null;
|
|
176
|
+
repoId: string | null;
|
|
177
|
+
}>;
|
|
104
178
|
declare namespace index_d_exports {
|
|
105
|
-
export { finalizeGenerator, generatorRegistry, getCapabilities, getModelIdentifier, ggmlLlm, ggmlStt, globalDownloadManager, mlxLlm, showModelsTable, showSttModelsTable, startGenerator, startModelDownload, status, testGgmlLlmCapabilities, testGgmlSttCapabilities };
|
|
179
|
+
export { estimateOnnxModelSize, estimateRuntimeMemory, finalizeGenerator, generatorRegistry, getCapabilities, getModelIdentifier, ggmlLlm, ggmlStt, globalDownloadManager, mlxLlm, onnxStt, onnxTts, resolveModelCacheDir, resolveOnnxDownloadManifest, showModelsTable, showSttModelsTable, startGenerator, startModelDownload, startOnnxModelDownload, status, testGgmlLlmCapabilities, testGgmlSttCapabilities };
|
|
106
180
|
}
|
|
107
181
|
declare function startGenerator(type: any, config: any): Promise<{
|
|
108
182
|
id: any;
|
|
@@ -132,8 +206,47 @@ declare namespace mlxLlm {
|
|
|
132
206
|
function applyChatTemplate(id: any, property: any): Promise<any>;
|
|
133
207
|
function releaseContext(id: any, property: any): Promise<any>;
|
|
134
208
|
}
|
|
209
|
+
declare namespace onnxStt {
|
|
210
|
+
function initContext(id: any, property: any): Promise<any>;
|
|
211
|
+
/**
|
|
212
|
+
* @returns {import('node:stream/web').ReadableStream}
|
|
213
|
+
*/
|
|
214
|
+
function transcribe(id: any, property: any): node_stream_web0.ReadableStream;
|
|
215
|
+
function transcribeData(id: any, property: any): Promise<any>;
|
|
216
|
+
function releaseContext(id: any, property: any): Promise<any>;
|
|
217
|
+
}
|
|
218
|
+
declare namespace onnxTts {
|
|
219
|
+
function initContext(id: any, property: any): Promise<any>;
|
|
220
|
+
function addSpeaker(id: any, speaker: any): Promise<any>;
|
|
221
|
+
function synthesize(id: any, property: any): Promise<any>;
|
|
222
|
+
function releaseContext(id: any, property: any): Promise<any>;
|
|
223
|
+
}
|
|
135
224
|
declare namespace status {
|
|
136
|
-
export function getFullStatus():
|
|
225
|
+
export function getFullStatus(): {
|
|
226
|
+
timestamp: string;
|
|
227
|
+
ggmlLlm: any;
|
|
228
|
+
ggmlStt: any;
|
|
229
|
+
mlxLlm: any;
|
|
230
|
+
onnxStt: any;
|
|
231
|
+
onnxTts: {
|
|
232
|
+
generators: {
|
|
233
|
+
id: any;
|
|
234
|
+
type: any;
|
|
235
|
+
refCount: any;
|
|
236
|
+
repoId: any;
|
|
237
|
+
dtype: any;
|
|
238
|
+
provider: any;
|
|
239
|
+
device: any;
|
|
240
|
+
modelBytes: any;
|
|
241
|
+
vocoderRepoId: any;
|
|
242
|
+
pipelines: any;
|
|
243
|
+
}[];
|
|
244
|
+
history: {
|
|
245
|
+
modelLoads: any[];
|
|
246
|
+
syntheses: any[];
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
};
|
|
137
250
|
export function getGgmlLlmStatus(): any;
|
|
138
251
|
export function getGgmlSttStatus(): any;
|
|
139
252
|
export function getMlxLlmStatus(): any;
|
|
@@ -184,7 +297,7 @@ declare namespace globalDownloadManager {
|
|
|
184
297
|
* The download will be tracked by the global download manager so that
|
|
185
298
|
* initContext can wait for it if needed.
|
|
186
299
|
*
|
|
187
|
-
* @param {string} type - The generator type ('ggml-llm'
|
|
300
|
+
* @param {string} type - The generator type ('ggml-llm', 'ggml-stt', etc.)
|
|
188
301
|
* @param {Object} config - The generator configuration
|
|
189
302
|
* @param {Object} options - Options for the download
|
|
190
303
|
* @param {function} options.onProgress - Progress callback (0-1)
|
|
@@ -223,7 +336,7 @@ type RuntimeConfig = {
|
|
|
223
336
|
huggingface_token?: string;
|
|
224
337
|
session_cache?: SessionCacheConfig;
|
|
225
338
|
} & Record<string, any>;
|
|
226
|
-
type GeneratorType = 'ggml-llm' | 'ggml-stt' | 'mlx-llm';
|
|
339
|
+
type GeneratorType = 'ggml-llm' | 'ggml-stt' | 'mlx-llm' | 'onnx-stt' | 'onnx-tts';
|
|
227
340
|
type GeneratorConfig = {
|
|
228
341
|
type: GeneratorType;
|
|
229
342
|
} & Record<string, any>;
|