Skip to content

Commit d75db7f

Browse files
committed
Make universal default prompt plain
fixed #15006
1 parent b7a3241 commit d75db7f

File tree

2 files changed

+39
-69
lines changed

2 files changed

+39
-69
lines changed

packages/ai-ide/src/common/universal-chat-agent.ts

+2-69
Original file line numberDiff line numberDiff line change
@@ -14,78 +14,11 @@
1414
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
1515
// *****************************************************************************
1616

17-
import { LanguageModelRequirement, PromptTemplate } from '@theia/ai-core/lib/common';
17+
import { LanguageModelRequirement } from '@theia/ai-core/lib/common';
1818
import { injectable } from '@theia/core/shared/inversify';
1919
import { AbstractStreamParsingChatAgent } from '@theia/ai-chat/lib/common/chat-agents';
20-
import { CHAT_CONTEXT_DETAILS_VARIABLE_ID } from '@theia/ai-chat';
2120
import { nls } from '@theia/core';
22-
23-
export const universalTemplate: PromptTemplate = {
24-
id: 'universal-system',
25-
template: `{{!-- Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
26-
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
27-
# Instructions
28-
29-
You are an AI assistant integrated into the Theia IDE, specifically designed to help software developers by
30-
providing concise and accurate answers to programming-related questions. Your role is to enhance the
31-
developer's productivity by offering quick solutions, explanations, and best practices.
32-
Keep responses short and to the point, focusing on delivering valuable insights, best practices and
33-
simple solutions.
34-
35-
### Guidelines
36-
37-
1. **Understand Context:**
38-
- Assess the context of the code or issue when available.
39-
- Tailor responses to be relevant to the programming language, framework, or tools like Eclipse Theia.
40-
- Ask clarifying questions if necessary to provide accurate assistance.
41-
42-
2. **Provide Clear Solutions:**
43-
- Offer direct answers or code snippets that solve the problem or clarify the concept.
44-
- Avoid lengthy explanations unless necessary for understanding.
45-
46-
3. **Promote Best Practices:**
47-
- Suggest best practices and common patterns relevant to the question.
48-
- Provide links to official documentation for further reading when applicable.
49-
50-
4. **Support Multiple Languages and Tools:**
51-
- Be familiar with popular programming languages, frameworks, IDEs like Eclipse Theia, and command-line tools.
52-
- Adapt advice based on the language, environment, or tools specified by the developer.
53-
54-
5. **Facilitate Learning:**
55-
- Encourage learning by explaining why a solution works or why a particular approach is recommended.
56-
- Keep explanations concise and educational.
57-
58-
6. **Maintain Professional Tone:**
59-
- Communicate in a friendly, professional manner.
60-
- Use technical jargon appropriately, ensuring clarity for the target audience.
61-
62-
7. **Stay on Topic:**
63-
- Limit responses strictly to topics related to software development, frameworks, Eclipse Theia, terminal usage, and relevant technologies.
64-
- Politely decline to answer questions unrelated to these areas by saying, "I'm here to assist with programming-related questions.
65-
For other topics, please refer to a specialized source."
66-
67-
### Example Interactions
68-
69-
- **Question:** "What's the difference between \`let\` and \`var\` in JavaScript?"
70-
**Answer:** "\`let\` is block-scoped, while \`var\` is function-scoped. Prefer \`let\` to avoid scope-related bugs."
71-
72-
- **Question:** "How do I handle exceptions in Java?"
73-
**Answer:** "Use try-catch blocks: \`\`\`java try { /* code */ } catch (ExceptionType e) { /* handle exception */ }\`\`\`."
74-
75-
- **Question:** "What is the capital of France?"
76-
**Answer:** "I'm here to assist with programming-related queries. For other topics, please refer to a specialized source."
77-
78-
### Current Context
79-
Some files and other pieces of data may already have been added to the context of the chat. If any have, the details can be found below.
80-
{{${CHAT_CONTEXT_DETAILS_VARIABLE_ID}}}
81-
`
82-
};
83-
84-
export const universalTemplateVariant: PromptTemplate = {
85-
id: 'universal-system-empty',
86-
template: '',
87-
variantOf: universalTemplate.id,
88-
};
21+
import { universalTemplate, universalTemplateVariant } from './universal-prompt-template';
8922

9023
export const UniversalChatAgentId = 'Universal';
9124
@injectable()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// *****************************************************************************
2+
// Copyright (C) 2025 EclipseSource GmbH.
3+
//
4+
// This program and the accompanying materials are made available under the
5+
// terms of the Eclipse Public License v. 2.0 which is available at
6+
// http://www.eclipse.org/legal/epl-2.0.
7+
//
8+
// This Source Code may also be made available under the following Secondary
9+
// Licenses when the conditions for such availability set forth in the Eclipse
10+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
11+
// with the GNU Classpath Exception which is available at
12+
// https://www.gnu.org/software/classpath/license.html.
13+
//
14+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15+
// *****************************************************************************
16+
17+
import { PromptTemplate } from '@theia/ai-core/lib/common';
18+
import { CHAT_CONTEXT_DETAILS_VARIABLE_ID } from '@theia/ai-chat';
19+
20+
export const universalTemplate: PromptTemplate = {
21+
id: 'universal-system',
22+
template: `{{!-- Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
23+
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
24+
25+
You are an assistant integrated into Theia IDE, designed to assist software developers.
26+
27+
## Current Context
28+
Some files and other pieces of data may have been added by the user to the context of the chat. If any have, the details can be found below.
29+
{{${CHAT_CONTEXT_DETAILS_VARIABLE_ID}}}
30+
`
31+
};
32+
33+
export const universalTemplateVariant: PromptTemplate = {
34+
id: 'universal-system-empty',
35+
template: '',
36+
variantOf: universalTemplate.id,
37+
};

0 commit comments

Comments
 (0)