agentgui 1.0.278 → 1.0.279
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/package.json +1 -1
- package/server.js +37 -35
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -97,30 +97,35 @@ async function ensureModelsDownloaded() {
|
|
|
97
97
|
broadcastModelProgress({ started: true, done: false, downloading: true, type: 'stt', source: 'ipfs', completedFiles, totalFiles });
|
|
98
98
|
let sttDownloaded = false;
|
|
99
99
|
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
100
|
+
const LIGHTHOUSE_STT_CID = 'bafybeidyw252ecy4vs46bbmezrtw325gl2ymdltosmzqgx4edjsc3fbofy';
|
|
101
|
+
const lighthouseSttBase = `https://gateway.lighthouse.storage/ipfs/${LIGHTHOUSE_STT_CID}/stt/onnx-community/whisper-base/`;
|
|
102
|
+
const whisperModels = require('webtalk/whisper-models');
|
|
103
|
+
console.log('[MODELS] Downloading STT from Lighthouse IPFS:', LIGHTHOUSE_STT_CID);
|
|
104
|
+
fs.mkdirSync(sttDir, { recursive: true });
|
|
105
|
+
const WHISPER_FILES = [
|
|
106
|
+
'config.json', 'preprocessor_config.json', 'tokenizer.json',
|
|
107
|
+
'tokenizer_config.json', 'vocab.json', 'merges.txt',
|
|
108
|
+
'model_quantized.onnx', 'onnx/encoder_model.onnx',
|
|
109
|
+
'onnx/decoder_model_merged_q4.onnx', 'onnx/decoder_model_merged.onnx'
|
|
110
|
+
];
|
|
111
|
+
try {
|
|
112
|
+
for (const file of WHISPER_FILES) {
|
|
113
|
+
const dest = path.join(sttDir, file);
|
|
114
|
+
if (!fs.existsSync(dest)) {
|
|
115
|
+
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
116
|
+
await whisperModels.downloadFile(lighthouseSttBase + file, dest, 3);
|
|
117
|
+
}
|
|
114
118
|
}
|
|
115
|
-
|
|
116
|
-
|
|
119
|
+
console.log('[MODELS] STT model downloaded from Lighthouse IPFS');
|
|
120
|
+
sttDownloaded = true;
|
|
121
|
+
} catch (err) {
|
|
122
|
+
console.error('[MODELS] IPFS STT download failed:', err.message, '- falling back to HuggingFace');
|
|
117
123
|
}
|
|
118
124
|
|
|
119
125
|
if (!sttDownloaded) {
|
|
120
126
|
console.log('[MODELS] Downloading STT model via HuggingFace...');
|
|
121
127
|
broadcastModelProgress({ started: true, done: false, downloading: true, type: 'stt', source: 'huggingface', completedFiles, totalFiles });
|
|
122
128
|
try {
|
|
123
|
-
const whisperModels = require('webtalk/whisper-models');
|
|
124
129
|
const modelsDir = path.join(dataDir, 'models');
|
|
125
130
|
fs.mkdirSync(modelsDir, { recursive: true });
|
|
126
131
|
await whisperModels.ensureModel('onnx-community/whisper-base', {
|
|
@@ -140,30 +145,27 @@ async function ensureModelsDownloaded() {
|
|
|
140
145
|
broadcastModelProgress({ started: true, done: false, downloading: true, type: 'tts', source: 'ipfs', completedFiles, totalFiles });
|
|
141
146
|
let ttsDownloaded = false;
|
|
142
147
|
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
} else {
|
|
159
|
-
console.warn('[MODELS] No TTS IPFS CID registered - using HuggingFace directly');
|
|
148
|
+
const LIGHTHOUSE_TTS_CID = 'bafybeidyw252ecy4vs46bbmezrtw325gl2ymdltosmzqgx4edjsc3fbofy';
|
|
149
|
+
const lighthouseTtsBase = `https://gateway.lighthouse.storage/ipfs/${LIGHTHOUSE_TTS_CID}/tts/`;
|
|
150
|
+
const ttsModels = require('webtalk/tts-models');
|
|
151
|
+
console.log('[MODELS] Downloading TTS from Lighthouse IPFS:', LIGHTHOUSE_TTS_CID);
|
|
152
|
+
fs.mkdirSync(ttsDir, { recursive: true });
|
|
153
|
+
try {
|
|
154
|
+
await ttsModels.ensureTTSModels({
|
|
155
|
+
ttsModelsDir: ttsDir,
|
|
156
|
+
ttsDir: path.join(dataDir, 'models', 'tts'),
|
|
157
|
+
ttsBaseUrl: lighthouseTtsBase,
|
|
158
|
+
});
|
|
159
|
+
console.log('[MODELS] TTS models downloaded from Lighthouse IPFS');
|
|
160
|
+
ttsDownloaded = true;
|
|
161
|
+
} catch (err) {
|
|
162
|
+
console.error('[MODELS] IPFS TTS download failed:', err.message, '- falling back to HuggingFace');
|
|
160
163
|
}
|
|
161
164
|
|
|
162
165
|
if (!ttsDownloaded) {
|
|
163
166
|
console.log('[MODELS] Downloading TTS models via HuggingFace...');
|
|
164
167
|
broadcastModelProgress({ started: true, done: false, downloading: true, type: 'tts', source: 'huggingface', completedFiles, totalFiles });
|
|
165
168
|
try {
|
|
166
|
-
const ttsModels = require('webtalk/tts-models');
|
|
167
169
|
await ttsModels.ensureTTSModels({
|
|
168
170
|
ttsModelsDir: ttsDir,
|
|
169
171
|
ttsDir: path.join(dataDir, 'models', 'tts'),
|