make lint

This commit is contained in:
yyh 2026-01-01 19:13:29 +08:00
parent 7d14b27447
commit 32ebf2a1c6
No known key found for this signature in database
6 changed files with 10 additions and 44 deletions

View File

@ -44,8 +44,7 @@ OFF_TOPIC_RESPONSES: dict[str, dict[str, str]] = {
"But if you want to add code logic to your workflow, I can help you configure a Code node!"
),
"zh": (
"我专注于Dify工作流设计而非通用编程帮助。"
"但如果您想在工作流中添加代码逻辑,我可以帮您配置一个代码节点!"
"我专注于Dify工作流设计而非通用编程帮助。但如果您想在工作流中添加代码逻辑我可以帮您配置一个代码节点"
),
},
"default": {
@ -71,4 +70,3 @@ DEFAULT_SUGGESTIONS: dict[str, list[str]] = {
"添加邮件通知到工作流",
],
}

View File

@ -40,6 +40,3 @@ __all__ = [
"ValidationResult",
"ValidationRule",
]

View File

@ -10,7 +10,6 @@ Tests cover:
- Tool node formatting
"""
from core.workflow.generator.utils.mermaid_generator import generate_mermaid

View File

@ -7,7 +7,6 @@ Tests cover:
- Empty tool lists
"""
from core.workflow.generator.prompts.planner_prompts import format_tools_for_planner

View File

@ -8,7 +8,6 @@ Tests cover:
- ValidationEngine integration
"""
from core.workflow.generator.validation import (
ValidationContext,
ValidationEngine,
@ -135,9 +134,7 @@ class TestStructureRules:
"""Tests for structure validation rules."""
def test_llm_missing_prompt_template(self):
ctx = ValidationContext(
nodes=[{"id": "llm_1", "type": "llm", "config": {}}]
)
ctx = ValidationContext(nodes=[{"id": "llm_1", "type": "llm", "config": {}}])
engine = ValidationEngine()
result = engine.validate(ctx)
@ -169,9 +166,7 @@ class TestStructureRules:
assert len(errors) == 0
def test_http_request_missing_url(self):
ctx = ValidationContext(
nodes=[{"id": "http_1", "type": "http-request", "config": {}}]
)
ctx = ValidationContext(nodes=[{"id": "http_1", "type": "http-request", "config": {}}])
engine = ValidationEngine()
result = engine.validate(ctx)
@ -196,9 +191,7 @@ class TestStructureRules:
assert len(errors) == 1
def test_code_node_missing_fields(self):
ctx = ValidationContext(
nodes=[{"id": "code_1", "type": "code", "config": {}}]
)
ctx = ValidationContext(nodes=[{"id": "code_1", "type": "code", "config": {}}])
engine = ValidationEngine()
result = engine.validate(ctx)
@ -207,9 +200,7 @@ class TestStructureRules:
assert "code.language.required" in error_rules
def test_knowledge_retrieval_missing_dataset(self):
ctx = ValidationContext(
nodes=[{"id": "kb_1", "type": "knowledge-retrieval", "config": {}}]
)
ctx = ValidationContext(nodes=[{"id": "kb_1", "type": "knowledge-retrieval", "config": {}}])
engine = ValidationEngine()
result = engine.validate(ctx)
@ -228,11 +219,7 @@ class TestSemanticRules:
{
"id": "llm_1",
"type": "llm",
"config": {
"prompt_template": [
{"role": "user", "text": "Process: {{#start.query#}}"}
]
},
"config": {"prompt_template": [{"role": "user", "text": "Process: {{#start.query#}}"}]},
},
]
)
@ -250,11 +237,7 @@ class TestSemanticRules:
{
"id": "llm_1",
"type": "llm",
"config": {
"prompt_template": [
{"role": "user", "text": "Process: {{#nonexistent.field#}}"}
]
},
"config": {"prompt_template": [{"role": "user", "text": "Process: {{#nonexistent.field#}}"}]},
},
]
)
@ -390,9 +373,7 @@ class TestReferenceRules:
"config": {"tool_key": "google/search"},
}
],
available_tools=[
{"provider_id": "google", "tool_key": "search", "is_team_authorization": False}
],
available_tools=[{"provider_id": "google", "tool_key": "search", "is_team_authorization": False}],
)
engine = ValidationEngine()
result = engine.validate(ctx)
@ -406,9 +387,7 @@ class TestValidationResult:
"""Tests for ValidationResult classification."""
def test_has_errors(self):
ctx = ValidationContext(
nodes=[{"id": "llm_1", "type": "llm", "config": {}}]
)
ctx = ValidationContext(nodes=[{"id": "llm_1", "type": "llm", "config": {}}])
engine = ValidationEngine()
result = engine.validate(ctx)
@ -447,9 +426,7 @@ class TestValidationResult:
assert "http_1" in by_node
def test_to_dict(self):
ctx = ValidationContext(
nodes=[{"id": "llm_1", "type": "llm", "config": {}}]
)
ctx = ValidationContext(nodes=[{"id": "llm_1", "type": "llm", "config": {}}])
engine = ValidationEngine()
result = engine.validate(ctx)
@ -531,6 +508,3 @@ class TestIntegration:
# Check stats
assert result.stats["total_nodes"] == 4
assert result.stats["total_errors"] >= 3

View File

@ -7,7 +7,6 @@ Tests cover:
- Edge cases and error handling
"""
from core.workflow.generator.utils.workflow_validator import ValidationHint, WorkflowValidator