瀏覽代碼

Docs: Added code component reference (#7821)

### What problem does this PR solve?

### Type of change

- [x] Documentation Update
tags/v0.19.0
writinwaters 5 月之前
父節點
當前提交
59934b63aa
No account linked to committer's email address

+ 50
- 0
docs/guides/agent/agent_component_reference/code.mdx 查看文件

@@ -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
- 1
docs/guides/agent/agent_component_reference/note.mdx 查看文件

@@ -1,5 +1,5 @@
---
sidebar_position: 13
sidebar_position: 18
slug: /note_component
---


+ 4
- 4
docs/release_notes.md 查看文件

@@ -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.
- 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.
- 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:

- Agent component: Enables tool calling within the Generate Component. Kudos 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).
- Vector database support: OpenSearch can now be used as RAGFlow's document engine. Kudos to [pyyuhao](https://github.com/pyyuhao).
- 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. Thanks to [Woody-Hu](https://github.com/Woody-Hu).
- Document engine support: OpenSearch can now be used as RAGFlow's document engine. Thanks to [pyyuhao](https://github.com/pyyuhao).

## v0.18.0


Loading…
取消
儲存