diff --git a/api/core/workflow/nodes/knowledge_retrieval/entities.py b/api/core/workflow/nodes/knowledge_retrieval/entities.py index 1a5c6f6d08..951060ee60 100644 --- a/api/core/workflow/nodes/knowledge_retrieval/entities.py +++ b/api/core/workflow/nodes/knowledge_retrieval/entities.py @@ -3,7 +3,6 @@ from typing import Any, Literal, Optional from pydantic import BaseModel from core.workflow.entities.base_node_data_entities import BaseNodeData -from core.workflow.entities.variable_entities import VariableSelector class RerankingModelConfig(BaseModel): diff --git a/api/core/workflow/nodes/question_classifier/entities.py b/api/core/workflow/nodes/question_classifier/entities.py index 695e698694..4b8d431a76 100644 --- a/api/core/workflow/nodes/question_classifier/entities.py +++ b/api/core/workflow/nodes/question_classifier/entities.py @@ -1,9 +1,8 @@ -from typing import Any, Literal, Optional, Union +from typing import Any from pydantic import BaseModel from core.workflow.entities.base_node_data_entities import BaseNodeData -from core.workflow.entities.variable_entities import VariableSelector class ModelConfig(BaseModel): diff --git a/api/core/workflow/nodes/question_classifier/question_classifier_node.py b/api/core/workflow/nodes/question_classifier/question_classifier_node.py index 158a4d1ac8..5d2a76d5e4 100644 --- a/api/core/workflow/nodes/question_classifier/question_classifier_node.py +++ b/api/core/workflow/nodes/question_classifier/question_classifier_node.py @@ -1,16 +1,18 @@ import json -from typing import Optional, cast, Union from collections.abc import Generator +from typing import Optional, Union, cast + from core.app.entities.app_invoke_entities import ModelConfigWithCredentialsEntity from core.entities.model_entities import ModelStatus from core.entities.provider_entities import QuotaUnit -from core.errors.error import ProviderTokenNotInitError, ModelCurrentlyNotSupportError, QuotaExceededError +from core.errors.error import ModelCurrentlyNotSupportError, ProviderTokenNotInitError, QuotaExceededError from core.memory.token_buffer_memory import TokenBufferMemory from core.model_manager import ModelInstance, ModelManager from core.model_runtime.entities.llm_entities import LLMUsage from core.model_runtime.entities.message_entities import PromptMessage, PromptMessageRole from core.model_runtime.entities.model_entities import ModelType from core.model_runtime.model_providers.__base.large_language_model import LargeLanguageModel +from core.model_runtime.utils.encoders import jsonable_encoder from core.prompt.advanced_prompt_transform import AdvancedPromptTransform from core.prompt.entities.advanced_prompt_entities import ChatModelMessage, CompletionModelPromptTemplate from core.prompt.simple_prompt_transform import ModelMode @@ -20,14 +22,18 @@ from core.workflow.entities.node_entities import NodeRunResult, NodeType, System from core.workflow.entities.variable_pool import VariablePool from core.workflow.nodes.base_node import BaseNode from core.workflow.nodes.question_classifier.entities import QuestionClassifierNodeData -from core.workflow.nodes.question_classifier.template_prompts import QUESTION_CLASSIFIER_SYSTEM_PROMPT, \ - QUESTION_CLASSIFIER_USER_PROMPT_1, QUESTION_CLASSIFIER_USER_PROMPT_2, QUESTION_CLASSIFIER_USER_PROMPT_3, \ - QUESTION_CLASSIFIER_ASSISTANT_PROMPT_1, QUESTION_CLASSIFIER_ASSISTANT_PROMPT_2, \ - QUESTION_CLASSIFIER_COMPLETION_PROMPT +from core.workflow.nodes.question_classifier.template_prompts import ( + QUESTION_CLASSIFIER_ASSISTANT_PROMPT_1, + QUESTION_CLASSIFIER_ASSISTANT_PROMPT_2, + QUESTION_CLASSIFIER_COMPLETION_PROMPT, + QUESTION_CLASSIFIER_SYSTEM_PROMPT, + QUESTION_CLASSIFIER_USER_PROMPT_1, + QUESTION_CLASSIFIER_USER_PROMPT_2, + QUESTION_CLASSIFIER_USER_PROMPT_3, +) from extensions.ext_database import db from models.model import Conversation -from models.provider import ProviderType, Provider -from core.model_runtime.utils.encoders import jsonable_encoder +from models.provider import Provider, ProviderType from models.workflow import WorkflowNodeExecutionStatus diff --git a/api/core/workflow/nodes/variable_assigner/entities.py b/api/core/workflow/nodes/variable_assigner/entities.py index 1e61fa94bf..177213a707 100644 --- a/api/core/workflow/nodes/variable_assigner/entities.py +++ b/api/core/workflow/nodes/variable_assigner/entities.py @@ -1,9 +1,6 @@ -from typing import Any, Literal, Optional, Union -from pydantic import BaseModel from core.workflow.entities.base_node_data_entities import BaseNodeData -from core.workflow.entities.variable_entities import VariableSelector class VariableAssignerNodeData(BaseNodeData):