Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from common.utils.common import bulk_create_in_batches
from knowledge.models import Document, KnowledgeType, Paragraph, File, FileSourceType, Problem, ProblemParagraphMapping
from knowledge.serializers.common import ProblemParagraphObject, ProblemParagraphManage
from knowledge.serializers.document import DocumentSerializers


class ParagraphInstanceSerializer(serializers.Serializer):
Expand Down Expand Up @@ -187,9 +188,19 @@ def save(self, document_list):

return document_model_list, knowledge_id, workspace_id

@staticmethod
def post_embedding(document_model_list, knowledge_id, workspace_id):
for document in document_model_list:
DocumentSerializers.Operate(data={
'knowledge_id': knowledge_id,
'document_id': document.id,
'workspace_id': workspace_id
}).refresh()

def execute(self, documents, **kwargs) -> NodeResult:

document_model_list, knowledge_id, workspace_id = self.save(documents)
self.post_embedding(document_model_list, knowledge_id, workspace_id)

write_content_list = [{
"name": document.get("name"),
Expand Down
6 changes: 4 additions & 2 deletions apps/common/sql/list_embedding_text.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ SELECT
problem.knowledge_id AS knowledge_id,
0 AS source_type,
problem."content" AS "text",
paragraph.is_active AS is_active
paragraph.is_active AS is_active,
paragraph.chunks AS chunks
FROM
problem problem
LEFT JOIN problem_paragraph_mapping problem_paragraph_mapping ON problem_paragraph_mapping.problem_id=problem."id"
Expand All @@ -20,7 +21,8 @@ SELECT
paragraph.knowledge_id AS knowledge_id,
1 AS source_type,
concat_ws(E'\n',paragraph.title,paragraph."content") AS "text",
paragraph.is_active AS is_active
paragraph.is_active AS is_active,
paragraph.chunks AS chunks
FROM
paragraph paragraph

Expand Down
3 changes: 3 additions & 0 deletions apps/locales/en_US/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8772,4 +8772,7 @@ msgid "Application token usage statistics"
msgstr ""

msgid "Application top question statistics"
msgstr ""

msgid "Workflow"
msgstr ""
3 changes: 3 additions & 0 deletions apps/locales/zh_CN/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8899,3 +8899,6 @@ msgstr "应用令牌使用统计"

msgid "Application top question statistics"
msgstr "应用提问次数统计"

msgid "Workflow"
msgstr "工作流"
5 changes: 4 additions & 1 deletion apps/locales/zh_Hant/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8898,4 +8898,7 @@ msgid "Application token usage statistics"
msgstr "應用令牌使用統計"

msgid "Application top question statistics"
msgstr "應用提問次數統計"
msgstr "應用提問次數統計"

msgid "Workflow"
msgstr "工作流"
20 changes: 20 additions & 0 deletions ui/src/views/knowledge/KnowledgeSetting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,26 @@
</div>
</div>
</el-card>
<el-card
shadow="never"
class="mb-8 w-full layout-bg"
style="line-height: 22px"
v-if="detail?.type === 4"
>
<div class="flex align-center">
<el-avatar shape="square" :size="32" style="background: #753DEF">
<img src="@/assets/knowledge/logo_workflow.svg" style="width: 100%" alt=""/>
</el-avatar>
<div>
<p>
<el-text>{{ $t('views.knowledge.knowledgeType.workflowKnowledge') }}</el-text>
</p>
<el-text type="info"
>{{ $t('views.knowledge.knowledgeType.workflowKnowledge') }}
</el-text>
</div>
</div>
</el-card>
</el-form-item>
<el-form-item
:label="$t('views.knowledge.form.source_url.label')"
Expand Down
Loading