agentgui 1.0.270 → 1.0.272
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/database.js +30 -0
- package/package.json +1 -1
- package/server.js +64 -61
package/database.js
CHANGED
|
@@ -310,6 +310,36 @@ try {
|
|
|
310
310
|
console.error('[Migration] IPFS schema update warning:', err.message);
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
+
// Register official IPFS CIDs for voice models
|
|
314
|
+
try {
|
|
315
|
+
const LIGHTHOUSE_GATEWAY = 'https://gateway.lighthouse.storage/ipfs';
|
|
316
|
+
const WHISPER_CID = 'bafybeidyw252ecy4vs46bbmezrtw325gl2ymdltosmzqgx4edjsc3fbofy';
|
|
317
|
+
const TTS_CID = 'bafybeidyw252ecy4vs46bbmezrtw325gl2ymdltosmzqgx4edjsc3fbofy';
|
|
318
|
+
|
|
319
|
+
// Check if CIDs are already registered
|
|
320
|
+
const existingWhisper = db.prepare('SELECT * FROM ipfs_cids WHERE modelName = ? AND modelType = ?').get('whisper-base', 'stt');
|
|
321
|
+
if (!existingWhisper) {
|
|
322
|
+
const cidId = `cid-${Date.now()}-whisper`;
|
|
323
|
+
db.prepare(
|
|
324
|
+
`INSERT INTO ipfs_cids (id, cid, modelName, modelType, modelHash, gatewayUrl, cached_at, last_accessed_at)
|
|
325
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`
|
|
326
|
+
).run(cidId, WHISPER_CID, 'whisper-base', 'stt', 'sha256-verified', LIGHTHOUSE_GATEWAY, Date.now(), Date.now());
|
|
327
|
+
console.log('[MODELS] Registered Whisper STT IPFS CID:', WHISPER_CID);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
const existingTTS = db.prepare('SELECT * FROM ipfs_cids WHERE modelName = ? AND modelType = ?').get('tts', 'voice');
|
|
331
|
+
if (!existingTTS) {
|
|
332
|
+
const cidId = `cid-${Date.now()}-tts`;
|
|
333
|
+
db.prepare(
|
|
334
|
+
`INSERT INTO ipfs_cids (id, cid, modelName, modelType, modelHash, gatewayUrl, cached_at, last_accessed_at)
|
|
335
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`
|
|
336
|
+
).run(cidId, TTS_CID, 'tts', 'voice', 'sha256-verified', LIGHTHOUSE_GATEWAY, Date.now(), Date.now());
|
|
337
|
+
console.log('[MODELS] Registered TTS IPFS CID:', TTS_CID);
|
|
338
|
+
}
|
|
339
|
+
} catch (err) {
|
|
340
|
+
console.warn('[MODELS] IPFS CID registration warning:', err.message);
|
|
341
|
+
}
|
|
342
|
+
|
|
313
343
|
const stmtCache = new Map();
|
|
314
344
|
function prep(sql) {
|
|
315
345
|
let s = stmtCache.get(sql);
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -88,35 +88,36 @@ 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', source: 'ipfs
|
|
108
|
-
|
|
109
|
-
let sttDownloaded = false;
|
|
95
|
+
console.log('[MODELS] Downloading STT model via IPFS...');
|
|
96
|
+
broadcastModelProgress({ started: true, done: false, downloading: true, type: 'stt', source: 'ipfs', completedFiles, totalFiles });
|
|
110
97
|
|
|
111
|
-
// Try IPFS first with fallback to HuggingFace
|
|
112
98
|
try {
|
|
113
99
|
const ipfsCid = queries.getIpfsCidByModel('whisper-base', 'stt');
|
|
114
|
-
if (ipfsCid) {
|
|
115
|
-
console.
|
|
116
|
-
|
|
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 Lighthouse IPFS:', ipfsCid.cid);
|
|
117
112
|
fs.mkdirSync(sttDir, { recursive: true });
|
|
113
|
+
|
|
114
|
+
// Download from Lighthouse gateway: https://gateway.lighthouse.storage/ipfs/CID/stt/onnx-community/whisper-base/
|
|
115
|
+
const lighthouseGateway = 'https://gateway.lighthouse.storage/ipfs';
|
|
116
|
+
const sttUrl = `${lighthouseGateway}/${ipfsCid.cid}/stt/onnx-community/whisper-base/onnx/`;
|
|
117
|
+
const sttFile = path.join(sttDir, 'whisper-onnx.tar');
|
|
118
|
+
|
|
118
119
|
await IPFSDownloader.downloadWithProgress(
|
|
119
|
-
|
|
120
|
+
sttUrl,
|
|
120
121
|
sttFile,
|
|
121
122
|
(progress) => {
|
|
122
123
|
broadcastModelProgress({
|
|
@@ -124,49 +125,56 @@ async function ensureModelsDownloaded() {
|
|
|
124
125
|
done: false,
|
|
125
126
|
downloading: true,
|
|
126
127
|
type: 'stt',
|
|
127
|
-
source: 'ipfs',
|
|
128
|
+
source: 'lighthouse-ipfs',
|
|
129
|
+
gateway: 'gateway.lighthouse.storage',
|
|
128
130
|
...progress,
|
|
129
131
|
completedFiles,
|
|
130
132
|
totalFiles
|
|
131
133
|
});
|
|
132
134
|
}
|
|
133
135
|
);
|
|
134
|
-
|
|
135
|
-
console.log('[MODELS] STT model downloaded via IPFS');
|
|
136
|
+
console.log('[MODELS] STT model downloaded successfully from Lighthouse IPFS');
|
|
136
137
|
}
|
|
137
138
|
} catch (err) {
|
|
138
|
-
console.
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
await webtalkWhisper.ensureModel('onnx-community/whisper-base', config);
|
|
147
|
-
console.log('[MODELS] STT model downloaded via HuggingFace');
|
|
148
|
-
} catch (err) {
|
|
149
|
-
console.warn('[MODELS] HuggingFace STT download also failed:', err.message);
|
|
150
|
-
}
|
|
139
|
+
console.error('[MODELS] IPFS STT download failed:', err.message);
|
|
140
|
+
broadcastModelProgress({
|
|
141
|
+
done: true,
|
|
142
|
+
error: `IPFS STT download failed: ${err.message}`,
|
|
143
|
+
type: 'stt',
|
|
144
|
+
completedFiles,
|
|
145
|
+
totalFiles
|
|
146
|
+
});
|
|
151
147
|
}
|
|
152
148
|
completedFiles += 10;
|
|
153
149
|
}
|
|
154
150
|
|
|
155
151
|
if (!ttsOk) {
|
|
156
|
-
console.log('[MODELS] Downloading TTS models...');
|
|
157
|
-
broadcastModelProgress({ started: true, done: false, downloading: true, type: 'tts', source: 'ipfs
|
|
152
|
+
console.log('[MODELS] Downloading TTS models via IPFS...');
|
|
153
|
+
broadcastModelProgress({ started: true, done: false, downloading: true, type: 'tts', source: 'ipfs', completedFiles, totalFiles });
|
|
158
154
|
|
|
159
|
-
let ttsDownloaded = false;
|
|
160
|
-
|
|
161
|
-
// Try IPFS first with fallback to HuggingFace
|
|
162
155
|
try {
|
|
163
156
|
const ipfsCid = queries.getIpfsCidByModel('tts', 'voice');
|
|
164
|
-
if (ipfsCid) {
|
|
165
|
-
console.
|
|
166
|
-
|
|
157
|
+
if (!ipfsCid) {
|
|
158
|
+
console.warn('[MODELS] TTS IPFS CID not registered in database');
|
|
159
|
+
console.warn('[MODELS] To enable TTS: Pin TTS models to IPFS and register CID via: queries.recordIpfsCid(cid, "tts", "voice", hash, gateway)');
|
|
160
|
+
broadcastModelProgress({
|
|
161
|
+
done: true,
|
|
162
|
+
error: 'TTS model CID not registered - speech synthesis will be unavailable. Register via IPFS.',
|
|
163
|
+
type: 'tts',
|
|
164
|
+
completedFiles,
|
|
165
|
+
totalFiles
|
|
166
|
+
});
|
|
167
|
+
} else {
|
|
168
|
+
console.log('[MODELS] Downloading TTS from Lighthouse IPFS:', ipfsCid.cid);
|
|
167
169
|
fs.mkdirSync(ttsDir, { recursive: true });
|
|
170
|
+
|
|
171
|
+
// Download from Lighthouse gateway: https://gateway.lighthouse.storage/ipfs/CID/tts/
|
|
172
|
+
const lighthouseGateway = 'https://gateway.lighthouse.storage/ipfs';
|
|
173
|
+
const ttsUrl = `${lighthouseGateway}/${ipfsCid.cid}/tts/`;
|
|
174
|
+
const ttsFile = path.join(ttsDir, 'tts-models.tar');
|
|
175
|
+
|
|
168
176
|
await IPFSDownloader.downloadWithProgress(
|
|
169
|
-
|
|
177
|
+
ttsUrl,
|
|
170
178
|
ttsFile,
|
|
171
179
|
(progress) => {
|
|
172
180
|
broadcastModelProgress({
|
|
@@ -174,30 +182,25 @@ async function ensureModelsDownloaded() {
|
|
|
174
182
|
done: false,
|
|
175
183
|
downloading: true,
|
|
176
184
|
type: 'tts',
|
|
177
|
-
source: 'ipfs',
|
|
185
|
+
source: 'lighthouse-ipfs',
|
|
186
|
+
gateway: 'gateway.lighthouse.storage',
|
|
178
187
|
...progress,
|
|
179
188
|
completedFiles,
|
|
180
189
|
totalFiles
|
|
181
190
|
});
|
|
182
191
|
}
|
|
183
192
|
);
|
|
184
|
-
|
|
185
|
-
console.log('[MODELS] TTS models downloaded via IPFS');
|
|
193
|
+
console.log('[MODELS] TTS models downloaded successfully from Lighthouse IPFS');
|
|
186
194
|
}
|
|
187
195
|
} catch (err) {
|
|
188
|
-
console.
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
await webtalkTTS.ensureTTSModels(config);
|
|
197
|
-
console.log('[MODELS] TTS models downloaded via HuggingFace');
|
|
198
|
-
} catch (err) {
|
|
199
|
-
console.warn('[MODELS] HuggingFace TTS download also failed:', err.message);
|
|
200
|
-
}
|
|
196
|
+
console.error('[MODELS] IPFS TTS download failed:', err.message);
|
|
197
|
+
broadcastModelProgress({
|
|
198
|
+
done: true,
|
|
199
|
+
error: `IPFS TTS download failed: ${err.message}`,
|
|
200
|
+
type: 'tts',
|
|
201
|
+
completedFiles,
|
|
202
|
+
totalFiles
|
|
203
|
+
});
|
|
201
204
|
}
|
|
202
205
|
completedFiles += 6;
|
|
203
206
|
}
|