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

@@ -313,17 +313,19 @@ export function AdminUsersConsole(): React.ReactElement {
<Card className="admin-list-card">
<CardHeader className="admin-list-header flex flex-col gap-4">
<div className="flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3">
<CardTitle className="admin-list-title">{t("listTitle")}</CardTitle>
<CardTitle className="admin-list-title">
{t("listTitle", { defaultValue: "平台账号列表" })}
</CardTitle>
{canManageUsers ? (
<Button type="button" size="sm" onClick={() => openCreateAccount()}>
{t("createAdmin")}
{t("createAdmin", { defaultValue: "新建平台账号" })}
</Button>
) : null}
</div>
<div className="rounded-xl border bg-muted/20 px-3 py-2 text-xs text-muted-foreground">
{t("modelGuide", {
{t("modelGuidePlatform", {
defaultValue:
"账号层只绑定角色,不直接分配功能权限;具体权限请到“角色管理”维护。",
"这里只管理平台账号与平台角色。代理账号请到「代理经营」中创建和维护;账号层只绑定角色,不直接分配功能权限。",
})}
</div>
<div className="admin-list-toolbar">
@@ -545,12 +547,19 @@ export function AdminUsersConsole(): React.ReactElement {
<DialogContent showCloseButton className="max-h-[90vh] max-w-lg gap-4 overflow-y-auto sm:max-w-xl">
<DialogHeader>
<DialogTitle>
{accountMode === "create" ? t("accountDialog.createTitle") : t("accountDialog.editTitle")}
{accountMode === "create"
? t("accountDialog.createTitle", { defaultValue: "新建平台账号" })
: t("accountDialog.editTitle", { defaultValue: "编辑平台账号" })}
</DialogTitle>
<DialogDescription>
{accountMode === "create"
? t("accountDialog.createDescription")
: t("accountDialog.editDescription")}
? t("accountDialog.createDescriptionPlatform", {
defaultValue:
"须为平台账号指定至少一个平台角色。登录账号仅可使用字母、数字、点、下划线与连字符,保存后为小写。",
})
: t("accountDialog.editDescriptionPlatform", {
defaultValue: "这里只编辑平台账号。登录账号不可修改,留空密码表示不修改。",
})}
</DialogDescription>
</DialogHeader>
<div className="space-y-3">
@@ -600,7 +609,11 @@ export function AdminUsersConsole(): React.ReactElement {
{accountMode === "create" ? (
<div className="space-y-2">
<div className="text-sm font-medium leading-none">{t("accountDialog.rolesRequired")}</div>
<p className="text-xs text-muted-foreground">{t("accountDialog.rolesDescription")}</p>
<p className="text-xs text-muted-foreground">
{t("accountDialog.rolesDescriptionPlatform", {
defaultValue: "这里只能选择平台角色;代理角色请到「代理经营」中分配。",
})}
</p>
<div className="max-h-52 space-y-2 overflow-y-auto rounded-md border p-2.5 sm:grid sm:max-h-56 sm:grid-cols-2 sm:gap-2 sm:space-y-0">
{(catalog?.roles ?? []).length === 0 ? (
<p className="col-span-full text-xs text-muted-foreground">