Files
Cyrene_v2/frontend/web/src/lib/api.ts
T
AskaEth 3972ea4007
CI / Backend (build / vet / test / cross-compile) (push) Has been cancelled
CI / Frontend (tsc + vite build) (push) Has been cancelled
refactor(admin-web): 模型目录面板改走既有 API 层(adminGetLlmCatalog)
- 新增 lib/api/admin.ts 的 adminGetLlmCatalog({refresh}) + 目录响应类型(lib/types/admin.ts),并由 lib/api.ts 再导出
- LlmCatalogPanel 不再直连 lib/api/core(它曾是全仓唯一这样做的 admin 模块),行为不变:
  五种状态判定、gzip 响应、离线粘贴导入均保持
- 复核:grep lib/api/core 全仓前端 0 命中;npx tsc --noEmit 0 错;npm run build 成功
2026-10-04 12:45:36 +08:00

119 lines
2.9 KiB
TypeScript

/**
* Public REST surface for the Cyrene v2 gateway, kept as a single import path
* (`lib/api`) so call sites never change. The implementation is split by domain
* under `lib/api/`:
*
* core.ts transport (request/ApiError) + token/role/API-key state
* auth.ts /auth/login, /health
* chat.ts /chat (sync + streaming)
* sessions.ts /sessions (list/create/delete, message history)
* messages.ts /messages/{id} (PATCH edit / DELETE)
* personas.ts /personas
* admin.ts /admin/* CRUD (personas, users, llm, rag, iot, automations…)
* adminChannels.ts /admin/channels/* (adapters, config, platform views, login)
* adminSystem.ts /admin/observability|notifications|backthink|system/*
*
* Everything below is a verbatim re-export — behaviour is unchanged.
*/
export {
ApiError,
decodeJwtRole,
getApiKey,
getAuthToken,
getStoredRole,
isNotImplemented,
isTokenExpired,
onAuthExpired,
setApiKey,
setAuthToken,
setStoredRole,
} from "./api/core";
export { health, login } from "./api/auth";
export { chatStream, chatSync } from "./api/chat";
export {
createSubSession,
deleteSession,
fetchMessages,
fetchSessions,
markSessionRead,
patchSession,
} from "./api/sessions";
export type { CreateSessionResult, MessageDto, SessionPatch } from "./api/sessions";
export { deleteMessage, patchMessage } from "./api/messages";
export { fetchPersonas } from "./api/personas";
export {
adminAddLlmProvider,
adminAddMemory,
adminCreateAutomation,
adminCreatePersona,
adminCreateUser,
adminDeleteAutomation,
adminDeleteRag,
adminExportSession,
adminGetLlm,
adminGetLlmCatalog,
adminGetOwnerProfile,
adminIndexRag,
adminIoTControl,
adminIoTRule,
adminIoTScenario,
adminIssueApiKey,
adminListAutomations,
adminListChannels,
adminListInstalledPlugins,
adminListIoT,
adminListMemories,
adminListPersonas,
adminListPlugins,
adminListRag,
adminListSessions,
adminListUsers,
adminMemorySearch,
adminPluginInstall,
adminPluginUninstall,
adminRevokeApiKey,
adminRunAutomation,
adminSaveOwnerProfile,
adminSearchRag,
adminSetPluginPolicy,
adminTestLlm,
adminUpdatePersona,
} from "./api/admin";
export {
adminChannelClose,
adminChannelFriendHandle,
adminChannelLogOverview,
adminChannelMessageTest,
adminChannelMessages,
adminChannelOpen,
adminChannelPlatformFriends,
adminChannelPlatformView,
adminChannelTest,
adminDeleteChannelAccount,
adminSaveChannelConfig,
adminWeixinLoginQR,
adminWeixinLoginStatus,
} from "./api/adminChannels";
export type { ChannelConfigSaveResult } from "./api/adminChannels";
export {
adminBackthink,
adminListNotifications,
adminObservabilityAudit,
adminObservabilityLogs,
adminObservabilityMetrics,
adminObservabilityTrace,
adminSystemBackup,
adminSystemRestore,
adminSystemRevokeKeys,
adminSystemRotateJWT,
} from "./api/adminSystem";