mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-14 01:26:00 +08:00
feat(agent_node): ensure that the enum-checking syntax is compatible with Python 3.11. (#20373)
Signed-off-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
parent
00199c41bb
commit
f59fb94dae
@ -356,7 +356,9 @@ class AgentNode(ToolNode):
|
||||
|
||||
def _remove_unsupported_model_features_for_old_version(self, model_schema: AIModelEntity) -> AIModelEntity:
|
||||
if model_schema.features:
|
||||
for feature in model_schema.features:
|
||||
if feature.value not in AgentOldVersionModelFeatures:
|
||||
for feature in model_schema.features[:]: # Create a copy to safely modify during iteration
|
||||
try:
|
||||
AgentOldVersionModelFeatures(feature.value) # Try to create enum member from value
|
||||
except ValueError:
|
||||
model_schema.features.remove(feature)
|
||||
return model_schema
|
||||
|
@ -1,4 +1,4 @@
|
||||
from enum import Enum
|
||||
from enum import Enum, StrEnum
|
||||
from typing import Any, Literal, Union
|
||||
|
||||
from pydantic import BaseModel
|
||||
@ -26,7 +26,7 @@ class ParamsAutoGenerated(Enum):
|
||||
OPEN = 1
|
||||
|
||||
|
||||
class AgentOldVersionModelFeatures(Enum):
|
||||
class AgentOldVersionModelFeatures(StrEnum):
|
||||
"""
|
||||
Enum class for old SDK version llm feature.
|
||||
"""
|
||||
|
@ -149,6 +149,7 @@ dev = [
|
||||
"types-tqdm~=4.67.0",
|
||||
"types-ujson~=5.10.0",
|
||||
"boto3-stubs>=1.38.20",
|
||||
"types-jmespath>=1.0.2.20240106",
|
||||
]
|
||||
|
||||
############################################################
|
||||
|
11
api/uv.lock
generated
11
api/uv.lock
generated
@ -1315,6 +1315,7 @@ dev = [
|
||||
{ name = "types-gevent" },
|
||||
{ name = "types-greenlet" },
|
||||
{ name = "types-html5lib" },
|
||||
{ name = "types-jmespath" },
|
||||
{ name = "types-jsonschema" },
|
||||
{ name = "types-markdown" },
|
||||
{ name = "types-oauthlib" },
|
||||
@ -1486,6 +1487,7 @@ dev = [
|
||||
{ name = "types-gevent", specifier = "~=24.11.0" },
|
||||
{ name = "types-greenlet", specifier = "~=3.1.0" },
|
||||
{ name = "types-html5lib", specifier = "~=1.1.11" },
|
||||
{ name = "types-jmespath", specifier = ">=1.0.2.20240106" },
|
||||
{ name = "types-jsonschema", specifier = "~=4.23.0" },
|
||||
{ name = "types-markdown", specifier = "~=3.7.0" },
|
||||
{ name = "types-oauthlib", specifier = "~=3.2.0" },
|
||||
@ -5726,6 +5728,15 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/ba/7c/f862b1dc31268ef10fe95b43dcdf216ba21a592fafa2d124445cd6b92e93/types_html5lib-1.1.11.20241018-py3-none-any.whl", hash = "sha256:3f1e064d9ed2c289001ae6392c84c93833abb0816165c6ff0abfc304a779f403", size = 17292 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "types-jmespath"
|
||||
version = "1.0.2.20240106"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/1b/e4/1f7414dbca03975f66f1ab1b3f7b3deb7c19b104ef14dd3c99036bbc39b2/types-jmespath-1.0.2.20240106.tar.gz", hash = "sha256:b4a65a116bfc1c700a4fd9d24e2e397f4a431122e0320a77b7f1989a6b5d819e", size = 5071 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/f5/30/3d6443f782601dd88820ba31e7668abfec7e19d685ac7f6fbcfd6ebba519/types_jmespath-1.0.2.20240106-py3-none-any.whl", hash = "sha256:c3e715fcaae9e5f8d74e14328fdedc4f2b3f0e18df17f3e457ae0a18e245bde0", size = 6087 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "types-jsonschema"
|
||||
version = "4.23.0.20241208"
|
||||
|
Loading…
x
Reference in New Issue
Block a user