feat(favorites): implement user favorites and recents functionality

Introduced a new API client for managing user favorites, allowing users to list, add, and remove starred resources. Enhanced the sidebar to display favorites and recents, improving user navigation. Updated internationalization files to include relevant labels and tooltips for the new features across multiple languages.

Refs: #1303
This commit is contained in:
wizardchen
2026-05-16 23:04:03 +08:00
committed by lyingbug
parent b905f18ebc
commit 8332a0dab6
28 changed files with 1874 additions and 251 deletions
+13 -1
View File
@@ -1,9 +1,21 @@
import { get, post, put, del, postUpload, getDown } from "../../utils/request";
// 知识库管理 API(列表、创建、获取、更新、删除、复制)
export function listKnowledgeBases(params?: { agent_id?: string }) {
export function listKnowledgeBases(params?: {
agent_id?: string;
/**
* Optional creator filter. Server-side semantics:
* - "mine" → only KBs whose creator_id matches the caller
* - "others" → only KBs created by someone else in this tenant
* - omitted/"all" → no filter
* KBs predating the RBAC backfill (creator_id="") never match
* mine/others — they fall out of both views by design.
*/
creator?: 'all' | 'mine' | 'others';
}) {
const query = new URLSearchParams();
if (params?.agent_id) query.set('agent_id', params.agent_id);
if (params?.creator && params.creator !== 'all') query.set('creator', params.creator);
const qs = query.toString();
return get(qs ? `/api/v1/knowledge-bases?${qs}` : '/api/v1/knowledge-bases');
}