agentgui 1.0.269 → 1.0.271
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 +88 -19
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -88,38 +88,107 @@ async function ensureModelsDownloaded() {
|
|
|
88
88
|
modelDownloadState.downloading = true;
|
|
89
89
|
modelDownloadState.error = null;
|
|
90
90
|
|
|
91
|
-
const webtalkDir = path.dirname(r.resolve('webtalk'));
|
|
92
|
-
const webtalkWhisper = r(path.join(webtalkDir, 'whisper-models'));
|
|
93
|
-
const webtalkTTS = r(path.join(webtalkDir, 'tts-models'));
|
|
94
|
-
const { createConfig } = r('webtalk/config');
|
|
95
|
-
const config = createConfig({ sdkDir: path.dirname(fileURLToPath(import.meta.url)) });
|
|
96
|
-
config.modelsDir = gmguiModels;
|
|
97
|
-
config.ttsModelsDir = ttsDir;
|
|
98
|
-
config.sttModelsDir = sttDir;
|
|
99
|
-
config.whisperBaseUrl = 'https://huggingface.co/';
|
|
100
|
-
config.ttsBaseUrl = 'https://huggingface.co/datasets/AnEntrypoint/sttttsmodels/resolve/main/tts/';
|
|
101
|
-
|
|
102
91
|
const totalFiles = 16;
|
|
103
92
|
let completedFiles = 0;
|
|
104
93
|
|
|
105
94
|
if (!sttOk) {
|
|
106
|
-
console.log('[MODELS] Downloading STT model...');
|
|
107
|
-
broadcastModelProgress({ started: true, done: false, downloading: true, type: 'stt', completedFiles, totalFiles });
|
|
95
|
+
console.log('[MODELS] Downloading STT model via IPFS...');
|
|
96
|
+
broadcastModelProgress({ started: true, done: false, downloading: true, type: 'stt', source: 'ipfs', completedFiles, totalFiles });
|
|
97
|
+
|
|
108
98
|
try {
|
|
109
|
-
|
|
99
|
+
const ipfsCid = queries.getIpfsCidByModel('whisper-base', 'stt');
|
|
100
|
+
if (!ipfsCid) {
|
|
101
|
+
console.warn('[MODELS] STT IPFS CID not registered in database');
|
|
102
|
+
console.warn('[MODELS] To enable STT: Pin whisper-base model to IPFS and register CID via: queries.recordIpfsCid(cid, "whisper-base", "stt", hash, gateway)');
|
|
103
|
+
broadcastModelProgress({
|
|
104
|
+
done: true,
|
|
105
|
+
error: 'STT model CID not registered - speech will be unavailable. Register via IPFS.',
|
|
106
|
+
type: 'stt',
|
|
107
|
+
completedFiles,
|
|
108
|
+
totalFiles
|
|
109
|
+
});
|
|
110
|
+
} else {
|
|
111
|
+
console.log('[MODELS] Downloading STT from IPFS:', ipfsCid.cid);
|
|
112
|
+
const sttFile = path.join(sttDir, 'model.onnx');
|
|
113
|
+
fs.mkdirSync(sttDir, { recursive: true });
|
|
114
|
+
await IPFSDownloader.downloadWithProgress(
|
|
115
|
+
`https://ipfs.io/ipfs/${ipfsCid.cid}`,
|
|
116
|
+
sttFile,
|
|
117
|
+
(progress) => {
|
|
118
|
+
broadcastModelProgress({
|
|
119
|
+
started: true,
|
|
120
|
+
done: false,
|
|
121
|
+
downloading: true,
|
|
122
|
+
type: 'stt',
|
|
123
|
+
source: 'ipfs',
|
|
124
|
+
...progress,
|
|
125
|
+
completedFiles,
|
|
126
|
+
totalFiles
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
console.log('[MODELS] STT model downloaded successfully from IPFS');
|
|
131
|
+
}
|
|
110
132
|
} catch (err) {
|
|
111
|
-
console.
|
|
133
|
+
console.error('[MODELS] IPFS STT download failed:', err.message);
|
|
134
|
+
broadcastModelProgress({
|
|
135
|
+
done: true,
|
|
136
|
+
error: `IPFS STT download failed: ${err.message}`,
|
|
137
|
+
type: 'stt',
|
|
138
|
+
completedFiles,
|
|
139
|
+
totalFiles
|
|
140
|
+
});
|
|
112
141
|
}
|
|
113
142
|
completedFiles += 10;
|
|
114
143
|
}
|
|
115
144
|
|
|
116
145
|
if (!ttsOk) {
|
|
117
|
-
console.log('[MODELS] Downloading TTS models...');
|
|
118
|
-
broadcastModelProgress({ started: true, done: false, downloading: true, type: 'tts', completedFiles, totalFiles });
|
|
146
|
+
console.log('[MODELS] Downloading TTS models via IPFS...');
|
|
147
|
+
broadcastModelProgress({ started: true, done: false, downloading: true, type: 'tts', source: 'ipfs', completedFiles, totalFiles });
|
|
148
|
+
|
|
119
149
|
try {
|
|
120
|
-
|
|
150
|
+
const ipfsCid = queries.getIpfsCidByModel('tts', 'voice');
|
|
151
|
+
if (!ipfsCid) {
|
|
152
|
+
console.warn('[MODELS] TTS IPFS CID not registered in database');
|
|
153
|
+
console.warn('[MODELS] To enable TTS: Pin TTS models to IPFS and register CID via: queries.recordIpfsCid(cid, "tts", "voice", hash, gateway)');
|
|
154
|
+
broadcastModelProgress({
|
|
155
|
+
done: true,
|
|
156
|
+
error: 'TTS model CID not registered - speech synthesis will be unavailable. Register via IPFS.',
|
|
157
|
+
type: 'tts',
|
|
158
|
+
completedFiles,
|
|
159
|
+
totalFiles
|
|
160
|
+
});
|
|
161
|
+
} else {
|
|
162
|
+
console.log('[MODELS] Downloading TTS from IPFS:', ipfsCid.cid);
|
|
163
|
+
const ttsFile = path.join(ttsDir, 'models.tar.gz');
|
|
164
|
+
fs.mkdirSync(ttsDir, { recursive: true });
|
|
165
|
+
await IPFSDownloader.downloadWithProgress(
|
|
166
|
+
`https://ipfs.io/ipfs/${ipfsCid.cid}`,
|
|
167
|
+
ttsFile,
|
|
168
|
+
(progress) => {
|
|
169
|
+
broadcastModelProgress({
|
|
170
|
+
started: true,
|
|
171
|
+
done: false,
|
|
172
|
+
downloading: true,
|
|
173
|
+
type: 'tts',
|
|
174
|
+
source: 'ipfs',
|
|
175
|
+
...progress,
|
|
176
|
+
completedFiles,
|
|
177
|
+
totalFiles
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
);
|
|
181
|
+
console.log('[MODELS] TTS models downloaded successfully from IPFS');
|
|
182
|
+
}
|
|
121
183
|
} catch (err) {
|
|
122
|
-
console.
|
|
184
|
+
console.error('[MODELS] IPFS TTS download failed:', err.message);
|
|
185
|
+
broadcastModelProgress({
|
|
186
|
+
done: true,
|
|
187
|
+
error: `IPFS TTS download failed: ${err.message}`,
|
|
188
|
+
type: 'tts',
|
|
189
|
+
completedFiles,
|
|
190
|
+
totalFiles
|
|
191
|
+
});
|
|
123
192
|
}
|
|
124
193
|
completedFiles += 6;
|
|
125
194
|
}
|