Skip to content

Commit a938142

Browse files
committed
feat: 高级编排支持文件上传(WIP)
1 parent 88b6eeb commit a938142

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

apps/application/flow/step_node/document_extract_node/impl/base_document_extract_node.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
# coding=utf-8
2+
from django.db.models import QuerySet
3+
24
from application.flow.i_step_node import NodeResult
35
from application.flow.step_node.document_extract_node.i_document_extract_node import IDocumentExtractNode
6+
from dataset.models import File
47

58

69
class BaseDocumentExtractNode(IDocumentExtractNode):
710
def execute(self, document, **kwargs):
811
self.context['document_list'] = document
912
content = ''
13+
spliter = '\n-----------------------------------\n'
1014
if len(document) > 0:
1115
for doc in document:
12-
content += doc['name']
13-
content += '\n-----------------------------------\n'
16+
file = QuerySet(File).filter(id=doc['file_id']).first()
17+
content += spliter + doc['name'] + '\n' + file.get_byte().tobytes().decode('utf-8')
18+
19+
1420
return NodeResult({'content': content}, {})
1521

1622
def get_details(self, index: int, **kwargs):

ui/src/components/ai-chat/component/chat-input-operate/index.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,13 @@ const uploadFile = async (file: any, fileList: any) => {
185185
file.file_id = f[0].file_id
186186
}
187187
})
188+
uploadDocumentList.value.forEach((file: any) => {
189+
const f = response.data.filter((f: any) => f.name === file.name)
190+
if (f.length > 0) {
191+
file.url = f[0].url
192+
file.file_id = f[0].file_id
193+
}
194+
})
188195
console.log(uploadDocumentList.value, uploadImageList.value)
189196
})
190197
}

0 commit comments

Comments
 (0)