agentgui 1.0.270 → 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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server.js +46 -55
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentgui",
3
- "version": "1.0.270",
3
+ "version": "1.0.271",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "server.js",
package/server.js CHANGED
@@ -88,31 +88,27 @@ 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-fallback', completedFiles, totalFiles });
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.log('[MODELS] Attempting IPFS download for STT model:', ipfsCid.cid);
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);
116
112
  const sttFile = path.join(sttDir, 'model.onnx');
117
113
  fs.mkdirSync(sttDir, { recursive: true });
118
114
  await IPFSDownloader.downloadWithProgress(
@@ -131,38 +127,39 @@ async function ensureModelsDownloaded() {
131
127
  });
132
128
  }
133
129
  );
134
- sttDownloaded = true;
135
- console.log('[MODELS] STT model downloaded via IPFS');
130
+ console.log('[MODELS] STT model downloaded successfully from IPFS');
136
131
  }
137
132
  } catch (err) {
138
- console.warn('[MODELS] IPFS STT download failed:', err.message);
139
- }
140
-
141
- // Fall back to webtalk/HuggingFace if IPFS didn't work
142
- if (!sttDownloaded) {
143
- try {
144
- console.log('[MODELS] Falling back to HuggingFace for STT model');
145
- broadcastModelProgress({ started: true, done: false, downloading: true, type: 'stt', source: 'huggingface', completedFiles, totalFiles });
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
- }
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
+ });
151
141
  }
152
142
  completedFiles += 10;
153
143
  }
154
144
 
155
145
  if (!ttsOk) {
156
- console.log('[MODELS] Downloading TTS models...');
157
- broadcastModelProgress({ started: true, done: false, downloading: true, type: 'tts', source: 'ipfs-fallback', 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 });
158
148
 
159
- let ttsDownloaded = false;
160
-
161
- // Try IPFS first with fallback to HuggingFace
162
149
  try {
163
150
  const ipfsCid = queries.getIpfsCidByModel('tts', 'voice');
164
- if (ipfsCid) {
165
- console.log('[MODELS] Attempting IPFS download for TTS models:', ipfsCid.cid);
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);
166
163
  const ttsFile = path.join(ttsDir, 'models.tar.gz');
167
164
  fs.mkdirSync(ttsDir, { recursive: true });
168
165
  await IPFSDownloader.downloadWithProgress(
@@ -181,23 +178,17 @@ async function ensureModelsDownloaded() {
181
178
  });
182
179
  }
183
180
  );
184
- ttsDownloaded = true;
185
- console.log('[MODELS] TTS models downloaded via IPFS');
181
+ console.log('[MODELS] TTS models downloaded successfully from IPFS');
186
182
  }
187
183
  } catch (err) {
188
- console.warn('[MODELS] IPFS TTS download failed:', err.message);
189
- }
190
-
191
- // Fall back to webtalk/HuggingFace if IPFS didn't work
192
- if (!ttsDownloaded) {
193
- try {
194
- console.log('[MODELS] Falling back to HuggingFace for TTS models');
195
- broadcastModelProgress({ started: true, done: false, downloading: true, type: 'tts', source: 'huggingface', completedFiles, totalFiles });
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
- }
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
+ });
201
192
  }
202
193
  completedFiles += 6;
203
194
  }