Feat: Add the JS code (or other) executor component to Agent. #4977 (#7677)

### What problem does this PR solve?

Feat: Add the JS code (or other) executor component to Agent. #4977

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-05-16 09:53:00 +08:00
committed by GitHub
parent 772992812a
commit 008e55a65e
14 changed files with 293 additions and 7 deletions

View File

@ -0,0 +1,26 @@
export enum ProgrammingLanguage {
Python = 'python',
Javascript = 'javascript',
}
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);
}
}
module.exports = { main };
`,
};