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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server.js +37 -35
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentgui",
3
- "version": "1.0.278",
3
+ "version": "1.0.279",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "server.js",
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 ipfsCid = queries.getIpfsCidByModel('whisper-base', 'stt');
101
- if (ipfsCid) {
102
- console.log('[MODELS] Downloading STT from Lighthouse IPFS:', ipfsCid.cid);
103
- fs.mkdirSync(sttDir, { recursive: true });
104
- const sttUrl = `https://gateway.lighthouse.storage/ipfs/${ipfsCid.cid}/stt/onnx-community/whisper-base/onnx/`;
105
- const sttFile = path.join(sttDir, 'whisper-onnx.tar');
106
- try {
107
- await IPFSDownloader.downloadWithProgress(sttUrl, sttFile, (progress) => {
108
- broadcastModelProgress({ started: true, done: false, downloading: true, type: 'stt', source: 'lighthouse-ipfs', gateway: 'gateway.lighthouse.storage', ...progress, completedFiles, totalFiles });
109
- });
110
- console.log('[MODELS] STT model downloaded from Lighthouse IPFS');
111
- sttDownloaded = true;
112
- } catch (err) {
113
- console.error('[MODELS] IPFS STT download failed:', err.message, '- falling back to HuggingFace');
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
- } else {
116
- console.warn('[MODELS] No STT IPFS CID registered - using HuggingFace directly');
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 ipfsCid = queries.getIpfsCidByModel('tts', 'voice');
144
- if (ipfsCid) {
145
- console.log('[MODELS] Downloading TTS from Lighthouse IPFS:', ipfsCid.cid);
146
- fs.mkdirSync(ttsDir, { recursive: true });
147
- const ttsUrl = `https://gateway.lighthouse.storage/ipfs/${ipfsCid.cid}/tts/`;
148
- const ttsFile = path.join(ttsDir, 'tts-models.tar');
149
- try {
150
- await IPFSDownloader.downloadWithProgress(ttsUrl, ttsFile, (progress) => {
151
- broadcastModelProgress({ started: true, done: false, downloading: true, type: 'tts', source: 'lighthouse-ipfs', gateway: 'gateway.lighthouse.storage', ...progress, completedFiles, totalFiles });
152
- });
153
- console.log('[MODELS] TTS models downloaded from Lighthouse IPFS');
154
- ttsDownloaded = true;
155
- } catch (err) {
156
- console.error('[MODELS] IPFS TTS download failed:', err.message, '- falling back to HuggingFace');
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'),