Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

Chore/format code (#13691)

jiangbo7214e7e172ff3e1
diff --git a/api/controllers/service_api/app/message.py b/api/controllers/service_api/app/message.py
index 773ea0e0c69..1869cf67c2e 100644
--- a/api/controllers/service_api/app/message.py
+++ b/api/controllers/service_api/app/message.py
@@ -10,6 +10,7 @@ from controllers.service_api.app.error import NotChatAppError
from controllers.service_api.wraps import FetchUserArg, WhereisUserArg, validate_app_token
from core.app.entities.app_invoke_entities import InvokeFrom
from fields.conversation_fields import message_file_fields
+from fields.message_fields import feedback_fields, retriever_resource_fields
from fields.raws import FilesContainedField
from libs.helper import TimestampField, uuid_value
from models.model import App, AppMode, EndUser
@@ -18,26 +19,6 @@ from services.message_service import MessageService
class MessageListApi(Resource):
- feedback_fields = {"rating": fields.String}
- retriever_resource_fields = {
- "id": fields.String,
- "message_id": fields.String,
- "position": fields.Integer,
- "dataset_id": fields.String,
- "dataset_name": fields.String,
- "document_id": fields.String,
- "document_name": fields.String,
- "data_source_type": fields.String,
- "segment_id": fields.String,
- "score": fields.Float,
- "hit_count": fields.Integer,
- "word_count": fields.Integer,
- "segment_position": fields.Integer,
- "index_node_hash": fields.String,
- "content": fields.String,
- "created_at": TimestampField,
- }
-
agent_thought_fields = {
"id": fields.String,
"chain_id": fields.String,
diff --git a/api/controllers/web/message.py b/api/controllers/web/message.py
index e6e546690c6..494b357d466 100644
--- a/api/controllers/web/message.py
+++ b/api/controllers/web/message.py
@@ -21,7 +21,7 @@ from core.app.entities.app_invoke_entities import InvokeFrom
from core.errors.error import ModelCurrentlyNotSupportError, ProviderTokenNotInitError, QuotaExceededError
from core.model_runtime.errors.invoke import InvokeError
from fields.conversation_fields import message_file_fields
-from fields.message_fields import agent_thought_fields
+from fields.message_fields import agent_thought_fields, feedback_fields, retriever_resource_fields
from fields.raws import FilesContainedField
from libs import helper
from libs.helper import TimestampField, uuid_value
@@ -34,27 +34,6 @@ from services.message_service import MessageService
class MessageListApi(WebApiResource):
- feedback_fields = {"rating": fields.String}
-
- retriever_resource_fields = {
- "id": fields.String,
- "message_id": fields.String,
- "position": fields.Integer,
- "dataset_id": fields.String,
- "dataset_name": fields.String,
- "document_id": fields.String,
- "document_name": fields.String,
- "data_source_type": fields.String,
- "segment_id": fields.String,
- "score": fields.Float,
- "hit_count": fields.Integer,
- "word_count": fields.Integer,
- "segment_position": fields.Integer,
- "index_node_hash": fields.String,
- "content": fields.String,
- "created_at": TimestampField,
- }
-
message_fields = {
"id": fields.String,
"conversation_id": fields.String,
diff --git a/api/fields/conversation_fields.py b/api/fields/conversation_fields.py
index c54554a6de8..80d1f0baf5f 100644
--- a/api/fields/conversation_fields.py
+++ b/api/fields/conversation_fields.py
@@ -95,10 +95,6 @@ model_config_fields = {
"agent_mode": fields.Raw,
}
-simple_configs_fields = {
- "prompt_template": fields.String,
-}
-
simple_model_config_fields = {
"model": fields.Raw(attribute="model_dict"),
"pre_prompt": fields.String,
@@ -212,14 +208,3 @@ conversation_infinite_scroll_pagination_fields = {
"has_more": fields.Boolean,
"data": fields.List(fields.Nested(simple_conversation_fields)),
}
-
-conversation_with_model_config_fields = {
- **simple_conversation_fields,
- "model_config": fields.Raw,
-}
-
-conversation_with_model_config_infinite_scroll_pagination_fields = {
- "limit": fields.Integer,
- "has_more": fields.Boolean,
- "data": fields.List(fields.Nested(conversation_with_model_config_fields)),
-}