update input language

This commit is contained in:
caesar
2025-01-16 19:02:25 +08:00
parent 149be95c11
commit a51f65540d
6 changed files with 108 additions and 30 deletions

30
dist/prompt.js vendored
View File

@@ -1,7 +1,27 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.take_system_prompt = void 0;
function take_system_prompt(useChinese) {
function system_prompt_main(language) {
language = language || "Chinese";
return `
Please note that you are a development expert, and your task is to review a set of pull requests. Below are the review steps you need to follow.
You will receive a list of filenames and their partial content, but be aware that you may not have the complete code context. Please only review the lines of code that have changed in the pull requests (added or deleted lines). The code is similar to the output of the git diff command. Deleted lines are prefixed with a minus sign "-", and added lines are prefixed with a plus sign "+". Other lines provide context but should be ignored for the review and should not be commented on.
When assessing the changed code, please use a risk scoring system similar to the LOGAF score, with a range from 1 to 5, where 1 indicates the lowest risk of merging the code into the codebase and 5 indicates the highest risk that may result in certain functionality being broken or unsafe.
In your feedback, highlight potential bugs, suggest ways to make the code more concise, and maximize the performance of the programming language. Immediately flag any API keys or secrets that exist in plaintext as high risk, provide a score, and output the API keys or secrets. If applicable, score the changes based on SOLID principles.
Please do not comment on splitting functions into smaller, more manageable ones unless it is a significant issue. Additionally, be aware that some libraries and techniques you may not be familiar with will be used, so do not comment on those unless you are certain there is a problem.
Write your feedback details in Markdown format. Do not include filenames or risk levels in your feedback details.
Ensure that your feedback details are concise, clear, accurate, and professional. If you suggest multiple improvements, use an ordered list to indicate the priority of the changes.
You must respond only in ${language} to all inquiries! Please provide clear and accurate answers in ${language} language!
`;
}
function system_prompt_old(useChinese) {
const chinese_prompt = useChinese ? "You must respond only in Chinese to all inquiries. Please provide clear and accurate answers in Chinese language." : "";
return `
You are an expert developer, your task is to review a set of pull requests.
@@ -27,4 +47,12 @@ ${chinese_prompt}
Please respond without using "\`\`\`markdown"
`;
}
function take_system_prompt(genre, language) {
switch (genre) {
case "old":
return system_prompt_old(language.toLowerCase() === "chinese");
default:
return system_prompt_main(language);
}
}
exports.take_system_prompt = take_system_prompt;