@qvac/sdk 0.8.3 → 0.9.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/NOTICE +267 -63
- package/dist/client/api/diffusion.d.ts +32 -0
- package/dist/client/api/diffusion.js +103 -0
- package/dist/client/api/embed.d.ts +9 -3
- package/dist/client/api/embed.js +4 -1
- package/dist/client/api/finetune.d.ts +69 -0
- package/dist/client/api/finetune.js +139 -0
- package/dist/client/api/get-model-info.d.ts +1 -1
- package/dist/client/api/index.d.ts +4 -0
- package/dist/client/api/index.js +4 -0
- package/dist/client/api/rag.d.ts +1 -1
- package/dist/client/api/rag.js +1 -1
- package/dist/client/api/resume.d.ts +14 -0
- package/dist/client/api/resume.js +20 -0
- package/dist/client/api/suspend.d.ts +13 -0
- package/dist/client/api/suspend.js +19 -0
- package/dist/client/api/transcribe.d.ts +25 -17
- package/dist/client/api/transcribe.js +115 -35
- package/dist/client/rpc/bare-client.d.ts +5 -1
- package/dist/client/rpc/bare-client.js +70 -57
- package/dist/client/rpc/expo-rpc-client.d.ts +4 -0
- package/dist/client/rpc/expo-rpc-client.js +8 -0
- package/dist/client/rpc/node-rpc-client.d.ts +4 -0
- package/dist/client/rpc/node-rpc-client.js +8 -0
- package/dist/client/rpc/rpc-client.d.ts +13 -0
- package/dist/client/rpc/rpc-client.js +131 -1
- package/dist/examples/delegated-inference/composite.d.ts +2 -0
- package/dist/examples/delegated-inference/composite.js +99 -0
- package/dist/examples/diffusion-flux2-klein.d.ts +2 -0
- package/dist/examples/diffusion-flux2-klein.js +46 -0
- package/dist/examples/diffusion-simple.d.ts +2 -0
- package/dist/examples/diffusion-simple.js +17 -0
- package/dist/examples/diffusion-txt2img.d.ts +2 -0
- package/dist/examples/diffusion-txt2img.js +40 -0
- package/dist/examples/embed-p2p.js +2 -2
- package/dist/examples/finetune/llamacpp-finetune.d.ts +2 -0
- package/dist/examples/finetune/llamacpp-finetune.js +78 -0
- package/dist/examples/logging-streaming.js +1 -1
- package/dist/examples/mcp-websearch.js +2 -0
- package/dist/examples/ocr-fasttext.js +11 -0
- package/dist/examples/profiling/per-call.js +3 -3
- package/dist/examples/rag/rag-chromadb.js +2 -2
- package/dist/examples/rag/rag-hyperdb/pipeline.js +1 -1
- package/dist/examples/rag/rag-lancedb.js +2 -2
- package/dist/examples/rag/rag-sqlite.js +2 -2
- package/dist/examples/suspend-resume.d.ts +2 -0
- package/dist/examples/suspend-resume.js +52 -0
- package/dist/examples/transcription/parakeet-ctc-filesystem.js +3 -5
- package/dist/examples/transcription/parakeet-microphone-record.js +42 -33
- package/dist/examples/transcription/parakeet-sortformer.js +13 -3
- package/dist/examples/transcription/parakeet-tdt-filesystem.js +5 -7
- package/dist/examples/transcription/whispercpp-filesystem-streaming.d.ts +2 -0
- package/dist/examples/transcription/whispercpp-filesystem-streaming.js +99 -0
- package/dist/examples/transcription/whispercpp-microphone-record.js +78 -299
- package/dist/examples/transcription/whispercpp-prompt.js +11 -0
- package/dist/examples/translation/translation-llm.js +2 -2
- package/dist/examples/tts/supertonic-multilingual.d.ts +2 -0
- package/dist/examples/tts/supertonic-multilingual.js +56 -0
- package/dist/examples/tts/supertonic.js +12 -7
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/logging/utils.js +1 -1
- package/dist/models/registry/models.d.ts +15176 -4264
- package/dist/models/registry/models.js +18657 -7404
- package/dist/models/update-models/codegen.js +2 -2
- package/dist/models/update-models/naming.js +26 -0
- package/dist/pear/pre.js +2 -0
- package/dist/polyfills/bare-globals.d.ts +2 -0
- package/dist/polyfills/bare-globals.js +4 -0
- package/dist/polyfills/bare-globals.noop.d.ts +2 -0
- package/dist/polyfills/bare-globals.noop.js +1 -0
- package/dist/profiling/exporters.js +16 -11
- package/dist/profiling/model-execution.d.ts +16 -0
- package/dist/profiling/model-execution.js +33 -0
- package/dist/schemas/common.d.ts +967 -198
- package/dist/schemas/common.js +16 -1
- package/dist/schemas/completion-stream.d.ts +14 -6
- package/dist/schemas/completion-stream.js +4 -3
- package/dist/schemas/download-asset.d.ts +7 -3
- package/dist/schemas/embed.d.ts +19 -0
- package/dist/schemas/embed.js +7 -0
- package/dist/schemas/engine-addon-map.js +4 -1
- package/dist/schemas/finetune.d.ts +620 -0
- package/dist/schemas/finetune.js +161 -0
- package/dist/schemas/get-model-info.d.ts +2 -0
- package/dist/schemas/get-model-info.js +1 -0
- package/dist/schemas/index.d.ts +5 -1
- package/dist/schemas/index.js +5 -1
- package/dist/schemas/llamacpp-config.d.ts +26 -6
- package/dist/schemas/llamacpp-config.js +12 -0
- package/dist/schemas/load-model.d.ts +4005 -1400
- package/dist/schemas/load-model.js +34 -1
- package/dist/schemas/model-src-utils.d.ts +10 -2
- package/dist/schemas/model-types.d.ts +19 -1
- package/dist/schemas/model-types.js +11 -0
- package/dist/schemas/ocr.d.ts +2 -0
- package/dist/schemas/plugin.d.ts +24 -3
- package/dist/schemas/plugin.js +14 -0
- package/dist/schemas/profiling.d.ts +4 -0
- package/dist/schemas/profiling.js +4 -0
- package/dist/schemas/registry.d.ts +18 -0
- package/dist/schemas/registry.js +2 -0
- package/dist/schemas/reload-config.d.ts +9 -1
- package/dist/schemas/resume.d.ts +10 -0
- package/dist/schemas/resume.js +7 -0
- package/dist/schemas/sdcpp-config.d.ts +327 -0
- package/dist/schemas/sdcpp-config.js +102 -0
- package/dist/schemas/sdk-config.d.ts +1225 -235
- package/dist/schemas/sdk-config.js +4 -0
- package/dist/schemas/sdk-errors-server.d.ts +2 -0
- package/dist/schemas/sdk-errors-server.js +12 -0
- package/dist/schemas/suspend.d.ts +10 -0
- package/dist/schemas/suspend.js +7 -0
- package/dist/schemas/text-to-speech.d.ts +187 -10
- package/dist/schemas/text-to-speech.js +12 -4
- package/dist/schemas/transcription-config.d.ts +16 -56
- package/dist/schemas/transcription-config.js +0 -2
- package/dist/schemas/transcription.d.ts +66 -6
- package/dist/schemas/transcription.js +29 -7
- package/dist/schemas/translate.d.ts +14 -4
- package/dist/schemas/translate.js +10 -2
- package/dist/schemas/translation-config.d.ts +30 -10
- package/dist/server/bare/delegate-rpc-client.js +3 -3
- package/dist/server/bare/hyperswarm.js +15 -3
- package/dist/server/bare/ops/embed.d.ts +8 -4
- package/dist/server/bare/ops/embed.js +15 -4
- package/dist/server/bare/ops/transcribe.d.ts +6 -2
- package/dist/server/bare/ops/transcribe.js +53 -1
- package/dist/server/bare/ops/translate.d.ts +4 -1
- package/dist/server/bare/ops/translate.js +28 -65
- package/dist/server/bare/ops/unload-model.js +2 -0
- package/dist/server/bare/plugins/index.d.ts +1 -0
- package/dist/server/bare/plugins/index.js +1 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.d.ts +3 -1
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.js +45 -9
- package/dist/server/bare/plugins/llamacpp-completion/ops/finetune.d.ts +11 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/finetune.js +112 -0
- package/dist/server/bare/plugins/llamacpp-completion/plugin.d.ts +175 -5
- package/dist/server/bare/plugins/llamacpp-completion/plugin.js +45 -35
- package/dist/server/bare/plugins/llamacpp-embedding/plugin.d.ts +11 -1
- package/dist/server/bare/plugins/llamacpp-embedding/plugin.js +9 -4
- package/dist/server/bare/plugins/nmtcpp-translation/plugin.d.ts +17 -2
- package/dist/server/bare/plugins/nmtcpp-translation/plugin.js +16 -15
- package/dist/server/bare/plugins/onnx-ocr/ops/ocr-stream.d.ts +5 -7
- package/dist/server/bare/plugins/onnx-ocr/ops/ocr-stream.js +11 -3
- package/dist/server/bare/plugins/onnx-ocr/plugin.d.ts +2 -0
- package/dist/server/bare/plugins/onnx-ocr/plugin.js +24 -19
- package/dist/server/bare/plugins/onnx-tts/ops/text-to-speech.d.ts +7 -2
- package/dist/server/bare/plugins/onnx-tts/ops/text-to-speech.js +22 -97
- package/dist/server/bare/plugins/onnx-tts/plugin.d.ts +98 -9
- package/dist/server/bare/plugins/onnx-tts/plugin.js +85 -46
- package/dist/server/bare/plugins/parakeet-transcription/plugin.d.ts +30 -60
- package/dist/server/bare/plugins/parakeet-transcription/plugin.js +49 -37
- package/dist/server/bare/plugins/sdcpp-generation/ops/diffusion.d.ts +3 -0
- package/dist/server/bare/plugins/sdcpp-generation/ops/diffusion.js +51 -0
- package/dist/server/bare/plugins/sdcpp-generation/plugin.d.ts +278 -0
- package/dist/server/bare/plugins/sdcpp-generation/plugin.js +70 -0
- package/dist/server/bare/plugins/whispercpp-transcription/plugin.d.ts +38 -2
- package/dist/server/bare/plugins/whispercpp-transcription/plugin.js +43 -22
- package/dist/server/bare/rag-hyperdb/handlers/ingest.js +2 -1
- package/dist/server/bare/rag-hyperdb/handlers/search.js +2 -1
- package/dist/server/bare/rag-hyperdb/rag-workspace-manager.js +7 -0
- package/dist/server/bare/registry/model-config-utils.js +3 -0
- package/dist/server/bare/registry/model-registry.d.ts +2 -2
- package/dist/server/bare/registry/model-registry.js +1 -1
- package/dist/server/bare/registry/registry-client.js +21 -0
- package/dist/server/bare/runtime-lifecycle.d.ts +28 -0
- package/dist/server/bare/runtime-lifecycle.js +132 -0
- package/dist/server/bare/types/addon-responses.d.ts +62 -0
- package/dist/server/bare/types/addon-responses.js +1 -0
- package/dist/server/env.js +3 -1
- package/dist/server/rpc/delegate-transport.js +1 -1
- package/dist/server/rpc/handle-request.js +50 -4
- package/dist/server/rpc/handler-registry.js +20 -1
- package/dist/server/rpc/handler-utils.d.ts +5 -3
- package/dist/server/rpc/handler-utils.js +52 -50
- package/dist/server/rpc/handlers/delete-cache.js +3 -0
- package/dist/server/rpc/handlers/diffusion-stream.d.ts +3 -0
- package/dist/server/rpc/handlers/diffusion-stream.js +4 -0
- package/dist/server/rpc/handlers/finetune.d.ts +3 -0
- package/dist/server/rpc/handlers/finetune.js +16 -0
- package/dist/server/rpc/handlers/index.d.ts +10 -0
- package/dist/server/rpc/handlers/index.js +10 -0
- package/dist/server/rpc/handlers/load-model/hyperdrive.js +24 -9
- package/dist/server/rpc/handlers/load-model/registry.d.ts +11 -0
- package/dist/server/rpc/handlers/load-model/registry.js +31 -4
- package/dist/server/rpc/handlers/plugin-dispatch.d.ts +1 -13
- package/dist/server/rpc/handlers/plugin-dispatch.js +21 -21
- package/dist/server/rpc/handlers/resume.d.ts +3 -0
- package/dist/server/rpc/handlers/resume.js +11 -0
- package/dist/server/rpc/handlers/suspend.d.ts +3 -0
- package/dist/server/rpc/handlers/suspend.js +11 -0
- package/dist/server/rpc/handlers/transcribe-stream.d.ts +1 -1
- package/dist/server/rpc/handlers/transcribe-stream.js +2 -2
- package/dist/server/rpc/handlers/transcribe.d.ts +3 -0
- package/dist/server/rpc/handlers/transcribe.js +4 -0
- package/dist/server/rpc/profiling/operation-metrics.js +107 -16
- package/dist/server/rpc/profiling/operation-wrappers.d.ts +1 -1
- package/dist/server/rpc/profiling/operation-wrappers.js +51 -19
- package/dist/server/rpc/progress-throttle.d.ts +8 -0
- package/dist/server/rpc/progress-throttle.js +47 -0
- package/dist/server/rpc/rpc-utils.d.ts +5 -0
- package/dist/server/rpc/rpc-utils.js +11 -0
- package/dist/server/utils/path-security.js +1 -1
- package/dist/server/utils/tool-integration.js +10 -0
- package/dist/server/utils/tool-parser.js +9 -5
- package/dist/server/worker-core.d.ts +2 -0
- package/dist/server/worker-core.js +26 -23
- package/dist/server/worker.js +2 -1
- package/dist/utils/encoding.d.ts +9 -0
- package/dist/utils/encoding.js +14 -0
- package/dist/utils/errors-server.d.ts +6 -0
- package/dist/utils/errors-server.js +11 -0
- package/package.json +36 -25
- package/dist/server/rpc/delegate-utils.d.ts +0 -2
- package/dist/server/rpc/delegate-utils.js +0 -5
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { type CreateModelParams, type PluginModelResult, type ResolveContext, type ResolveResult, type SdcppConfig } from "../../../../schemas/index";
|
|
2
|
+
type DiffusionArtifactKey = "clipLModelPath" | "clipGModelPath" | "t5XxlModelPath" | "llmModelPath" | "vaeModelPath";
|
|
3
|
+
export declare const diffusionPlugin: {
|
|
4
|
+
modelType: "sdcpp-generation";
|
|
5
|
+
displayName: string;
|
|
6
|
+
addonPackage: "@qvac/diffusion-cpp";
|
|
7
|
+
loadConfigSchema: import("zod").ZodObject<{
|
|
8
|
+
threads: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
9
|
+
device: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
10
|
+
cpu: "cpu";
|
|
11
|
+
gpu: "gpu";
|
|
12
|
+
}>>;
|
|
13
|
+
prediction: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
14
|
+
auto: "auto";
|
|
15
|
+
eps: "eps";
|
|
16
|
+
v: "v";
|
|
17
|
+
edm_v: "edm_v";
|
|
18
|
+
flow: "flow";
|
|
19
|
+
flux_flow: "flux_flow";
|
|
20
|
+
flux2_flow: "flux2_flow";
|
|
21
|
+
}>>;
|
|
22
|
+
type: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
23
|
+
auto: "auto";
|
|
24
|
+
f32: "f32";
|
|
25
|
+
f16: "f16";
|
|
26
|
+
bf16: "bf16";
|
|
27
|
+
q2_k: "q2_k";
|
|
28
|
+
q3_k: "q3_k";
|
|
29
|
+
q4_0: "q4_0";
|
|
30
|
+
q4_1: "q4_1";
|
|
31
|
+
q4_k: "q4_k";
|
|
32
|
+
q5_0: "q5_0";
|
|
33
|
+
q5_1: "q5_1";
|
|
34
|
+
q5_k: "q5_k";
|
|
35
|
+
q6_k: "q6_k";
|
|
36
|
+
q8_0: "q8_0";
|
|
37
|
+
}>>;
|
|
38
|
+
rng: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
39
|
+
cpu: "cpu";
|
|
40
|
+
cuda: "cuda";
|
|
41
|
+
std_default: "std_default";
|
|
42
|
+
}>>;
|
|
43
|
+
sampler_rng: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
44
|
+
cpu: "cpu";
|
|
45
|
+
cuda: "cuda";
|
|
46
|
+
std_default: "std_default";
|
|
47
|
+
}>>;
|
|
48
|
+
clip_on_cpu: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
49
|
+
vae_on_cpu: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
50
|
+
vae_tiling: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
51
|
+
flash_attn: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
52
|
+
verbosity: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
53
|
+
clipLModelSrc: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
|
|
54
|
+
src: import("zod").ZodString;
|
|
55
|
+
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
56
|
+
modelId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
57
|
+
registryPath: import("zod").ZodOptional<import("zod").ZodString>;
|
|
58
|
+
registrySource: import("zod").ZodOptional<import("zod").ZodString>;
|
|
59
|
+
blobCoreKey: import("zod").ZodOptional<import("zod").ZodString>;
|
|
60
|
+
blobIndex: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
61
|
+
engine: import("zod").ZodOptional<import("zod").ZodString>;
|
|
62
|
+
expectedSize: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
63
|
+
sha256Checksum: import("zod").ZodOptional<import("zod").ZodString>;
|
|
64
|
+
addon: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodEnum<{
|
|
65
|
+
"llamacpp-completion": "llamacpp-completion";
|
|
66
|
+
"whispercpp-transcription": "whispercpp-transcription";
|
|
67
|
+
"llamacpp-embedding": "llamacpp-embedding";
|
|
68
|
+
"nmtcpp-translation": "nmtcpp-translation";
|
|
69
|
+
"onnx-tts": "onnx-tts";
|
|
70
|
+
"parakeet-transcription": "parakeet-transcription";
|
|
71
|
+
"onnx-ocr": "onnx-ocr";
|
|
72
|
+
"sdcpp-generation": "sdcpp-generation";
|
|
73
|
+
llm: "llm";
|
|
74
|
+
whisper: "whisper";
|
|
75
|
+
embeddings: "embeddings";
|
|
76
|
+
nmt: "nmt";
|
|
77
|
+
parakeet: "parakeet";
|
|
78
|
+
tts: "tts";
|
|
79
|
+
ocr: "ocr";
|
|
80
|
+
diffusion: "diffusion";
|
|
81
|
+
}>, import("zod").ZodLiteral<"vad">]>>;
|
|
82
|
+
}, import("zod/v4/core").$strip>]>>;
|
|
83
|
+
clipGModelSrc: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
|
|
84
|
+
src: import("zod").ZodString;
|
|
85
|
+
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
86
|
+
modelId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
87
|
+
registryPath: import("zod").ZodOptional<import("zod").ZodString>;
|
|
88
|
+
registrySource: import("zod").ZodOptional<import("zod").ZodString>;
|
|
89
|
+
blobCoreKey: import("zod").ZodOptional<import("zod").ZodString>;
|
|
90
|
+
blobIndex: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
91
|
+
engine: import("zod").ZodOptional<import("zod").ZodString>;
|
|
92
|
+
expectedSize: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
93
|
+
sha256Checksum: import("zod").ZodOptional<import("zod").ZodString>;
|
|
94
|
+
addon: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodEnum<{
|
|
95
|
+
"llamacpp-completion": "llamacpp-completion";
|
|
96
|
+
"whispercpp-transcription": "whispercpp-transcription";
|
|
97
|
+
"llamacpp-embedding": "llamacpp-embedding";
|
|
98
|
+
"nmtcpp-translation": "nmtcpp-translation";
|
|
99
|
+
"onnx-tts": "onnx-tts";
|
|
100
|
+
"parakeet-transcription": "parakeet-transcription";
|
|
101
|
+
"onnx-ocr": "onnx-ocr";
|
|
102
|
+
"sdcpp-generation": "sdcpp-generation";
|
|
103
|
+
llm: "llm";
|
|
104
|
+
whisper: "whisper";
|
|
105
|
+
embeddings: "embeddings";
|
|
106
|
+
nmt: "nmt";
|
|
107
|
+
parakeet: "parakeet";
|
|
108
|
+
tts: "tts";
|
|
109
|
+
ocr: "ocr";
|
|
110
|
+
diffusion: "diffusion";
|
|
111
|
+
}>, import("zod").ZodLiteral<"vad">]>>;
|
|
112
|
+
}, import("zod/v4/core").$strip>]>>;
|
|
113
|
+
t5XxlModelSrc: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
|
|
114
|
+
src: import("zod").ZodString;
|
|
115
|
+
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
116
|
+
modelId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
117
|
+
registryPath: import("zod").ZodOptional<import("zod").ZodString>;
|
|
118
|
+
registrySource: import("zod").ZodOptional<import("zod").ZodString>;
|
|
119
|
+
blobCoreKey: import("zod").ZodOptional<import("zod").ZodString>;
|
|
120
|
+
blobIndex: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
121
|
+
engine: import("zod").ZodOptional<import("zod").ZodString>;
|
|
122
|
+
expectedSize: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
123
|
+
sha256Checksum: import("zod").ZodOptional<import("zod").ZodString>;
|
|
124
|
+
addon: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodEnum<{
|
|
125
|
+
"llamacpp-completion": "llamacpp-completion";
|
|
126
|
+
"whispercpp-transcription": "whispercpp-transcription";
|
|
127
|
+
"llamacpp-embedding": "llamacpp-embedding";
|
|
128
|
+
"nmtcpp-translation": "nmtcpp-translation";
|
|
129
|
+
"onnx-tts": "onnx-tts";
|
|
130
|
+
"parakeet-transcription": "parakeet-transcription";
|
|
131
|
+
"onnx-ocr": "onnx-ocr";
|
|
132
|
+
"sdcpp-generation": "sdcpp-generation";
|
|
133
|
+
llm: "llm";
|
|
134
|
+
whisper: "whisper";
|
|
135
|
+
embeddings: "embeddings";
|
|
136
|
+
nmt: "nmt";
|
|
137
|
+
parakeet: "parakeet";
|
|
138
|
+
tts: "tts";
|
|
139
|
+
ocr: "ocr";
|
|
140
|
+
diffusion: "diffusion";
|
|
141
|
+
}>, import("zod").ZodLiteral<"vad">]>>;
|
|
142
|
+
}, import("zod/v4/core").$strip>]>>;
|
|
143
|
+
llmModelSrc: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
|
|
144
|
+
src: import("zod").ZodString;
|
|
145
|
+
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
146
|
+
modelId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
147
|
+
registryPath: import("zod").ZodOptional<import("zod").ZodString>;
|
|
148
|
+
registrySource: import("zod").ZodOptional<import("zod").ZodString>;
|
|
149
|
+
blobCoreKey: import("zod").ZodOptional<import("zod").ZodString>;
|
|
150
|
+
blobIndex: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
151
|
+
engine: import("zod").ZodOptional<import("zod").ZodString>;
|
|
152
|
+
expectedSize: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
153
|
+
sha256Checksum: import("zod").ZodOptional<import("zod").ZodString>;
|
|
154
|
+
addon: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodEnum<{
|
|
155
|
+
"llamacpp-completion": "llamacpp-completion";
|
|
156
|
+
"whispercpp-transcription": "whispercpp-transcription";
|
|
157
|
+
"llamacpp-embedding": "llamacpp-embedding";
|
|
158
|
+
"nmtcpp-translation": "nmtcpp-translation";
|
|
159
|
+
"onnx-tts": "onnx-tts";
|
|
160
|
+
"parakeet-transcription": "parakeet-transcription";
|
|
161
|
+
"onnx-ocr": "onnx-ocr";
|
|
162
|
+
"sdcpp-generation": "sdcpp-generation";
|
|
163
|
+
llm: "llm";
|
|
164
|
+
whisper: "whisper";
|
|
165
|
+
embeddings: "embeddings";
|
|
166
|
+
nmt: "nmt";
|
|
167
|
+
parakeet: "parakeet";
|
|
168
|
+
tts: "tts";
|
|
169
|
+
ocr: "ocr";
|
|
170
|
+
diffusion: "diffusion";
|
|
171
|
+
}>, import("zod").ZodLiteral<"vad">]>>;
|
|
172
|
+
}, import("zod/v4/core").$strip>]>>;
|
|
173
|
+
vaeModelSrc: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
|
|
174
|
+
src: import("zod").ZodString;
|
|
175
|
+
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
176
|
+
modelId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
177
|
+
registryPath: import("zod").ZodOptional<import("zod").ZodString>;
|
|
178
|
+
registrySource: import("zod").ZodOptional<import("zod").ZodString>;
|
|
179
|
+
blobCoreKey: import("zod").ZodOptional<import("zod").ZodString>;
|
|
180
|
+
blobIndex: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
181
|
+
engine: import("zod").ZodOptional<import("zod").ZodString>;
|
|
182
|
+
expectedSize: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
183
|
+
sha256Checksum: import("zod").ZodOptional<import("zod").ZodString>;
|
|
184
|
+
addon: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodEnum<{
|
|
185
|
+
"llamacpp-completion": "llamacpp-completion";
|
|
186
|
+
"whispercpp-transcription": "whispercpp-transcription";
|
|
187
|
+
"llamacpp-embedding": "llamacpp-embedding";
|
|
188
|
+
"nmtcpp-translation": "nmtcpp-translation";
|
|
189
|
+
"onnx-tts": "onnx-tts";
|
|
190
|
+
"parakeet-transcription": "parakeet-transcription";
|
|
191
|
+
"onnx-ocr": "onnx-ocr";
|
|
192
|
+
"sdcpp-generation": "sdcpp-generation";
|
|
193
|
+
llm: "llm";
|
|
194
|
+
whisper: "whisper";
|
|
195
|
+
embeddings: "embeddings";
|
|
196
|
+
nmt: "nmt";
|
|
197
|
+
parakeet: "parakeet";
|
|
198
|
+
tts: "tts";
|
|
199
|
+
ocr: "ocr";
|
|
200
|
+
diffusion: "diffusion";
|
|
201
|
+
}>, import("zod").ZodLiteral<"vad">]>>;
|
|
202
|
+
}, import("zod/v4/core").$strip>]>>;
|
|
203
|
+
}, import("zod/v4/core").$strip>;
|
|
204
|
+
resolveConfig(cfg: SdcppConfig, ctx: ResolveContext): Promise<ResolveResult<SdcppConfig, DiffusionArtifactKey>>;
|
|
205
|
+
createModel(params: CreateModelParams): PluginModelResult;
|
|
206
|
+
handlers: {
|
|
207
|
+
diffusionStream: import("../../../../schemas/index").PluginHandlerDefinition<import("zod").ZodObject<{
|
|
208
|
+
modelId: import("zod").ZodString;
|
|
209
|
+
prompt: import("zod").ZodString;
|
|
210
|
+
negative_prompt: import("zod").ZodOptional<import("zod").ZodString>;
|
|
211
|
+
width: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
212
|
+
height: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
213
|
+
steps: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
214
|
+
cfg_scale: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
215
|
+
guidance: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
216
|
+
sampling_method: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
217
|
+
euler: "euler";
|
|
218
|
+
euler_a: "euler_a";
|
|
219
|
+
heun: "heun";
|
|
220
|
+
dpm2: "dpm2";
|
|
221
|
+
"dpm++2m": "dpm++2m";
|
|
222
|
+
"dpm++2mv2": "dpm++2mv2";
|
|
223
|
+
"dpm++2s_a": "dpm++2s_a";
|
|
224
|
+
lcm: "lcm";
|
|
225
|
+
ipndm: "ipndm";
|
|
226
|
+
ipndm_v: "ipndm_v";
|
|
227
|
+
ddim_trailing: "ddim_trailing";
|
|
228
|
+
tcd: "tcd";
|
|
229
|
+
res_multistep: "res_multistep";
|
|
230
|
+
res_2s: "res_2s";
|
|
231
|
+
}>>;
|
|
232
|
+
scheduler: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
233
|
+
lcm: "lcm";
|
|
234
|
+
discrete: "discrete";
|
|
235
|
+
karras: "karras";
|
|
236
|
+
exponential: "exponential";
|
|
237
|
+
ays: "ays";
|
|
238
|
+
gits: "gits";
|
|
239
|
+
sgm_uniform: "sgm_uniform";
|
|
240
|
+
simple: "simple";
|
|
241
|
+
smoothstep: "smoothstep";
|
|
242
|
+
kl_optimal: "kl_optimal";
|
|
243
|
+
bong_tangent: "bong_tangent";
|
|
244
|
+
}>>;
|
|
245
|
+
seed: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
246
|
+
batch_count: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
247
|
+
vae_tiling: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
248
|
+
cache_preset: import("zod").ZodOptional<import("zod").ZodString>;
|
|
249
|
+
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
250
|
+
type: import("zod").ZodLiteral<"diffusionStream">;
|
|
251
|
+
step: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
252
|
+
totalSteps: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
253
|
+
elapsedMs: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
254
|
+
data: import("zod").ZodOptional<import("zod").ZodString>;
|
|
255
|
+
outputIndex: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
256
|
+
done: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
257
|
+
stats: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
258
|
+
modelLoadMs: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
259
|
+
generationMs: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
260
|
+
totalGenerationMs: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
261
|
+
totalWallMs: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
262
|
+
totalSteps: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
263
|
+
totalGenerations: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
264
|
+
totalImages: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
265
|
+
totalPixels: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
266
|
+
width: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
267
|
+
height: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
268
|
+
seed: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
269
|
+
}, import("zod/v4/core").$strip>>;
|
|
270
|
+
}, import("zod/v4/core").$strip>>;
|
|
271
|
+
};
|
|
272
|
+
logging: {
|
|
273
|
+
module: import("@qvac/diffusion-cpp/addonLogging").AddonLogging;
|
|
274
|
+
namespace: "sdcpp-generation";
|
|
275
|
+
};
|
|
276
|
+
};
|
|
277
|
+
export {};
|
|
278
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import ImgStableDiffusion, {} from "@qvac/diffusion-cpp";
|
|
2
|
+
import addonLogging from "@qvac/diffusion-cpp/addonLogging.js";
|
|
3
|
+
import { definePlugin, defineHandler, sdcppConfigSchema, diffusionRequestSchema, diffusionStreamResponseSchema, ModelType, ADDON_DIFFUSION, } from "../../../../schemas/index.js";
|
|
4
|
+
import { createStreamLogger, registerAddonLogger } from "../../../../logging/index.js";
|
|
5
|
+
import { parseModelPath } from "../../../utils/index.js";
|
|
6
|
+
import { diffusion } from "./ops/diffusion.js";
|
|
7
|
+
export const diffusionPlugin = definePlugin({
|
|
8
|
+
modelType: ModelType.sdcppGeneration,
|
|
9
|
+
displayName: "Image Generation (stable-diffusion.cpp)",
|
|
10
|
+
addonPackage: ADDON_DIFFUSION,
|
|
11
|
+
loadConfigSchema: sdcppConfigSchema,
|
|
12
|
+
async resolveConfig(cfg, ctx) {
|
|
13
|
+
const { clipLModelSrc, clipGModelSrc, t5XxlModelSrc, llmModelSrc, vaeModelSrc, ...runtimeConfig } = cfg;
|
|
14
|
+
const sources = { clipLModelSrc, clipGModelSrc, t5XxlModelSrc, llmModelSrc, vaeModelSrc };
|
|
15
|
+
const hasSources = Object.values(sources).some(Boolean);
|
|
16
|
+
if (!hasSources) {
|
|
17
|
+
return { config: runtimeConfig };
|
|
18
|
+
}
|
|
19
|
+
const resolve = ctx.resolveModelPath;
|
|
20
|
+
const [clipLModelPath, clipGModelPath, t5XxlModelPath, llmModelPath, vaeModelPath] = await Promise.all([
|
|
21
|
+
clipLModelSrc ? resolve(clipLModelSrc) : undefined,
|
|
22
|
+
clipGModelSrc ? resolve(clipGModelSrc) : undefined,
|
|
23
|
+
t5XxlModelSrc ? resolve(t5XxlModelSrc) : undefined,
|
|
24
|
+
llmModelSrc ? resolve(llmModelSrc) : undefined,
|
|
25
|
+
vaeModelSrc ? resolve(vaeModelSrc) : undefined,
|
|
26
|
+
]);
|
|
27
|
+
return {
|
|
28
|
+
config: runtimeConfig,
|
|
29
|
+
artifacts: {
|
|
30
|
+
...(clipLModelPath && { clipLModelPath }),
|
|
31
|
+
...(clipGModelPath && { clipGModelPath }),
|
|
32
|
+
...(t5XxlModelPath && { t5XxlModelPath }),
|
|
33
|
+
...(llmModelPath && { llmModelPath }),
|
|
34
|
+
...(vaeModelPath && { vaeModelPath }),
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
createModel(params) {
|
|
39
|
+
const { modelId, modelPath, modelConfig, artifacts } = params;
|
|
40
|
+
const config = (modelConfig ?? {});
|
|
41
|
+
const { dirPath, basePath } = parseModelPath(modelPath);
|
|
42
|
+
const logger = createStreamLogger(modelId, ModelType.sdcppGeneration);
|
|
43
|
+
registerAddonLogger(modelId, ModelType.sdcppGeneration, logger);
|
|
44
|
+
const addonArgs = {
|
|
45
|
+
diskPath: dirPath,
|
|
46
|
+
modelName: basePath,
|
|
47
|
+
logger,
|
|
48
|
+
opts: { stats: true },
|
|
49
|
+
...(artifacts?.["clipLModelPath"] && { clipLModel: artifacts["clipLModelPath"] }),
|
|
50
|
+
...(artifacts?.["clipGModelPath"] && { clipGModel: artifacts["clipGModelPath"] }),
|
|
51
|
+
...(artifacts?.["t5XxlModelPath"] && { t5XxlModel: artifacts["t5XxlModelPath"] }),
|
|
52
|
+
...(artifacts?.["llmModelPath"] && { llmModel: artifacts["llmModelPath"] }),
|
|
53
|
+
...(artifacts?.["vaeModelPath"] && { vaeModel: artifacts["vaeModelPath"] }),
|
|
54
|
+
};
|
|
55
|
+
const model = new ImgStableDiffusion(addonArgs, config);
|
|
56
|
+
return { model, loader: undefined };
|
|
57
|
+
},
|
|
58
|
+
handlers: {
|
|
59
|
+
diffusionStream: defineHandler({
|
|
60
|
+
requestSchema: diffusionRequestSchema,
|
|
61
|
+
responseSchema: diffusionStreamResponseSchema,
|
|
62
|
+
streaming: true,
|
|
63
|
+
handler: diffusion,
|
|
64
|
+
}),
|
|
65
|
+
},
|
|
66
|
+
logging: {
|
|
67
|
+
module: addonLogging,
|
|
68
|
+
namespace: ModelType.sdcppGeneration,
|
|
69
|
+
},
|
|
70
|
+
});
|
|
@@ -82,6 +82,7 @@ export declare const whisperPlugin: {
|
|
|
82
82
|
"onnx-tts": "onnx-tts";
|
|
83
83
|
"parakeet-transcription": "parakeet-transcription";
|
|
84
84
|
"onnx-ocr": "onnx-ocr";
|
|
85
|
+
"sdcpp-generation": "sdcpp-generation";
|
|
85
86
|
llm: "llm";
|
|
86
87
|
whisper: "whisper";
|
|
87
88
|
embeddings: "embeddings";
|
|
@@ -89,6 +90,7 @@ export declare const whisperPlugin: {
|
|
|
89
90
|
parakeet: "parakeet";
|
|
90
91
|
tts: "tts";
|
|
91
92
|
ocr: "ocr";
|
|
93
|
+
diffusion: "diffusion";
|
|
92
94
|
}>, import("zod").ZodLiteral<"vad">]>>;
|
|
93
95
|
}, import("zod/v4/core").$strip>]>>;
|
|
94
96
|
}, import("zod/v4/core").$strip>;
|
|
@@ -211,8 +213,9 @@ export declare const whisperPlugin: {
|
|
|
211
213
|
}>;
|
|
212
214
|
createModel(params: CreateModelParams): PluginModelResult;
|
|
213
215
|
handlers: {
|
|
214
|
-
|
|
216
|
+
transcribe: import("../../../../schemas/index").PluginHandlerDefinition<import("zod").ZodObject<{
|
|
215
217
|
modelId: import("zod").ZodString;
|
|
218
|
+
prompt: import("zod").ZodOptional<import("zod").ZodString>;
|
|
216
219
|
audioChunk: import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
|
|
217
220
|
type: import("zod").ZodLiteral<"base64">;
|
|
218
221
|
value: import("zod").ZodString;
|
|
@@ -220,13 +223,46 @@ export declare const whisperPlugin: {
|
|
|
220
223
|
type: import("zod").ZodLiteral<"filePath">;
|
|
221
224
|
value: import("zod").ZodString;
|
|
222
225
|
}, import("zod/v4/core").$strip>], "type">;
|
|
226
|
+
type: import("zod").ZodLiteral<"transcribe">;
|
|
227
|
+
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
228
|
+
text: import("zod").ZodOptional<import("zod").ZodString>;
|
|
229
|
+
done: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
230
|
+
stats: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
231
|
+
audioDuration: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
232
|
+
realTimeFactor: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
233
|
+
tokensPerSecond: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
234
|
+
totalTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
235
|
+
totalSegments: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
236
|
+
whisperEncodeTime: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
237
|
+
whisperDecodeTime: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
238
|
+
encoderTime: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
239
|
+
decoderTime: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
240
|
+
melSpecTime: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
241
|
+
}, import("zod/v4/core").$strip>>;
|
|
242
|
+
error: import("zod").ZodOptional<import("zod").ZodString>;
|
|
243
|
+
type: import("zod").ZodLiteral<"transcribe">;
|
|
244
|
+
}, import("zod/v4/core").$strip>>;
|
|
245
|
+
transcribeStream: import("../../../../schemas/index").PluginHandlerDefinition<import("zod").ZodObject<{
|
|
246
|
+
modelId: import("zod").ZodString;
|
|
223
247
|
prompt: import("zod").ZodOptional<import("zod").ZodString>;
|
|
224
248
|
type: import("zod").ZodLiteral<"transcribeStream">;
|
|
225
249
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
226
|
-
type: import("zod").ZodLiteral<"transcribeStream">;
|
|
227
250
|
text: import("zod").ZodOptional<import("zod").ZodString>;
|
|
228
251
|
done: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
252
|
+
stats: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
253
|
+
audioDuration: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
254
|
+
realTimeFactor: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
255
|
+
tokensPerSecond: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
256
|
+
totalTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
257
|
+
totalSegments: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
258
|
+
whisperEncodeTime: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
259
|
+
whisperDecodeTime: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
260
|
+
encoderTime: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
261
|
+
decoderTime: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
262
|
+
melSpecTime: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
263
|
+
}, import("zod/v4/core").$strip>>;
|
|
229
264
|
error: import("zod").ZodOptional<import("zod").ZodString>;
|
|
265
|
+
type: import("zod").ZodLiteral<"transcribeStream">;
|
|
230
266
|
}, import("zod/v4/core").$strip>>;
|
|
231
267
|
};
|
|
232
268
|
logging: {
|
|
@@ -1,28 +1,20 @@
|
|
|
1
1
|
import whisperAddonLogging from "@qvac/transcription-whispercpp/addonLogging.js";
|
|
2
2
|
import TranscriptionWhispercpp, {} from "@qvac/transcription-whispercpp";
|
|
3
|
-
import { definePlugin, defineHandler, transcribeStreamRequestSchema, transcribeStreamResponseSchema, ModelType, whisperConfigSchema, ADDON_WHISPER, } from "../../../../schemas/index.js";
|
|
3
|
+
import { definePlugin, defineHandler, defineDuplexHandler, transcribeRequestSchema, transcribeResponseSchema, transcribeStreamRequestSchema, transcribeStreamResponseSchema, ModelType, whisperConfigSchema, ADDON_WHISPER, } from "../../../../schemas/index.js";
|
|
4
4
|
import { createStreamLogger, registerAddonLogger } from "../../../../logging/index.js";
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import { transcribe } from "../../ops/transcribe.js";
|
|
5
|
+
import { transcribe, transcribeStream } from "../../ops/transcribe.js";
|
|
6
|
+
import { attachModelExecutionMs } from "../../../../profiling/model-execution.js";
|
|
8
7
|
function createWhisperModel(modelId, modelPath, whisperConfig, vadModelPath) {
|
|
9
|
-
const { dirPath, basePath } = parseModelPath(modelPath);
|
|
10
|
-
let vadModelName = "";
|
|
11
|
-
if (vadModelPath) {
|
|
12
|
-
const vadParsed = parseModelPath(vadModelPath);
|
|
13
|
-
vadModelName = vadParsed.basePath;
|
|
14
|
-
}
|
|
15
|
-
const loader = new FilesystemDL({ dirPath });
|
|
16
8
|
const logger = createStreamLogger(modelId, ModelType.whispercppTranscription);
|
|
17
9
|
registerAddonLogger(modelId, ModelType.whispercppTranscription, logger);
|
|
18
10
|
const args = {
|
|
19
|
-
|
|
11
|
+
files: {
|
|
12
|
+
model: modelPath,
|
|
13
|
+
...(vadModelPath && { vadModel: vadModelPath }),
|
|
14
|
+
},
|
|
20
15
|
logger,
|
|
21
|
-
modelName: basePath,
|
|
22
|
-
diskPath: dirPath,
|
|
23
|
-
vadModelName,
|
|
24
16
|
opts: {
|
|
25
|
-
stats:
|
|
17
|
+
stats: true,
|
|
26
18
|
},
|
|
27
19
|
};
|
|
28
20
|
const { contextParams, miscConfig, ...whisperParams } = whisperConfig;
|
|
@@ -32,7 +24,7 @@ function createWhisperModel(modelId, modelPath, whisperConfig, vadModelPath) {
|
|
|
32
24
|
...(miscConfig && { miscConfig }),
|
|
33
25
|
};
|
|
34
26
|
const model = new TranscriptionWhispercpp(args, config);
|
|
35
|
-
return { model, loader };
|
|
27
|
+
return { model, loader: null };
|
|
36
28
|
}
|
|
37
29
|
export const whisperPlugin = definePlugin({
|
|
38
30
|
modelType: ModelType.whispercppTranscription,
|
|
@@ -56,16 +48,45 @@ export const whisperPlugin = definePlugin({
|
|
|
56
48
|
return { model, loader };
|
|
57
49
|
},
|
|
58
50
|
handlers: {
|
|
59
|
-
|
|
60
|
-
requestSchema:
|
|
61
|
-
responseSchema:
|
|
51
|
+
transcribe: defineHandler({
|
|
52
|
+
requestSchema: transcribeRequestSchema,
|
|
53
|
+
responseSchema: transcribeResponseSchema,
|
|
62
54
|
streaming: true,
|
|
63
55
|
handler: async function* (request) {
|
|
64
|
-
|
|
56
|
+
const stream = transcribe({
|
|
65
57
|
modelId: request.modelId,
|
|
66
58
|
audioChunk: request.audioChunk,
|
|
67
59
|
prompt: request.prompt,
|
|
68
|
-
})
|
|
60
|
+
});
|
|
61
|
+
try {
|
|
62
|
+
let result = await stream.next();
|
|
63
|
+
while (!result.done) {
|
|
64
|
+
yield {
|
|
65
|
+
type: "transcribe",
|
|
66
|
+
text: result.value,
|
|
67
|
+
};
|
|
68
|
+
result = await stream.next();
|
|
69
|
+
}
|
|
70
|
+
const { modelExecutionMs, stats } = result.value;
|
|
71
|
+
yield attachModelExecutionMs({
|
|
72
|
+
type: "transcribe",
|
|
73
|
+
text: "",
|
|
74
|
+
done: true,
|
|
75
|
+
...(stats && { stats }),
|
|
76
|
+
}, modelExecutionMs);
|
|
77
|
+
}
|
|
78
|
+
finally {
|
|
79
|
+
await stream.return?.(undefined);
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
}),
|
|
83
|
+
transcribeStream: defineDuplexHandler({
|
|
84
|
+
requestSchema: transcribeStreamRequestSchema,
|
|
85
|
+
responseSchema: transcribeStreamResponseSchema,
|
|
86
|
+
streaming: true,
|
|
87
|
+
duplex: true,
|
|
88
|
+
handler: async function* (request, inputStream) {
|
|
89
|
+
for await (const text of transcribeStream(request.modelId, inputStream, request.prompt)) {
|
|
69
90
|
yield {
|
|
70
91
|
type: "transcribeStream",
|
|
71
92
|
text,
|
|
@@ -4,7 +4,8 @@ import { ragIngestParamsSchema } from "../../../../schemas/index.js";
|
|
|
4
4
|
export async function ingest(params, options) {
|
|
5
5
|
const { modelId, documents, chunk, chunkOpts, workspace, progressInterval } = ragIngestParamsSchema.parse(params);
|
|
6
6
|
async function embeddingFunction(text) {
|
|
7
|
-
|
|
7
|
+
const result = await embed({ modelId, text });
|
|
8
|
+
return result.embedding;
|
|
8
9
|
}
|
|
9
10
|
const rag = await getRagInstance(modelId, embeddingFunction, workspace);
|
|
10
11
|
const ingestOpts = {
|
|
@@ -7,7 +7,8 @@ export async function search(params) {
|
|
|
7
7
|
return [];
|
|
8
8
|
}
|
|
9
9
|
async function embeddingFunction(text) {
|
|
10
|
-
|
|
10
|
+
const result = await embed({ modelId, text });
|
|
11
|
+
return result.embedding;
|
|
11
12
|
}
|
|
12
13
|
const rag = await getRagInstance(modelId, embeddingFunction, workspace);
|
|
13
14
|
const results = await rag.search(query, { topK, n });
|
|
@@ -7,6 +7,7 @@ import { RAGWorkspaceModelMismatchError, RAGWorkspaceNotOpenError, } from "../..
|
|
|
7
7
|
import { validateAndJoinPath } from "../../utils/path-security.js";
|
|
8
8
|
import { createStreamLogger, getServerLogger, RAG_NAMESPACE, } from "../../../logging/index.js";
|
|
9
9
|
import { cancelAllRagOperations } from "./rag-operation-manager.js";
|
|
10
|
+
import { registerCorestore, unregisterCorestore, } from "../runtime-lifecycle.js";
|
|
10
11
|
const logger = getServerLogger();
|
|
11
12
|
const ragWorkspaces = new Map();
|
|
12
13
|
export const DEFAULT_WORKSPACE = "default";
|
|
@@ -39,6 +40,10 @@ async function getOrCreateWorkspaceEntry(workspace) {
|
|
|
39
40
|
dbName: key,
|
|
40
41
|
});
|
|
41
42
|
await dbAdapter.ready();
|
|
43
|
+
registerCorestore(corestore, {
|
|
44
|
+
label: `rag-workspace:${key}`,
|
|
45
|
+
createdAt: Date.now(),
|
|
46
|
+
});
|
|
42
47
|
const entry = {
|
|
43
48
|
corestore,
|
|
44
49
|
dbAdapter,
|
|
@@ -81,6 +86,7 @@ export async function closeRagInstance(workspace) {
|
|
|
81
86
|
}
|
|
82
87
|
await entry.dbAdapter.close();
|
|
83
88
|
await entry.corestore.close();
|
|
89
|
+
unregisterCorestore(entry.corestore);
|
|
84
90
|
ragWorkspaces.delete(key);
|
|
85
91
|
}
|
|
86
92
|
let isCleaningUp = false;
|
|
@@ -96,6 +102,7 @@ export async function closeAllRagInstances() {
|
|
|
96
102
|
}
|
|
97
103
|
await entry.dbAdapter.close();
|
|
98
104
|
await entry.corestore.close();
|
|
105
|
+
unregisterCorestore(entry.corestore);
|
|
99
106
|
ragWorkspaces.delete(key);
|
|
100
107
|
});
|
|
101
108
|
await Promise.all(closures);
|
|
@@ -2,6 +2,7 @@ import { ModelType, } from "../../../schemas/index.js";
|
|
|
2
2
|
import { llmConfigSchema, embedConfigSchema } from "../../../schemas/llamacpp-config.js";
|
|
3
3
|
import { whisperConfigSchema, parakeetRuntimeConfigSchema, } from "../../../schemas/transcription-config.js";
|
|
4
4
|
import { ocrConfigSchema } from "../../../schemas/ocr.js";
|
|
5
|
+
import { sdcppConfigSchema } from "../../../schemas/sdcpp-config.js";
|
|
5
6
|
export const CANONICAL_TO_ALIAS = {
|
|
6
7
|
[ModelType.llamacppCompletion]: "llm",
|
|
7
8
|
[ModelType.llamacppEmbedding]: "embeddings",
|
|
@@ -10,6 +11,7 @@ export const CANONICAL_TO_ALIAS = {
|
|
|
10
11
|
[ModelType.nmtcppTranslation]: "nmt",
|
|
11
12
|
[ModelType.onnxTts]: "tts",
|
|
12
13
|
[ModelType.onnxOcr]: "ocr",
|
|
14
|
+
[ModelType.sdcppGeneration]: "diffusion",
|
|
13
15
|
};
|
|
14
16
|
export const MODEL_CONFIG_SCHEMAS = {
|
|
15
17
|
[ModelType.llamacppCompletion]: llmConfigSchema,
|
|
@@ -17,6 +19,7 @@ export const MODEL_CONFIG_SCHEMAS = {
|
|
|
17
19
|
[ModelType.whispercppTranscription]: whisperConfigSchema,
|
|
18
20
|
[ModelType.parakeetTranscription]: parakeetRuntimeConfigSchema.passthrough(),
|
|
19
21
|
[ModelType.onnxOcr]: ocrConfigSchema,
|
|
22
|
+
[ModelType.sdcppGeneration]: sdcppConfigSchema,
|
|
20
23
|
};
|
|
21
24
|
// Ordered general → specific (later patterns override earlier)
|
|
22
25
|
export const BUILTIN_DEVICE_PATTERNS = [
|
|
@@ -21,7 +21,7 @@ interface LocalOptions {
|
|
|
21
21
|
config: unknown;
|
|
22
22
|
modelType: CanonicalModelType;
|
|
23
23
|
name?: string | undefined;
|
|
24
|
-
loader
|
|
24
|
+
loader?: FilesystemDL;
|
|
25
25
|
}
|
|
26
26
|
export interface ModelEntry {
|
|
27
27
|
id: string;
|
|
@@ -34,7 +34,7 @@ export declare function registerModel(id: string, options: {
|
|
|
34
34
|
path: string;
|
|
35
35
|
config: unknown;
|
|
36
36
|
modelType: CanonicalModelType;
|
|
37
|
-
loader
|
|
37
|
+
loader?: FilesystemDL;
|
|
38
38
|
name?: string | undefined;
|
|
39
39
|
} | {
|
|
40
40
|
topic: string;
|