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.

fix: doc_language return null when document segment settings (#7719)

Jiakun Xue38334cfd253
diff --git a/api/controllers/console/datasets/datasets_document.py b/api/controllers/console/datasets/datasets_document.py
index 7d0b9f04609..6bc29a86435 100644
--- a/api/controllers/console/datasets/datasets_document.py
+++ b/api/controllers/console/datasets/datasets_document.py
@@ -599,6 +599,7 @@ class DocumentDetailApi(DocumentResource):
"hit_count": document.hit_count,
"display_status": document.display_status,
"doc_form": document.doc_form,
+ "doc_language": document.doc_language,
}
else:
process_rules = DatasetService.get_process_rules(dataset_id)
@@ -631,6 +632,7 @@ class DocumentDetailApi(DocumentResource):
"hit_count": document.hit_count,
"display_status": document.display_status,
"doc_form": document.doc_form,
+ "doc_language": document.doc_language,
}
return response, 200
diff --git a/web/app/components/datasets/create/step-two/index.tsx b/web/app/components/datasets/create/step-two/index.tsx
index 890ceea630e..10b378d8c58 100644
--- a/web/app/components/datasets/create/step-two/index.tsx
+++ b/web/app/components/datasets/create/step-two/index.tsx
@@ -123,7 +123,9 @@ const StepTwo = ({
const [docForm, setDocForm] = useState<DocForm | string>(
(datasetId && documentDetail) ? documentDetail.doc_form : DocForm.TEXT,
)
- const [docLanguage, setDocLanguage] = useState<string>(locale !== LanguagesSupported[1] ? 'English' : 'Chinese')
+ const [docLanguage, setDocLanguage] = useState<string>(
+ (datasetId && documentDetail) ? documentDetail.doc_language : (locale !== LanguagesSupported[1] ? 'English' : 'Chinese'),
+ )
const [QATipHide, setQATipHide] = useState(false)
const [previewSwitched, setPreviewSwitched] = useState(false)
const [showPreview, { setTrue: setShowPreview, setFalse: hidePreview }] = useBoolean()
diff --git a/web/models/datasets.ts b/web/models/datasets.ts
index 5731ec76464..0ae78312456 100644
--- a/web/models/datasets.ts
+++ b/web/models/datasets.ts
@@ -189,6 +189,7 @@ export type InitialDocumentDetail = {
completed_segments?: number
total_segments?: number
doc_form: 'text_model' | 'qa_model'
+ doc_language: string
}
export type SimpleDocumentDetail = InitialDocumentDetail & {