@myassis/gateway 1.0.33 → 1.0.35
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');
|
|
@@ -125,7 +125,10 @@ async function getSystemPromptAsync(agent, customPrompt) {
|
|
|
125
125
|
1.逐步思考,分步骤调用工具,工具调用前尽量返回content,明确当前工具调用的目的。
|
|
126
126
|
2.工具调用的参数全部采用JSON语法,调用前先验证JSON语法正确后,再回复,切记未验证JSON语法就直接回复。
|
|
127
127
|
【命令执行】执行命令时一定要根据当前系统来执行命令
|
|
128
|
-
|
|
128
|
+
【文件操作】
|
|
129
|
+
1.文件编辑后一定要验证编辑是否成功,文件内容与预期是否一致。
|
|
130
|
+
2.文件工具目前未提供批量替换操作,如果需要批量修改,请自行创建脚本来完成。
|
|
131
|
+
3.大文件写入如果无法识别,请先写入主体内容,再使用edit工具进行修改来操作
|
|
129
132
|
【特殊语法】mermaid折线图需要使用xychart-beta,完整示例如下:
|
|
130
133
|
xychart-beta
|
|
131
134
|
title "2025年上半年产品销量对比"
|