@myassis/gateway 1.0.33 → 1.0.34

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.
@@ -26,11 +26,14 @@ class LLMClient {
26
26
  preferredModelId;
27
27
  signal;
28
28
  timeoutMs = 120000;
29
- constructor(models, messages, signal, tools) {
29
+ constructor(models, messages, signal, tools, timeoutMs) {
30
30
  this.models = models;
31
31
  this.messages = messages;
32
32
  this.tools = tools;
33
33
  this.signal = signal;
34
+ if (timeoutMs) {
35
+ this.timeoutMs = timeoutMs;
36
+ }
34
37
  }
35
38
  getActionName(params) {
36
39
  const args = parseAruments(params);
@@ -209,7 +209,7 @@ ${conversation}
209
209
  }
210
210
  const summaryPrompt = this.buildSummaryPrompt(messages, lastSummary);
211
211
  const token = index_js_1.authStore.get(this.session.userId).accessToken;
212
- const llmClient = new LLMClient_js_1.LLMClient((await dataService_js_1.modelsService.list(token)).data.map((x) => (0, models_js_1.toModel)(x)), [{ role: 'user', content: summaryPrompt }], this.signal, []);
212
+ const llmClient = new LLMClient_js_1.LLMClient((await dataService_js_1.modelsService.list(token)).data.map((x) => (0, models_js_1.toModel)(x)), [{ role: 'user', content: summaryPrompt }], this.signal, [], 600000);
213
213
  const response = await llmClient.Chat();
214
214
  const content = (response.content || '').trim();
215
215
  if (!content) {
@@ -233,7 +233,7 @@ ${conversation}
233
233
  const batch = formattedMessages.slice(i, i + BATCH_SIZE);
234
234
  const batchPrompt = `请简洁总结以下对话片段的关键信息,特别关注:项目结构、关键决策、错误及修复。\n\n${batch.join('\n\n')}`;
235
235
  const token = index_js_1.authStore.get(this.session.userId).accessToken;
236
- const llmClient = new LLMClient_js_1.LLMClient((await dataService_js_1.modelsService.list(token)).data.map((x) => (0, models_js_1.toModel)(x)), [{ role: 'user', content: batchPrompt }], this.signal, []);
236
+ const llmClient = new LLMClient_js_1.LLMClient((await dataService_js_1.modelsService.list(token)).data.map((x) => (0, models_js_1.toModel)(x)), [{ role: 'user', content: batchPrompt }], this.signal, [], 600000);
237
237
  const response = await llmClient.Chat();
238
238
  const subContent = (response.content || '').trim();
239
239
  if (subContent) {
@@ -250,7 +250,7 @@ ${conversation}
250
250
  // 合并子摘要为最终摘要
251
251
  const mergePrompt = this.buildMergePrompt(subSummaries, lastSummary);
252
252
  const token = index_js_1.authStore.get(this.session.userId).accessToken;
253
- const mergeLlmClient = new LLMClient_js_1.LLMClient((await dataService_js_1.modelsService.list(token)).data.map((x) => (0, models_js_1.toModel)(x)), [{ role: 'user', content: mergePrompt }], this.signal, []);
253
+ const mergeLlmClient = new LLMClient_js_1.LLMClient((await dataService_js_1.modelsService.list(token)).data.map((x) => (0, models_js_1.toModel)(x)), [{ role: 'user', content: mergePrompt }], this.signal, [], 600000);
254
254
  const mergeResponse = await mergeLlmClient.Chat();
255
255
  const mergedContent = (mergeResponse.content || '').trim();
256
256
  return mergedContent || subSummaries.join('\n\n');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myassis/gateway",
3
- "version": "1.0.33",
3
+ "version": "1.0.34",
4
4
  "description": "我的助手 Gateway Service - 本地 AI 网关服务,支持认证、WebSocket 实时通信和任务调度",
5
5
  "main": "dist/index.js",
6
6
  "bin": {