fix: Manually adding file types to the workflow knowledge base cannot upload files after adding them in lowercase letters (#4499)

This commit is contained in:
shaohuzhang1 2025-12-11 15:57:11 +08:00 committed by CaptainB
parent 1e8459c0c7
commit a0d5b17fab
2 changed files with 8 additions and 3 deletions

View File

@ -95,9 +95,7 @@ class KnowledgeWorkflowManage(WorkflowManage):
self.status = 500
current_node.get_write_error_context(e)
self.answer += str(e)
QuerySet(KnowledgeAction).filter(id=self.params.get('knowledge_action_id')).update(
details=self.get_runtime_details(),
state=State.FAILURE)
QuerySet(KnowledgeAction).filter(id=self.params.get('knowledge_action_id')).update(state=State.FAILURE)
finally:
current_node.node_chunk.end()
QuerySet(KnowledgeAction).filter(id=self.params.get('knowledge_action_id')).update(

View File

@ -15,6 +15,13 @@ from django.core.files.uploadedfile import InMemoryUploadedFile, TemporaryUpload
class SystemEncoder(json.JSONEncoder):
def encode(self, obj):
# 先序列化为字符串
json_str = super().encode(obj)
# 移除所有空字符
json_str = json_str.replace('\\u0000', '')
return json_str
def default(self, obj):
if isinstance(obj, uuid.UUID):
return str(obj)