feat(admin): 面板补全 — 插件安装表单+已装列表 / LLM组maxTokens展示编辑 / POST admin/llm 部分编辑合并
- 前端: api.ts(adminPluginInstall带config/uninstall/listInstalledPlugins) + types + plugins/InstalledPlugins.tsx(已装列表+安装表单, Miuix) + llm/LlmProviderForm.tsx(maxTokens输入) ; Plugins.tsx去假安装按钮 - 后端 admin_write_llm_channels.go: llmProviderRequest字段改指针, mergeLlmProvider部分合并(省略保留原值), runtimeconfig/models.go Find - 新增测试 admin_write_test TestAdminAddLlmProviderPartialEditPreservesFields - 前端 build + 后端 build/vet/test 全绿; Docs/api-client v0.29 - (面板无法实机登录, 用 react-dom/server 冒烟渲染 LlmModule/PluginsModule)
This commit is contained in:
1 parent
70c9fba529
commit
18b2040c95
10 files changed
+812
-220
No files matched your search
@@ -20,6 +20,7 @@ import type {
|
||||
ChannelTestResult,
|
||||
ChatMessage,
|
||||
ChatSyncResult,
|
||||
InstalledPlugin,
|
||||
LlmProviderRequest,
|
||||
LlmTestRequest,
|
||||
LlmTestResult,
|
||||
@@ -32,6 +33,8 @@ import type {
|
||||
Mode,
|
||||
PersonaRecord,
|
||||
PersonaUpsertRequest,
|
||||
PluginInstallRequest,
|
||||
PluginInstallResult,
|
||||
KookFriendList,
|
||||
KookMessageTestResult,
|
||||
KookViewResponse,
|
||||
@@ -391,6 +394,11 @@ export function adminListMemories(): Promise<MemoryRecord[]> {
|
||||
export function adminListPlugins(): Promise<AdminPluginRecord[]> {
|
||||
return request<AdminPluginRecord[]>("/admin/plugins");
|
||||
}
|
||||
/** GET /api/v1/admin/plugins/installed — runtime-installed plugins (v0.28), with
|
||||
* the backend masking apiKey/sensitive env and reporting live/toolCount. */
|
||||
export function adminListInstalledPlugins(): Promise<InstalledPlugin[]> {
|
||||
return request<InstalledPlugin[]>("/admin/plugins/installed");
|
||||
}
|
||||
/** POST /api/v1/admin/plugins/policy — owner-only, audited. */
|
||||
export function adminSetPluginPolicy(
|
||||
name: string,
|
||||
@@ -677,15 +685,18 @@ export function adminWeixinLoginStatus(
|
||||
`/admin/channels/${encodeURIComponent(platform)}/login-status${q}`,
|
||||
);
|
||||
}
|
||||
/** POST /api/v1/admin/plugins/install — honest 501 (needs a plugin source). */
|
||||
export function adminPluginInstall(req: { name: string; kind: string; description: string }): Promise<AdminPluginRecord> {
|
||||
return request<AdminPluginRecord>("/admin/plugins/install", { method: "POST", body: JSON.stringify(req) });
|
||||
/** POST /api/v1/admin/plugins/install — installs (or refreshes) an MCP server
|
||||
* plugin (v0.28): connects, discovers its tools and hot-registers them. The
|
||||
* backend answers 502 and persists nothing when connect/discover fails. */
|
||||
export function adminPluginInstall(req: PluginInstallRequest): Promise<PluginInstallResult> {
|
||||
return request<PluginInstallResult>("/admin/plugins/install", { method: "POST", body: JSON.stringify(req) });
|
||||
}
|
||||
/** POST /api/v1/admin/plugins/uninstall — removes a capability from the registry. */
|
||||
export function adminPluginUninstall(req: { name: string }): Promise<{ name: string; uninstalled: boolean }> {
|
||||
return request<{ name: string; uninstalled: boolean }>("/admin/plugins/uninstall", {
|
||||
/** POST /api/v1/admin/plugins/uninstall — removes an installed MCP server (tools
|
||||
* unregistered + config deleted) or a plain capability from the registry. */
|
||||
export function adminPluginUninstall(name: string): Promise<{ name: string; uninstalled: boolean; kind?: string }> {
|
||||
return request<{ name: string; uninstalled: boolean; kind?: string }>("/admin/plugins/uninstall", {
|
||||
method: "POST",
|
||||
body: JSON.stringify(req),
|
||||
body: JSON.stringify({ name }),
|
||||
});
|
||||
}
|
||||
/** POST /api/v1/admin/memories/search — real retrieval over the memory store. */
|
||||
|
||||
@@ -261,6 +261,25 @@ export interface AdminPluginRecord {
|
||||
allowInStranger: boolean;
|
||||
}
|
||||
|
||||
/** One runtime-installed plugin (GET /api/v1/admin/plugins/installed, v0.28).
|
||||
* A v1 plugin is an external MCP server; `live` = connected and its tools are
|
||||
* registered, `toolCount` = tools it contributed. The backend masks apiKey and
|
||||
* sensitive env values before they reach the client. */
|
||||
export interface InstalledPlugin {
|
||||
id: string;
|
||||
name: string;
|
||||
kind: string;
|
||||
transport: string;
|
||||
endpoint?: string;
|
||||
command?: string;
|
||||
args?: string[];
|
||||
apiKey?: string;
|
||||
env?: Record<string, string>;
|
||||
createdAt?: string;
|
||||
live: boolean;
|
||||
toolCount: number;
|
||||
}
|
||||
|
||||
/** A channel adapter as returned by GET /api/v1/admin/channels. */
|
||||
export interface AdminChannelRecord {
|
||||
name: string;
|
||||
@@ -355,6 +374,9 @@ export interface AdminLlmProvider {
|
||||
multimodal: boolean;
|
||||
enabled: boolean;
|
||||
fallback?: string;
|
||||
/** The group's token budget. Absent/0 = unset (the runtime falls back to
|
||||
* LLM_FALLBACK_MAX_TOKENS on the last step, then the adapter default). */
|
||||
maxTokens?: number;
|
||||
}
|
||||
export interface AdminLlmConfig {
|
||||
providers: AdminLlmProvider[];
|
||||
@@ -508,7 +530,9 @@ export interface AutomationRunResult {
|
||||
}
|
||||
|
||||
/** POST /api/v1/admin/llm body — saves a provider group to models.json and
|
||||
* hot-reloads the running LLM stack (persisted + active). */
|
||||
* hot-reloads the running LLM stack (persisted + active). The backend merges
|
||||
* the request over the stored group (read-modify-write): an omitted field keeps
|
||||
* its stored value, so a partial edit never wipes a budget or key. */
|
||||
export interface LlmProviderRequest {
|
||||
id?: string;
|
||||
name?: string;
|
||||
@@ -518,6 +542,8 @@ export interface LlmProviderRequest {
|
||||
model: string;
|
||||
multimodal?: boolean;
|
||||
fallback?: string;
|
||||
/** Absent = keep the stored budget (or leave unset for a new group). */
|
||||
maxTokens?: number;
|
||||
}
|
||||
|
||||
/** POST /api/v1/admin/llm/test body. */
|
||||
@@ -538,6 +564,34 @@ export interface LlmTestResult {
|
||||
tokens: number;
|
||||
}
|
||||
|
||||
/** MCP server connection block for POST /api/v1/admin/plugins/install (v0.28).
|
||||
* `endpoint` is for http/sse, `command` (+ `args`) for stdio. apiKey is sent
|
||||
* once and persisted but never echoed back; env is the stdio child environment. */
|
||||
export interface PluginInstallConfig {
|
||||
transport: string;
|
||||
endpoint?: string;
|
||||
command?: string;
|
||||
args?: string[];
|
||||
apiKey?: string;
|
||||
env?: Record<string, string>;
|
||||
}
|
||||
|
||||
/** POST /api/v1/admin/plugins/install body. v1 installs MCP servers only. */
|
||||
export interface PluginInstallRequest {
|
||||
kind: string;
|
||||
name: string;
|
||||
config: PluginInstallConfig;
|
||||
}
|
||||
|
||||
/** POST /api/v1/admin/plugins/install result — the live server's registered tool count. */
|
||||
export interface PluginInstallResult {
|
||||
installed: boolean;
|
||||
name: string;
|
||||
kind: string;
|
||||
transport: string;
|
||||
toolCount: number;
|
||||
}
|
||||
|
||||
/** POST /api/v1/admin/channels/test result (structural identity verdict). */
|
||||
export interface ChannelTestResult {
|
||||
role: string;
|
||||
|
||||
Reference in new issue
Block a user