mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-24 18:23:07 +08:00
feat: support max_retries in jina requests (#6585)
This commit is contained in:
@@ -60,11 +60,13 @@ class JinaReaderTool(BuiltinTool):
|
||||
if tool_parameters.get('no_cache', False):
|
||||
headers['X-No-Cache'] = 'true'
|
||||
|
||||
max_retries = tool_parameters.get('max_retries', 3)
|
||||
response = ssrf_proxy.get(
|
||||
str(URL(self._jina_reader_endpoint + url)),
|
||||
headers=headers,
|
||||
params=request_params,
|
||||
timeout=(10, 60),
|
||||
max_retries=max_retries
|
||||
)
|
||||
|
||||
if tool_parameters.get('summary', False):
|
||||
|
||||
@@ -150,3 +150,17 @@ parameters:
|
||||
pt_BR: Habilitar resumo para a saída
|
||||
llm_description: enable summary
|
||||
form: form
|
||||
- name: max_retries
|
||||
type: number
|
||||
required: false
|
||||
default: 3
|
||||
label:
|
||||
en_US: Retry
|
||||
zh_Hans: 重试
|
||||
pt_BR: Repetir
|
||||
human_description:
|
||||
en_US: Number of times to retry the request if it fails
|
||||
zh_Hans: 请求失败时重试的次数
|
||||
pt_BR: Número de vezes para repetir a solicitação se falhar
|
||||
llm_description: Number of times to retry the request if it fails
|
||||
form: form
|
||||
|
||||
@@ -40,10 +40,12 @@ class JinaSearchTool(BuiltinTool):
|
||||
if tool_parameters.get('no_cache', False):
|
||||
headers['X-No-Cache'] = 'true'
|
||||
|
||||
max_retries = tool_parameters.get('max_retries', 3)
|
||||
response = ssrf_proxy.get(
|
||||
str(URL(self._jina_search_endpoint + query)),
|
||||
headers=headers,
|
||||
timeout=(10, 60)
|
||||
timeout=(10, 60),
|
||||
max_retries=max_retries
|
||||
)
|
||||
|
||||
return self.create_text_message(response.text)
|
||||
|
||||
@@ -91,3 +91,17 @@ parameters:
|
||||
pt_BR: Ignorar o cache
|
||||
llm_description: bypass the cache
|
||||
form: form
|
||||
- name: max_retries
|
||||
type: number
|
||||
required: false
|
||||
default: 3
|
||||
label:
|
||||
en_US: Retry
|
||||
zh_Hans: 重试
|
||||
pt_BR: Repetir
|
||||
human_description:
|
||||
en_US: Number of times to retry the request if it fails
|
||||
zh_Hans: 请求失败时重试的次数
|
||||
pt_BR: Número de vezes para repetir a solicitação se falhar
|
||||
llm_description: Number of times to retry the request if it fails
|
||||
form: form
|
||||
|
||||
Reference in New Issue
Block a user