agentgui 1.0.271 → 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 +22 -10
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
|
@@ -108,11 +108,16 @@ async function ensureModelsDownloaded() {
|
|
|
108
108
|
totalFiles
|
|
109
109
|
});
|
|
110
110
|
} else {
|
|
111
|
-
console.log('[MODELS] Downloading STT from IPFS:', ipfsCid.cid);
|
|
112
|
-
const sttFile = path.join(sttDir, 'model.onnx');
|
|
111
|
+
console.log('[MODELS] Downloading STT from Lighthouse IPFS:', ipfsCid.cid);
|
|
113
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
|
+
|
|
114
119
|
await IPFSDownloader.downloadWithProgress(
|
|
115
|
-
|
|
120
|
+
sttUrl,
|
|
116
121
|
sttFile,
|
|
117
122
|
(progress) => {
|
|
118
123
|
broadcastModelProgress({
|
|
@@ -120,14 +125,15 @@ async function ensureModelsDownloaded() {
|
|
|
120
125
|
done: false,
|
|
121
126
|
downloading: true,
|
|
122
127
|
type: 'stt',
|
|
123
|
-
source: 'ipfs',
|
|
128
|
+
source: 'lighthouse-ipfs',
|
|
129
|
+
gateway: 'gateway.lighthouse.storage',
|
|
124
130
|
...progress,
|
|
125
131
|
completedFiles,
|
|
126
132
|
totalFiles
|
|
127
133
|
});
|
|
128
134
|
}
|
|
129
135
|
);
|
|
130
|
-
console.log('[MODELS] STT model downloaded successfully from IPFS');
|
|
136
|
+
console.log('[MODELS] STT model downloaded successfully from Lighthouse IPFS');
|
|
131
137
|
}
|
|
132
138
|
} catch (err) {
|
|
133
139
|
console.error('[MODELS] IPFS STT download failed:', err.message);
|
|
@@ -159,11 +165,16 @@ async function ensureModelsDownloaded() {
|
|
|
159
165
|
totalFiles
|
|
160
166
|
});
|
|
161
167
|
} else {
|
|
162
|
-
console.log('[MODELS] Downloading TTS from IPFS:', ipfsCid.cid);
|
|
163
|
-
const ttsFile = path.join(ttsDir, 'models.tar.gz');
|
|
168
|
+
console.log('[MODELS] Downloading TTS from Lighthouse IPFS:', ipfsCid.cid);
|
|
164
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
|
+
|
|
165
176
|
await IPFSDownloader.downloadWithProgress(
|
|
166
|
-
|
|
177
|
+
ttsUrl,
|
|
167
178
|
ttsFile,
|
|
168
179
|
(progress) => {
|
|
169
180
|
broadcastModelProgress({
|
|
@@ -171,14 +182,15 @@ async function ensureModelsDownloaded() {
|
|
|
171
182
|
done: false,
|
|
172
183
|
downloading: true,
|
|
173
184
|
type: 'tts',
|
|
174
|
-
source: 'ipfs',
|
|
185
|
+
source: 'lighthouse-ipfs',
|
|
186
|
+
gateway: 'gateway.lighthouse.storage',
|
|
175
187
|
...progress,
|
|
176
188
|
completedFiles,
|
|
177
189
|
totalFiles
|
|
178
190
|
});
|
|
179
191
|
}
|
|
180
192
|
);
|
|
181
|
-
console.log('[MODELS] TTS models downloaded successfully from IPFS');
|
|
193
|
+
console.log('[MODELS] TTS models downloaded successfully from Lighthouse IPFS');
|
|
182
194
|
}
|
|
183
195
|
} catch (err) {
|
|
184
196
|
console.error('[MODELS] IPFS TTS download failed:', err.message);
|