Feat/assistant app (#2086)

Co-authored-by: chenhe <guchenhe@gmail.com>
Co-authored-by: Pascal M <11357019+perzeuss@users.noreply.github.com>
This commit is contained in:
Yeuoly
2024-01-23 19:58:23 +08:00
committed by GitHub
parent 7bbe12b2bd
commit 86286e1ac8
175 changed files with 11619 additions and 1235 deletions

View File

@@ -50,17 +50,24 @@ def get_dataset_ids_from_model_config(app_model_config: AppModelConfig) -> set:
return dataset_ids
agent_mode = app_model_config.agent_mode_dict
if agent_mode.get('enabled') is False:
return dataset_ids
if not agent_mode.get('tools'):
return dataset_ids
tools = agent_mode.get('tools')
tools = agent_mode.get('tools', []) or []
for tool in tools:
if len(list(tool.keys())) != 1:
continue
tool_type = list(tool.keys())[0]
tool_config = list(tool.values())[0]
if tool_type == "dataset":
dataset_ids.add(tool_config.get("id"))
# get dataset from dataset_configs
dataset_configs = app_model_config.dataset_configs_dict
datasets = dataset_configs.get('datasets', {}) or {}
for dataset in datasets.get('datasets', []) or []:
keys = list(dataset.keys())
if len(keys) == 1 and keys[0] == 'dataset':
if dataset['dataset'].get('id'):
dataset_ids.add(dataset['dataset'].get('id'))
return dataset_ids