Dify AI 教程:知识全网搜索
Exa.ai搜索摘要用户问题相关网页,以易读格式输出。
工作流图谱
YAML 源码
app:
description: Exa.ai搜索摘要用户问题相关网页,以易读格式输出。
icon: 🤖
icon_background: '#FFEAD5'
mode: advanced-chat
name: Dify AI 教程:知识全网搜索
use_icon_as_answer_icon: false
kind: app
version: 0.1.2
workflow:
conversation_variables: []
environment_variables: []
features:
file_upload:
allowed_file_extensions:
- .JPG
- .JPEG
- .PNG
- .GIF
- .WEBP
- .SVG
allowed_file_types:
- image
allowed_file_upload_methods:
- local_file
- remote_url
enabled: false
image:
enabled: false
number_limits: 3
transfer_methods:
- local_file
- remote_url
number_limits: 3
opening_statement: ''
retriever_resource:
enabled: false
sensitive_word_avoidance:
enabled: false
speech_to_text:
enabled: false
suggested_questions: []
suggested_questions_after_answer:
enabled: false
text_to_speech:
enabled: false
language: ''
voice: ''
graph:
edges:
- data:
isInIteration: false
sourceType: code
targetType: http-request
id: 1721468180646-source-1721463453690-target
selected: false
source: '1721468180646'
sourceHandle: source
target: '1721463453690'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: code
targetType: code
id: 1721469428830-source-1721468180646-target
selected: false
source: '1721469428830'
sourceHandle: source
target: '1721468180646'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: http-request
targetType: code
id: 1721463453690-source-1721474172600-target
selected: false
source: '1721463453690'
sourceHandle: source
target: '1721474172600'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: code
targetType: iteration
id: 1721474172600-source-1721475912946-target
selected: false
source: '1721474172600'
sourceHandle: source
target: '1721475912946'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: true
iteration_id: '1721475912946'
sourceType: template-transform
targetType: answer
id: 1721476736499-source-1721477350072-target
selected: false
source: '1721476736499'
sourceHandle: source
target: '1721477350072'
targetHandle: target
type: custom
zIndex: 1002
- data:
isInIteration: false
sourceType: llm
targetType: code
id: 1721478635205-source-1721469428830-target
selected: false
source: '1721478635205'
sourceHandle: source
target: '1721469428830'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: true
iteration_id: '1721475912946'
sourceType: llm
targetType: template-transform
id: 1721475919640-source-1721476736499-target
selected: false
source: '1721475919640'
sourceHandle: source
target: '1721476736499'
targetHandle: target
type: custom
zIndex: 1002
- data:
isInIteration: true
iteration_id: '1721475912946'
sourceType: code
targetType: http-request
id: 1721476938220-source-1721481486245-target
selected: false
source: '1721476938220'
sourceHandle: source
target: '1721481486245'
targetHandle: target
type: custom
zIndex: 1002
- data:
isInIteration: true
iteration_id: '1721475912946'
sourceType: http-request
targetType: llm
id: 1721481486245-source-1721475919640-target
selected: false
source: '1721481486245'
sourceHandle: source
target: '1721475919640'
targetHandle: target
type: custom
zIndex: 1002
- data:
isInIteration: false
sourceType: start
targetType: llm
id: 1720358802844-source-1721478635205-target
selected: false
source: '1720358802844'
sourceHandle: source
target: '1721478635205'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: true
iteration_id: '1721475912946'
sourceType: iteration-start
targetType: code
id: 1721475912946start0-source-1721476938220-target
selected: false
source: 1721475912946start0
sourceHandle: source
target: '1721476938220'
targetHandle: target
type: custom
zIndex: 1002
nodes:
- data:
desc: ''
selected: false
title: Start
type: start
variables: []
height: 64
id: '1720358802844'
position:
x: 1390.2361218981657
y: 431.6291063691216
positionAbsolute:
x: 1390.2361218981657
y: 431.6291063691216
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 243
- data:
authorization:
config:
api_key: 70970943-0cb6-4886-a8fa-300a50fe727c
header: x-api-key
type: custom
type: api-key
body:
data: '{{#1721468180646.result#}}'
type: json
desc: ''
headers: 'accept:application/json
content-type:application/json'
method: post
params: ''
selected: false
timeout:
max_connect_timeout: 0
max_read_timeout: 0
max_write_timeout: 0
title: Exa.ai 搜索
type: http-request
url: https://api.exa.ai/search
variables: []
height: 134
id: '1721463453690'
position:
x: 2645.733448326028
y: 431.6291063691216
positionAbsolute:
x: 2645.733448326028
y: 431.6291063691216
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 243
- data:
code: "import json\n\ndef main(arg1: str, startPublishedDate: str, endPublishedDate:\
\ str) -> dict:\n json_data = {\n \"query\": arg1,\n \"\
type\": \"neural\",\n \"numResults\": 6,\n \"startPublishedDate\"\
: startPublishedDate,\n \"endPublishedDate\":endPublishedDate,\n\
\ \"contents\": {\n \"text\": True,\n \"highlights\"\
: {\n \"numSentences\": 7,\n \"highlightPerUrl\"\
: 3\n }\n }\n }\n\n return {\"result\": json.dumps(json_data)}"
code_language: python3
desc: ''
outputs:
result:
children: null
type: string
selected: true
title: HTTP请求的json
type: code
variables:
- value_selector:
- sys
- query
variable: arg1
- value_selector:
- '1721469428830'
- startPublishedDate
variable: startPublishedDate
- value_selector:
- '1721469428830'
- endPublishedDate
variable: endPublishedDate
height: 64
id: '1721468180646'
position:
x: 2341.940147955429
y: 431.6291063691216
positionAbsolute:
x: 2341.940147955429
y: 431.6291063691216
selected: true
sourcePosition: right
targetPosition: left
type: custom
width: 243
- data:
code: "from datetime import datetime, timedelta\n\ndef main(arg1: str) ->\
\ dict:\n end_date = datetime.now()\n start_date = end_date - timedelta(days=60)\n\
\ \n end_formatted = end_date.strftime(\"%Y-%m-%dT%H:%M:%S.%fZ\")\n\
\ start_formatted = start_date.strftime(\"%Y-%m-%dT%H:%M:%S.%fZ\")\n\
\ \n return {\n \"startPublishedDate\": start_formatted,\n\
\ \"endPublishedDate\": end_formatted\n }"
code_language: python3
desc: ''
outputs:
endPublishedDate:
children: null
type: string
startPublishedDate:
children: null
type: string
selected: false
title: 使用代码节点获取日期
type: code
variables:
- value_selector:
- sys
- query
variable: arg1
height: 64
id: '1721469428830'
position:
x: 2035.5228742372458
y: 431.6291063691216
positionAbsolute:
x: 2035.5228742372458
y: 431.6291063691216
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 243
- data:
code: "import json\n\ndef main(input_data: str) -> dict:\n \"\"\"\n \
\ 解析输入的JSON字符串,提取结果数组并将每个项目转换为JSON字符串\n\n 输入:\n - input_data: JSON字符串\n\
\ 输出:\n - 一个包含'items'键和'item_number'键的字典\n \"\"\"\n # 解析输入的JSON字符串\n\
\ data = json.loads(input_data)\n \n # 提取结果数组,并将每个项目转换为JSON字符串\n\
\ items = [json.dumps(item) for item in data.get('results', [])]\n\n\
\ # 计算项目的数量\n item_number = len(items)\n\n # 返回包含'items'键和'item_number'键的字典\n\
\ return {\n \"items\": items,\n \"item_number\": item_number\n\
\ }"
code_language: python3
desc: ''
outputs:
item_number:
children: null
type: number
items:
children: null
type: array[string]
selected: false
title: 查询结果提取
type: code
variables:
- value_selector:
- '1721463453690'
- body
variable: input_data
height: 64
id: '172...(过长已截断)