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