mirror of
https://github.com/langgenius/dify.git
synced 2026-07-21 18:58:35 +08:00
fix: raise clear error on unsupported language in execute_code (#38448)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
10cf9be3c7
commit
af4538e942
@ -74,12 +74,16 @@ class CodeExecutor:
|
||||
:param code: code
|
||||
:return:
|
||||
"""
|
||||
running_language = cls.code_language_to_running_language.get(language)
|
||||
if running_language is None:
|
||||
raise CodeExecutionError(f"Unsupported language {language}")
|
||||
|
||||
url = code_execution_endpoint_url / "v1" / "sandbox" / "run"
|
||||
|
||||
headers = {"X-Api-Key": dify_config.CODE_EXECUTION_API_KEY}
|
||||
|
||||
data = {
|
||||
"language": cls.code_language_to_running_language.get(language),
|
||||
"language": running_language,
|
||||
"code": code,
|
||||
"preload": preload,
|
||||
"enable_network": True,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user