@theia/ai-chat 1.66.0-next.41 → 1.66.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/change-set-file-element.d.ts +1 -1
- package/lib/browser/change-set-file-element.d.ts.map +1 -1
- package/lib/browser/change-set-file-element.js +6 -2
- package/lib/browser/change-set-file-element.js.map +1 -1
- package/lib/browser/change-set-file-service.d.ts.map +1 -1
- package/lib/browser/change-set-file-service.js +2 -2
- package/lib/browser/change-set-file-service.js.map +1 -1
- package/lib/browser/file-chat-variable-contribution.d.ts.map +1 -1
- package/lib/browser/file-chat-variable-contribution.js +1 -1
- package/lib/browser/file-chat-variable-contribution.js.map +1 -1
- package/lib/browser/image-context-variable-contribution.js +1 -1
- package/lib/browser/image-context-variable-contribution.js.map +1 -1
- package/lib/browser/task-context-service.d.ts.map +1 -1
- package/lib/browser/task-context-service.js +8 -2
- package/lib/browser/task-context-service.js.map +1 -1
- package/lib/browser/task-context-variable.d.ts.map +1 -1
- package/lib/browser/task-context-variable.js +7 -3
- package/lib/browser/task-context-variable.js.map +1 -1
- package/lib/common/change-set.d.ts.map +1 -1
- package/lib/common/change-set.js +1 -1
- package/lib/common/change-set.js.map +1 -1
- package/lib/common/chat-agents-variable-contribution.d.ts.map +1 -1
- package/lib/common/chat-agents-variable-contribution.js +17 -1
- package/lib/common/chat-agents-variable-contribution.js.map +1 -1
- package/lib/common/chat-agents.d.ts.map +1 -1
- package/lib/common/chat-agents.js +3 -3
- package/lib/common/chat-agents.js.map +1 -1
- package/lib/common/chat-request-parser.d.ts +8 -1
- package/lib/common/chat-request-parser.d.ts.map +1 -1
- package/lib/common/chat-request-parser.js +29 -1
- package/lib/common/chat-request-parser.js.map +1 -1
- package/lib/common/chat-request-parser.spec.js +51 -0
- package/lib/common/chat-request-parser.spec.js.map +1 -1
- package/lib/common/chat-session-naming-service.d.ts.map +1 -1
- package/lib/common/chat-session-naming-service.js +11 -3
- package/lib/common/chat-session-naming-service.js.map +1 -1
- package/lib/common/chat-session-summary-agent-prompt.js +1 -1
- package/lib/common/chat-session-summary-agent-prompt.js.map +1 -1
- package/lib/common/chat-session-summary-agent.d.ts.map +1 -1
- package/lib/common/chat-session-summary-agent.js +2 -1
- package/lib/common/chat-session-summary-agent.js.map +1 -1
- package/lib/common/chat-tool-preferences.js +1 -1
- package/lib/common/chat-tool-preferences.js.map +1 -1
- package/lib/common/image-context-variable.d.ts.map +1 -1
- package/lib/common/image-context-variable.js +21 -6
- package/lib/common/image-context-variable.js.map +1 -1
- package/package.json +9 -9
- package/src/browser/change-set-file-element.ts +10 -4
- package/src/browser/change-set-file-service.ts +3 -3
- package/src/browser/file-chat-variable-contribution.ts +2 -2
- package/src/browser/image-context-variable-contribution.ts +1 -1
- package/src/browser/task-context-service.ts +9 -3
- package/src/browser/task-context-variable.ts +8 -3
- package/src/common/change-set.ts +2 -2
- package/src/common/chat-agents-variable-contribution.ts +2 -2
- package/src/common/chat-agents.ts +4 -4
- package/src/common/chat-request-parser.spec.ts +61 -0
- package/src/common/chat-request-parser.ts +40 -1
- package/src/common/chat-session-naming-service.ts +12 -4
- package/src/common/chat-session-summary-agent-prompt.ts +1 -1
- package/src/common/chat-session-summary-agent.ts +2 -1
- package/src/common/chat-tool-preferences.ts +1 -2
- package/src/common/image-context-variable.ts +21 -6
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
17
|
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
18
|
-
import { MaybePromise, ProgressService, URI, generateUuid, Event, EOL } from '@theia/core';
|
|
18
|
+
import { MaybePromise, ProgressService, URI, generateUuid, Event, EOL, nls } from '@theia/core';
|
|
19
19
|
import { ChatAgent, ChatAgentLocation, ChatService, ChatSession, MutableChatModel, MutableChatRequestModel, ParsedChatRequestTextPart } from '../common';
|
|
20
20
|
import { PreferenceService } from '@theia/core/lib/common';
|
|
21
21
|
import { ChatSessionSummaryAgent } from '../common/chat-session-summary-agent';
|
|
@@ -90,7 +90,10 @@ export class TaskContextService {
|
|
|
90
90
|
if (existing && !override) { return existing.id; }
|
|
91
91
|
const summaryId = generateUuid();
|
|
92
92
|
const summaryDeferred = new Deferred<Summary>();
|
|
93
|
-
const progress = await this.progressService.showProgress({
|
|
93
|
+
const progress = await this.progressService.showProgress({
|
|
94
|
+
text: nls.localize('theia/ai/chat/taskContextService/summarizeProgressMessage', 'Summarize: {0}', session.title || session.id),
|
|
95
|
+
options: { location: 'ai-chat' }
|
|
96
|
+
});
|
|
94
97
|
this.pendingSummaries.set(session.id, summaryDeferred.promise);
|
|
95
98
|
try {
|
|
96
99
|
const prompt = await this.getSystemPrompt(session, promptId);
|
|
@@ -127,7 +130,10 @@ export class TaskContextService {
|
|
|
127
130
|
return this.summarize(session, promptId, agent, override);
|
|
128
131
|
}
|
|
129
132
|
|
|
130
|
-
const progress = await this.progressService.showProgress({
|
|
133
|
+
const progress = await this.progressService.showProgress({
|
|
134
|
+
text: nls.localize('theia/ai/chat/taskContextService/updatingProgressMessage', 'Updating: {0}', session.title || session.id),
|
|
135
|
+
options: { location: 'ai-chat' }
|
|
136
|
+
});
|
|
131
137
|
try {
|
|
132
138
|
const prompt = await this.getSystemPrompt(session, promptId);
|
|
133
139
|
if (!prompt) {
|
|
@@ -15,14 +15,19 @@
|
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
17
|
import { AIVariable } from '@theia/ai-core';
|
|
18
|
+
import { nls } from '@theia/core';
|
|
18
19
|
import { codiconArray } from '@theia/core/lib/browser';
|
|
19
20
|
|
|
20
21
|
export const TASK_CONTEXT_VARIABLE: AIVariable = {
|
|
21
22
|
id: 'taskContext',
|
|
22
|
-
description:
|
|
23
|
+
description: nls.localize('theia/chat/taskContextVariable/description',
|
|
24
|
+
'Provides context information for a task, e.g. the plan for completing a task or a summary of a previous sessions'),
|
|
23
25
|
name: 'taskContext',
|
|
24
|
-
label: 'Task Context',
|
|
26
|
+
label: nls.localize('theia/chat/taskContextVariable/label', 'Task Context'),
|
|
25
27
|
iconClasses: codiconArray('clippy'),
|
|
26
28
|
isContextVariable: true,
|
|
27
|
-
args: [{
|
|
29
|
+
args: [{
|
|
30
|
+
name: 'context-id',
|
|
31
|
+
description: nls.localize('theia/chat/taskContextVariable/args/contextId/description', 'The ID of the task context to retrieve, or a chat session to summarize.')
|
|
32
|
+
}]
|
|
28
33
|
};
|
package/src/common/change-set.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
-
import { ArrayUtils, Disposable, Emitter, Event, URI } from '@theia/core';
|
|
17
|
+
import { ArrayUtils, Disposable, Emitter, Event, nls, URI } from '@theia/core';
|
|
18
18
|
|
|
19
19
|
export interface ChangeSetElement {
|
|
20
20
|
readonly uri: URI;
|
|
@@ -95,7 +95,7 @@ export class ChangeSetImpl implements ChangeSet {
|
|
|
95
95
|
|
|
96
96
|
protected hasBeenSet = false;
|
|
97
97
|
protected _elements = new Map<string, ChangeSetElement | undefined>();
|
|
98
|
-
protected _title = 'Suggested Changes';
|
|
98
|
+
protected _title = nls.localize('theia/ai/chat/changeSetDefaultTitle', 'Suggested Changes');
|
|
99
99
|
get title(): string {
|
|
100
100
|
return this._title;
|
|
101
101
|
}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
//
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
|
-
import { MaybePromise } from '@theia/core';
|
|
16
|
+
import { MaybePromise, nls } from '@theia/core';
|
|
17
17
|
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
18
18
|
import {
|
|
19
19
|
AIVariable,
|
|
@@ -29,7 +29,7 @@ import { ChatAgentService } from './chat-agent-service';
|
|
|
29
29
|
export const CHAT_AGENTS_VARIABLE: AIVariable = {
|
|
30
30
|
id: 'chatAgents',
|
|
31
31
|
name: 'chatAgents',
|
|
32
|
-
description: 'Returns the list of chat agents available in the system'
|
|
32
|
+
description: nls.localize('theia/ai/chat/chatAgentsVariable/description', 'Returns the list of chat agents available in the system')
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
export interface ChatAgentDescriptor {
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
LanguageModelRegistry,
|
|
50
50
|
LanguageModelStreamResponsePart
|
|
51
51
|
} from '@theia/ai-core/lib/common';
|
|
52
|
-
import { ContributionProvider, ILogger, isArray } from '@theia/core';
|
|
52
|
+
import { ContributionProvider, ILogger, isArray, nls } from '@theia/core';
|
|
53
53
|
import { inject, injectable, named, postConstruct } from '@theia/core/shared/inversify';
|
|
54
54
|
import { ChatAgentService } from './chat-agent-service';
|
|
55
55
|
import {
|
|
@@ -155,7 +155,7 @@ export abstract class AbstractChatAgent implements ChatAgent {
|
|
|
155
155
|
readonly abstract languageModelRequirements: LanguageModelRequirement[];
|
|
156
156
|
iconClass: string = 'codicon codicon-copilot';
|
|
157
157
|
locations: ChatAgentLocation[] = ChatAgentLocation.ALL;
|
|
158
|
-
tags: string[] = ['Chat'];
|
|
158
|
+
tags: string[] = [nls.localizeByDefault('Chat')];
|
|
159
159
|
description: string = '';
|
|
160
160
|
variables: string[] = [];
|
|
161
161
|
prompts: PromptVariantSet[] = [];
|
|
@@ -180,7 +180,7 @@ export abstract class AbstractChatAgent implements ChatAgent {
|
|
|
180
180
|
try {
|
|
181
181
|
const languageModel = await this.getLanguageModel(this.defaultLanguageModelPurpose);
|
|
182
182
|
if (!languageModel) {
|
|
183
|
-
throw new Error('Couldn\'t find a matching language model. Please check your setup!');
|
|
183
|
+
throw new Error(nls.localize('theia/ai/chat/couldNotFindMatchingLM', 'Couldn\'t find a matching language model. Please check your setup!'));
|
|
184
184
|
}
|
|
185
185
|
const systemMessageDescription = await this.getSystemMessageDescription({ model: request.session, request } satisfies ChatSessionContext);
|
|
186
186
|
const messages = await this.getMessages(request.session);
|
|
@@ -237,7 +237,7 @@ export abstract class AbstractChatAgent implements ChatAgent {
|
|
|
237
237
|
protected async selectLanguageModel(selector: LanguageModelRequirement): Promise<LanguageModel> {
|
|
238
238
|
const languageModel = await this.languageModelRegistry.selectLanguageModel({ agent: this.id, ...selector });
|
|
239
239
|
if (!languageModel) {
|
|
240
|
-
throw new Error(
|
|
240
|
+
throw new Error(nls.localize('theia/ai/chat/couldNotFindReadyLMforAgent', 'Couldn\'t find a ready language model for agent {0}. Please check your setup!', this.id));
|
|
241
241
|
}
|
|
242
242
|
return languageModel;
|
|
243
243
|
}
|
|
@@ -204,4 +204,65 @@ describe('ChatRequestParserImpl', () => {
|
|
|
204
204
|
expect(result.toolRequests.get(testTool1.id)).to.deep.equal(testTool1);
|
|
205
205
|
expect(result.toolRequests.get(testTool2.id)).to.deep.equal(testTool2);
|
|
206
206
|
});
|
|
207
|
+
|
|
208
|
+
it('parses simple command without arguments', async () => {
|
|
209
|
+
const req: ChatRequest = {
|
|
210
|
+
text: '/hello'
|
|
211
|
+
};
|
|
212
|
+
const context: ChatContext = { variables: [] };
|
|
213
|
+
const result = await parser.parseChatRequest(req, ChatAgentLocation.Panel, context);
|
|
214
|
+
|
|
215
|
+
expect(result.parts.length).to.equal(1);
|
|
216
|
+
expect(result.parts[0] instanceof ParsedChatRequestVariablePart).to.be.true;
|
|
217
|
+
const varPart = result.parts[0] as ParsedChatRequestVariablePart;
|
|
218
|
+
expect(varPart.variableName).to.equal('prompt');
|
|
219
|
+
expect(varPart.variableArg).to.equal('hello');
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
it('parses command with single argument', async () => {
|
|
223
|
+
const req: ChatRequest = {
|
|
224
|
+
text: '/explain topic'
|
|
225
|
+
};
|
|
226
|
+
const context: ChatContext = { variables: [] };
|
|
227
|
+
const result = await parser.parseChatRequest(req, ChatAgentLocation.Panel, context);
|
|
228
|
+
|
|
229
|
+
expect(result.parts.length).to.equal(1);
|
|
230
|
+
const varPart = result.parts[0] as ParsedChatRequestVariablePart;
|
|
231
|
+
expect(varPart.variableName).to.equal('prompt');
|
|
232
|
+
expect(varPart.variableArg).to.equal('explain|topic');
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
it('parses command with multiple arguments', async () => {
|
|
236
|
+
const req: ChatRequest = {
|
|
237
|
+
text: '/compare item1 item2'
|
|
238
|
+
};
|
|
239
|
+
const context: ChatContext = { variables: [] };
|
|
240
|
+
const result = await parser.parseChatRequest(req, ChatAgentLocation.Panel, context);
|
|
241
|
+
|
|
242
|
+
const varPart = result.parts[0] as ParsedChatRequestVariablePart;
|
|
243
|
+
expect(varPart.variableName).to.equal('prompt');
|
|
244
|
+
expect(varPart.variableArg).to.equal('compare|item1 item2');
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
it('parses command with quoted arguments', async () => {
|
|
248
|
+
const req: ChatRequest = {
|
|
249
|
+
text: '/cmd "arg with spaces" other'
|
|
250
|
+
};
|
|
251
|
+
const context: ChatContext = { variables: [] };
|
|
252
|
+
const result = await parser.parseChatRequest(req, ChatAgentLocation.Panel, context);
|
|
253
|
+
|
|
254
|
+
const varPart = result.parts[0] as ParsedChatRequestVariablePart;
|
|
255
|
+
expect(varPart.variableArg).to.equal('cmd|"arg with spaces" other');
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
it('handles command with escaped quotes', async () => {
|
|
259
|
+
const req: ChatRequest = {
|
|
260
|
+
text: '/cmd "arg with \\"quote\\"" other'
|
|
261
|
+
};
|
|
262
|
+
const context: ChatContext = { variables: [] };
|
|
263
|
+
const result = await parser.parseChatRequest(req, ChatAgentLocation.Panel, context);
|
|
264
|
+
|
|
265
|
+
const varPart = result.parts[0] as ParsedChatRequestVariablePart;
|
|
266
|
+
expect(varPart.variableArg).to.equal('cmd|"arg with \\"quote\\"" other');
|
|
267
|
+
});
|
|
207
268
|
});
|
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
ParsedChatRequestTextPart,
|
|
32
32
|
ParsedChatRequestVariablePart,
|
|
33
33
|
chatVariableLeader,
|
|
34
|
+
chatSubcommandLeader,
|
|
34
35
|
OffsetRange,
|
|
35
36
|
ParsedChatRequest,
|
|
36
37
|
ParsedChatRequestPart,
|
|
@@ -42,6 +43,7 @@ const agentReg = /^@([\w_\-\.]+)(?=(\s|$|\b))/i; // An @-agent
|
|
|
42
43
|
const functionReg = /^~([\w_\-\.]+)(?=(\s|$|\b))/i; // A ~ tool function
|
|
43
44
|
const functionPromptFormatReg = /^\~\{\s*(.*?)\s*\}/i; // A ~{} prompt-format tool function
|
|
44
45
|
const variableReg = /^#([\w_\-]+)(?::([\w_\-_\/\\.:]+))?(?=(\s|$|\b))/i; // A #-variable with an optional : arg (#file:workspace/path/name.ext)
|
|
46
|
+
const commandReg = /^\/([\w_\-]+)(?:\s+(.+?))?(?=\s*$)/; // A /-command with optional arguments (/commandname arg1 arg2)
|
|
45
47
|
|
|
46
48
|
export const ChatRequestParser = Symbol('ChatRequestParser');
|
|
47
49
|
export interface ChatRequestParser {
|
|
@@ -114,7 +116,21 @@ export class ChatRequestParserImpl implements ChatRequestParser {
|
|
|
114
116
|
let newPart: ParsedChatRequestPart | undefined;
|
|
115
117
|
|
|
116
118
|
if (previousChar.match(/\s/) || i === 0) {
|
|
117
|
-
if (char ===
|
|
119
|
+
if (char === chatSubcommandLeader) {
|
|
120
|
+
// Try to parse as command - commands are syntactic sugar for #prompt:commandName|args
|
|
121
|
+
const commandPart = this.tryToParseCommand(
|
|
122
|
+
message.slice(i),
|
|
123
|
+
i,
|
|
124
|
+
parts
|
|
125
|
+
);
|
|
126
|
+
if (commandPart) {
|
|
127
|
+
newPart = commandPart;
|
|
128
|
+
const variable = this.variableService.getVariable(commandPart.variableName);
|
|
129
|
+
if (variable) {
|
|
130
|
+
variables.set(variable.name, variable);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
} else if (char === chatFunctionLeader) {
|
|
118
134
|
const functionPart = this.tryToParseFunction(
|
|
119
135
|
message.slice(i),
|
|
120
136
|
i
|
|
@@ -248,6 +264,29 @@ export class ChatRequestParserImpl implements ChatRequestParser {
|
|
|
248
264
|
return new ParsedChatRequestVariablePart(varRange, name, variableArg);
|
|
249
265
|
}
|
|
250
266
|
|
|
267
|
+
/**
|
|
268
|
+
* Try to parse a command at the start of the given message.
|
|
269
|
+
*
|
|
270
|
+
* Commands are syntactic sugar for `#prompt:commandName|args`.
|
|
271
|
+
* The prompt variable resolver will handle the actual resolution.
|
|
272
|
+
*/
|
|
273
|
+
protected tryToParseCommand(
|
|
274
|
+
message: string,
|
|
275
|
+
offset: number,
|
|
276
|
+
_parts: ReadonlyArray<ParsedChatRequestPart>
|
|
277
|
+
): ParsedChatRequestVariablePart | undefined {
|
|
278
|
+
const nextCommandMatch = message.match(commandReg);
|
|
279
|
+
if (!nextCommandMatch) {
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
const [full, commandName, commandArgs] = nextCommandMatch;
|
|
284
|
+
const commandRange = offsetRange(offset, offset + full.length);
|
|
285
|
+
|
|
286
|
+
const variableArg = commandArgs ? `${commandName}|${commandArgs}` : commandName;
|
|
287
|
+
return new ParsedChatRequestVariablePart(commandRange, 'prompt', variableArg);
|
|
288
|
+
}
|
|
289
|
+
|
|
251
290
|
private tryToParseFunction(message: string, offset: number): ParsedChatRequestFunctionPart | undefined {
|
|
252
291
|
// Support both the and chat and prompt formats for functions
|
|
253
292
|
const nextFunctionMatch = message.match(functionPromptFormatReg) || message.match(functionReg);
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
} from '@theia/ai-core';
|
|
27
27
|
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
28
28
|
import { ChatSession } from './chat-service';
|
|
29
|
-
import { generateUuid } from '@theia/core';
|
|
29
|
+
import { generateUuid, nls } from '@theia/core';
|
|
30
30
|
|
|
31
31
|
import { CHAT_SESSION_NAMING_PROMPT } from './chat-session-naming-prompt-template';
|
|
32
32
|
|
|
@@ -47,7 +47,7 @@ export class ChatSessionNamingAgent implements Agent {
|
|
|
47
47
|
static ID = 'Chat Session Naming';
|
|
48
48
|
id = ChatSessionNamingAgent.ID;
|
|
49
49
|
name = ChatSessionNamingAgent.ID;
|
|
50
|
-
description = 'Agent for generating chat session names';
|
|
50
|
+
description = nls.localize('theia/ai/chat/chatSessionNamingAgent/description', 'Agent for generating chat session names');
|
|
51
51
|
variables = [];
|
|
52
52
|
prompts = [CHAT_SESSION_NAMING_PROMPT];
|
|
53
53
|
languageModelRequirements: LanguageModelRequirement[] = [{
|
|
@@ -55,8 +55,16 @@ export class ChatSessionNamingAgent implements Agent {
|
|
|
55
55
|
identifier: 'default/summarize',
|
|
56
56
|
}];
|
|
57
57
|
agentSpecificVariables = [
|
|
58
|
-
{
|
|
59
|
-
|
|
58
|
+
{
|
|
59
|
+
name: 'conversation',
|
|
60
|
+
usedInPrompt: true,
|
|
61
|
+
description: nls.localize('theia/ai/chat/chatSessionNamingAgent/vars/conversation/description', 'The content of the chat conversation.')
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'listOfSessionNames',
|
|
65
|
+
usedInPrompt: true,
|
|
66
|
+
description: nls.localize('theia/ai/chat/chatSessionNamingAgent/vars/listOfSessionNames/description', 'The list of existing session names.')
|
|
67
|
+
}
|
|
60
68
|
];
|
|
61
69
|
functions = [];
|
|
62
70
|
|
|
@@ -24,7 +24,7 @@ export const CHAT_SESSION_SUMMARY_PROMPT = {
|
|
|
24
24
|
'The summary will primarily be used by other AI agents, so tailor your response for use by AI agents. ' +
|
|
25
25
|
'Also consider the system message. ' +
|
|
26
26
|
'Make sure you include all necessary context information and use unique references (such as URIs, file paths, etc.). ' +
|
|
27
|
-
'If the conversation was about a task, describe the state of the task, i.e.what has been completed and what is open. ' +
|
|
27
|
+
'If the conversation was about a task, describe the state of the task, i.e. what has been completed and what is open. ' +
|
|
28
28
|
'If a changeset is open in the session, describe the state of the suggested changes. ' +
|
|
29
29
|
`\n\n{{${CHANGE_SET_SUMMARY_VARIABLE_ID}}}`,
|
|
30
30
|
}
|
|
@@ -21,13 +21,14 @@ import {
|
|
|
21
21
|
import { injectable } from '@theia/core/shared/inversify';
|
|
22
22
|
import { AbstractStreamParsingChatAgent, ChatAgent } from './chat-agents';
|
|
23
23
|
import { CHAT_SESSION_SUMMARY_PROMPT } from './chat-session-summary-agent-prompt';
|
|
24
|
+
import { nls } from '@theia/core';
|
|
24
25
|
|
|
25
26
|
@injectable()
|
|
26
27
|
export class ChatSessionSummaryAgent extends AbstractStreamParsingChatAgent implements ChatAgent {
|
|
27
28
|
static ID = 'chat-session-summary-agent';
|
|
28
29
|
id = ChatSessionSummaryAgent.ID;
|
|
29
30
|
name = 'Chat Session Summary';
|
|
30
|
-
override description = 'Agent for generating chat session summaries.';
|
|
31
|
+
override description = nls.localize('theia/ai/chat/chatSessionSummaryAgent/description', 'Agent for generating chat session summaries.');
|
|
31
32
|
override prompts: PromptVariantSet[] = [CHAT_SESSION_SUMMARY_PROMPT];
|
|
32
33
|
protected readonly defaultLanguageModelPurpose = 'chat-session-summary';
|
|
33
34
|
languageModelRequirements: LanguageModelRequirement[] = [{
|
|
@@ -70,7 +70,7 @@ export const chatToolPreferences: PreferenceSchema = {
|
|
|
70
70
|
},
|
|
71
71
|
default: {},
|
|
72
72
|
description: nls.localize('theia/ai/chat/toolConfirmation/description',
|
|
73
|
-
'Configure confirmation behavior for different tools. Key is the tool ID, value is the confirmation mode.' +
|
|
73
|
+
'Configure confirmation behavior for different tools. Key is the tool ID, value is the confirmation mode. ' +
|
|
74
74
|
'Use "*" as the key to set a global default for all tools.'),
|
|
75
75
|
title: AI_CORE_PREFERENCES_TITLE,
|
|
76
76
|
}
|
|
@@ -80,4 +80,3 @@ export const chatToolPreferences: PreferenceSchema = {
|
|
|
80
80
|
export interface ChatToolConfiguration {
|
|
81
81
|
[TOOL_CONFIRMATION_PREFERENCE]: { [toolId: string]: ToolConfirmationMode };
|
|
82
82
|
}
|
|
83
|
-
|
|
@@ -19,19 +19,34 @@ import {
|
|
|
19
19
|
AIVariableResolutionRequest,
|
|
20
20
|
ResolvedAIContextVariable
|
|
21
21
|
} from '@theia/ai-core';
|
|
22
|
+
import { nls } from '@theia/core';
|
|
22
23
|
|
|
23
24
|
export const IMAGE_CONTEXT_VARIABLE: AIVariable = {
|
|
24
25
|
id: 'imageContext',
|
|
25
|
-
description: 'Provides context information for an image',
|
|
26
|
+
description: nls.localize('theia/ai/chat/imageContextVariable/description', 'Provides context information for an image'),
|
|
26
27
|
name: 'imageContext',
|
|
27
|
-
label: 'Image File',
|
|
28
|
+
label: nls.localize('theia/ai/chat/imageContextVariable/label', 'Image File'),
|
|
28
29
|
iconClasses: ['codicon', 'codicon-file-media'],
|
|
29
30
|
isContextVariable: true,
|
|
30
31
|
args: [
|
|
31
|
-
{
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
{
|
|
33
|
+
name: 'name',
|
|
34
|
+
description: nls.localize('theia/ai/chat/imageContextVariable/args/name/description', 'The name of the image file if available.'),
|
|
35
|
+
isOptional: true
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'wsRelativePath',
|
|
39
|
+
description: nls.localize('theia/ai/chat/imageContextVariable/args/wsRelativePath/description', 'The workspace-relative path of the image file if available.'),
|
|
40
|
+
isOptional: true
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'data',
|
|
44
|
+
description: nls.localize('theia/ai/chat/imageContextVariable/args/data/description', 'The image data in base64.')
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'mimeType',
|
|
48
|
+
description: nls.localize('theia/ai/chat/imageContextVariable/args/mimeType/description', 'The mimetype of the image.')
|
|
49
|
+
}
|
|
35
50
|
]
|
|
36
51
|
};
|
|
37
52
|
|