Feat/add retriever rerank (#1560)

Co-authored-by: jyong <jyong@dify.ai>
This commit is contained in:
Jyong 2023-11-17 22:13:37 +08:00 • committed by GitHub
commit 4588831bff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
44 changed files with 1899 additions and 164 deletions

View file

@ -160,7 +160,13 @@ class AppModelConfig(db.Model):
@property
def dataset_configs_dict(self) -> dict:
return json.loads(self.dataset_configs) if self.dataset_configs else {"top_k": 2, "score_threshold": {"enable": False}}
if self.dataset_configs:
dataset_configs = json.loads(self.dataset_configs)
if 'retrieval_model' not in dataset_configs:
return {'retrieval_model': 'single'}
else:
return dataset_configs
return {'retrieval_model': 'single'}
@property
def file_upload_dict(self) -> dict: