feat(api, agents): add agent node profile retrieval and update functionality

Implemented new API functions to fetch and update agent node profiles, enhancing the management capabilities for agent data. This addition improves the overall functionality of the admin agents console, allowing for better user interaction with agent profiles. Updated related types for improved type safety and clarity in the codebase.
This commit is contained in:
2026-06-04 09:17:55 +08:00
parent 59b0684ea1
commit cbc499e5b2
79 changed files with 3468 additions and 1406 deletions

View File

@@ -0,0 +1,13 @@
import { adminRequest } from "@/lib/admin-http";
import type {
AdminAgentLineProvisionPayload,
AdminAgentLineProvisionResult,
} from "@/types/api/admin-agent-line";
const A = `/admin`;
export async function postAdminAgentLine(
payload: AdminAgentLineProvisionPayload,
): Promise<AdminAgentLineProvisionResult> {
return adminRequest.post<AdminAgentLineProvisionResult>(`${A}/agent-lines`, payload);
}

View File

@@ -8,6 +8,8 @@ import type {
AgentNodeCreatePayload,
AgentNodeRow,
AgentNodeUpdatePayload,
AgentProfilePayload,
AgentProfileRow,
AgentRoleCreatePayload,
AgentRoleListData,
AgentTreeData,
@@ -39,6 +41,17 @@ export async function deleteAgentNode(agentNodeId: number): Promise<null> {
return adminRequest.delete<null>(`${A}/agent-nodes/${agentNodeId}`);
}
export async function getAgentNodeProfile(agentNodeId: number): Promise<AgentProfileRow> {
return adminRequest.get<AgentProfileRow>(`${A}/agent-nodes/${agentNodeId}/profile`);
}
export async function putAgentNodeProfile(
agentNodeId: number,
body: AgentProfilePayload,
): Promise<AgentProfileRow> {
return adminRequest.put<AgentProfileRow>(`${A}/agent-nodes/${agentNodeId}/profile`, body);
}
export async function getAgentNodeRoles(agentNodeId: number): Promise<AgentRoleListData> {
return adminRequest.get<AgentRoleListData>(`${A}/agent-nodes/${agentNodeId}/roles`);
}