mirror of
https://github.com/langgenius/dify-docs.git
synced 2026-03-27 13:28:32 +07:00
* fix redirect language code prefixes * rename: cn -> zh, jp -> ja * remove hardcoded ja / zh references * remove hardcoded 'english' references * renamed variable names and dict keys to language agnostic names * fix: add missing language helper methods to PRAnalyzer - Add get_language_directory() method - Initialize source_language and target_languages from config - Fixes AttributeError when generating mixed PR errors 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * test: kitchen sink workflow validation v2 This PR validates the translation workflow after config-driven refactoring: Changes: - Add new test file: test-workflow-validation.mdx - Modify existing file: introduction.mdx - Update docs.json navigation Tests: - New file translation (add workflow) - Existing file translation (update workflow) - Navigation sync across languages - Config-driven language codes (zh/ja instead of cn/jp) - Source language abstraction (no hardcoded "English") Expected workflow behavior: 1. Detect changes in en/ directory 2. Translate new file to zh and ja 3. Update modified file translations 4. Sync docs.json for all language sections 5. Commit translated files automatically 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: update workflow paths to use zh/ja instead of cn/jp Aligns workflow trigger paths with the zh/ja language directory rename. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Revert "fix: update workflow paths to use zh/ja instead of cn/jp" This reverts commit9587b7cc5d. * Revert "test: kitchen sink workflow validation v2" This reverts commit4abdd69fd2. * fix: update workflow paths in doc analyze workflow to use zh/ja instead of cn/jp * Refactor/language codes (#240) * test: kitchen sink workflow validation v2 This PR validates the translation workflow after config-driven refactoring: Changes: - Add new test file: test-workflow-validation.mdx - Modify existing file: introduction.mdx - Update docs.json navigation Tests: - New file translation (add workflow) - Existing file translation (update workflow) - Navigation sync across languages - Config-driven language codes (zh/ja instead of cn/jp) - Source language abstraction (no hardcoded "English") Expected workflow behavior: 1. Detect changes in en/ directory 2. Translate new file to zh and ja 3. Update modified file translations 4. Sync docs.json for all language sections 5. Commit translated files automatically 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: update workflow paths to use zh/ja instead of cn/jp Aligns workflow trigger paths with the zh/ja language directory rename. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Revert "fix: update workflow paths to use zh/ja instead of cn/jp" This reverts commit9587b7cc5d. * Revert "test: kitchen sink workflow validation v2" This reverts commit4abdd69fd2. * fix: update workflow paths in doc analyze workflow to use zh/ja instead of cn/jp --------- Co-authored-by: Claude <noreply@anthropic.com> * fix: update workflow files to use 'source' instead of 'english' After refactoring the PR analyzer to use 'source' for source language PRs (instead of hardcoded 'english'), the workflow files need to match. Changes: - sync_docs_analyze.yml: pr_type == 'source' (was 'english') - sync_docs_update.yml: PR_TYPE != 'source' check - Updated all comments from "English" to "source language" - Updated all pr_type values in JSON from "english" to "source" This ensures the workflows trigger correctly with the refactored config-driven language system. Related: language code refactoring (cn/jp → zh/ja) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Fix/workflow source language references (#245) * test: kitchen sink workflow validation v2 This PR validates the translation workflow after config-driven refactoring: Changes: - Add new test file: test-workflow-validation.mdx - Modify existing file: introduction.mdx - Update docs.json navigation Tests: - New file translation (add workflow) - Existing file translation (update workflow) - Navigation sync across languages - Config-driven language codes (zh/ja instead of cn/jp) - Source language abstraction (no hardcoded "English") Expected workflow behavior: 1. Detect changes in en/ directory 2. Translate new file to zh and ja 3. Update modified file translations 4. Sync docs.json for all language sections 5. Commit translated files automatically 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: update workflow paths to use zh/ja instead of cn/jp Aligns workflow trigger paths with the zh/ja language directory rename. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Revert "fix: update workflow paths to use zh/ja instead of cn/jp" This reverts commit9587b7cc5d. * Revert "test: kitchen sink workflow validation v2" This reverts commit4abdd69fd2. * fix: update workflow paths in doc analyze workflow to use zh/ja instead of cn/jp * fix: update workflow files to use 'source' instead of 'english' After refactoring the PR analyzer to use 'source' for source language PRs (instead of hardcoded 'english'), the workflow files need to match. Changes: - sync_docs_analyze.yml: pr_type == 'source' (was 'english') - sync_docs_update.yml: PR_TYPE != 'source' check - Updated all comments from "English" to "source language" - Updated all pr_type values in JSON from "english" to "source" This ensures the workflows trigger correctly with the refactored config-driven language system. Related: language code refactoring (cn/jp → zh/ja) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com> * fix * fix docs.json language codes * rename previous version docs: cn -> zh, jp -> ja * rm duplicate redirect entires --------- Co-authored-by: Claude <noreply@anthropic.com>
163 lines
6.2 KiB
Plaintext
163 lines
6.2 KiB
Plaintext
---
|
||
title: "シンプルなチャットボット"
|
||
description: "Hello World"
|
||
---
|
||
|
||
Difyの真の価値は、どんなに複雑なアイデアでも簡単に構築、デプロイ、スケールできることにあります。高速プロトタイピング、スムーズなイテレーション、あらゆるレベルでの信頼性の高いデプロイのために構築されています。
|
||
|
||
まずは、アプリケーションへの信頼性の高いLLM統合を学びましょう。このガイドでは、ユーザーの質問を分類し、LLMを使用して直接応答し、国固有の豆知識で応答を強化する簡単なチャットボットを構築します。
|
||
|
||
<iframe
|
||
className="w-full aspect-video rounded-xl"
|
||
src="https://www.youtube.com/embed/dJ34OU_JY7Y?si=AiYJq7WY1iUCgGAO"
|
||
title="Difyクイックスタートビデオ"
|
||
frameBorder="0"
|
||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||
allowFullScreen
|
||
/>
|
||
|
||
## ステップ 1:新しいワークフローを作成(2分)
|
||
|
||
1. **スタジオ** > **ワークフロー** > **空白から作成** > **オーケストレート** > **新しいチャットフロー** > **作成** へ移動
|
||
|
||
## ステップ 2:ワークフローノードを追加(6分)
|
||
|
||
<Tip>
|
||
任意の変数を参照したい場合は、まず `{` または `/` を入力すると、ワークフローで使用可能なさまざまな変数が表示されます。
|
||
</Tip>
|
||
|
||
### 1. LLMノードと出力:質問を理解して回答
|
||
|
||
<Info>
|
||
`LLM` ノードは言語モデルにプロンプトを送信し、ユーザー入力に基づいて応答を生成します。API呼び出し、レート制限、インフラストラクチャの複雑さを抽象化するので、ロジックの設計に集中できます。
|
||
</Info>
|
||
|
||
<Steps>
|
||
<Step title="LLMノードを作成">
|
||
`ノードを追加` ボタンを使用してLLMノードを作成し、開始ノードに接続
|
||
</Step>
|
||
|
||
<Step title="モデルを設定">
|
||
デフォルトのモデルを選択
|
||
</Step>
|
||
|
||
<Step title="システムプロンプトを設定">
|
||
システムプロンプトフィールドに以下を貼り付け:
|
||
|
||
```text
|
||
ユーザーは国に関する質問をします。質問は {{sys.query}} です
|
||
タスク:
|
||
1. 言及された国を特定する。
|
||
2. 質問を明確に言い換える。
|
||
3. 一般的な知識を使って質問に答える。
|
||
|
||
次のJSON形式で応答してください:
|
||
{
|
||
"country": "<国名>",
|
||
"question": "<言い換えた質問>",
|
||
"answer": "<質問への直接的な回答>"
|
||
}
|
||
```
|
||
</Step>
|
||
|
||
<Step title="構造化出力を有効化">
|
||
**構造化出力を有効にする** により、LLMが返すものを簡単に制御し、正確なデータ抽出や条件ロジックでのダウンストリーム使用のために一貫した機械可読出力を確保できます。
|
||
|
||
- 出力変数の構造化をONに切り替え > `設定` をクリックして `JSONからインポート` をクリック
|
||
- 貼り付け:
|
||
|
||
```json
|
||
{
|
||
"country": "string",
|
||
"question": "string",
|
||
"answer": "string"
|
||
}
|
||
```
|
||
</Step>
|
||
</Steps>
|
||
|
||
### 2. コードブロック:豆知識を取得
|
||
|
||
<Info>
|
||
`コード` ノードはコードを使用してカスタムロジックを実行します。必要な場所に正確にコードを注入できます——ビジュアルワークフロー内で——バックエンド全体を配線する必要がありません。
|
||
</Info>
|
||
|
||
<Steps>
|
||
<Step title="コードノードを作成">
|
||
`ノードを追加` ボタンを使用して `コード` ノードを作成し、LLMブロックに接続
|
||
</Step>
|
||
|
||
<Step title="入力変数を設定">
|
||
1つの `入力変数` 名を "country" に変更し、変数を `structured_output` > `country` に設定
|
||
</Step>
|
||
|
||
<Step title="Pythonコードを追加">
|
||
このコードを `PYTHON3` に貼り付け:
|
||
|
||
```python
|
||
def main(country: str) -> dict:
|
||
country_name = country.lower()
|
||
fun_facts = {
|
||
"japan": "日本には500万台以上の自動販売機があります。",
|
||
"france": "フランスは世界で最も訪問者が多い国です。",
|
||
"italy": "イタリアは他のどの国よりも多くのユネスコ世界遺産を持っています。"
|
||
}
|
||
fun_fact = fun_facts.get(country_name, f"{country.title()}に関する豆知識はありません。")
|
||
return {"fun_fact": fun_fact}
|
||
```
|
||
</Step>
|
||
|
||
<Step title="出力変数の名前を変更">
|
||
より良いラベル付けのため、出力変数 `result` を `fun_fact` に変更
|
||
</Step>
|
||
</Steps>
|
||
|
||
### 3. 回答ノード:ユーザーへの最終回答
|
||
|
||
<Info>
|
||
`回答` ノードはクリーンな最終出力を作成して返します。
|
||
</Info>
|
||
|
||
<Steps>
|
||
<Step title="回答ノードを作成">
|
||
`ノードを追加` ボタンを使用して `回答` ノードを作成
|
||
</Step>
|
||
|
||
<Step title="回答フィールドを設定">
|
||
回答フィールドに貼り付け:
|
||
|
||
```text
|
||
Q: {{ structured_output.question }}
|
||
|
||
A: {{ structured_output.answer }}
|
||
|
||
豆知識: {{ fun_fact }}
|
||
```
|
||
</Step>
|
||
</Steps>
|
||
|
||
ワークフローの終了:
|
||
|
||
<img
|
||
src="/images/quick-start-workflow-overview.png"
|
||
alt="LLM、コード、回答ノードが接続された完全なワークフロー図"
|
||
style={{ width: "100%" }}
|
||
/>
|
||
|
||
---
|
||
|
||
## ステップ 3:ボットをテスト(3分)
|
||
|
||
`プレビュー` をクリックして、次の質問をしてみましょう:
|
||
|
||
- "フランスの首都は何ですか?"
|
||
- "日本料理について教えてください"
|
||
- "イタリアの文化について説明してください"
|
||
- その他の質問
|
||
|
||
ボットが期待通りに動作することを確認してください!
|
||
|
||
## ボットが完成しました!
|
||
|
||
このガイドでは、インフラストラクチャを再発明することなく、言語モデルを確実かつスケーラブルに統合する方法を示しました。Difyのビジュアルワークフローとモジュラーノードにより、より速く構築するだけでなく、LLM駆動アプリのためのクリーンでプロダクション対応のアーキテクチャを採用しています。
|