mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### 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:
26
web/src/constants/agent.ts
Normal file
26
web/src/constants/agent.ts
Normal 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 };
|
||||
`,
|
||||
};
|
||||
Reference in New Issue
Block a user