Skip to content

Commit 2a8348f

Browse files
committed
fix(ux): knowledge list no longer silently caps at 100
- getDocuments() now requests limit=500 (backend max); optional limit/offset for future paging - DocumentRepository ABC list_by_user signature synced with kwargs (limit=None = full) - Drop unused desktop.confirmTitle locale keys
1 parent 23daba7 commit 2a8348f

4 files changed

Lines changed: 19 additions & 6 deletions

File tree

‎backend/repositories/knowledge_repo.py‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,14 @@ async def list_by_status(self, status: str) -> list[Any]:
2727
raise NotImplementedError
2828

2929
@abstractmethod
30-
async def list_by_user(self, user_id: uuid.UUID) -> list[Any]:
31-
"""列出当前用户可见的文档(含全局共享)"""
30+
async def list_by_user(
31+
self,
32+
user_id: uuid.UUID,
33+
*,
34+
limit: int | None = None,
35+
offset: int = 0,
36+
) -> list[Any]:
37+
"""列出当前用户可见的文档(含全局共享)。limit=None 表示不截断。"""
3238
raise NotImplementedError
3339

3440
@abstractmethod

‎frontend/lib/api.ts‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -911,8 +911,17 @@ export async function deleteCronJob(cronId: string): Promise<{ deleted: boolean
911911

912912
// ====== Knowledge APIs ======
913913

914-
export async function getDocuments(): Promise<Document[]> {
915-
const res = await api.get('/knowledge/documents');
914+
export async function getDocuments(opts?: {
915+
limit?: number;
916+
offset?: number;
917+
}): Promise<Document[]> {
918+
// Backend default is 100; pass max (500) so alpha knowledge center shows full list.
919+
// Callers can still page via { limit, offset } when UI grows a "load more".
920+
const limit = opts?.limit ?? 500;
921+
const offset = opts?.offset ?? 0;
922+
const res = await api.get('/knowledge/documents', {
923+
params: { limit, offset },
924+
});
916925
return res.data;
917926
}
918927

‎frontend/locales/en.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2043,7 +2043,6 @@
20432043
"chatDisplay.errorPrefix": "Error: {msg}",
20442044
"settings.deleteProvider": "Delete provider \"{name}\"?",
20452045
"settings.deleteProviderTitle": "Delete provider",
2046-
"desktop.confirmTitle": "Please confirm",
20472046
"api.connectFailed": "Cannot connect to backend ({base}{path}). Ensure Tevarn has started.",
20482047
"api.notFound": "API not found (404).",
20492048
"api.badGateway": "Backend temporarily unavailable (502). Please try again later.",

‎frontend/locales/zh.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2043,7 +2043,6 @@
20432043
"chatDisplay.errorPrefix": "错误:{msg}",
20442044
"settings.deleteProvider": "删除供应商「{name}」?",
20452045
"settings.deleteProviderTitle": "删除供应商",
2046-
"desktop.confirmTitle": "请确认",
20472046
"api.connectFailed": "无法连接后端({base}{path})。请确认 Tevarn 已启动。",
20482047
"api.notFound": "接口不存在(404)。",
20492048
"api.badGateway": "后端暂时不可用(502),请稍后重试。",

0 commit comments

Comments
 (0)