@theia/ai-chat 1.55.1 → 1.57.0-next.112
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/README.md +2 -1
- package/lib/browser/ai-chat-frontend-module.d.ts.map +1 -1
- package/lib/browser/ai-chat-frontend-module.js +14 -4
- package/lib/browser/ai-chat-frontend-module.js.map +1 -1
- package/lib/browser/change-set-file-element.d.ts +44 -0
- package/lib/browser/change-set-file-element.d.ts.map +1 -0
- package/lib/browser/change-set-file-element.js +113 -0
- package/lib/browser/change-set-file-element.js.map +1 -0
- package/lib/browser/change-set-file-resource.d.ts +13 -0
- package/lib/browser/change-set-file-resource.d.ts.map +1 -0
- package/lib/browser/change-set-file-resource.js +73 -0
- package/lib/browser/change-set-file-resource.js.map +1 -0
- package/lib/browser/change-set-file-service.d.ts +26 -0
- package/lib/browser/change-set-file-service.d.ts.map +1 -0
- package/lib/browser/change-set-file-service.js +139 -0
- package/lib/browser/change-set-file-service.js.map +1 -0
- package/lib/common/chat-agents.d.ts +16 -9
- package/lib/common/chat-agents.d.ts.map +1 -1
- package/lib/common/chat-agents.js +51 -67
- package/lib/common/chat-agents.js.map +1 -1
- package/lib/common/chat-history-entry.d.ts +7 -0
- package/lib/common/chat-history-entry.d.ts.map +1 -0
- package/lib/common/chat-history-entry.js +42 -0
- package/lib/common/chat-history-entry.js.map +1 -0
- package/lib/common/chat-model-util.d.ts +7 -0
- package/lib/common/chat-model-util.d.ts.map +1 -0
- package/lib/common/chat-model-util.js +50 -0
- package/lib/common/chat-model-util.js.map +1 -0
- package/lib/common/chat-model.d.ts +176 -7
- package/lib/common/chat-model.d.ts.map +1 -1
- package/lib/common/chat-model.js +193 -9
- package/lib/common/chat-model.js.map +1 -1
- package/lib/common/chat-service.d.ts +6 -0
- package/lib/common/chat-service.d.ts.map +1 -1
- package/lib/common/chat-service.js +12 -0
- package/lib/common/chat-service.js.map +1 -1
- package/lib/common/chat-tool-request-service.d.ts +17 -0
- package/lib/common/chat-tool-request-service.d.ts.map +1 -0
- package/lib/common/chat-tool-request-service.js +52 -0
- package/lib/common/chat-tool-request-service.js.map +1 -0
- package/lib/common/command-chat-agents.d.ts.map +1 -1
- package/lib/common/command-chat-agents.js +4 -2
- package/lib/common/command-chat-agents.js.map +1 -1
- package/lib/common/index.d.ts +1 -0
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +1 -0
- package/lib/common/index.js.map +1 -1
- package/lib/common/orchestrator-chat-agent.d.ts.map +1 -1
- package/lib/common/orchestrator-chat-agent.js +16 -14
- package/lib/common/orchestrator-chat-agent.js.map +1 -1
- package/lib/common/parse-contents.d.ts +2 -2
- package/lib/common/parse-contents.d.ts.map +1 -1
- package/lib/common/parse-contents.js +4 -4
- package/lib/common/parse-contents.js.map +1 -1
- package/lib/common/parse-contents.spec.d.ts.map +1 -1
- package/lib/common/parse-contents.spec.js +14 -13
- package/lib/common/parse-contents.spec.js.map +1 -1
- package/lib/common/response-content-matcher.d.ts +3 -3
- package/lib/common/response-content-matcher.d.ts.map +1 -1
- package/lib/common/response-content-matcher.js +2 -2
- package/lib/common/response-content-matcher.js.map +1 -1
- package/lib/common/universal-chat-agent.d.ts +1 -0
- package/lib/common/universal-chat-agent.d.ts.map +1 -1
- package/lib/common/universal-chat-agent.js +10 -3
- package/lib/common/universal-chat-agent.js.map +1 -1
- package/package.json +10 -8
- package/src/browser/ai-chat-frontend-module.ts +17 -6
- package/src/browser/change-set-file-element.ts +137 -0
- package/src/browser/change-set-file-resource.ts +74 -0
- package/src/browser/change-set-file-service.ts +136 -0
- package/src/common/chat-agents.ts +56 -78
- package/src/common/chat-history-entry.ts +47 -0
- package/src/common/chat-model-util.ts +44 -0
- package/src/common/chat-model.ts +325 -14
- package/src/common/chat-service.ts +17 -0
- package/src/common/chat-tool-request-service.ts +59 -0
- package/src/common/command-chat-agents.ts +4 -2
- package/src/common/index.ts +1 -0
- package/src/common/orchestrator-chat-agent.ts +17 -14
- package/src/common/parse-contents.spec.ts +16 -14
- package/src/common/parse-contents.ts +5 -4
- package/src/common/response-content-matcher.ts +4 -3
- package/src/common/universal-chat-agent.ts +10 -2
- package/lib/common/o1-chat-agent.d.ts +0 -13
- package/lib/common/o1-chat-agent.d.ts.map +0 -1
- package/lib/common/o1-chat-agent.js +0 -45
- package/lib/common/o1-chat-agent.js.map +0 -1
- package/src/common/o1-chat-agent.ts +0 -51
|
@@ -29,6 +29,8 @@ const inversify_1 = require("@theia/core/shared/inversify");
|
|
|
29
29
|
const chat_model_1 = require("./chat-model");
|
|
30
30
|
const parse_contents_1 = require("./parse-contents");
|
|
31
31
|
const response_content_matcher_1 = require("./response-content-matcher");
|
|
32
|
+
const chat_history_entry_1 = require("./chat-history-entry");
|
|
33
|
+
const chat_tool_request_service_1 = require("./chat-tool-request-service");
|
|
32
34
|
var SystemMessageDescription;
|
|
33
35
|
(function (SystemMessageDescription) {
|
|
34
36
|
function fromResolvedPromptTemplate(resolvedPrompt) {
|
|
@@ -73,31 +75,31 @@ let AbstractChatAgent = class AbstractChatAgent {
|
|
|
73
75
|
this.locations = locations;
|
|
74
76
|
this.tags = tags;
|
|
75
77
|
this.defaultLogging = defaultLogging;
|
|
78
|
+
this.additionalToolRequests = [];
|
|
76
79
|
this.contentMatchers = [];
|
|
77
80
|
}
|
|
78
81
|
init() {
|
|
79
|
-
this.
|
|
82
|
+
this.initializeContentMatchers();
|
|
83
|
+
}
|
|
84
|
+
initializeContentMatchers() {
|
|
85
|
+
const contributedContentMatchers = this.contentMatcherProviders.getContributions().flatMap(provider => provider.matchers);
|
|
86
|
+
this.contentMatchers.push(...contributedContentMatchers);
|
|
80
87
|
}
|
|
81
88
|
async invoke(request) {
|
|
82
|
-
var _a
|
|
89
|
+
var _a;
|
|
83
90
|
try {
|
|
84
91
|
const languageModel = await this.getLanguageModel(this.defaultLanguageModelPurpose);
|
|
85
92
|
if (!languageModel) {
|
|
86
93
|
throw new Error('Couldn\'t find a matching language model. Please check your setup!');
|
|
87
94
|
}
|
|
95
|
+
const systemMessageDescription = await this.getSystemMessageDescription();
|
|
88
96
|
const messages = await this.getMessages(request.session);
|
|
89
97
|
if (this.defaultLogging) {
|
|
90
|
-
this.recordingService.recordRequest({
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
requestId: request.id,
|
|
95
|
-
request: request.request.text,
|
|
96
|
-
messages
|
|
97
|
-
});
|
|
98
|
+
this.recordingService.recordRequest(chat_history_entry_1.ChatHistoryEntry.fromRequest(this.id, request, {
|
|
99
|
+
messages,
|
|
100
|
+
systemMessage: systemMessageDescription === null || systemMessageDescription === void 0 ? void 0 : systemMessageDescription.text
|
|
101
|
+
}));
|
|
98
102
|
}
|
|
99
|
-
const systemMessageDescription = await this.getSystemMessageDescription();
|
|
100
|
-
const tools = new Map();
|
|
101
103
|
if (systemMessageDescription) {
|
|
102
104
|
const systemMsg = {
|
|
103
105
|
actor: 'system',
|
|
@@ -106,37 +108,27 @@ let AbstractChatAgent = class AbstractChatAgent {
|
|
|
106
108
|
};
|
|
107
109
|
// insert system message at the beginning of the request messages
|
|
108
110
|
messages.unshift(systemMsg);
|
|
109
|
-
(_a = systemMessageDescription.functionDescriptions) === null || _a === void 0 ? void 0 : _a.forEach((tool, id) => {
|
|
110
|
-
tools.set(id, tool);
|
|
111
|
-
});
|
|
112
111
|
}
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const languageModelResponse = await this.callLlm(languageModel, messages, tools.size > 0 ? Array.from(tools.values()) : undefined, cancellationToken.token);
|
|
112
|
+
const systemMessageToolRequests = (_a = systemMessageDescription === null || systemMessageDescription === void 0 ? void 0 : systemMessageDescription.functionDescriptions) === null || _a === void 0 ? void 0 : _a.values();
|
|
113
|
+
const tools = [
|
|
114
|
+
...this.chatToolRequestService.getChatToolRequests(request),
|
|
115
|
+
...this.chatToolRequestService.toChatToolRequests(systemMessageToolRequests ? Array.from(systemMessageToolRequests) : [], request),
|
|
116
|
+
...this.chatToolRequestService.toChatToolRequests(this.additionalToolRequests, request)
|
|
117
|
+
];
|
|
118
|
+
const languageModelResponse = await this.callLlm(languageModel, messages, tools.length > 0 ? tools : undefined, request.response.cancellationToken);
|
|
121
119
|
await this.addContentsToResponse(languageModelResponse, request);
|
|
122
|
-
|
|
120
|
+
await this.onResponseComplete(request);
|
|
123
121
|
if (this.defaultLogging) {
|
|
124
|
-
this.recordingService.recordResponse(
|
|
125
|
-
agentId: this.id,
|
|
126
|
-
sessionId: request.session.id,
|
|
127
|
-
timestamp: Date.now(),
|
|
128
|
-
requestId: request.response.requestId,
|
|
129
|
-
response: request.response.response.asString()
|
|
130
|
-
});
|
|
122
|
+
this.recordingService.recordResponse(chat_history_entry_1.ChatHistoryEntry.fromResponse(this.id, request));
|
|
131
123
|
}
|
|
132
124
|
}
|
|
133
125
|
catch (e) {
|
|
134
126
|
this.handleError(request, e);
|
|
135
127
|
}
|
|
136
128
|
}
|
|
137
|
-
parseContents(text) {
|
|
129
|
+
parseContents(text, request) {
|
|
138
130
|
var _a;
|
|
139
|
-
return (0, parse_contents_1.parseContents)(text, this.contentMatchers, (_a = this.defaultContentFactory) === null || _a === void 0 ? void 0 : _a.create.bind(this.defaultContentFactory));
|
|
131
|
+
return (0, parse_contents_1.parseContents)(text, request, this.contentMatchers, (_a = this.defaultContentFactory) === null || _a === void 0 ? void 0 : _a.create.bind(this.defaultContentFactory));
|
|
140
132
|
}
|
|
141
133
|
;
|
|
142
134
|
handleError(request, error) {
|
|
@@ -176,14 +168,6 @@ let AbstractChatAgent = class AbstractChatAgent {
|
|
|
176
168
|
});
|
|
177
169
|
return requestMessages;
|
|
178
170
|
}
|
|
179
|
-
/**
|
|
180
|
-
* @returns the list of tools used by this agent, or undefined if none is needed.
|
|
181
|
-
*/
|
|
182
|
-
getTools(request) {
|
|
183
|
-
return request.message.toolRequests.size > 0
|
|
184
|
-
? [...request.message.toolRequests.values()]
|
|
185
|
-
: undefined;
|
|
186
|
-
}
|
|
187
171
|
async callLlm(languageModel, messages, tools, token) {
|
|
188
172
|
const settings = this.getLlmSettings();
|
|
189
173
|
const languageModelResponse = languageModel.request({
|
|
@@ -199,6 +183,15 @@ let AbstractChatAgent = class AbstractChatAgent {
|
|
|
199
183
|
getLlmSettings() {
|
|
200
184
|
return undefined;
|
|
201
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* Invoked after the response by the LLM completed successfully.
|
|
188
|
+
*
|
|
189
|
+
* The default implementation sets the state of the response to `complete`.
|
|
190
|
+
* Subclasses may override this method to perform additional actions or keep the response open for processing further requests.
|
|
191
|
+
*/
|
|
192
|
+
async onResponseComplete(request) {
|
|
193
|
+
return request.response.complete();
|
|
194
|
+
}
|
|
202
195
|
};
|
|
203
196
|
exports.AbstractChatAgent = AbstractChatAgent;
|
|
204
197
|
tslib_1.__decorate([
|
|
@@ -213,6 +206,10 @@ tslib_1.__decorate([
|
|
|
213
206
|
(0, inversify_1.inject)(ai_core_1.CommunicationRecordingService),
|
|
214
207
|
tslib_1.__metadata("design:type", Object)
|
|
215
208
|
], AbstractChatAgent.prototype, "recordingService", void 0);
|
|
209
|
+
tslib_1.__decorate([
|
|
210
|
+
(0, inversify_1.inject)(chat_tool_request_service_1.ChatToolRequestService),
|
|
211
|
+
tslib_1.__metadata("design:type", chat_tool_request_service_1.ChatToolRequestService)
|
|
212
|
+
], AbstractChatAgent.prototype, "chatToolRequestService", void 0);
|
|
216
213
|
tslib_1.__decorate([
|
|
217
214
|
(0, inversify_1.inject)(ai_core_1.PromptService),
|
|
218
215
|
tslib_1.__metadata("design:type", Object)
|
|
@@ -234,6 +231,13 @@ tslib_1.__decorate([
|
|
|
234
231
|
], AbstractChatAgent.prototype, "init", null);
|
|
235
232
|
exports.AbstractChatAgent = AbstractChatAgent = tslib_1.__decorate([
|
|
236
233
|
(0, inversify_1.injectable)(),
|
|
234
|
+
tslib_1.__param(0, (0, inversify_1.unmanaged)()),
|
|
235
|
+
tslib_1.__param(1, (0, inversify_1.unmanaged)()),
|
|
236
|
+
tslib_1.__param(2, (0, inversify_1.unmanaged)()),
|
|
237
|
+
tslib_1.__param(3, (0, inversify_1.unmanaged)()),
|
|
238
|
+
tslib_1.__param(4, (0, inversify_1.unmanaged)()),
|
|
239
|
+
tslib_1.__param(5, (0, inversify_1.unmanaged)()),
|
|
240
|
+
tslib_1.__param(6, (0, inversify_1.unmanaged)()),
|
|
237
241
|
tslib_1.__metadata("design:paramtypes", [String, Array, String, String, Array, Array, Boolean])
|
|
238
242
|
], AbstractChatAgent);
|
|
239
243
|
let AbstractTextToModelParsingChatAgent = class AbstractTextToModelParsingChatAgent extends AbstractChatAgent {
|
|
@@ -251,32 +255,12 @@ exports.AbstractTextToModelParsingChatAgent = AbstractTextToModelParsingChatAgen
|
|
|
251
255
|
let AbstractStreamParsingChatAgent = class AbstractStreamParsingChatAgent extends AbstractChatAgent {
|
|
252
256
|
async addContentsToResponse(languageModelResponse, request) {
|
|
253
257
|
if ((0, common_1.isLanguageModelTextResponse)(languageModelResponse)) {
|
|
254
|
-
const contents = this.parseContents(languageModelResponse.text);
|
|
258
|
+
const contents = this.parseContents(languageModelResponse.text, request);
|
|
255
259
|
request.response.response.addContents(contents);
|
|
256
|
-
request.response.complete();
|
|
257
|
-
if (this.defaultLogging) {
|
|
258
|
-
this.recordingService.recordResponse({
|
|
259
|
-
agentId: this.id,
|
|
260
|
-
sessionId: request.session.id,
|
|
261
|
-
timestamp: Date.now(),
|
|
262
|
-
requestId: request.response.requestId,
|
|
263
|
-
response: request.response.response.asString()
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
260
|
return;
|
|
267
261
|
}
|
|
268
262
|
if ((0, common_1.isLanguageModelStreamResponse)(languageModelResponse)) {
|
|
269
263
|
await this.addStreamResponse(languageModelResponse, request);
|
|
270
|
-
request.response.complete();
|
|
271
|
-
if (this.defaultLogging) {
|
|
272
|
-
this.recordingService.recordResponse({
|
|
273
|
-
agentId: this.id,
|
|
274
|
-
sessionId: request.session.id,
|
|
275
|
-
timestamp: Date.now(),
|
|
276
|
-
requestId: request.response.requestId,
|
|
277
|
-
response: request.response.response.asString()
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
264
|
return;
|
|
281
265
|
}
|
|
282
266
|
this.logger.error('Received unknown response in agent. Return response as text');
|
|
@@ -285,7 +269,7 @@ let AbstractStreamParsingChatAgent = class AbstractStreamParsingChatAgent extend
|
|
|
285
269
|
async addStreamResponse(languageModelResponse, request) {
|
|
286
270
|
var _a;
|
|
287
271
|
for await (const token of languageModelResponse.stream) {
|
|
288
|
-
const newContents = this.parse(token, request
|
|
272
|
+
const newContents = this.parse(token, request);
|
|
289
273
|
if ((0, core_1.isArray)(newContents)) {
|
|
290
274
|
request.response.response.addContents(newContents);
|
|
291
275
|
}
|
|
@@ -300,7 +284,7 @@ let AbstractStreamParsingChatAgent = class AbstractStreamParsingChatAgent extend
|
|
|
300
284
|
if (text === undefined) {
|
|
301
285
|
return;
|
|
302
286
|
}
|
|
303
|
-
const result = (0, parse_contents_1.findFirstMatch)(this.contentMatchers, text) ? this.parseContents(text) : [];
|
|
287
|
+
const result = (0, parse_contents_1.findFirstMatch)(this.contentMatchers, text) ? this.parseContents(text, request) : [];
|
|
304
288
|
if (result.length > 0) {
|
|
305
289
|
request.response.response.addContents(result);
|
|
306
290
|
}
|
|
@@ -309,18 +293,18 @@ let AbstractStreamParsingChatAgent = class AbstractStreamParsingChatAgent extend
|
|
|
309
293
|
}
|
|
310
294
|
}
|
|
311
295
|
}
|
|
312
|
-
parse(token,
|
|
296
|
+
parse(token, request) {
|
|
313
297
|
const content = token.content;
|
|
314
298
|
// eslint-disable-next-line no-null/no-null
|
|
315
299
|
if (content !== undefined && content !== null) {
|
|
316
|
-
return this.defaultContentFactory.create(content);
|
|
300
|
+
return this.defaultContentFactory.create(content, request);
|
|
317
301
|
}
|
|
318
302
|
const toolCalls = token.tool_calls;
|
|
319
303
|
if (toolCalls !== undefined) {
|
|
320
304
|
const toolCallContents = toolCalls.map(toolCall => { var _a, _b; return new chat_model_1.ToolCallChatResponseContentImpl(toolCall.id, (_a = toolCall.function) === null || _a === void 0 ? void 0 : _a.name, (_b = toolCall.function) === null || _b === void 0 ? void 0 : _b.arguments, toolCall.finished, toolCall.result); });
|
|
321
305
|
return toolCallContents;
|
|
322
306
|
}
|
|
323
|
-
return this.defaultContentFactory.create('');
|
|
307
|
+
return this.defaultContentFactory.create('', request);
|
|
324
308
|
}
|
|
325
309
|
};
|
|
326
310
|
exports.AbstractStreamParsingChatAgent = AbstractStreamParsingChatAgent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-agents.js","sourceRoot":"","sources":["../../src/common/chat-agents.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF;;;gGAGgG;AAChG,6JAA6J;;;;AAE7J,4CAUwB;AACxB,sDAOmC;AACnC,
|
|
1
|
+
{"version":3,"file":"chat-agents.js","sourceRoot":"","sources":["../../src/common/chat-agents.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF;;;gGAGgG;AAChG,6JAA6J;;;;AAE7J,4CAUwB;AACxB,sDAOmC;AACnC,sCAAwF;AACxF,4DAAmG;AAEnG,6CAOsB;AACtB,qDAAiE;AACjE,yEAAmI;AACnI,6DAAwD;AACxD,2EAAqE;A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MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAAC;QACnC,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC1B,MAAM,gBAAgB,GAAG,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,eAC9C,OAAA,IAAI,4CAA+B,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAA,QAAQ,CAAC,QAAQ,0CAAE,IAAI,EAAE,MAAA,QAAQ,CAAC,QAAQ,0CAAE,SAAS,EAAE,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA,EAAA,CAAC,CAAC;YACjJ,OAAO,gBAAgB,CAAC;QAC5B,CAAC;QACD,OAAO,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IAC1D,CAAC;CAEJ,CAAA;AAhEqB,wEAA8B;yCAA9B,8BAA8B;IADnD,IAAA,sBAAU,GAAE;GACS,8BAA8B,CAgEnD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CommunicationRequestEntryParam, CommunicationResponseEntryParam } from '@theia/ai-core/lib/common/communication-recording-service';
|
|
2
|
+
import { ChatRequestModel } from './chat-model';
|
|
3
|
+
export declare namespace ChatHistoryEntry {
|
|
4
|
+
function fromRequest(agentId: string, request: ChatRequestModel, args?: Partial<CommunicationRequestEntryParam>): CommunicationRequestEntryParam;
|
|
5
|
+
function fromResponse(agentId: string, request: ChatRequestModel, args?: Partial<CommunicationResponseEntryParam>): CommunicationResponseEntryParam;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=chat-history-entry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-history-entry.d.ts","sourceRoot":"","sources":["../../src/common/chat-history-entry.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,8BAA8B,EAAE,+BAA+B,EAAE,MAAM,2DAA2D,CAAC;AAC5I,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,yBAAiB,gBAAgB,CAAC;IAC9B,SAAgB,WAAW,CACvB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,gBAAgB,EACzB,IAAI,GAAE,OAAO,CAAC,8BAA8B,CAAM,GACnD,8BAA8B,CAQhC;IACD,SAAgB,YAAY,CACxB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,gBAAgB,EACzB,IAAI,GAAE,OAAO,CAAC,+BAA+B,CAAM,GACpD,+BAA+B,CAQjC;CACJ"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2024 EclipseSource GmbH.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.ChatHistoryEntry = void 0;
|
|
19
|
+
var ChatHistoryEntry;
|
|
20
|
+
(function (ChatHistoryEntry) {
|
|
21
|
+
function fromRequest(agentId, request, args = {}) {
|
|
22
|
+
return {
|
|
23
|
+
agentId: agentId,
|
|
24
|
+
sessionId: request.session.id,
|
|
25
|
+
requestId: request.id,
|
|
26
|
+
request: request.request.text,
|
|
27
|
+
...args,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
ChatHistoryEntry.fromRequest = fromRequest;
|
|
31
|
+
function fromResponse(agentId, request, args = {}) {
|
|
32
|
+
return {
|
|
33
|
+
agentId: agentId,
|
|
34
|
+
sessionId: request.session.id,
|
|
35
|
+
requestId: request.id,
|
|
36
|
+
response: request.response.response.asString(),
|
|
37
|
+
...args,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
ChatHistoryEntry.fromResponse = fromResponse;
|
|
41
|
+
})(ChatHistoryEntry || (exports.ChatHistoryEntry = ChatHistoryEntry = {}));
|
|
42
|
+
//# sourceMappingURL=chat-history-entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-history-entry.js","sourceRoot":"","sources":["../../src/common/chat-history-entry.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAKhF,IAAiB,gBAAgB,CA2BhC;AA3BD,WAAiB,gBAAgB;IAC7B,SAAgB,WAAW,CACvB,OAAe,EACf,OAAyB,EACzB,OAAgD,EAAE;QAElD,OAAO;YACH,OAAO,EAAE,OAAO;YAChB,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE;YAC7B,SAAS,EAAE,OAAO,CAAC,EAAE;YACrB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI;YAC7B,GAAG,IAAI;SACV,CAAC;IACN,CAAC;IAZe,4BAAW,cAY1B,CAAA;IACD,SAAgB,YAAY,CACxB,OAAe,EACf,OAAyB,EACzB,OAAiD,EAAE;QAEnD,OAAO;YACH,OAAO,EAAE,OAAO;YAChB,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE;YAC7B,SAAS,EAAE,OAAO,CAAC,EAAE;YACrB,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE;YAC9C,GAAG,IAAI;SACV,CAAC;IACN,CAAC;IAZe,6BAAY,eAY3B,CAAA;AACL,CAAC,EA3BgB,gBAAgB,gCAAhB,gBAAgB,QA2BhC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ChatProgressMessage, ChatRequestModel, ChatResponse, ChatResponseContent, ChatResponseModel, QuestionResponseContent } from './chat-model';
|
|
2
|
+
export declare function lastResponseContent(request: ChatRequestModel): ChatResponseContent | undefined;
|
|
3
|
+
export declare function lastContentOfResponse(response: ChatResponse | undefined): ChatResponseContent | undefined;
|
|
4
|
+
export declare function lastProgressMessage(request: ChatRequestModel): ChatProgressMessage | undefined;
|
|
5
|
+
export declare function lastProgressMessageOfResponse(response: ChatResponseModel | undefined): ChatProgressMessage | undefined;
|
|
6
|
+
export declare function unansweredQuestions(request: ChatRequestModel): QuestionResponseContent[];
|
|
7
|
+
//# sourceMappingURL=chat-model-util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-model-util.d.ts","sourceRoot":"","sources":["../../src/common/chat-model-util.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEpJ,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,GAAG,mBAAmB,GAAG,SAAS,CAE9F;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,YAAY,GAAG,SAAS,GAAG,mBAAmB,GAAG,SAAS,CAGzG;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,GAAG,mBAAmB,GAAG,SAAS,CAE9F;AAED,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,iBAAiB,GAAG,SAAS,GAAG,mBAAmB,GAAG,SAAS,CAGtH;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,GAAG,uBAAuB,EAAE,CAGxF"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.unansweredQuestions = exports.lastProgressMessageOfResponse = exports.lastProgressMessage = exports.lastContentOfResponse = exports.lastResponseContent = void 0;
|
|
4
|
+
// *****************************************************************************
|
|
5
|
+
// Copyright (C) 2024 EclipseSource GmbH.
|
|
6
|
+
//
|
|
7
|
+
// This program and the accompanying materials are made available under the
|
|
8
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
9
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
10
|
+
//
|
|
11
|
+
// This Source Code may also be made available under the following Secondary
|
|
12
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
13
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
14
|
+
// with the GNU Classpath Exception which is available at
|
|
15
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
16
|
+
//
|
|
17
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
18
|
+
// *****************************************************************************
|
|
19
|
+
const chat_model_1 = require("./chat-model");
|
|
20
|
+
function lastResponseContent(request) {
|
|
21
|
+
var _a;
|
|
22
|
+
return lastContentOfResponse((_a = request.response) === null || _a === void 0 ? void 0 : _a.response);
|
|
23
|
+
}
|
|
24
|
+
exports.lastResponseContent = lastResponseContent;
|
|
25
|
+
function lastContentOfResponse(response) {
|
|
26
|
+
const content = response === null || response === void 0 ? void 0 : response.content;
|
|
27
|
+
return content && content.length > 0 ? content[content.length - 1] : undefined;
|
|
28
|
+
}
|
|
29
|
+
exports.lastContentOfResponse = lastContentOfResponse;
|
|
30
|
+
function lastProgressMessage(request) {
|
|
31
|
+
return lastProgressMessageOfResponse(request.response);
|
|
32
|
+
}
|
|
33
|
+
exports.lastProgressMessage = lastProgressMessage;
|
|
34
|
+
function lastProgressMessageOfResponse(response) {
|
|
35
|
+
const progressMessages = response === null || response === void 0 ? void 0 : response.progressMessages;
|
|
36
|
+
return progressMessages && progressMessages.length > 0 ? progressMessages[progressMessages.length - 1] : undefined;
|
|
37
|
+
}
|
|
38
|
+
exports.lastProgressMessageOfResponse = lastProgressMessageOfResponse;
|
|
39
|
+
function unansweredQuestions(request) {
|
|
40
|
+
const response = request.response;
|
|
41
|
+
return unansweredQuestionsOfResponse(response);
|
|
42
|
+
}
|
|
43
|
+
exports.unansweredQuestions = unansweredQuestions;
|
|
44
|
+
function unansweredQuestionsOfResponse(response) {
|
|
45
|
+
if (!response || !response.response) {
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
return response.response.content.filter((c) => chat_model_1.QuestionResponseContent.is(c) && c.selectedOption === undefined);
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=chat-model-util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-model-util.js","sourceRoot":"","sources":["../../src/common/chat-model-util.ts"],"names":[],"mappings":";;;AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF,6CAAoJ;AAEpJ,SAAgB,mBAAmB,CAAC,OAAyB;;IACzD,OAAO,qBAAqB,CAAC,MAAA,OAAO,CAAC,QAAQ,0CAAE,QAAQ,CAAC,CAAC;AAC7D,CAAC;AAFD,kDAEC;AAED,SAAgB,qBAAqB,CAAC,QAAkC;IACpE,MAAM,OAAO,GAAG,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,CAAC;IAClC,OAAO,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,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