perf: DataSource Failure Notification for Assistant

This commit is contained in:
fit2cloud-chenyw
2025-09-03 17:12:18 +08:00
parent 32d51696b8
commit b8b0825290
2 changed files with 4 additions and 3 deletions
+3 -2
View File
@@ -399,7 +399,8 @@ class LLMService:
]
""" _ds_list = self.session.exec(select(CoreDatasource).options(
load_only(CoreDatasource.id, CoreDatasource.name, CoreDatasource.description))).all() """
if not _ds_list:
raise SingleMessageError('No available datasource configuration found')
ignore_auto_select = _ds_list and len(_ds_list) == 1
# ignore auto select ds
@@ -1175,7 +1176,7 @@ class LLMService:
match_ds = any(item.get("id") == _ds.id for item in _ds_list)
if not match_ds:
type = self.current_assistant.type
msg = f"ds is invalid [please check ds list and public ds list]" if type == 0 else f"ds is invalid [please check ds api]"
msg = f"[please check ds list and public ds list]" if type == 0 else f"[please check ds api]"
raise SingleMessageError(msg)
except Exception as e:
raise SingleMessageError(f"ds is invalid [{str(e)}]")
+1 -1
View File
@@ -44,7 +44,7 @@ def get_assistant_ds(session: Session, llm_service) -> list[dict]:
if public_list:
stmt = stmt.where(CoreDatasource.id.in_(public_list))
else:
raise RuntimeError('no public datasource valid')
return []
""" private_list: list[int] = config.get('private_list') or None
if private_list:
stmt = stmt.where(~CoreDatasource.id.in_(private_list)) """