mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-30 21:04:59 +00:00
fix(quota): exclude agents from quota rules and usage records (#325)
* fix(quota): exclude agents from quota rules and usage records * refactor(quota): remove agent_skill_call_count resource type and related logic * chore(db): replace manual migration with prisma-generated migration
This commit is contained in:
@@ -3,7 +3,6 @@ import { Type } from 'typebox'
|
|||||||
import { type AgentTool } from '@earendil-works/pi-agent-core'
|
import { type AgentTool } from '@earendil-works/pi-agent-core'
|
||||||
import { agentService } from '@shumai/core/src/agent/agent'
|
import { agentService } from '@shumai/core/src/agent/agent'
|
||||||
import { resolveEffectiveRole } from '@shumai/core/src/authz/authz'
|
import { resolveEffectiveRole } from '@shumai/core/src/authz/authz'
|
||||||
import { quotaService } from '@shumai/core/src/quota/quota-service'
|
|
||||||
|
|
||||||
const readSkillSchema = Type.Object({
|
const readSkillSchema = Type.Object({
|
||||||
skillId: Type.String({ description: 'The ID of the skill to read' }),
|
skillId: Type.String({ description: 'The ID of the skill to read' }),
|
||||||
@@ -61,18 +60,6 @@ export const createReadSkillTool = (
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Quota pre-check
|
|
||||||
await quotaService.checkQuota(
|
|
||||||
{
|
|
||||||
teamId: skill.teamId,
|
|
||||||
userId,
|
|
||||||
role: effectiveRole,
|
|
||||||
resource: 'agent_skill_call_count',
|
|
||||||
resourceData: { id: params.skillId, skillId: params.skillId },
|
|
||||||
},
|
|
||||||
1,
|
|
||||||
)
|
|
||||||
|
|
||||||
// Capture environment variables using agentService
|
// Capture environment variables using agentService
|
||||||
const envs = await agentService.getSkillEnvs(params.skillId)
|
const envs = await agentService.getSkillEnvs(params.skillId)
|
||||||
onEnvsAdded(envs)
|
onEnvsAdded(envs)
|
||||||
@@ -83,18 +70,6 @@ export const createReadSkillTool = (
|
|||||||
// Notify that a skill was successfully loaded (e.g. to enable restricted tools)
|
// Notify that a skill was successfully loaded (e.g. to enable restricted tools)
|
||||||
await onSkillLoaded?.()
|
await onSkillLoaded?.()
|
||||||
|
|
||||||
// Consume quota
|
|
||||||
await quotaService.consumeQuota(
|
|
||||||
{
|
|
||||||
teamId: skill.teamId,
|
|
||||||
userId,
|
|
||||||
role: effectiveRole,
|
|
||||||
resource: 'agent_skill_call_count',
|
|
||||||
resourceData: { id: params.skillId, skillId: params.skillId },
|
|
||||||
},
|
|
||||||
1,
|
|
||||||
)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
content: [{ type: 'text', text: skillMdContent }],
|
content: [{ type: 'text', text: skillMdContent }],
|
||||||
details: { skillId: params.skillId },
|
details: { skillId: params.skillId },
|
||||||
|
|||||||
@@ -209,26 +209,26 @@ describe('QuotaService', () => {
|
|||||||
data: { name: 'Bob', email: 'bob@example.com', password: 'pw' },
|
data: { name: 'Bob', email: 'bob@example.com', password: 'pw' },
|
||||||
})
|
})
|
||||||
|
|
||||||
// Create rule: each member with role editor gets 5 skill calls per 1hour
|
// Create rule: each member with role editor gets 5 MCP calls per 1hour
|
||||||
await quotaService.createRule(team.id, {
|
await quotaService.createRule(team.id, {
|
||||||
scopeMode: 'each_member',
|
scopeMode: 'each_member',
|
||||||
role: 'editor',
|
role: 'editor',
|
||||||
resource: 'agent_skill_call_count',
|
resource: 'agent_mcp_call_count',
|
||||||
resourceData: { id: 'skill_1' },
|
resourceData: { id: 'server_1' },
|
||||||
limit: 5,
|
limit: 5,
|
||||||
period: '1hour',
|
period: '1hour',
|
||||||
enabled: true,
|
enabled: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
// Alice consumes 5 skill calls
|
// Alice consumes 5 MCP calls
|
||||||
for (let i = 0; i < 5; i++) {
|
for (let i = 0; i < 5; i++) {
|
||||||
await quotaService.consumeQuota(
|
await quotaService.consumeQuota(
|
||||||
{
|
{
|
||||||
teamId: team.id,
|
teamId: team.id,
|
||||||
userId: userAlice.id,
|
userId: userAlice.id,
|
||||||
role: 'editor',
|
role: 'editor',
|
||||||
resource: 'agent_skill_call_count',
|
resource: 'agent_mcp_call_count',
|
||||||
resourceData: { id: 'skill_1' },
|
resourceData: { id: 'server_1' },
|
||||||
},
|
},
|
||||||
1,
|
1,
|
||||||
)
|
)
|
||||||
@@ -241,8 +241,8 @@ describe('QuotaService', () => {
|
|||||||
teamId: team.id,
|
teamId: team.id,
|
||||||
userId: userAlice.id,
|
userId: userAlice.id,
|
||||||
role: 'editor',
|
role: 'editor',
|
||||||
resource: 'agent_skill_call_count',
|
resource: 'agent_mcp_call_count',
|
||||||
resourceData: { id: 'skill_1' },
|
resourceData: { id: 'server_1' },
|
||||||
},
|
},
|
||||||
1,
|
1,
|
||||||
),
|
),
|
||||||
@@ -255,8 +255,8 @@ describe('QuotaService', () => {
|
|||||||
teamId: team.id,
|
teamId: team.id,
|
||||||
userId: userBob.id,
|
userId: userBob.id,
|
||||||
role: 'editor',
|
role: 'editor',
|
||||||
resource: 'agent_skill_call_count',
|
resource: 'agent_mcp_call_count',
|
||||||
resourceData: { id: 'skill_1' },
|
resourceData: { id: 'server_1' },
|
||||||
},
|
},
|
||||||
1,
|
1,
|
||||||
),
|
),
|
||||||
@@ -268,8 +268,8 @@ describe('QuotaService', () => {
|
|||||||
teamId: team.id,
|
teamId: team.id,
|
||||||
userId: userBob.id,
|
userId: userBob.id,
|
||||||
role: 'reviewer',
|
role: 'reviewer',
|
||||||
resource: 'agent_skill_call_count',
|
resource: 'agent_mcp_call_count',
|
||||||
resourceData: { id: 'skill_1' },
|
resourceData: { id: 'server_1' },
|
||||||
},
|
},
|
||||||
1,
|
1,
|
||||||
)
|
)
|
||||||
@@ -670,10 +670,10 @@ describe('QuotaService', () => {
|
|||||||
period: '1hour',
|
period: '1hour',
|
||||||
})
|
})
|
||||||
|
|
||||||
// Updating resource to agent_skill_call_count without resourceData.id should fail validation
|
// Updating resource to agent_mcp_call_count without resourceData.id should fail validation
|
||||||
await expect(
|
await expect(
|
||||||
quotaService.updateRule(team.id, rule.id, {
|
quotaService.updateRule(team.id, rule.id, {
|
||||||
resource: 'agent_skill_call_count',
|
resource: 'agent_mcp_call_count',
|
||||||
}),
|
}),
|
||||||
).rejects.toThrow()
|
).rejects.toThrow()
|
||||||
|
|
||||||
@@ -766,4 +766,87 @@ describe('QuotaService', () => {
|
|||||||
expect(records).toHaveLength(1)
|
expect(records).toHaveLength(1)
|
||||||
expect(records[0].consumed).toBe(150)
|
expect(records[0].consumed).toBe(150)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('excludes agents from quota usage records and prevents creating quota rules for agents', async () => {
|
||||||
|
const team = await prisma.team.create({ data: { name: 'Exclude Agent Team' } })
|
||||||
|
|
||||||
|
// Create human user
|
||||||
|
const humanUser = await prisma.user.create({
|
||||||
|
data: {
|
||||||
|
name: 'Human Member',
|
||||||
|
email: 'human.member@example.com',
|
||||||
|
type: 'human',
|
||||||
|
password: 'pw',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
await prisma.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: humanUser.id, role: 'reviewer' },
|
||||||
|
})
|
||||||
|
|
||||||
|
// Create agent user and agent
|
||||||
|
const agentUser = await prisma.user.create({
|
||||||
|
data: {
|
||||||
|
name: 'AI Agent Member',
|
||||||
|
email: 'ai.agent@shumai.ai',
|
||||||
|
type: 'agent',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
await prisma.agent.create({
|
||||||
|
data: {
|
||||||
|
id: agentUser.id,
|
||||||
|
teamId: team.id,
|
||||||
|
type: 'chat',
|
||||||
|
config: { provider: 'google', model: 'gemini' },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
await prisma.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: agentUser.id, role: 'reviewer' },
|
||||||
|
})
|
||||||
|
|
||||||
|
// 1. Quota rule with each_member
|
||||||
|
const eachMemberRule = await quotaService.createRule(team.id, {
|
||||||
|
scopeMode: 'each_member',
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
limit: 10000,
|
||||||
|
period: '1hour',
|
||||||
|
enabled: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
// listRuleRecords should ONLY return human members, NOT agents
|
||||||
|
const recordsResult = await quotaService.listRuleRecords(team.id, eachMemberRule.id)
|
||||||
|
expect(recordsResult.total).toBe(1)
|
||||||
|
expect(recordsResult.records).toHaveLength(1)
|
||||||
|
expect(recordsResult.records[0].userId).toBe(humanUser.id)
|
||||||
|
expect(recordsResult.records[0].user?.email).toBe('human.member@example.com')
|
||||||
|
|
||||||
|
// 2. Quota rule with selected_members targeting agentUser should be rejected
|
||||||
|
await expect(
|
||||||
|
quotaService.createRule(team.id, {
|
||||||
|
scopeMode: 'selected_members',
|
||||||
|
userIds: [agentUser.id],
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
limit: 5000,
|
||||||
|
period: '1day',
|
||||||
|
}),
|
||||||
|
).rejects.toThrow('One or more selected users are not members of the team')
|
||||||
|
|
||||||
|
// 3. Updating quota rule with selected_members targeting agentUser should be rejected
|
||||||
|
const validSelectedRule = await quotaService.createRule(team.id, {
|
||||||
|
scopeMode: 'selected_members',
|
||||||
|
userIds: [humanUser.id],
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
limit: 5000,
|
||||||
|
period: '1day',
|
||||||
|
})
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
quotaService.updateRule(team.id, validSelectedRule.id, {
|
||||||
|
userIds: [agentUser.id],
|
||||||
|
}),
|
||||||
|
).rejects.toThrow('One or more selected users are not members of the team')
|
||||||
|
|
||||||
|
const selectedRecords = await quotaService.listRuleRecords(team.id, validSelectedRule.id)
|
||||||
|
expect(selectedRecords.total).toBe(1)
|
||||||
|
expect(selectedRecords.records[0].userId).toBe(humanUser.id)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import {
|
|||||||
type UpdateQuotaRuleRequest,
|
type UpdateQuotaRuleRequest,
|
||||||
normalizeQuotaPeriod,
|
normalizeQuotaPeriod,
|
||||||
formatQuotaPeriod,
|
formatQuotaPeriod,
|
||||||
skillResourceDataSchema,
|
|
||||||
mcpResourceDataSchema,
|
mcpResourceDataSchema,
|
||||||
bashResourceDataSchema,
|
bashResourceDataSchema,
|
||||||
toolResourceDataSchema,
|
toolResourceDataSchema,
|
||||||
@@ -121,11 +120,7 @@ function matchesQuotaRule(rule: QuotaRule, event: QuotaEvent): boolean {
|
|||||||
const resourceData = (rule.resourceData as Record<string, unknown> | null) ?? null
|
const resourceData = (rule.resourceData as Record<string, unknown> | null) ?? null
|
||||||
|
|
||||||
// Resource data check
|
// Resource data check
|
||||||
if (rule.resource === 'agent_skill_call_count') {
|
if (rule.resource === 'agent_mcp_call_count') {
|
||||||
const targetId = resourceData?.id ?? resourceData?.skillId
|
|
||||||
const eventSkillId = event.resourceData?.skillId ?? event.resourceData?.id
|
|
||||||
if (targetId && eventSkillId !== targetId) return false
|
|
||||||
} else if (rule.resource === 'agent_mcp_call_count') {
|
|
||||||
const targetId = resourceData?.id ?? resourceData?.mcpServerId
|
const targetId = resourceData?.id ?? resourceData?.mcpServerId
|
||||||
const eventMcpId = event.resourceData?.mcpServerId ?? event.resourceData?.id
|
const eventMcpId = event.resourceData?.mcpServerId ?? event.resourceData?.id
|
||||||
if (targetId && eventMcpId !== targetId) return false
|
if (targetId && eventMcpId !== targetId) return false
|
||||||
@@ -198,6 +193,7 @@ export class QuotaService {
|
|||||||
where: {
|
where: {
|
||||||
teamId,
|
teamId,
|
||||||
userId: { in: req.userIds },
|
userId: { in: req.userIds },
|
||||||
|
user: { type: 'human' },
|
||||||
},
|
},
|
||||||
select: { userId: true },
|
select: { userId: true },
|
||||||
})
|
})
|
||||||
@@ -274,6 +270,7 @@ export class QuotaService {
|
|||||||
where: {
|
where: {
|
||||||
teamId,
|
teamId,
|
||||||
userId: { in: effectiveUserIds },
|
userId: { in: effectiveUserIds },
|
||||||
|
user: { type: 'human' },
|
||||||
},
|
},
|
||||||
select: { userId: true },
|
select: { userId: true },
|
||||||
})
|
})
|
||||||
@@ -284,14 +281,7 @@ export class QuotaService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (effectiveResource === 'agent_skill_call_count') {
|
if (effectiveResource === 'agent_mcp_call_count') {
|
||||||
const res = skillResourceDataSchema.safeParse(effectiveResourceData)
|
|
||||||
if (!res.success) {
|
|
||||||
throw new HTTPException(400, {
|
|
||||||
message: 'resourceData.id is required for agent_skill_call_count',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} else if (effectiveResource === 'agent_mcp_call_count') {
|
|
||||||
const res = mcpResourceDataSchema.safeParse(effectiveResourceData)
|
const res = mcpResourceDataSchema.safeParse(effectiveResourceData)
|
||||||
if (!res.success) {
|
if (!res.success) {
|
||||||
throw new HTTPException(400, {
|
throw new HTTPException(400, {
|
||||||
@@ -481,13 +471,16 @@ export class QuotaService {
|
|||||||
const userIds = Array.isArray(rule.userIds) ? (rule.userIds as string[]) : []
|
const userIds = Array.isArray(rule.userIds) ? (rule.userIds as string[]) : []
|
||||||
if (userIds.length > 0) {
|
if (userIds.length > 0) {
|
||||||
targetUsers = await this.prismaClient.user.findMany({
|
targetUsers = await this.prismaClient.user.findMany({
|
||||||
where: { id: { in: userIds } },
|
where: { id: { in: userIds }, type: 'human' },
|
||||||
select: { id: true, name: true, email: true, image: true },
|
select: { id: true, name: true, email: true, image: true },
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// each_member
|
// each_member
|
||||||
const memberWhere: Prisma.TeamMemberWhereInput = { teamId }
|
const memberWhere: Prisma.TeamMemberWhereInput = {
|
||||||
|
teamId,
|
||||||
|
user: { type: 'human' },
|
||||||
|
}
|
||||||
if (rule.role) {
|
if (rule.role) {
|
||||||
memberWhere.role = rule.role
|
memberWhere.role = rule.role
|
||||||
}
|
}
|
||||||
|
|||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
Warnings:
|
||||||
|
|
||||||
|
- The values [agent_skill_call_count] on the enum `QuotaResourceType` will be removed. If these variants are still used in the database, this will fail.
|
||||||
|
|
||||||
|
*/
|
||||||
|
-- AlterEnum
|
||||||
|
BEGIN;
|
||||||
|
CREATE TYPE "QuotaResourceType_new" AS ENUM ('agent_total_tokens', 'agent_cost', 'agent_mcp_call_count', 'agent_bash_call_count', 'agent_tool_call_count');
|
||||||
|
ALTER TABLE "quota_rules" ALTER COLUMN "resource" TYPE "QuotaResourceType_new" USING ("resource"::text::"QuotaResourceType_new");
|
||||||
|
ALTER TYPE "QuotaResourceType" RENAME TO "QuotaResourceType_old";
|
||||||
|
ALTER TYPE "QuotaResourceType_new" RENAME TO "QuotaResourceType";
|
||||||
|
DROP TYPE "public"."QuotaResourceType_old";
|
||||||
|
COMMIT;
|
||||||
@@ -151,7 +151,6 @@ enum QuotaPeriod {
|
|||||||
enum QuotaResourceType {
|
enum QuotaResourceType {
|
||||||
agent_total_tokens
|
agent_total_tokens
|
||||||
agent_cost
|
agent_cost
|
||||||
agent_skill_call_count
|
|
||||||
agent_mcp_call_count
|
agent_mcp_call_count
|
||||||
agent_bash_call_count
|
agent_bash_call_count
|
||||||
agent_tool_call_count
|
agent_tool_call_count
|
||||||
|
|||||||
-1
@@ -195,7 +195,6 @@ export type QuotaPeriod = (typeof QuotaPeriod)[keyof typeof QuotaPeriod]
|
|||||||
export const QuotaResourceType = {
|
export const QuotaResourceType = {
|
||||||
agent_total_tokens: 'agent_total_tokens',
|
agent_total_tokens: 'agent_total_tokens',
|
||||||
agent_cost: 'agent_cost',
|
agent_cost: 'agent_cost',
|
||||||
agent_skill_call_count: 'agent_skill_call_count',
|
|
||||||
agent_mcp_call_count: 'agent_mcp_call_count',
|
agent_mcp_call_count: 'agent_mcp_call_count',
|
||||||
agent_bash_call_count: 'agent_bash_call_count',
|
agent_bash_call_count: 'agent_bash_call_count',
|
||||||
agent_tool_call_count: 'agent_tool_call_count'
|
agent_tool_call_count: 'agent_tool_call_count'
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -62,10 +62,6 @@ export type QuotaResourceTypeEnum = z.infer<typeof quotaResourceTypeSchema>
|
|||||||
export const quotaRoleSchema = z.enum(['owner', 'editor', 'reviewer'])
|
export const quotaRoleSchema = z.enum(['owner', 'editor', 'reviewer'])
|
||||||
export type QuotaRole = z.infer<typeof quotaRoleSchema>
|
export type QuotaRole = z.infer<typeof quotaRoleSchema>
|
||||||
|
|
||||||
export const skillResourceDataSchema = z.object({
|
|
||||||
id: z.string().min(1, 'Skill ID is required'),
|
|
||||||
})
|
|
||||||
|
|
||||||
export const mcpResourceDataSchema = z.object({
|
export const mcpResourceDataSchema = z.object({
|
||||||
id: z.string().min(1, 'MCP server ID is required'),
|
id: z.string().min(1, 'MCP server ID is required'),
|
||||||
})
|
})
|
||||||
@@ -155,16 +151,7 @@ export const createQuotaRuleRequestSchema = z
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (data.resource === 'agent_skill_call_count') {
|
if (data.resource === 'agent_mcp_call_count') {
|
||||||
const res = skillResourceDataSchema.safeParse(data.resourceData)
|
|
||||||
if (!res.success) {
|
|
||||||
ctx.addIssue({
|
|
||||||
code: z.ZodIssueCode.custom,
|
|
||||||
message: 'resourceData.id is required for agent_skill_call_count',
|
|
||||||
path: ['resourceData', 'id'],
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} else if (data.resource === 'agent_mcp_call_count') {
|
|
||||||
const res = mcpResourceDataSchema.safeParse(data.resourceData)
|
const res = mcpResourceDataSchema.safeParse(data.resourceData)
|
||||||
if (!res.success) {
|
if (!res.success) {
|
||||||
ctx.addIssue({
|
ctx.addIssue({
|
||||||
@@ -216,16 +203,7 @@ export const updateQuotaRuleRequestSchema = z
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (data.resource === 'agent_skill_call_count' && data.resourceData !== undefined) {
|
if (data.resource === 'agent_mcp_call_count' && data.resourceData !== undefined) {
|
||||||
const res = skillResourceDataSchema.safeParse(data.resourceData)
|
|
||||||
if (!res.success) {
|
|
||||||
ctx.addIssue({
|
|
||||||
code: z.ZodIssueCode.custom,
|
|
||||||
message: 'resourceData.id is required for agent_skill_call_count',
|
|
||||||
path: ['resourceData', 'id'],
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} else if (data.resource === 'agent_mcp_call_count' && data.resourceData !== undefined) {
|
|
||||||
const res = mcpResourceDataSchema.safeParse(data.resourceData)
|
const res = mcpResourceDataSchema.safeParse(data.resourceData)
|
||||||
if (!res.success) {
|
if (!res.success) {
|
||||||
ctx.addIssue({
|
ctx.addIssue({
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ import { Avatar, AvatarFallback, AvatarImage } from '@/ui/components/ui/avatar'
|
|||||||
import {
|
import {
|
||||||
Cpu,
|
Cpu,
|
||||||
DollarSign,
|
DollarSign,
|
||||||
Puzzle,
|
|
||||||
Server,
|
Server,
|
||||||
Terminal,
|
Terminal,
|
||||||
Wrench,
|
Wrench,
|
||||||
@@ -93,12 +92,6 @@ const RESOURCE_CONFIG = {
|
|||||||
unit: '$',
|
unit: '$',
|
||||||
defaultLimit: 10,
|
defaultLimit: 10,
|
||||||
},
|
},
|
||||||
agent_skill_call_count: {
|
|
||||||
label: () => m.quota_resource_agent_skill_call_count(),
|
|
||||||
icon: Puzzle,
|
|
||||||
unit: 'calls',
|
|
||||||
defaultLimit: 100,
|
|
||||||
},
|
|
||||||
agent_mcp_call_count: {
|
agent_mcp_call_count: {
|
||||||
label: () => m.quota_resource_agent_mcp_call_count(),
|
label: () => m.quota_resource_agent_mcp_call_count(),
|
||||||
icon: Server,
|
icon: Server,
|
||||||
@@ -134,7 +127,6 @@ export const QuotaRuleDialog: React.FC<QuotaRuleDialogProps> = ({
|
|||||||
const [roleScope, setRoleScope] = useState<string>('team') // 'team' | 'owner' | 'editor' | 'reviewer'
|
const [roleScope, setRoleScope] = useState<string>('team') // 'team' | 'owner' | 'editor' | 'reviewer'
|
||||||
const [selectedUserIds, setSelectedUserIds] = useState<string[]>([])
|
const [selectedUserIds, setSelectedUserIds] = useState<string[]>([])
|
||||||
const [resource, setResource] = useState<QuotaResourceTypeEnum>('agent_total_tokens')
|
const [resource, setResource] = useState<QuotaResourceTypeEnum>('agent_total_tokens')
|
||||||
const [skillId, setSkillId] = useState<string>('')
|
|
||||||
const [mcpServerId, setMcpServerId] = useState<string>('')
|
const [mcpServerId, setMcpServerId] = useState<string>('')
|
||||||
const [bashMatch, setBashMatch] = useState<string>('*')
|
const [bashMatch, setBashMatch] = useState<string>('*')
|
||||||
const [toolName, setToolName] = useState<string>('analyze_image')
|
const [toolName, setToolName] = useState<string>('analyze_image')
|
||||||
@@ -158,18 +150,6 @@ export const QuotaRuleDialog: React.FC<QuotaRuleDialogProps> = ({
|
|||||||
enabled: open,
|
enabled: open,
|
||||||
})
|
})
|
||||||
|
|
||||||
// Fetch team skills when needed
|
|
||||||
const { data: skillsData } = useQuery({
|
|
||||||
queryKey: ['teams', teamId, 'skills'],
|
|
||||||
queryFn: async () => {
|
|
||||||
const res = await client.api.teams[':teamId'].skills.$get({ param: { teamId } })
|
|
||||||
if (!res.ok) return { skills: [] }
|
|
||||||
return await res.json()
|
|
||||||
},
|
|
||||||
enabled: open && resource === 'agent_skill_call_count',
|
|
||||||
})
|
|
||||||
const skills = skillsData?.skills || []
|
|
||||||
|
|
||||||
// Fetch team MCP servers when needed
|
// Fetch team MCP servers when needed
|
||||||
const { data: mcpData } = useQuery({
|
const { data: mcpData } = useQuery({
|
||||||
queryKey: ['teams', teamId, 'mcp', 'servers'],
|
queryKey: ['teams', teamId, 'mcp', 'servers'],
|
||||||
@@ -190,7 +170,6 @@ export const QuotaRuleDialog: React.FC<QuotaRuleDialogProps> = ({
|
|||||||
setSelectedUserIds(rule.userIds || [])
|
setSelectedUserIds(rule.userIds || [])
|
||||||
setResource(rule.resource)
|
setResource(rule.resource)
|
||||||
const resData = (rule.resourceData as Record<string, unknown> | null) || {}
|
const resData = (rule.resourceData as Record<string, unknown> | null) || {}
|
||||||
setSkillId(typeof resData.id === 'string' ? resData.id : '')
|
|
||||||
setMcpServerId(typeof resData.id === 'string' ? resData.id : '')
|
setMcpServerId(typeof resData.id === 'string' ? resData.id : '')
|
||||||
setBashMatch(typeof resData.match === 'string' ? resData.match : '*')
|
setBashMatch(typeof resData.match === 'string' ? resData.match : '*')
|
||||||
setToolName(
|
setToolName(
|
||||||
@@ -208,7 +187,6 @@ export const QuotaRuleDialog: React.FC<QuotaRuleDialogProps> = ({
|
|||||||
setRoleScope('team')
|
setRoleScope('team')
|
||||||
setSelectedUserIds([])
|
setSelectedUserIds([])
|
||||||
setResource('agent_total_tokens')
|
setResource('agent_total_tokens')
|
||||||
setSkillId('')
|
|
||||||
setMcpServerId('')
|
setMcpServerId('')
|
||||||
setBashMatch('*')
|
setBashMatch('*')
|
||||||
setToolName('analyze_image')
|
setToolName('analyze_image')
|
||||||
@@ -230,9 +208,7 @@ export const QuotaRuleDialog: React.FC<QuotaRuleDialogProps> = ({
|
|||||||
const createMutation = useMutation({
|
const createMutation = useMutation({
|
||||||
mutationFn: async () => {
|
mutationFn: async () => {
|
||||||
const resourceData: Record<string, unknown> = {}
|
const resourceData: Record<string, unknown> = {}
|
||||||
if (resource === 'agent_skill_call_count') {
|
if (resource === 'agent_mcp_call_count') {
|
||||||
resourceData.id = skillId
|
|
||||||
} else if (resource === 'agent_mcp_call_count') {
|
|
||||||
resourceData.id = mcpServerId
|
resourceData.id = mcpServerId
|
||||||
} else if (resource === 'agent_bash_call_count') {
|
} else if (resource === 'agent_bash_call_count') {
|
||||||
resourceData.match = bashMatch.trim() || '*'
|
resourceData.match = bashMatch.trim() || '*'
|
||||||
@@ -280,9 +256,7 @@ export const QuotaRuleDialog: React.FC<QuotaRuleDialogProps> = ({
|
|||||||
mutationFn: async () => {
|
mutationFn: async () => {
|
||||||
if (!rule) return
|
if (!rule) return
|
||||||
const resourceData: Record<string, unknown> = {}
|
const resourceData: Record<string, unknown> = {}
|
||||||
if (resource === 'agent_skill_call_count') {
|
if (resource === 'agent_mcp_call_count') {
|
||||||
resourceData.id = skillId
|
|
||||||
} else if (resource === 'agent_mcp_call_count') {
|
|
||||||
resourceData.id = mcpServerId
|
resourceData.id = mcpServerId
|
||||||
} else if (resource === 'agent_bash_call_count') {
|
} else if (resource === 'agent_bash_call_count') {
|
||||||
resourceData.match = bashMatch.trim() || '*'
|
resourceData.match = bashMatch.trim() || '*'
|
||||||
@@ -351,10 +325,6 @@ export const QuotaRuleDialog: React.FC<QuotaRuleDialogProps> = ({
|
|||||||
toast.error(m.select_user())
|
toast.error(m.select_user())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (resource === 'agent_skill_call_count' && !skillId.trim()) {
|
|
||||||
toast.error(m.enter_skill_id())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (resource === 'agent_mcp_call_count' && !mcpServerId.trim()) {
|
if (resource === 'agent_mcp_call_count' && !mcpServerId.trim()) {
|
||||||
toast.error(m.enter_mcp_id())
|
toast.error(m.enter_mcp_id())
|
||||||
return
|
return
|
||||||
@@ -570,12 +540,6 @@ export const QuotaRuleDialog: React.FC<QuotaRuleDialogProps> = ({
|
|||||||
<span>{m.quota_resource_agent_cost()}</span>
|
<span>{m.quota_resource_agent_cost()}</span>
|
||||||
</div>
|
</div>
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
<SelectItem value="agent_skill_call_count">
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<Puzzle className="w-4 h-4 text-amber-500" />
|
|
||||||
<span>{m.quota_resource_agent_skill_call_count()}</span>
|
|
||||||
</div>
|
|
||||||
</SelectItem>
|
|
||||||
<SelectItem value="agent_mcp_call_count">
|
<SelectItem value="agent_mcp_call_count">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Server className="w-4 h-4 text-blue-500" />
|
<Server className="w-4 h-4 text-blue-500" />
|
||||||
@@ -599,40 +563,6 @@ export const QuotaRuleDialog: React.FC<QuotaRuleDialogProps> = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Resource Specific Fields */}
|
{/* Resource Specific Fields */}
|
||||||
{resource === 'agent_skill_call_count' && (
|
|
||||||
<div className="space-y-2">
|
|
||||||
<Label htmlFor="quota-skill" className="text-sm font-semibold">
|
|
||||||
{m.select_skill()}
|
|
||||||
</Label>
|
|
||||||
{skills.length > 0 ? (
|
|
||||||
<Select
|
|
||||||
value={skillId}
|
|
||||||
onValueChange={setSkillId}
|
|
||||||
disabled={isEditing || isPending}
|
|
||||||
>
|
|
||||||
<SelectTrigger id="quota-skill" className="w-full">
|
|
||||||
<SelectValue placeholder={m.select_skill()} />
|
|
||||||
</SelectTrigger>
|
|
||||||
<SelectContent>
|
|
||||||
{skills.map((s: { id: string; name: string }) => (
|
|
||||||
<SelectItem key={s.id} value={s.id}>
|
|
||||||
{s.name} ({s.id})
|
|
||||||
</SelectItem>
|
|
||||||
))}
|
|
||||||
</SelectContent>
|
|
||||||
</Select>
|
|
||||||
) : (
|
|
||||||
<Input
|
|
||||||
id="quota-skill"
|
|
||||||
value={skillId}
|
|
||||||
onChange={(e) => setSkillId(e.target.value)}
|
|
||||||
placeholder={m.enter_skill_id()}
|
|
||||||
disabled={isEditing || isPending}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{resource === 'agent_mcp_call_count' && (
|
{resource === 'agent_mcp_call_count' && (
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label htmlFor="quota-mcp" className="text-sm font-semibold">
|
<Label htmlFor="quota-mcp" className="text-sm font-semibold">
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import { Avatar, AvatarFallback, AvatarImage } from '@/ui/components/ui/avatar'
|
|||||||
import {
|
import {
|
||||||
Cpu,
|
Cpu,
|
||||||
DollarSign,
|
DollarSign,
|
||||||
Puzzle,
|
|
||||||
Server,
|
Server,
|
||||||
Terminal,
|
Terminal,
|
||||||
Wrench,
|
Wrench,
|
||||||
@@ -54,11 +53,6 @@ const RESOURCE_META: Record<
|
|||||||
icon: DollarSign,
|
icon: DollarSign,
|
||||||
unit: '$',
|
unit: '$',
|
||||||
},
|
},
|
||||||
agent_skill_call_count: {
|
|
||||||
label: () => m.quota_resource_agent_skill_call_count(),
|
|
||||||
icon: Puzzle,
|
|
||||||
unit: 'calls',
|
|
||||||
},
|
|
||||||
agent_mcp_call_count: {
|
agent_mcp_call_count: {
|
||||||
label: () => m.quota_resource_agent_mcp_call_count(),
|
label: () => m.quota_resource_agent_mcp_call_count(),
|
||||||
icon: Server,
|
icon: Server,
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import {
|
|||||||
Trash2,
|
Trash2,
|
||||||
Cpu,
|
Cpu,
|
||||||
DollarSign,
|
DollarSign,
|
||||||
Puzzle,
|
|
||||||
Server,
|
Server,
|
||||||
Terminal,
|
Terminal,
|
||||||
Wrench,
|
Wrench,
|
||||||
@@ -66,11 +65,6 @@ const RESOURCE_META: Record<
|
|||||||
icon: DollarSign,
|
icon: DollarSign,
|
||||||
unit: '$',
|
unit: '$',
|
||||||
},
|
},
|
||||||
agent_skill_call_count: {
|
|
||||||
label: () => m.quota_resource_agent_skill_call_count(),
|
|
||||||
icon: Puzzle,
|
|
||||||
unit: 'calls',
|
|
||||||
},
|
|
||||||
agent_mcp_call_count: {
|
agent_mcp_call_count: {
|
||||||
label: () => m.quota_resource_agent_mcp_call_count(),
|
label: () => m.quota_resource_agent_mcp_call_count(),
|
||||||
icon: Server,
|
icon: Server,
|
||||||
@@ -230,9 +224,6 @@ export const QuotasSettings: React.FC<QuotasSettingsProps> = ({ teamId }) => {
|
|||||||
</div>
|
</div>
|
||||||
{/* Subtitle / target details */}
|
{/* Subtitle / target details */}
|
||||||
<div className="text-xs text-muted-foreground line-clamp-1">
|
<div className="text-xs text-muted-foreground line-clamp-1">
|
||||||
{rule.resource === 'agent_skill_call_count' && (
|
|
||||||
<span>Skill: {String(resData.id || '')}</span>
|
|
||||||
)}
|
|
||||||
{rule.resource === 'agent_mcp_call_count' && (
|
{rule.resource === 'agent_mcp_call_count' && (
|
||||||
<span>Server: {String(resData.id || '')}</span>
|
<span>Server: {String(resData.id || '')}</span>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1071,7 +1071,6 @@
|
|||||||
"quota_resource": "Resource",
|
"quota_resource": "Resource",
|
||||||
"quota_resource_agent_total_tokens": "AI Tokens",
|
"quota_resource_agent_total_tokens": "AI Tokens",
|
||||||
"quota_resource_agent_cost": "AI Cost ($)",
|
"quota_resource_agent_cost": "AI Cost ($)",
|
||||||
"quota_resource_agent_skill_call_count": "Skill Calls",
|
|
||||||
"quota_resource_agent_mcp_call_count": "MCP Server Calls",
|
"quota_resource_agent_mcp_call_count": "MCP Server Calls",
|
||||||
"quota_resource_agent_bash_call_count": "Agent Bash Calls",
|
"quota_resource_agent_bash_call_count": "Agent Bash Calls",
|
||||||
"quota_resource_agent_tool_call_count": "Agent Tool Calls",
|
"quota_resource_agent_tool_call_count": "Agent Tool Calls",
|
||||||
@@ -1120,14 +1119,12 @@
|
|||||||
"select_members": "Select Members",
|
"select_members": "Select Members",
|
||||||
"select_role": "Select Role",
|
"select_role": "Select Role",
|
||||||
"select_user": "Select User",
|
"select_user": "Select User",
|
||||||
"select_skill": "Select Skill",
|
|
||||||
"select_mcp_server": "Select MCP Server",
|
"select_mcp_server": "Select MCP Server",
|
||||||
"select_tool": "Select Tool",
|
"select_tool": "Select Tool",
|
||||||
"custom_id": "Custom ID",
|
"custom_id": "Custom ID",
|
||||||
"enter_custom_id": "Enter custom ID",
|
"enter_custom_id": "Enter custom ID",
|
||||||
"bash_command_pattern": "Bash Match Wildcard",
|
"bash_command_pattern": "Bash Match Wildcard",
|
||||||
"bash_command_pattern_placeholder": "e.g. * or npm*",
|
"bash_command_pattern_placeholder": "e.g. * or npm*",
|
||||||
"enter_skill_id": "Enter Skill ID",
|
|
||||||
"enter_mcp_id": "Enter MCP Server ID",
|
"enter_mcp_id": "Enter MCP Server ID",
|
||||||
"quota_bash_hint": "Supports wildcards (*). Examples: git *, npm test, curl *, python script.py (use * for all commands)",
|
"quota_bash_hint": "Supports wildcards (*). Examples: git *, npm test, curl *, python script.py (use * for all commands)",
|
||||||
"quota_tool_hint": "Select a specific agent tool to configure its quota limit"
|
"quota_tool_hint": "Select a specific agent tool to configure its quota limit"
|
||||||
|
|||||||
@@ -1071,7 +1071,6 @@
|
|||||||
"quota_resource": "资源类型",
|
"quota_resource": "资源类型",
|
||||||
"quota_resource_agent_total_tokens": "AI Token 总量",
|
"quota_resource_agent_total_tokens": "AI Token 总量",
|
||||||
"quota_resource_agent_cost": "AI 费用 ($)",
|
"quota_resource_agent_cost": "AI 费用 ($)",
|
||||||
"quota_resource_agent_skill_call_count": "Skill 调用次数",
|
|
||||||
"quota_resource_agent_mcp_call_count": "MCP 服务调用次数",
|
"quota_resource_agent_mcp_call_count": "MCP 服务调用次数",
|
||||||
"quota_resource_agent_bash_call_count": "智能体 Bash 执行次数",
|
"quota_resource_agent_bash_call_count": "智能体 Bash 执行次数",
|
||||||
"quota_resource_agent_tool_call_count": "智能体工具调用次数",
|
"quota_resource_agent_tool_call_count": "智能体工具调用次数",
|
||||||
@@ -1090,7 +1089,7 @@
|
|||||||
"quota_period_resets": "重置于",
|
"quota_period_resets": "重置于",
|
||||||
"quota_active_window": "生效周期",
|
"quota_active_window": "生效周期",
|
||||||
"no_quotas_title": "暂未配置资源配额",
|
"no_quotas_title": "暂未配置资源配额",
|
||||||
"no_quotas_description": "为 AI Token、费用、Skill 执行和智能体工具调用设置限制,以便管理团队的使用情况。",
|
"no_quotas_description": "为 AI Token、费用、MCP 服务和智能体工具调用设置限制,以便管理团队的使用情况。",
|
||||||
"delete_quota": "删除配额",
|
"delete_quota": "删除配额",
|
||||||
"delete_quota_confirm": "确定要删除此配额规则吗?此操作无法撤销。",
|
"delete_quota_confirm": "确定要删除此配额规则吗?此操作无法撤销。",
|
||||||
"quota_created_successfully": "配额规则创建成功",
|
"quota_created_successfully": "配额规则创建成功",
|
||||||
@@ -1120,14 +1119,12 @@
|
|||||||
"select_members": "选择成员",
|
"select_members": "选择成员",
|
||||||
"select_role": "选择角色",
|
"select_role": "选择角色",
|
||||||
"select_user": "选择用户",
|
"select_user": "选择用户",
|
||||||
"select_skill": "选择 Skill",
|
|
||||||
"select_mcp_server": "选择 MCP 服务",
|
"select_mcp_server": "选择 MCP 服务",
|
||||||
"select_tool": "选择工具",
|
"select_tool": "选择工具",
|
||||||
"custom_id": "自定义 ID",
|
"custom_id": "自定义 ID",
|
||||||
"enter_custom_id": "输入自定义 ID",
|
"enter_custom_id": "输入自定义 ID",
|
||||||
"bash_command_pattern": "Bash 命令通配符",
|
"bash_command_pattern": "Bash 命令通配符",
|
||||||
"bash_command_pattern_placeholder": "例如 * 或 npm*",
|
"bash_command_pattern_placeholder": "例如 * 或 npm*",
|
||||||
"enter_skill_id": "输入技能 ID",
|
|
||||||
"enter_mcp_id": "输入 MCP 服务 ID",
|
"enter_mcp_id": "输入 MCP 服务 ID",
|
||||||
"quota_bash_hint": "支持通配符 (*)。示例:git *、npm test、curl *、python script.py(使用 * 匹配所有命令)",
|
"quota_bash_hint": "支持通配符 (*)。示例:git *、npm test、curl *、python script.py(使用 * 匹配所有命令)",
|
||||||
"quota_tool_hint": "选择特定的智能体工具以配置其配额限制"
|
"quota_tool_hint": "选择特定的智能体工具以配置其配额限制"
|
||||||
|
|||||||
-3
@@ -1015,7 +1015,6 @@ export * from "./quota_scope_user_description.js";
|
|||||||
export * from "./quota_resource.js";
|
export * from "./quota_resource.js";
|
||||||
export * from "./quota_resource_agent_total_tokens.js";
|
export * from "./quota_resource_agent_total_tokens.js";
|
||||||
export * from "./quota_resource_agent_cost.js";
|
export * from "./quota_resource_agent_cost.js";
|
||||||
export * from "./quota_resource_agent_skill_call_count.js";
|
|
||||||
export * from "./quota_resource_agent_mcp_call_count.js";
|
export * from "./quota_resource_agent_mcp_call_count.js";
|
||||||
export * from "./quota_resource_agent_bash_call_count.js";
|
export * from "./quota_resource_agent_bash_call_count.js";
|
||||||
export * from "./quota_resource_agent_tool_call_count.js";
|
export * from "./quota_resource_agent_tool_call_count.js";
|
||||||
@@ -1064,14 +1063,12 @@ export * from "./quota_selected_users_count.js";
|
|||||||
export * from "./select_members.js";
|
export * from "./select_members.js";
|
||||||
export * from "./select_role.js";
|
export * from "./select_role.js";
|
||||||
export * from "./select_user.js";
|
export * from "./select_user.js";
|
||||||
export * from "./select_skill.js";
|
|
||||||
export * from "./select_mcp_server.js";
|
export * from "./select_mcp_server.js";
|
||||||
export * from "./select_tool.js";
|
export * from "./select_tool.js";
|
||||||
export * from "./custom_id.js";
|
export * from "./custom_id.js";
|
||||||
export * from "./enter_custom_id.js";
|
export * from "./enter_custom_id.js";
|
||||||
export * from "./bash_command_pattern.js";
|
export * from "./bash_command_pattern.js";
|
||||||
export * from "./bash_command_pattern_placeholder.js";
|
export * from "./bash_command_pattern_placeholder.js";
|
||||||
export * from "./enter_skill_id.js";
|
|
||||||
export * from "./enter_mcp_id.js";
|
export * from "./enter_mcp_id.js";
|
||||||
export * from "./quota_bash_hint.js";
|
export * from "./quota_bash_hint.js";
|
||||||
export * from "./quota_tool_hint.js";
|
export * from "./quota_tool_hint.js";
|
||||||
|
|||||||
-3
@@ -1017,7 +1017,6 @@ export * from './quota_scope_user_description.js'
|
|||||||
export * from './quota_resource.js'
|
export * from './quota_resource.js'
|
||||||
export * from './quota_resource_agent_total_tokens.js'
|
export * from './quota_resource_agent_total_tokens.js'
|
||||||
export * from './quota_resource_agent_cost.js'
|
export * from './quota_resource_agent_cost.js'
|
||||||
export * from './quota_resource_agent_skill_call_count.js'
|
|
||||||
export * from './quota_resource_agent_mcp_call_count.js'
|
export * from './quota_resource_agent_mcp_call_count.js'
|
||||||
export * from './quota_resource_agent_bash_call_count.js'
|
export * from './quota_resource_agent_bash_call_count.js'
|
||||||
export * from './quota_resource_agent_tool_call_count.js'
|
export * from './quota_resource_agent_tool_call_count.js'
|
||||||
@@ -1066,14 +1065,12 @@ export * from './quota_selected_users_count.js'
|
|||||||
export * from './select_members.js'
|
export * from './select_members.js'
|
||||||
export * from './select_role.js'
|
export * from './select_role.js'
|
||||||
export * from './select_user.js'
|
export * from './select_user.js'
|
||||||
export * from './select_skill.js'
|
|
||||||
export * from './select_mcp_server.js'
|
export * from './select_mcp_server.js'
|
||||||
export * from './select_tool.js'
|
export * from './select_tool.js'
|
||||||
export * from './custom_id.js'
|
export * from './custom_id.js'
|
||||||
export * from './enter_custom_id.js'
|
export * from './enter_custom_id.js'
|
||||||
export * from './bash_command_pattern.js'
|
export * from './bash_command_pattern.js'
|
||||||
export * from './bash_command_pattern_placeholder.js'
|
export * from './bash_command_pattern_placeholder.js'
|
||||||
export * from './enter_skill_id.js'
|
|
||||||
export * from './enter_mcp_id.js'
|
export * from './enter_mcp_id.js'
|
||||||
export * from './quota_bash_hint.js'
|
export * from './quota_bash_hint.js'
|
||||||
export * from './quota_tool_hint.js'
|
export * from './quota_tool_hint.js'
|
||||||
-16
@@ -1,16 +0,0 @@
|
|||||||
/**
|
|
||||||
* | output |
|
|
||||||
* | --- |
|
|
||||||
* | "Enter Skill ID" |
|
|
||||||
*
|
|
||||||
* @param {Enter_Skill_IdInputs} inputs
|
|
||||||
* @param {{ locale?: "en" | "zh" }} options
|
|
||||||
* @returns {LocalizedString}
|
|
||||||
*/
|
|
||||||
export const enter_skill_id: ((inputs?: Enter_Skill_IdInputs, options?: {
|
|
||||||
locale?: "en" | "zh";
|
|
||||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Enter_Skill_IdInputs, {
|
|
||||||
locale?: "en" | "zh";
|
|
||||||
}, {}>;
|
|
||||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
|
||||||
export type Enter_Skill_IdInputs = {};
|
|
||||||
-29
@@ -1,29 +0,0 @@
|
|||||||
/* eslint-disable */
|
|
||||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
|
||||||
|
|
||||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
|
||||||
|
|
||||||
/** @typedef {{}} Enter_Skill_IdInputs */
|
|
||||||
|
|
||||||
const en_enter_skill_id = /** @type {(inputs: Enter_Skill_IdInputs) => LocalizedString} */ () => {
|
|
||||||
return /** @type {LocalizedString} */ (`Enter Skill ID`)
|
|
||||||
};
|
|
||||||
|
|
||||||
const zh_enter_skill_id = /** @type {(inputs: Enter_Skill_IdInputs) => LocalizedString} */ () => {
|
|
||||||
return /** @type {LocalizedString} */ (`输入技能 ID`)
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* | output |
|
|
||||||
* | --- |
|
|
||||||
* | "Enter Skill ID" |
|
|
||||||
*
|
|
||||||
* @param {Enter_Skill_IdInputs} inputs
|
|
||||||
* @param {{ locale?: "en" | "zh" }} options
|
|
||||||
* @returns {LocalizedString}
|
|
||||||
*/
|
|
||||||
export const enter_skill_id = /** @type {((inputs?: Enter_Skill_IdInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Enter_Skill_IdInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
|
||||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
|
||||||
if (locale === "en") return en_enter_skill_id(inputs)
|
|
||||||
return zh_enter_skill_id(inputs)
|
|
||||||
});
|
|
||||||
+1
-1
@@ -10,7 +10,7 @@ const en_no_quotas_description = /** @type {(inputs: No_Quotas_DescriptionInputs
|
|||||||
};
|
};
|
||||||
|
|
||||||
const zh_no_quotas_description = /** @type {(inputs: No_Quotas_DescriptionInputs) => LocalizedString} */ () => {
|
const zh_no_quotas_description = /** @type {(inputs: No_Quotas_DescriptionInputs) => LocalizedString} */ () => {
|
||||||
return /** @type {LocalizedString} */ (`为 AI Token、费用、Skill 执行和智能体工具调用设置限制,以便管理团队的使用情况。`)
|
return /** @type {LocalizedString} */ (`为 AI Token、费用、MCP 服务和智能体工具调用设置限制,以便管理团队的使用情况。`)
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
-16
@@ -1,16 +0,0 @@
|
|||||||
/**
|
|
||||||
* | output |
|
|
||||||
* | --- |
|
|
||||||
* | "Skill Calls" |
|
|
||||||
*
|
|
||||||
* @param {Quota_Resource_Agent_Skill_Call_CountInputs} inputs
|
|
||||||
* @param {{ locale?: "en" | "zh" }} options
|
|
||||||
* @returns {LocalizedString}
|
|
||||||
*/
|
|
||||||
export const quota_resource_agent_skill_call_count: ((inputs?: Quota_Resource_Agent_Skill_Call_CountInputs, options?: {
|
|
||||||
locale?: "en" | "zh";
|
|
||||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Quota_Resource_Agent_Skill_Call_CountInputs, {
|
|
||||||
locale?: "en" | "zh";
|
|
||||||
}, {}>;
|
|
||||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
|
||||||
export type Quota_Resource_Agent_Skill_Call_CountInputs = {};
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
/* eslint-disable */
|
|
||||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
|
||||||
|
|
||||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
|
||||||
|
|
||||||
/** @typedef {{}} Quota_Resource_Agent_Skill_Call_CountInputs */
|
|
||||||
|
|
||||||
const en_quota_resource_agent_skill_call_count = /** @type {(inputs: Quota_Resource_Agent_Skill_Call_CountInputs) => LocalizedString} */ () => {
|
|
||||||
return /** @type {LocalizedString} */ (`Skill Calls`)
|
|
||||||
};
|
|
||||||
|
|
||||||
const zh_quota_resource_agent_skill_call_count = /** @type {(inputs: Quota_Resource_Agent_Skill_Call_CountInputs) => LocalizedString} */ () => {
|
|
||||||
return /** @type {LocalizedString} */ (`Skill 调用次数`)
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* | output |
|
|
||||||
* | --- |
|
|
||||||
* | "Skill Calls" |
|
|
||||||
*
|
|
||||||
* @param {Quota_Resource_Agent_Skill_Call_CountInputs} inputs
|
|
||||||
* @param {{ locale?: "en" | "zh" }} options
|
|
||||||
* @returns {LocalizedString}
|
|
||||||
*/
|
|
||||||
export const quota_resource_agent_skill_call_count = /** @type {((inputs?: Quota_Resource_Agent_Skill_Call_CountInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Quota_Resource_Agent_Skill_Call_CountInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
|
||||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
|
||||||
if (locale === "en") return en_quota_resource_agent_skill_call_count(inputs)
|
|
||||||
return zh_quota_resource_agent_skill_call_count(inputs)
|
|
||||||
});
|
|
||||||
-16
@@ -1,16 +0,0 @@
|
|||||||
/**
|
|
||||||
* | output |
|
|
||||||
* | --- |
|
|
||||||
* | "Select Skill" |
|
|
||||||
*
|
|
||||||
* @param {Select_SkillInputs} inputs
|
|
||||||
* @param {{ locale?: "en" | "zh" }} options
|
|
||||||
* @returns {LocalizedString}
|
|
||||||
*/
|
|
||||||
export const select_skill: ((inputs?: Select_SkillInputs, options?: {
|
|
||||||
locale?: "en" | "zh";
|
|
||||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Select_SkillInputs, {
|
|
||||||
locale?: "en" | "zh";
|
|
||||||
}, {}>;
|
|
||||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
|
||||||
export type Select_SkillInputs = {};
|
|
||||||
-29
@@ -1,29 +0,0 @@
|
|||||||
/* eslint-disable */
|
|
||||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
|
||||||
|
|
||||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
|
||||||
|
|
||||||
/** @typedef {{}} Select_SkillInputs */
|
|
||||||
|
|
||||||
const en_select_skill = /** @type {(inputs: Select_SkillInputs) => LocalizedString} */ () => {
|
|
||||||
return /** @type {LocalizedString} */ (`Select Skill`)
|
|
||||||
};
|
|
||||||
|
|
||||||
const zh_select_skill = /** @type {(inputs: Select_SkillInputs) => LocalizedString} */ () => {
|
|
||||||
return /** @type {LocalizedString} */ (`选择 Skill`)
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* | output |
|
|
||||||
* | --- |
|
|
||||||
* | "Select Skill" |
|
|
||||||
*
|
|
||||||
* @param {Select_SkillInputs} inputs
|
|
||||||
* @param {{ locale?: "en" | "zh" }} options
|
|
||||||
* @returns {LocalizedString}
|
|
||||||
*/
|
|
||||||
export const select_skill = /** @type {((inputs?: Select_SkillInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Select_SkillInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
|
||||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
|
||||||
if (locale === "en") return en_select_skill(inputs)
|
|
||||||
return zh_select_skill(inputs)
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user