Skip to content

Commit b8b0825

Browse files
perf: DataSource Failure Notification for Assistant
1 parent 32d5169 commit b8b0825

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

backend/apps/chat/task/llm.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,8 @@ def select_datasource(self):
399399
]
400400
""" _ds_list = self.session.exec(select(CoreDatasource).options(
401401
load_only(CoreDatasource.id, CoreDatasource.name, CoreDatasource.description))).all() """
402-
402+
if not _ds_list:
403+
raise SingleMessageError('No available datasource configuration found')
403404
ignore_auto_select = _ds_list and len(_ds_list) == 1
404405
# ignore auto select ds
405406

@@ -1175,7 +1176,7 @@ def validate_history_ds(self):
11751176
match_ds = any(item.get("id") == _ds.id for item in _ds_list)
11761177
if not match_ds:
11771178
type = self.current_assistant.type
1178-
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]"
1179+
msg = f"[please check ds list and public ds list]" if type == 0 else f"[please check ds api]"
11791180
raise SingleMessageError(msg)
11801181
except Exception as e:
11811182
raise SingleMessageError(f"ds is invalid [{str(e)}]")

backend/apps/system/crud/assistant.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def get_assistant_ds(session: Session, llm_service) -> list[dict]:
4444
if public_list:
4545
stmt = stmt.where(CoreDatasource.id.in_(public_list))
4646
else:
47-
raise RuntimeError('no public datasource valid')
47+
return []
4848
""" private_list: list[int] = config.get('private_list') or None
4949
if private_list:
5050
stmt = stmt.where(~CoreDatasource.id.in_(private_list)) """

0 commit comments

Comments
 (0)