Update template content (#720)

This commit is contained in:
AllenWriter
2025-04-15 11:13:53 +08:00
committed by GitHub
parent 1510cc391c
commit dd70837ed8
3 changed files with 11 additions and 11 deletions
+1 -1
View File
@@ -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
-1
View File
@@ -42,7 +42,6 @@ Jinja2のPythonテンプレート言語を使って、データ変換やテキ
Jinjaの[公式ドキュメント](https://jinja.palletsprojects.com/en/3.1.x/templates/)を参考にして、さまざまなタスクを実行するためのより複雑なテンプレートを作成することができます。
**例3** HTMLフォームのレンダリングをサポート
```html
+10 -9
View File
@@ -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>
@@ -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>