mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-07-20 22:54:25 +08:00
fix: check result should be string. (#1959)
This commit is contained in:
parent
87832ede17
commit
a8cedea15a
@ -58,7 +58,7 @@ class ApiExternalDataTool(ExternalDataTool):
|
||||
if not api_based_extension:
|
||||
raise ValueError("[External data tool] API query failed, variable: {}, "
|
||||
"error: api_based_extension_id is invalid"
|
||||
.format(self.config.get('variable')))
|
||||
.format(self.variable))
|
||||
|
||||
# decrypt api_key
|
||||
api_key = encrypter.decrypt_token(
|
||||
@ -74,7 +74,7 @@ class ApiExternalDataTool(ExternalDataTool):
|
||||
)
|
||||
except Exception as e:
|
||||
raise ValueError("[External data tool] API query failed, variable: {}, error: {}".format(
|
||||
self.config.get('variable'),
|
||||
self.variable,
|
||||
e
|
||||
))
|
||||
|
||||
@ -87,6 +87,10 @@ class ApiExternalDataTool(ExternalDataTool):
|
||||
|
||||
if 'result' not in response_json:
|
||||
raise ValueError("[External data tool] API query failed, variable: {}, error: result not found in response"
|
||||
.format(self.config.get('variable')))
|
||||
.format(self.variable))
|
||||
|
||||
if not isinstance(response_json['result'], str):
|
||||
raise ValueError("[External data tool] API query failed, variable: {}, error: result is not string"
|
||||
.format(self.variable))
|
||||
|
||||
return response_json['result']
|
||||
|
Loading…
x
Reference in New Issue
Block a user