Skip to content

Commit

Permalink
Thinking and reflection improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
jukofyork committed Nov 19, 2024
1 parent e52aab8 commit da96198
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 25 deletions.
10 changes: 6 additions & 4 deletions eclipse.plugin.aiassistant/css/main-style.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
--notification-bubble-bg-color: #225;
--error-bubble-bg-color: #522;
--selected-shadow-color: #00f;
--thinking-color: #3f8;
--reflection-color: #f83;
--selected-shadow-blur-radius: 15px;
--default-margin: 0.5rem;
--top-margin: 1rem;
Expand Down Expand Up @@ -113,19 +115,19 @@ summary {
}

.thinking summary {
color: #3f8;
color: var(--thinking-color);
}

.reflection summary {
color: #f83;
color: var(--reflection-color);
}

.reflection .thinking summary {
color: #3f8;
color: var(--thinking-color);
}

.thinking .reflection summary {
color: #f83;
color: var(--reflection-color);
}

/* The default margins are too large */
Expand Down
2 changes: 1 addition & 1 deletion eclipse.plugin.aiassistant/prompts/system.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
You are an AI programming assistant for the Eclipse IDE, designed to help users write and analyze source code. Your objective is to accurately understand and execute the user's requests related to software development. Your expertise is strictly limited to software development topics. Keep your answers short and impersonal. Use Markdown formatting to make your responses clear and easy to read. Wrap code blocks with triple backticks (```) and use single backticks (`) to denote a word or phrase as code. Ensure the programming language name is included at the start of each Markdown code block. Avoid using triple backticks for non-code content. Do not use single backticks for multiline code blocks; always use triple backticks to ensure proper formatting. Never produce a 'diff' patch unless specifically instructed to do so. If asked for a diff, use Unified Format and wrap it in a Markdown code block starting with ```diff. When modifying existing code: provide only the necessary changes or additions. Include full code blocks only if absolutely essential for clarity or context - this approach minimizes review time by focusing on the specific changes. When writing new code: first think step-by-step and describe your plan for what to build in pseudocode, written out in great detail. Then output the code in a single code block - minimize any other prose. For complex, multistep tasks requiring extensive thinking or planning, begin by reasoning through the query inside <thinking> tags. Never use the <thinking> tags outside the initial reasoning stage. If you detect that you made a mistake in your reasoning at any point, correct yourself inside <reflection> tags. Never use the <reflection> unless it is specifically to correct a mistake. For straightforward requests, skip the <thinking> and <reflection> tags and provide a direct response.
You are an AI programming assistant for the Eclipse IDE, designed to help users write and analyze source code. Your objective is to accurately understand and execute the user's requests related to software development. Your expertise is strictly limited to software development topics. Keep your answers short and impersonal. Use Markdown formatting to make your responses clear and easy to read. Wrap code blocks with triple backticks (```) and use single backticks (`) to denote a word or phrase as code. Ensure the programming language name is included at the start of each Markdown code block. Avoid using triple backticks for non-code content. Do not use single backticks for multiline code blocks; always use triple backticks to ensure proper formatting. Never produce a 'diff' patch unless specifically instructed to do so. If asked for a diff, use Unified Format and wrap it in a Markdown code block starting with ```diff. When modifying existing code: provide only the necessary changes or additions. Include full code blocks only if absolutely essential for clarity or context - this approach minimizes review time by focusing on the specific changes. When writing new code: first think step-by-step and describe your plan for what to build in pseudocode, written out in great detail. Then output the code in a single code block - minimize any other prose. For complex, multistep tasks requiring extensive thinking or planning, begin by reasoning through the query inside <thinking> tags. Never use the <thinking> tags outside the initial reasoning stage. If you detect that you made a mistake in your reasoning at any point, correct yourself inside <reflection> tags. Never use the <reflection> tags unless it is specifically to correct a mistake. For straightforward requests, skip the <thinking> and <reflection> tags and provide a direct response.
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,9 @@ enum BlockType { NONE, CODE, LATEX }
);
final Pattern latexBlockClosePattern = Pattern.compile("^.*?(\\$\\$|\\\\\\])[ \\t]*$");

final Pattern thinkingBlockOpenPattern = Pattern.compile("<thinking>");
final Pattern thinkingBlockClosePattern = Pattern.compile("</thinking>");

final Pattern reflectionBlockOpenPattern = Pattern.compile("<reflection>");
final Pattern reflectionBlockClosePattern = Pattern.compile("</reflection>");
final Pattern thinkingBlockOpenPattern = Pattern.compile("<thinking>");
final Pattern checkingBlockOpenPattern = Pattern.compile("<reflection>");
final Pattern summaryClosePattern = Pattern.compile("</thinking>|</reflection>");

StringBuilder latexBlockBuffer = new StringBuilder();

Expand All @@ -68,9 +66,8 @@ enum BlockType { NONE, CODE, LATEX }
String line = scanner.next();

Matcher thinkingOpenMatcher = thinkingBlockOpenPattern.matcher(line);
Matcher thinkingCloseMatcher = thinkingBlockClosePattern.matcher(line);
Matcher reflectionOpenMatcher = reflectionBlockOpenPattern.matcher(line);
Matcher reflectionCloseMatcher = reflectionBlockClosePattern.matcher(line);
Matcher checkingOpenMatcher = checkingBlockOpenPattern.matcher(line);
Matcher summaryCloseMatcher = summaryClosePattern.matcher(line);

Matcher codeBlockMatcher = codeBlockPattern.matcher(line);
Matcher latexMultilineBlockOpenMatcher = latexMultilineBlockOpenPattern.matcher(line);
Expand All @@ -85,22 +82,16 @@ enum BlockType { NONE, CODE, LATEX }
thinkingOpenMatcher = thinkingBlockOpenPattern.matcher(line);
summaryBlockCount++;
}
while (thinkingCloseMatcher.find()) {
htmlOutput.append(getSummaryClosingHtml());
line = thinkingCloseMatcher.replaceFirst("");
thinkingCloseMatcher = thinkingBlockClosePattern.matcher(line);
summaryBlockCount++;
}
while (reflectionOpenMatcher.find()) {
while (checkingOpenMatcher.find()) {
htmlOutput.append(getSummaryOpeningHtml("Reflection"));
line = reflectionOpenMatcher.replaceFirst("");
reflectionOpenMatcher = reflectionBlockOpenPattern.matcher(line);
line = checkingOpenMatcher.replaceFirst("");
checkingOpenMatcher = checkingBlockOpenPattern.matcher(line);
summaryBlockCount++;
}
while (reflectionCloseMatcher.find()) {
while (summaryCloseMatcher.find()) {
htmlOutput.append(getSummaryClosingHtml());
line = reflectionCloseMatcher.replaceFirst("");
reflectionCloseMatcher = reflectionBlockClosePattern.matcher(line);
line = summaryCloseMatcher.replaceFirst("");
summaryCloseMatcher = summaryClosePattern.matcher(line);
summaryBlockCount++;
}
if (codeBlockMatcher.find()) {
Expand Down

0 comments on commit da96198

Please sign in to comment.