@theia/ai-chat 1.55.0-next.37 → 1.55.0-next.67
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/lib/browser/ai-chat-frontend-module.d.ts.map +1 -1
- package/lib/browser/ai-chat-frontend-module.js +25 -2
- package/lib/browser/ai-chat-frontend-module.js.map +1 -1
- package/lib/browser/custom-agent-factory.d.ts +4 -0
- package/lib/browser/custom-agent-factory.d.ts.map +1 -0
- package/lib/browser/custom-agent-factory.js +20 -0
- package/lib/browser/custom-agent-factory.js.map +1 -0
- package/lib/browser/custom-agent-frontend-application-contribution.d.ts +13 -0
- package/lib/browser/custom-agent-frontend-application-contribution.d.ts.map +1 -0
- package/lib/browser/custom-agent-frontend-application-contribution.js +82 -0
- package/lib/browser/custom-agent-frontend-application-contribution.js.map +1 -0
- package/lib/common/chat-agent-service.d.ts +11 -0
- package/lib/common/chat-agent-service.d.ts.map +1 -1
- package/lib/common/chat-agent-service.js +3 -0
- package/lib/common/chat-agent-service.js.map +1 -1
- package/lib/common/chat-agents.d.ts.map +1 -1
- package/lib/common/chat-agents.js +9 -30
- 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/custom-chat-agent.d.ts +14 -0
- package/lib/common/custom-chat-agent.d.ts.map +1 -0
- package/lib/common/custom-chat-agent.js +43 -0
- package/lib/common/custom-chat-agent.js.map +1 -0
- package/lib/common/index.d.ts +4 -3
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +4 -3
- package/lib/common/index.js.map +1 -1
- package/lib/common/o1-chat-agent.d.ts +13 -0
- package/lib/common/o1-chat-agent.d.ts.map +1 -0
- package/lib/common/o1-chat-agent.js +45 -0
- package/lib/common/o1-chat-agent.js.map +1 -0
- package/lib/common/orchestrator-chat-agent.d.ts.map +1 -1
- package/lib/common/orchestrator-chat-agent.js +13 -13
- package/lib/common/orchestrator-chat-agent.js.map +1 -1
- package/package.json +8 -8
- package/src/browser/ai-chat-frontend-module.ts +30 -4
- package/src/browser/custom-agent-factory.ts +20 -0
- package/src/browser/custom-agent-frontend-application-contribution.ts +73 -0
- package/src/common/chat-agent-service.ts +15 -0
- package/src/common/chat-agents.ts +13 -31
- package/src/common/chat-history-entry.ts +47 -0
- package/src/common/custom-chat-agent.ts +44 -0
- package/src/common/index.ts +4 -3
- package/src/common/o1-chat-agent.ts +51 -0
- package/src/common/orchestrator-chat-agent.ts +14 -13
|
@@ -23,6 +23,7 @@ import { ChatAgentService } from './chat-agent-service';
|
|
|
23
23
|
import { AbstractStreamParsingChatAgent, ChatAgent, SystemMessageDescription } from './chat-agents';
|
|
24
24
|
import { ChatRequestModelImpl, InformationalChatResponseContentImpl } from './chat-model';
|
|
25
25
|
import { generateUuid } from '@theia/core';
|
|
26
|
+
import { ChatHistoryEntry } from './chat-history-entry';
|
|
26
27
|
|
|
27
28
|
export const orchestratorTemplate: PromptTemplate = {
|
|
28
29
|
id: 'orchestrator-system',
|
|
@@ -60,7 +61,7 @@ You must only use the \`id\` attribute of the agent, never the name.
|
|
|
60
61
|
`};
|
|
61
62
|
|
|
62
63
|
export const OrchestratorChatAgentId = 'Orchestrator';
|
|
63
|
-
const
|
|
64
|
+
const OrchestratorRequestIdKey = 'orchestatorRequestIdKey';
|
|
64
65
|
|
|
65
66
|
@injectable()
|
|
66
67
|
export class OrchestratorChatAgent extends AbstractStreamParsingChatAgent implements ChatAgent {
|
|
@@ -93,16 +94,17 @@ export class OrchestratorChatAgent extends AbstractStreamParsingChatAgent implem
|
|
|
93
94
|
override async invoke(request: ChatRequestModelImpl): Promise<void> {
|
|
94
95
|
request.response.addProgressMessage({ content: 'Determining the most appropriate agent', status: 'inProgress' });
|
|
95
96
|
// We generate a dedicated ID for recording the orchestrator request/response, as we will forward the original request to another agent
|
|
96
|
-
const
|
|
97
|
-
request.addData(
|
|
98
|
-
const
|
|
99
|
-
this.
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
97
|
+
const orchestratorRequestId = generateUuid();
|
|
98
|
+
request.addData(OrchestratorRequestIdKey, orchestratorRequestId);
|
|
99
|
+
const messages = await this.getMessages(request.session);
|
|
100
|
+
const systemMessage = (await this.getSystemMessageDescription())?.text;
|
|
101
|
+
this.recordingService.recordRequest(
|
|
102
|
+
ChatHistoryEntry.fromRequest(this.id, request, {
|
|
103
|
+
requestId: orchestratorRequestId,
|
|
104
|
+
messages,
|
|
105
|
+
systemMessage
|
|
106
|
+
})
|
|
107
|
+
);
|
|
106
108
|
return super.invoke(request);
|
|
107
109
|
}
|
|
108
110
|
|
|
@@ -115,12 +117,11 @@ export class OrchestratorChatAgent extends AbstractStreamParsingChatAgent implem
|
|
|
115
117
|
let agentIds: string[] = [];
|
|
116
118
|
const responseText = await getTextOfResponse(response);
|
|
117
119
|
// We use the previously generated, dedicated ID to log the orchestrator response before we forward the original request
|
|
118
|
-
const orchestratorRequestId = request.getDataByKey(
|
|
120
|
+
const orchestratorRequestId = request.getDataByKey(OrchestratorRequestIdKey);
|
|
119
121
|
if (typeof orchestratorRequestId === 'string') {
|
|
120
122
|
this.recordingService.recordResponse({
|
|
121
123
|
agentId: this.id,
|
|
122
124
|
sessionId: request.session.id,
|
|
123
|
-
timestamp: Date.now(),
|
|
124
125
|
requestId: orchestratorRequestId,
|
|
125
126
|
response: responseText,
|
|
126
127
|
});
|