mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-13 08:49:02 +08:00
Docs: Added code component reference (#7821)
### What problem does this PR solve? ### Type of change - [x] Documentation Update
This commit is contained in:
parent
31e229ff78
commit
59934b63aa
50
docs/guides/agent/agent_component_reference/code.mdx
Normal file
50
docs/guides/agent/agent_component_reference/code.mdx
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
---
|
||||||
|
sidebar_position: 13
|
||||||
|
slug: /code_component
|
||||||
|
---
|
||||||
|
|
||||||
|
# Code component
|
||||||
|
|
||||||
|
A component that enables users to integrate Python or JavaScript codes into their Agent for dynamic data processing.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Scenarios
|
||||||
|
|
||||||
|
A **Code** component is essential when you need to integrate complex code logic (Python or JavaScript) into your Agent for dynamic data processing.
|
||||||
|
|
||||||
|
## Input variables
|
||||||
|
|
||||||
|
You can specify multiple input sources for the **Code** component. Click **+ Add variable** in the **Input variables** section to include the desired input variables.
|
||||||
|
|
||||||
|
After defining an input variable, you are required to select from the dropdown menu:
|
||||||
|
- A component ID under **Component Output**, or
|
||||||
|
- A global variable under **Begin input**, which is defined in the **Begin** component.
|
||||||
|
|
||||||
|
## Coding field
|
||||||
|
|
||||||
|
### A Python code example
|
||||||
|
|
||||||
|
```Python
|
||||||
|
def main(arg1: str, arg2: str) -> dict:
|
||||||
|
return {
|
||||||
|
"result": arg1 + arg2,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### A JavaScript code example
|
||||||
|
|
||||||
|
```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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
sidebar_position: 13
|
sidebar_position: 18
|
||||||
slug: /note_component
|
slug: /note_component
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -31,13 +31,13 @@ Released on May 26, 2025.
|
|||||||
- Cross-language search is supported in the Knowledge and Chat modules, enhancing search accuracy and user experience in multilingual environments, such as in Chinese-English knowledge bases.
|
- Cross-language search is supported in the Knowledge and Chat modules, enhancing search accuracy and user experience in multilingual environments, such as in Chinese-English knowledge bases.
|
||||||
- Agent component: A new Code component supports Python and JavaScript scripts, enabling developers to handle more complex tasks like dynamic data processing.
|
- Agent component: A new Code component supports Python and JavaScript scripts, enabling developers to handle more complex tasks like dynamic data processing.
|
||||||
- Enhanced image display: Images in Chat and Search now render directly within responses, rather than as external references. Knowledge retrieval testing can retrieve images directly, instead of texts extracted from images.
|
- Enhanced image display: Images in Chat and Search now render directly within responses, rather than as external references. Knowledge retrieval testing can retrieve images directly, instead of texts extracted from images.
|
||||||
- Claude 4: Developers can now use the newly released, most advanced Claude model.
|
- Claude 4 and ChatGPT o3: Developers can now use the newly released, most advanced Claude model alongside OpenAI’s latest ChatGPT o3 inference model.
|
||||||
|
|
||||||
> The following features are contributed by our community contributors:
|
> The following features are contributed by our community contributors:
|
||||||
|
|
||||||
- Agent component: Enables tool calling within the Generate Component. Kudos to [notsyncing](https://github.com/notsyncing).
|
- Agent component: Enables tool calling within the Generate Component. Thanks to [notsyncing](https://github.com/notsyncing).
|
||||||
- Markdown rendering: Image references in a markdown file can be displayed after chunking. Kudos to [Woody-Hu](https://github.com/Woody-Hu).
|
- Markdown rendering: Image references in a markdown file can be displayed after chunking. Thanks to [Woody-Hu](https://github.com/Woody-Hu).
|
||||||
- Vector database support: OpenSearch can now be used as RAGFlow's document engine. Kudos to [pyyuhao](https://github.com/pyyuhao).
|
- Document engine support: OpenSearch can now be used as RAGFlow's document engine. Thanks to [pyyuhao](https://github.com/pyyuhao).
|
||||||
|
|
||||||
## v0.18.0
|
## v0.18.0
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user