Skip to content
This repository was archived by the owner on May 29, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion en/guides/workflow/node/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ This template node can then be used within a Chatflow to return intermediate out

> The `Answer` node in a Chatflow is non-terminal. It can be inserted anywhere to output responses at multiple points within the flow.

Support for rendering HTML forms
Example: Support for rendering HTML forms:

```html
<form data-format="json"> // Default to text
Expand Down
1 change: 0 additions & 1 deletion jp/guides/workflow/node/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ Jinja2のPythonテンプレート言語を使って、データ変換やテキ

Jinjaの[公式ドキュメント](https://jinja.palletsprojects.com/en/3.1.x/templates/)を参考にして、さまざまなタスクを実行するためのより複雑なテンプレートを作成することができます。


**例3:** HTMLフォームのレンダリングをサポート

```html
Expand Down
19 changes: 10 additions & 9 deletions zh_CN/guides/workflow/node/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,34 @@

模板节点允许你借助 Jinja2 这一强大的 Python 模板语言,在工作流内实现轻量、灵活的数据转换,适用于文本处理、JSON 转换等情景。例如灵活地格式化并合并来自前面步骤的变量,创建出单一的文本输出。这非常适合于将多个数据源的信息汇总成一个特定格式,满足后续步骤的需求。

**示例1:** 将多个输入(文章标题、介绍、内容)拼接为完整文本
**示例 1:** 将多个输入(文章标题、介绍、内容)拼接为完整文本

<figure><img src="../../../.gitbook/assets/image (209).png" alt="" width="375"><figcaption><p>拼接文本</p></figcaption></figure>
<figure><img src="../../../.gitbook/assets/image (209).png" alt=""width="375"><figcaption><p > 拼接文本 </p></figcaption></figure>

**示例2:** 将知识检索节点获取的信息及其相关的元数据,整理成一个结构化的 Markdown 格式
**示例 2:** 将知识检索节点获取的信息及其相关的元数据,整理成一个结构化的 Markdown 格式

```Plain
{% raw %}
{% for item in chunks %}
### Chunk {{ loop.index }}.
### Similarity: {{ item.metadata.score | default('N/A') }}
### Similarity: {{ item.metadata.score | default ('N/A') }}

#### {{ item.title }}

##### Content
{{ item.content | replace('\n', '\n\n') }}
{{ item.content | replace ('\n', '\n\n') }}

---
{% endfor %}
{% endraw %}
```

<figure><img src="../../../.gitbook/assets/image (210).png" alt=""><figcaption><p>知识检索节点输出转换为 Markdown</p></figcaption></figure>
<figure><img src="../../../.gitbook/assets/image (210).png" alt=""><figcaption><p > 知识检索节点输出转换为 Markdown</p></figcaption></figure>

你可以参考 Jinja 的[官方文档](https://jinja.palletsprojects.com/en/3.1.x/templates/),创建更为复杂的模板来执行各种任务。
你可以参考 Jinja 的 [官方文档](https://jinja.palletsprojects.com/en/3.1.x/templates/),创建更为复杂的模板来执行各种任务。

**示例 3:** 支持渲染 HTML 的表单

**示例3:** 支持渲染HTML的表单
```html
<form data-format="json"> // Default to text
<label for="username">Username:</label>
Expand All @@ -64,4 +65,4 @@
</form>
```

<figure><img src="../../../.gitbook/assets/form_002.jpg" alt="" width="375"><figcaption></figcaption></figure>
<figure><img src="../../../.gitbook/assets/form_002.jpg" alt=""width="375"><figcaption></figcaption></figure>
Loading