mirror of
https://github.com/langgenius/dify.git
synced 2026-09-24 23:22:26 +08:00
fix: pydantic_core._pydantic_core.ValidationError: 2 validation errors for DatasetDetailResponse (#36753)
This commit is contained in:
+10
-1
@@ -322,6 +322,12 @@ class Dataset(Base):
|
||||
|
||||
@property
|
||||
def retrieval_model_dict(self):
|
||||
"""Return a normalized retrieval model payload for API responses.
|
||||
|
||||
Older rows may only persist a partial retrieval model dict. Merge the
|
||||
stored value over the current defaults so response validation still sees
|
||||
the required baseline fields.
|
||||
"""
|
||||
default_retrieval_model = {
|
||||
"search_method": RetrievalMethod.SEMANTIC_SEARCH,
|
||||
"reranking_enable": False,
|
||||
@@ -329,7 +335,10 @@ class Dataset(Base):
|
||||
"top_k": 2,
|
||||
"score_threshold_enabled": False,
|
||||
}
|
||||
return self.retrieval_model or default_retrieval_model
|
||||
if not self.retrieval_model:
|
||||
return default_retrieval_model
|
||||
|
||||
return {**default_retrieval_model, **self.retrieval_model}
|
||||
|
||||
@property
|
||||
def tags(self):
|
||||
|
||||
Reference in New Issue
Block a user