mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-09 02:46:52 +08:00
improve: code upgrade (#4231)
This commit is contained in:
@@ -1,17 +1,19 @@
|
||||
import os
|
||||
from typing import Literal
|
||||
from typing import Literal, Optional
|
||||
|
||||
import pytest
|
||||
from _pytest.monkeypatch import MonkeyPatch
|
||||
from jinja2 import Template
|
||||
|
||||
from core.helper.code_executor.code_executor import CodeExecutor
|
||||
from core.helper.code_executor.entities import CodeDependency
|
||||
|
||||
MOCK = os.getenv('MOCK_SWITCH', 'false') == 'true'
|
||||
|
||||
class MockedCodeExecutor:
|
||||
@classmethod
|
||||
def invoke(cls, language: Literal['python3', 'javascript', 'jinja2'], code: str, inputs: dict) -> dict:
|
||||
def invoke(cls, language: Literal['python3', 'javascript', 'jinja2'],
|
||||
code: str, inputs: dict, dependencies: Optional[list[CodeDependency]] = None) -> dict:
|
||||
# invoke directly
|
||||
if language == 'python3':
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user