Feat: Modify the Python language template code of the code operator #4977 (#7714)

### What problem does this PR solve?

Feat: Modify the Python language template code of the code operator
#4977
### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-05-19 19:34:43 +08:00
committed by GitHub
parent e8e2a95165
commit 8e87436725
5 changed files with 184 additions and 100 deletions

View File

@ -4,23 +4,19 @@ export enum ProgrammingLanguage {
}
export const CodeTemplateStrMap = {
[ProgrammingLanguage.Python]: `
def main(arg1: str, arg2: str) -> dict:
return {
"result": arg1 + arg2,
}
`,
[ProgrammingLanguage.Javascript]: `
const axios = require('axios');
async function main(args) {
try {
const response = await axios.get('https://github.com/infiniflow/ragflow');
console.log('Body:', response.data);
} catch (error) {
console.error('Error:', error.message);
}
}
[ProgrammingLanguage.Python]: `def main(arg1: str, arg2: str) -> str:
return f"result: {arg1 + arg2}"
`,
[ProgrammingLanguage.Javascript]: `const axios = require('axios');
async function main(args) {
try {
const response = await axios.get('https://github.com/infiniflow/ragflow');
console.log('Body:', response.data);
} catch (error) {
console.error('Error:', error.message);
}
}
module.exports = { main };
`,
module.exports = { main };
`,
};