Merge pull request #215 from shumaiOne/feat/ai-token-usage-tracking

feat(ai-usage): add team and member token usage tracking and APIs
This commit is contained in:
Yiling-J
2026-07-23 15:26:32 +08:00
committed by GitHub
57 changed files with 4410 additions and 30 deletions
@@ -56,6 +56,7 @@ describe('Agent Activities', () => {
it('should call agentChatActivity and prompt the harness', async () => {
const mockHarness = {
subscribe: vi.fn(),
prompt: vi.fn().mockResolvedValue({
content: [{ type: 'text', text: 'AI response' }],
usage: { input: 10, output: 20 },
@@ -95,6 +96,84 @@ describe('Agent Activities', () => {
expect(piAgent.createAgentSession).toHaveBeenCalled()
})
it('should subscribe to harness events and record usage for assistant message_end events', async () => {
const { aiUsageService } = await import('@shumai/core/src/ai-usage/ai-usage')
const spyRecordUsage = vi.spyOn(aiUsageService, 'recordUsage').mockResolvedValue()
let subscribeListener!: (event: unknown) => Promise<void>
const mockHarness = {
subscribe: vi.fn().mockImplementation((listener) => {
subscribeListener = listener
}),
prompt: vi.fn().mockImplementation(async () => {
// Trigger assistant message end event during turn
if (subscribeListener) {
await subscribeListener({
type: 'message_end',
message: {
role: 'assistant',
usage: {
input: 150,
output: 75,
cacheRead: 25,
totalTokens: 225,
cost: { total: 0.0015 },
},
},
})
}
return {
content: [{ type: 'text', text: 'Subscribed response' }],
usage: { input: 150, output: 75 },
}
}),
}
const mockSession = {
getEntries: vi.fn().mockResolvedValue([]),
getStorage: vi.fn().mockReturnValue({ sessionId: 'mock-session-id' }),
}
vi.mocked(piAgent.createAgentSession).mockResolvedValue({
session: mockSession as unknown as Session<DatabaseSessionMetadata>,
harness: mockHarness as unknown as AgentHarness,
})
const context = {
agent: { id: 'b1', provider: { name: 'google' }, modelRef: { modelId: 'gemini' } },
dbProviders: [],
teamSkills: [],
allowedDomains: [],
} as unknown as AgentExecutionContext
const res = await agentChatActivity({
teamId: 'team123',
agentId: 'b1',
message: 'Hi',
imageUrls: [],
projectId: 'p1',
folderId: 'f1',
sessionId: 'mock-session-id',
userId: 'user123',
context,
})
expect(res.text).toBe('Subscribed response')
expect(res.usage.inputTokens).toBe(150)
expect(res.usage.outputTokens).toBe(75)
expect(res.usage.cacheReadTokens).toBe(25)
expect(res.usage.cost).toBe(0.0015)
expect(spyRecordUsage).toHaveBeenCalledWith({
teamId: 'team123',
userId: 'user123',
inputTokens: 150,
outputTokens: 75,
cacheReadTokens: 25,
totalTokens: 225,
cost: 0.0015,
})
})
it('should register local cancellation handler and call harness.abort when cancelled in local mode', async () => {
let resolvePrompt!: (value: {
content: Array<{ type: string; text: string } | { type: string }>
@@ -107,6 +186,7 @@ describe('Agent Activities', () => {
})
const mockHarness = {
subscribe: vi.fn(),
prompt: vi.fn().mockReturnValue(promptPromise),
abort: vi.fn(),
}
@@ -174,6 +254,7 @@ describe('Agent Activities', () => {
})
const mockHarness = {
subscribe: vi.fn(),
prompt: vi.fn().mockReturnValue(promptPromise),
abort: vi.fn(),
}
@@ -234,6 +315,7 @@ describe('Agent Activities', () => {
it('should include error message in text when stopReason is error', async () => {
const mockHarness = {
subscribe: vi.fn(),
prompt: vi.fn().mockResolvedValue({
content: [],
usage: { input: 0, output: 0 },
@@ -274,6 +356,7 @@ describe('Agent Activities', () => {
it('should pass thinkingLevel from agent config to createAgentSession', async () => {
const mockHarness = {
subscribe: vi.fn(),
prompt: vi.fn().mockResolvedValue({
content: [],
usage: { input: 0, output: 0 },
@@ -322,6 +405,7 @@ describe('Agent Activities', () => {
it('should call autofillAiActivity and run autofill tool', async () => {
const mockHarness = {
subscribe: vi.fn(),
prompt: vi.fn().mockResolvedValue({
content: [{ type: 'text', text: 'Captured' }],
usage: { input: 5, output: 5 },
@@ -962,6 +1046,7 @@ describe('Agent Database Activities Integration', () => {
})
const mockHarness = {
subscribe: vi.fn(),
prompt: vi.fn().mockResolvedValue({
content: [{ type: 'text', text: ' "Summarized Chat Title" ' }],
}),
+57 -2
View File
@@ -25,11 +25,15 @@ import {
type DbProviderInfo,
} from '../index'
import { aiUsageService } from '@shumai/core/src/ai-usage/ai-usage'
import { UpdateAssetMetadataRequest } from '@shumai/dtos'
export interface Usage {
inputTokens: number
outputTokens: number
cacheReadTokens: number
totalTokens: number
cost: number
model: string
}
@@ -209,8 +213,56 @@ If you need to create files in the local filesystem (for example, a temporary fi
} as unknown as SessionTreeEntry)
}
let totalInputTokens = 0
let totalOutputTokens = 0
let totalCacheReadTokens = 0
let grandTotalTokens = 0
let totalCost = 0
harness.subscribe(async (event) => {
if (event.type === 'message_end' && event.message.role === 'assistant') {
const assistantMsg = event.message
const u = assistantMsg.usage
if (u) {
const inputTokens = u.input || 0
const outputTokens = u.output || 0
const cacheReadTokens = u.cacheRead || 0
const totalTokens = u.totalTokens || inputTokens + outputTokens
const cost = u.cost?.total || 0
totalInputTokens += inputTokens
totalOutputTokens += outputTokens
totalCacheReadTokens += cacheReadTokens
grandTotalTokens += totalTokens
totalCost += cost
try {
await aiUsageService.recordUsage({
teamId: params.teamId,
userId: params.userId,
inputTokens,
outputTokens,
cacheReadTokens,
totalTokens,
cost,
})
} catch (err) {
logger.error({ err }, 'Failed to record AI usage')
}
}
}
})
const assistantMessage = await harness.prompt(params.prompt, { images: imagesToPass })
if (totalInputTokens === 0 && totalOutputTokens === 0 && assistantMessage.usage) {
totalInputTokens = assistantMessage.usage.input || 0
totalOutputTokens = assistantMessage.usage.output || 0
totalCacheReadTokens = assistantMessage.usage.cacheRead || 0
grandTotalTokens = assistantMessage.usage.totalTokens || totalInputTokens + totalOutputTokens
totalCost = assistantMessage.usage.cost?.total || 0
}
const sessionEntries = await session.getEntries()
sessionEntries.forEach((entry) => {
if (entry.type === 'message') {
@@ -243,8 +295,11 @@ If you need to create files in the local filesystem (for example, a temporary fi
const usage: Usage = {
model: modelId,
inputTokens: assistantMessage.usage?.input || 0,
outputTokens: assistantMessage.usage?.output || 0,
inputTokens: totalInputTokens,
outputTokens: totalOutputTokens,
cacheReadTokens: totalCacheReadTokens,
totalTokens: grandTotalTokens,
cost: totalCost,
}
const storage = session.getStorage()
+17 -17
View File
@@ -7,21 +7,21 @@ import {
} from '@earendil-works/pi-agent-core'
import { NodeExecutionEnv } from '@earendil-works/pi-agent-core/node'
import { getModel } from '@earendil-works/pi-ai/compat'
import { agentService } from '@shumai/core/src/agent/agent'
import { prisma } from '@shumai/db'
import { Type, type TSchema } from '@sinclair/typebox'
import * as fs from 'fs'
import * as path from 'path'
import { prisma } from '@shumai/db'
import { agentService } from '@shumai/core/src/agent/agent'
import { DatabaseSessionStorage } from './database-session-storage'
import { createAnalyzeImageTool } from './tools/analyze-image'
import { createScreenshotTool } from './tools/screenshot'
import { createReadPdfPagesTool } from './tools/read-pdf-pages'
import { createCreateFileTool } from './tools/create-file'
import { createCreateFolderTool } from './tools/create-folder'
import { createCreateVersionTool } from './tools/create-version'
import { createListAssetsTool } from './tools/list-assets'
import { createReadPdfPagesTool } from './tools/read-pdf-pages'
import { createReadSkillTool } from './tools/read-skill'
import { createSandboxedBashTool } from './tools/sandboxed-bash'
import { createScreenshotTool } from './tools/screenshot'
export interface DbModelInfo {
modelId: string
@@ -380,15 +380,15 @@ export function formatSkillsForPrompt(
return lines.join('\n')
}
import { registerWorkflow, registerActivities } from '@shumai/workflow-core'
import { WorkflowTaskType } from '@shumai/db'
import { agentEmbeddingMedia } from './workflows/agent-embedding'
import { queryEmbeddingForSearch } from './workflows/query-embedding-for-search'
import { agentAutofillMedia } from './workflows/agent-autofill'
import { agentChat } from './workflows/agent-chat'
import { agentToolCall } from './workflows/agent-tool-call'
import { registerActivities, registerWorkflow } from '@shumai/workflow-core'
import * as agentActivities from './activities/agent'
import * as aiActivities from './activities/ai'
import { agentAutofillMedia } from './workflows/agent-autofill'
import { agentChat } from './workflows/agent-chat'
import { agentEmbeddingMedia } from './workflows/agent-embedding'
import { agentToolCall } from './workflows/agent-tool-call'
import { queryEmbeddingForSearch } from './workflows/query-embedding-for-search'
export function initAgentWorkflows() {
registerWorkflow(WorkflowTaskType.ai_embedding, agentEmbeddingMedia)
@@ -401,19 +401,19 @@ export function initAgentWorkflows() {
registerActivities(aiActivities)
}
export * from './database-session-storage'
export * from './activities/agent'
export {
extractAiMetadataActivity,
generateEmbeddingActivity,
generateImageEmbeddingActivity,
generateTextEmbeddingActivity,
generateVideoChunkEmbeddingActivity,
type ExtractAiMetadataParams,
type GeneratedEmbedding,
type GenerateEmbeddingParams,
generateEmbeddingActivity,
type GenerateTextEmbeddingParams,
generateTextEmbeddingActivity,
type ExtractAiMetadataParams,
extractAiMetadataActivity,
generateImageEmbeddingActivity,
generateVideoChunkEmbeddingActivity,
} from './activities/ai'
export * from './database-session-storage'
export * from './workflows/agent-autofill'
export * from './workflows/agent-chat'
export * from './workflows/agent-embedding'
+68
View File
@@ -37,6 +37,13 @@ vi.mock('@shumai/core/src/user/api-token', () => ({
},
}))
vi.mock('@shumai/core/src/ai-usage/ai-usage', () => ({
aiUsageService: {
recordUsage: vi.fn(),
getTeamUsageStats: vi.fn(),
},
}))
describe('team api', () => {
const app = new Hono().use('*', authMiddleware).route('/', teamRoute)
let mockCreateTeam: any // eslint-disable-line @typescript-eslint/no-explicit-any
@@ -403,5 +410,66 @@ describe('team api', () => {
expect(data).toEqual({ success: true })
expect(apiTokenService.deleteToken).toHaveBeenCalledWith('user1', 'token1')
})
it('GET /teams/:teamId/ai-usage returns team usage stats for owner', async () => {
const { aiUsageService } = await import('@shumai/core/src/ai-usage/ai-usage')
vi.mocked(aiUsageService.getTeamUsageStats).mockResolvedValue({
timeframe: '30d',
team: {
inputTokens: 1000,
outputTokens: 500,
cacheReadTokens: 200,
totalTokens: 1500,
cost: 0.005,
},
})
const res = await app.request('/teams/t1/ai-usage?timeframe=30d')
expect(res.status).toBe(200)
const data = await res.json()
expect(data.team.totalTokens).toBe(1500)
expect(authzService.hasPermission).toHaveBeenCalledWith(
expect.objectContaining({
permission: Permission.Admin,
type: ResourceType.Team,
id: 't1',
}),
)
expect(aiUsageService.getTeamUsageStats).toHaveBeenCalledWith({
teamId: 't1',
timeframe: '30d',
userId: undefined,
})
})
it('GET /teams/:teamId/ai-usage?userId=user1 returns specific member usage stats', async () => {
const { aiUsageService } = await import('@shumai/core/src/ai-usage/ai-usage')
vi.mocked(aiUsageService.getTeamUsageStats).mockResolvedValue({
timeframe: '7d',
member: {
userId: 'user1',
userName: 'Test User',
userEmail: 'user1@example.com',
role: 'owner',
inputTokens: 400,
outputTokens: 200,
cacheReadTokens: 50,
totalTokens: 600,
cost: 0.002,
},
})
const res = await app.request('/teams/t1/ai-usage?timeframe=7d&userId=user1')
expect(res.status).toBe(200)
const data = await res.json()
expect(data.member.userId).toBe('user1')
expect(aiUsageService.getTeamUsageStats).toHaveBeenCalledWith({
teamId: 't1',
timeframe: '7d',
userId: 'user1',
})
})
})
})
+22 -1
View File
@@ -15,8 +15,9 @@ import {
updateTeamMemberRoleRequestSchema,
createApiTokenRequestSchema,
} from '@shumai/dtos'
import { updateUserMetadataRequestSchema } from '@shumai/dtos'
import { updateUserMetadataRequestSchema, getTeamAiUsageQuerySchema } from '@shumai/dtos'
import { apiTokenService } from '@shumai/core/src/user/api-token'
import { aiUsageService } from '@shumai/core/src/ai-usage/ai-usage'
import type { Prisma } from '@shumai/db'
type User = Prisma.UserGetPayload<Record<string, never>>
@@ -313,5 +314,25 @@ const route = new Hono<{ Variables: { user: User } }>()
await apiTokenService.deleteToken(user.id, tokenId)
return c.json({ success: true })
})
.get('/teams/:teamId/ai-usage', zValidator('query', getTeamAiUsageQuerySchema), async (c) => {
const user = c.get('user')
const teamId = c.req.param('teamId')
const { timeframe, userId } = c.req.valid('query')
await authzService.hasPermission({
user,
permission: Permission.Admin,
type: ResourceType.Team,
id: teamId,
})
const stats = await aiUsageService.getTeamUsageStats({
teamId,
timeframe,
userId,
})
return c.json(stats)
})
export default route
+313
View File
@@ -0,0 +1,313 @@
import { describe, expect, it, vi } from 'vitest'
import { prisma } from '@shumai/db'
import { setupTestDbHooks } from '@shumai/db/test'
import { aiUsageService } from './ai-usage'
import { HTTPException } from 'hono/http-exception'
describe('AiUsageService', () => {
setupTestDbHooks()
async function createTestTeamAndUser() {
const user = await prisma.user.create({
data: {
name: 'Usage Test User',
email: `usage-test-${Date.now()}-${Math.random()}@example.com`,
},
})
const team = await prisma.team.create({
data: {
name: 'Usage Test Team',
},
})
const teamMember = await prisma.teamMember.create({
data: {
teamId: team.id,
userId: user.id,
role: 'owner',
},
})
return { user, team, teamMember }
}
it('records usage for both team total and specific member', async () => {
const { team, user } = await createTestTeamAndUser()
const now = new Date()
await aiUsageService.recordUsage({
teamId: team.id,
userId: user.id,
inputTokens: 100,
outputTokens: 50,
cacheReadTokens: 20,
totalTokens: 150,
cost: 0.001,
timestamp: now,
})
// Verify database rows
const records = await prisma.aiUsage.findMany({
where: { teamId: team.id },
})
expect(records).toHaveLength(2)
const teamRecord = records.find((r) => r.userId === null)
expect(teamRecord).toBeDefined()
expect(teamRecord?.inputTokens).toBe(100)
expect(teamRecord?.outputTokens).toBe(50)
expect(teamRecord?.cacheReadTokens).toBe(20)
expect(teamRecord?.totalTokens).toBe(150)
expect(teamRecord?.cost).toBeCloseTo(0.001)
const memberRecord = records.find((r) => r.userId === user.id)
expect(memberRecord).toBeDefined()
expect(memberRecord?.inputTokens).toBe(100)
expect(memberRecord?.outputTokens).toBe(50)
expect(memberRecord?.cacheReadTokens).toBe(20)
expect(memberRecord?.totalTokens).toBe(150)
expect(memberRecord?.cost).toBeCloseTo(0.001)
})
it('increments existing hourly buckets for team and member', async () => {
const { team, user } = await createTestTeamAndUser()
const now = new Date()
await aiUsageService.recordUsage({
teamId: team.id,
userId: user.id,
inputTokens: 100,
outputTokens: 50,
cacheReadTokens: 10,
totalTokens: 150,
cost: 0.001,
timestamp: now,
})
await aiUsageService.recordUsage({
teamId: team.id,
userId: user.id,
inputTokens: 200,
outputTokens: 100,
cacheReadTokens: 30,
totalTokens: 300,
cost: 0.002,
timestamp: now,
})
const teamStats = await aiUsageService.getTeamUsageStats({
teamId: team.id,
timeframe: '1h',
})
expect(teamStats.team).toBeDefined()
expect(teamStats.team?.inputTokens).toBe(300)
expect(teamStats.team?.outputTokens).toBe(150)
expect(teamStats.team?.cacheReadTokens).toBe(40)
expect(teamStats.team?.totalTokens).toBe(450)
expect(teamStats.team?.cost).toBeCloseTo(0.003)
const memberStats = await aiUsageService.getTeamUsageStats({
teamId: team.id,
timeframe: '1h',
userId: user.id,
})
expect(memberStats.member).toBeDefined()
expect(memberStats.member?.userId).toBe(user.id)
expect(memberStats.member?.inputTokens).toBe(300)
expect(memberStats.member?.outputTokens).toBe(150)
expect(memberStats.member?.cacheReadTokens).toBe(40)
expect(memberStats.member?.totalTokens).toBe(450)
expect(memberStats.member?.cost).toBeCloseTo(0.003)
})
it('handles background system tasks with no userId', async () => {
const { team } = await createTestTeamAndUser()
await aiUsageService.recordUsage({
teamId: team.id,
userId: null,
inputTokens: 50,
outputTokens: 25,
cacheReadTokens: 5,
totalTokens: 75,
cost: 0.0005,
})
const records = await prisma.aiUsage.findMany({
where: { teamId: team.id },
})
expect(records).toHaveLength(1)
expect(records[0].userId).toBeNull()
expect(records[0].inputTokens).toBe(50)
})
it('filters statistics correctly by timeframe', async () => {
vi.useFakeTimers()
const now = new Date('2026-07-23T15:30:00Z')
vi.setSystemTime(now)
try {
const { team, user } = await createTestTeamAndUser()
// 5 minutes ago (within current 1h bucket)
const recent = new Date(now.getTime() - 5 * 60 * 1000)
// 2 hours ago (within 24h, outside 1h)
const twoHoursAgo = new Date(now.getTime() - 2 * 60 * 60 * 1000)
// 3 days ago (within 7d, outside 24h)
const threeDaysAgo = new Date(now.getTime() - 3 * 24 * 60 * 60 * 1000)
await aiUsageService.recordUsage({
teamId: team.id,
userId: user.id,
inputTokens: 100,
outputTokens: 50,
cacheReadTokens: 10,
totalTokens: 150,
cost: 0.001,
timestamp: recent,
})
await aiUsageService.recordUsage({
teamId: team.id,
userId: user.id,
inputTokens: 200,
outputTokens: 100,
cacheReadTokens: 20,
totalTokens: 300,
cost: 0.002,
timestamp: twoHoursAgo,
})
await aiUsageService.recordUsage({
teamId: team.id,
userId: user.id,
inputTokens: 400,
outputTokens: 200,
cacheReadTokens: 40,
totalTokens: 600,
cost: 0.004,
timestamp: threeDaysAgo,
})
// 1h timeframe should only include recent
const stats1h = await aiUsageService.getTeamUsageStats({
teamId: team.id,
timeframe: '1h',
})
expect(stats1h.team?.inputTokens).toBe(100)
// 24h timeframe should include recent + 2 hours ago
const stats24h = await aiUsageService.getTeamUsageStats({
teamId: team.id,
timeframe: '24h',
})
expect(stats24h.team?.inputTokens).toBe(300)
// 7d timeframe should include all 3
const stats7d = await aiUsageService.getTeamUsageStats({
teamId: team.id,
timeframe: '7d',
})
expect(stats7d.team?.inputTokens).toBe(700)
} finally {
vi.useRealTimers()
}
})
it('throws 404 when querying non-existent team member', async () => {
const { team } = await createTestTeamAndUser()
await expect(
aiUsageService.getTeamUsageStats({
teamId: team.id,
timeframe: '30d',
userId: 'non-existent-user-id',
}),
).rejects.toThrow(HTTPException)
})
it('targets only current hour bucket for 1h timeframe instead of including previous hour bucket', async () => {
const { team, user } = await createTestTeamAndUser()
// 10:15 AM (previous hour)
const prevHour = new Date('2026-07-23T10:15:00Z')
// 11:10 AM (current hour)
const currHour = new Date('2026-07-23T11:10:00Z')
await aiUsageService.recordUsage({
teamId: team.id,
userId: user.id,
inputTokens: 100,
outputTokens: 0,
cacheReadTokens: 0,
totalTokens: 100,
cost: 0.001,
timestamp: prevHour,
})
await aiUsageService.recordUsage({
teamId: team.id,
userId: user.id,
inputTokens: 50,
outputTokens: 0,
cacheReadTokens: 0,
totalTokens: 50,
cost: 0.0005,
timestamp: currHour,
})
vi.useFakeTimers()
vi.setSystemTime(new Date('2026-07-23T11:15:00Z'))
try {
const stats1h = await aiUsageService.getTeamUsageStats({
teamId: team.id,
timeframe: '1h',
})
expect(stats1h.team?.inputTokens).toBe(50)
} finally {
vi.useRealTimers()
}
})
it('handles concurrent recordUsage calls for the same team and user without duplication or race errors', async () => {
const { team, user } = await createTestTeamAndUser()
const now = new Date()
await Promise.all([
aiUsageService.recordUsage({
teamId: team.id,
userId: user.id,
inputTokens: 100,
outputTokens: 50,
cacheReadTokens: 10,
totalTokens: 150,
cost: 0.001,
timestamp: now,
}),
aiUsageService.recordUsage({
teamId: team.id,
userId: user.id,
inputTokens: 200,
outputTokens: 100,
cacheReadTokens: 20,
totalTokens: 300,
cost: 0.002,
timestamp: now,
}),
])
const stats = await aiUsageService.getTeamUsageStats({
teamId: team.id,
timeframe: '1h',
})
expect(stats.team?.inputTokens).toBe(300)
expect(stats.team?.outputTokens).toBe(150)
})
})
+263
View File
@@ -0,0 +1,263 @@
import { prisma, Prisma } from '@shumai/db'
import type { TeamUsageStatsResponse, Timeframe } from '@shumai/dtos'
import { HTTPException } from 'hono/http-exception'
export interface RecordUsageParams {
teamId: string
userId?: string | null
inputTokens: number
outputTokens: number
cacheReadTokens: number
totalTokens: number
cost: number
timestamp?: Date
}
export interface GetTeamUsageStatsParams {
teamId: string
timeframe: Timeframe
userId?: string
}
export class AiUsageService {
private async incrementBucket(params: {
teamId: string
userId: string | null
periodStart: Date
inputTokens: number
outputTokens: number
cacheReadTokens: number
totalTokens: number
cost: number
}): Promise<void> {
if (params.userId !== null) {
await prisma.aiUsage.upsert({
where: {
// eslint-disable-next-line @typescript-eslint/naming-convention
teamId_userId_periodStart: {
teamId: params.teamId,
userId: params.userId,
periodStart: params.periodStart,
},
},
update: {
inputTokens: { increment: params.inputTokens },
outputTokens: { increment: params.outputTokens },
cacheReadTokens: { increment: params.cacheReadTokens },
totalTokens: { increment: params.totalTokens },
cost: { increment: params.cost },
},
create: {
teamId: params.teamId,
userId: params.userId,
periodStart: params.periodStart,
inputTokens: params.inputTokens,
outputTokens: params.outputTokens,
cacheReadTokens: params.cacheReadTokens,
totalTokens: params.totalTokens,
cost: params.cost,
},
})
} else {
const existing = await prisma.aiUsage.findFirst({
where: {
teamId: params.teamId,
userId: null,
periodStart: params.periodStart,
},
})
if (existing) {
await prisma.aiUsage.update({
where: { id: existing.id },
data: {
inputTokens: { increment: params.inputTokens },
outputTokens: { increment: params.outputTokens },
cacheReadTokens: { increment: params.cacheReadTokens },
totalTokens: { increment: params.totalTokens },
cost: { increment: params.cost },
},
})
} else {
try {
await prisma.aiUsage.create({
data: {
teamId: params.teamId,
userId: null,
periodStart: params.periodStart,
inputTokens: params.inputTokens,
outputTokens: params.outputTokens,
cacheReadTokens: params.cacheReadTokens,
totalTokens: params.totalTokens,
cost: params.cost,
},
})
} catch (err) {
if (err instanceof Prisma.PrismaClientKnownRequestError && err.code === 'P2002') {
await prisma.aiUsage.updateMany({
where: {
teamId: params.teamId,
userId: null,
periodStart: params.periodStart,
},
data: {
inputTokens: { increment: params.inputTokens },
outputTokens: { increment: params.outputTokens },
cacheReadTokens: { increment: params.cacheReadTokens },
totalTokens: { increment: params.totalTokens },
cost: { increment: params.cost },
},
})
} else {
throw err
}
}
}
}
}
async recordUsage(params: RecordUsageParams): Promise<void> {
const timestamp = params.timestamp ?? new Date()
const periodStart = new Date(timestamp)
periodStart.setMinutes(0, 0, 0)
// 1. Update/create Team Total record (userId = null)
await this.incrementBucket({
teamId: params.teamId,
userId: null,
periodStart,
inputTokens: params.inputTokens,
outputTokens: params.outputTokens,
cacheReadTokens: params.cacheReadTokens,
totalTokens: params.totalTokens,
cost: params.cost,
})
// 2. If triggered by a team member, update/create Member Usage record (userId = params.userId)
if (params.userId) {
await this.incrementBucket({
teamId: params.teamId,
userId: params.userId,
periodStart,
inputTokens: params.inputTokens,
outputTokens: params.outputTokens,
cacheReadTokens: params.cacheReadTokens,
totalTokens: params.totalTokens,
cost: params.cost,
})
}
}
async getTeamUsageStats(params: GetTeamUsageStatsParams): Promise<TeamUsageStatsResponse> {
const now = new Date()
const since = new Date(now)
switch (params.timeframe) {
case '1h':
// For 1h, target the current 1h bucket floored to start of current hour
since.setMinutes(0, 0, 0)
break
case '24h':
since.setDate(since.getDate() - 1)
since.setMinutes(0, 0, 0)
break
case '7d':
since.setDate(since.getDate() - 7)
since.setMinutes(0, 0, 0)
break
case '30d':
since.setDate(since.getDate() - 30)
since.setMinutes(0, 0, 0)
break
}
if (!params.userId) {
// Return Team-Level Usage (userId = null)
const teamRecords = await prisma.aiUsage.findMany({
where: {
teamId: params.teamId,
userId: null,
periodStart: { gte: since },
},
})
let inputTokens = 0
let outputTokens = 0
let cacheReadTokens = 0
let totalTokens = 0
let cost = 0
for (const r of teamRecords) {
inputTokens += r.inputTokens
outputTokens += r.outputTokens
cacheReadTokens += r.cacheReadTokens
totalTokens += r.totalTokens
cost += r.cost
}
return {
timeframe: params.timeframe,
team: {
inputTokens,
outputTokens,
cacheReadTokens,
totalTokens,
cost: Math.round((cost + Number.EPSILON) * 1000000) / 1000000,
},
}
} else {
// Return Specific Member Usage
const teamMember = await prisma.teamMember.findFirst({
where: {
teamId: params.teamId,
userId: params.userId,
},
include: { user: true },
})
if (!teamMember) {
throw new HTTPException(404, { message: 'Team member not found' })
}
const memberRecords = await prisma.aiUsage.findMany({
where: {
teamId: params.teamId,
userId: params.userId,
periodStart: { gte: since },
},
})
let inputTokens = 0
let outputTokens = 0
let cacheReadTokens = 0
let totalTokens = 0
let cost = 0
for (const r of memberRecords) {
inputTokens += r.inputTokens
outputTokens += r.outputTokens
cacheReadTokens += r.cacheReadTokens
totalTokens += r.totalTokens
cost += r.cost
}
return {
timeframe: params.timeframe,
member: {
userId: teamMember.user.id,
userName: teamMember.user.name,
userEmail: teamMember.user.email,
userImage: teamMember.user.image,
role: teamMember.role,
inputTokens,
outputTokens,
cacheReadTokens,
totalTokens,
cost: Math.round((cost + Number.EPSILON) * 1000000) / 1000000,
},
}
}
}
}
export const aiUsageService = new AiUsageService()
+1
View File
@@ -21,3 +21,4 @@ export * from './versionStack/versionStack'
export * from './hyrumtoken'
export * from './pagination'
export * from './chat/chat'
export * from './ai-usage/ai-usage'
@@ -0,0 +1,28 @@
-- CreateTable
CREATE TABLE "ai_usages" (
"id" TEXT NOT NULL,
"team_id" TEXT NOT NULL,
"user_id" TEXT,
"period_start" TIMESTAMP(3) NOT NULL,
"input_tokens" INTEGER NOT NULL DEFAULT 0,
"output_tokens" INTEGER NOT NULL DEFAULT 0,
"cache_read_tokens" INTEGER NOT NULL DEFAULT 0,
"total_tokens" INTEGER NOT NULL DEFAULT 0,
"cost" DOUBLE PRECISION NOT NULL DEFAULT 0,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(3) NOT NULL,
CONSTRAINT "ai_usages_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE INDEX "ai_usages_team_id_period_start_idx" ON "ai_usages"("team_id", "period_start");
-- CreateIndex
CREATE INDEX "ai_usages_team_id_user_id_period_start_idx" ON "ai_usages"("team_id", "user_id", "period_start");
-- AddForeignKey
ALTER TABLE "ai_usages" ADD CONSTRAINT "ai_usages_team_id_fkey" FOREIGN KEY ("team_id") REFERENCES "teams"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ai_usages" ADD CONSTRAINT "ai_usages_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;
@@ -0,0 +1,8 @@
/*
Warnings:
- A unique constraint covering the columns `[team_id,user_id,period_start]` on the table `ai_usages` will be added. If there are existing duplicate values, this will fail.
*/
-- CreateIndex
CREATE UNIQUE INDEX "ai_usages_team_id_user_id_period_start_key" ON "ai_usages"("team_id", "user_id", "period_start");
+25
View File
@@ -155,6 +155,7 @@ model User {
collections Collection[] @relation("UserToCollection")
shareLinks ShareLink[] @relation("UserToShareLink")
apiTokens ApiToken[] @relation("UserToApiToken")
aiUsages AiUsage[] @relation("UserToAiUsage")
@@map("users")
}
@@ -237,6 +238,7 @@ model Team {
skills Skill[] @relation("TeamToSkill")
sandbox Sandbox? @relation("TeamToSandbox")
agents Agent[] @relation("TeamToAgent")
aiUsages AiUsage[] @relation("TeamToAiUsage")
@@map("teams")
}
@@ -814,3 +816,26 @@ model ApiToken {
@@map("api_tokens")
}
model AiUsage {
id String @id @default(ulid())
teamId String @map("team_id")
userId String? @map("user_id")
periodStart DateTime @map("period_start")
inputTokens Int @default(0) @map("input_tokens")
outputTokens Int @default(0) @map("output_tokens")
cacheReadTokens Int @default(0) @map("cache_read_tokens")
totalTokens Int @default(0) @map("total_tokens")
cost Float @default(0) @map("cost")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
team Team @relation("TeamToAiUsage", fields: [teamId], references: [id], onDelete: Cascade)
user User? @relation("UserToAiUsage", fields: [userId], references: [id], onDelete: SetNull)
@@map("ai_usages")
@@unique([teamId, userId, periodStart])
@@index([teamId, periodStart])
@@index([teamId, userId, periodStart])
}
+5
View File
@@ -182,3 +182,8 @@ export type Collection = Prisma.CollectionModel
*
*/
export type ApiToken = Prisma.ApiTokenModel
/**
* Model AiUsage
*
*/
export type AiUsage = Prisma.AiUsageModel
+5
View File
@@ -206,3 +206,8 @@ export type Collection = Prisma.CollectionModel
*
*/
export type ApiToken = Prisma.ApiTokenModel
/**
* Model AiUsage
*
*/
export type AiUsage = Prisma.AiUsageModel
+43
View File
@@ -643,6 +643,33 @@ export type EnumAgentSessionTypeWithAggregatesFilter<$PrismaModel = never> = {
_max?: Prisma.NestedEnumAgentSessionTypeFilter<$PrismaModel>
}
export type FloatFilter<$PrismaModel = never> = {
equals?: number | Prisma.FloatFieldRefInput<$PrismaModel>
in?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
notIn?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
lt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
lte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
gt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
gte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
not?: Prisma.NestedFloatFilter<$PrismaModel> | number
}
export type FloatWithAggregatesFilter<$PrismaModel = never> = {
equals?: number | Prisma.FloatFieldRefInput<$PrismaModel>
in?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
notIn?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
lt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
lte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
gt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
gte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
not?: Prisma.NestedFloatWithAggregatesFilter<$PrismaModel> | number
_count?: Prisma.NestedIntFilter<$PrismaModel>
_avg?: Prisma.NestedFloatFilter<$PrismaModel>
_sum?: Prisma.NestedFloatFilter<$PrismaModel>
_min?: Prisma.NestedFloatFilter<$PrismaModel>
_max?: Prisma.NestedFloatFilter<$PrismaModel>
}
export type NestedStringFilter<$PrismaModel = never> = {
equals?: string | Prisma.StringFieldRefInput<$PrismaModel>
in?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel>
@@ -1218,4 +1245,20 @@ export type NestedEnumAgentSessionTypeWithAggregatesFilter<$PrismaModel = never>
_max?: Prisma.NestedEnumAgentSessionTypeFilter<$PrismaModel>
}
export type NestedFloatWithAggregatesFilter<$PrismaModel = never> = {
equals?: number | Prisma.FloatFieldRefInput<$PrismaModel>
in?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
notIn?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
lt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
lte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
gt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
gte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
not?: Prisma.NestedFloatWithAggregatesFilter<$PrismaModel> | number
_count?: Prisma.NestedIntFilter<$PrismaModel>
_avg?: Prisma.NestedFloatFilter<$PrismaModel>
_sum?: Prisma.NestedFloatFilter<$PrismaModel>
_min?: Prisma.NestedFloatFilter<$PrismaModel>
_max?: Prisma.NestedFloatFilter<$PrismaModel>
}
File diff suppressed because one or more lines are too long
+95 -2
View File
@@ -416,7 +416,8 @@ export const ModelName = {
Model: 'Model',
Provider: 'Provider',
Collection: 'Collection',
ApiToken: 'ApiToken'
ApiToken: 'ApiToken',
AiUsage: 'AiUsage'
} as const
export type ModelName = (typeof ModelName)[keyof typeof ModelName]
@@ -432,7 +433,7 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
omit: GlobalOmitOptions
}
meta: {
modelProps: "user" | "session" | "account" | "verification" | "authToken" | "team" | "sandbox" | "skill" | "teamMember" | "project" | "projectMember" | "shareLink" | "asset" | "storageKey" | "assetMetadataValue" | "assetComment" | "assetCommentAttachment" | "assetEmbedding" | "invite" | "metadataField" | "notification" | "systemSettings" | "task" | "workflowTask" | "agent" | "agentSkill" | "agentSession" | "agentSessionEntry" | "userMetadata" | "model" | "provider" | "collection" | "apiToken"
modelProps: "user" | "session" | "account" | "verification" | "authToken" | "team" | "sandbox" | "skill" | "teamMember" | "project" | "projectMember" | "shareLink" | "asset" | "storageKey" | "assetMetadataValue" | "assetComment" | "assetCommentAttachment" | "assetEmbedding" | "invite" | "metadataField" | "notification" | "systemSettings" | "task" | "workflowTask" | "agent" | "agentSkill" | "agentSession" | "agentSessionEntry" | "userMetadata" | "model" | "provider" | "collection" | "apiToken" | "aiUsage"
txIsolationLevel: TransactionIsolationLevel
}
model: {
@@ -2878,6 +2879,80 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
}
}
}
AiUsage: {
payload: Prisma.$AiUsagePayload<ExtArgs>
fields: Prisma.AiUsageFieldRefs
operations: {
findUnique: {
args: Prisma.AiUsageFindUniqueArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload> | null
}
findUniqueOrThrow: {
args: Prisma.AiUsageFindUniqueOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>
}
findFirst: {
args: Prisma.AiUsageFindFirstArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload> | null
}
findFirstOrThrow: {
args: Prisma.AiUsageFindFirstOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>
}
findMany: {
args: Prisma.AiUsageFindManyArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>[]
}
create: {
args: Prisma.AiUsageCreateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>
}
createMany: {
args: Prisma.AiUsageCreateManyArgs<ExtArgs>
result: BatchPayload
}
createManyAndReturn: {
args: Prisma.AiUsageCreateManyAndReturnArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>[]
}
delete: {
args: Prisma.AiUsageDeleteArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>
}
update: {
args: Prisma.AiUsageUpdateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>
}
deleteMany: {
args: Prisma.AiUsageDeleteManyArgs<ExtArgs>
result: BatchPayload
}
updateMany: {
args: Prisma.AiUsageUpdateManyArgs<ExtArgs>
result: BatchPayload
}
updateManyAndReturn: {
args: Prisma.AiUsageUpdateManyAndReturnArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>[]
}
upsert: {
args: Prisma.AiUsageUpsertArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>
}
aggregate: {
args: Prisma.AiUsageAggregateArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.AggregateAiUsage>
}
groupBy: {
args: Prisma.AiUsageGroupByArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.AiUsageGroupByOutputType>[]
}
count: {
args: Prisma.AiUsageCountArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.AiUsageCountAggregateOutputType> | number
}
}
}
}
} & {
other: {
@@ -3392,6 +3467,23 @@ export const ApiTokenScalarFieldEnum = {
export type ApiTokenScalarFieldEnum = (typeof ApiTokenScalarFieldEnum)[keyof typeof ApiTokenScalarFieldEnum]
export const AiUsageScalarFieldEnum = {
id: 'id',
teamId: 'teamId',
userId: 'userId',
periodStart: 'periodStart',
inputTokens: 'inputTokens',
outputTokens: 'outputTokens',
cacheReadTokens: 'cacheReadTokens',
totalTokens: 'totalTokens',
cost: 'cost',
createdAt: 'createdAt',
updatedAt: 'updatedAt'
} as const
export type AiUsageScalarFieldEnum = (typeof AiUsageScalarFieldEnum)[keyof typeof AiUsageScalarFieldEnum]
export const SortOrder = {
asc: 'asc',
desc: 'desc'
@@ -3889,6 +3981,7 @@ export type GlobalOmitConfig = {
provider?: Prisma.ProviderOmit
collection?: Prisma.CollectionOmit
apiToken?: Prisma.ApiTokenOmit
aiUsage?: Prisma.AiUsageOmit
}
/* Types for Logging */
@@ -83,7 +83,8 @@ export const ModelName = {
Model: 'Model',
Provider: 'Provider',
Collection: 'Collection',
ApiToken: 'ApiToken'
ApiToken: 'ApiToken',
AiUsage: 'AiUsage'
} as const
export type ModelName = (typeof ModelName)[keyof typeof ModelName]
@@ -577,6 +578,23 @@ export const ApiTokenScalarFieldEnum = {
export type ApiTokenScalarFieldEnum = (typeof ApiTokenScalarFieldEnum)[keyof typeof ApiTokenScalarFieldEnum]
export const AiUsageScalarFieldEnum = {
id: 'id',
teamId: 'teamId',
userId: 'userId',
periodStart: 'periodStart',
inputTokens: 'inputTokens',
outputTokens: 'outputTokens',
cacheReadTokens: 'cacheReadTokens',
totalTokens: 'totalTokens',
cost: 'cost',
createdAt: 'createdAt',
updatedAt: 'updatedAt'
} as const
export type AiUsageScalarFieldEnum = (typeof AiUsageScalarFieldEnum)[keyof typeof AiUsageScalarFieldEnum]
export const SortOrder = {
asc: 'asc',
desc: 'desc'
+1
View File
@@ -41,4 +41,5 @@ export type * from './models/Model.ts'
export type * from './models/Provider.ts'
export type * from './models/Collection.ts'
export type * from './models/ApiToken.ts'
export type * from './models/AiUsage.ts'
export type * from './commonInputTypes.ts'
File diff suppressed because it is too large Load Diff
+194
View File
@@ -199,6 +199,7 @@ export type TeamWhereInput = {
skills?: Prisma.SkillListRelationFilter
sandbox?: Prisma.XOR<Prisma.SandboxNullableScalarRelationFilter, Prisma.SandboxWhereInput> | null
agents?: Prisma.AgentListRelationFilter
aiUsages?: Prisma.AiUsageListRelationFilter
}
export type TeamOrderByWithRelationInput = {
@@ -219,6 +220,7 @@ export type TeamOrderByWithRelationInput = {
skills?: Prisma.SkillOrderByRelationAggregateInput
sandbox?: Prisma.SandboxOrderByWithRelationInput
agents?: Prisma.AgentOrderByRelationAggregateInput
aiUsages?: Prisma.AiUsageOrderByRelationAggregateInput
}
export type TeamWhereUniqueInput = Prisma.AtLeast<{
@@ -242,6 +244,7 @@ export type TeamWhereUniqueInput = Prisma.AtLeast<{
skills?: Prisma.SkillListRelationFilter
sandbox?: Prisma.XOR<Prisma.SandboxNullableScalarRelationFilter, Prisma.SandboxWhereInput> | null
agents?: Prisma.AgentListRelationFilter
aiUsages?: Prisma.AiUsageListRelationFilter
}, "id" | "rootFolderId">
export type TeamOrderByWithAggregationInput = {
@@ -285,6 +288,7 @@ export type TeamCreateInput = {
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateInput = {
@@ -304,6 +308,7 @@ export type TeamUncheckedCreateInput = {
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamUpdateInput = {
@@ -323,6 +328,7 @@ export type TeamUpdateInput = {
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateInput = {
@@ -342,6 +348,7 @@ export type TeamUncheckedUpdateInput = {
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateManyInput = {
@@ -579,6 +586,20 @@ export type TeamUpdateOneRequiredWithoutProvidersNestedInput = {
update?: Prisma.XOR<Prisma.XOR<Prisma.TeamUpdateToOneWithWhereWithoutProvidersInput, Prisma.TeamUpdateWithoutProvidersInput>, Prisma.TeamUncheckedUpdateWithoutProvidersInput>
}
export type TeamCreateNestedOneWithoutAiUsagesInput = {
create?: Prisma.XOR<Prisma.TeamCreateWithoutAiUsagesInput, Prisma.TeamUncheckedCreateWithoutAiUsagesInput>
connectOrCreate?: Prisma.TeamCreateOrConnectWithoutAiUsagesInput
connect?: Prisma.TeamWhereUniqueInput
}
export type TeamUpdateOneRequiredWithoutAiUsagesNestedInput = {
create?: Prisma.XOR<Prisma.TeamCreateWithoutAiUsagesInput, Prisma.TeamUncheckedCreateWithoutAiUsagesInput>
connectOrCreate?: Prisma.TeamCreateOrConnectWithoutAiUsagesInput
upsert?: Prisma.TeamUpsertWithoutAiUsagesInput
connect?: Prisma.TeamWhereUniqueInput
update?: Prisma.XOR<Prisma.XOR<Prisma.TeamUpdateToOneWithWhereWithoutAiUsagesInput, Prisma.TeamUpdateWithoutAiUsagesInput>, Prisma.TeamUncheckedUpdateWithoutAiUsagesInput>
}
export type TeamCreateWithoutSandboxInput = {
id?: string
name: string
@@ -595,6 +616,7 @@ export type TeamCreateWithoutSandboxInput = {
providers?: Prisma.ProviderCreateNestedManyWithoutTeamInput
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutSandboxInput = {
@@ -613,6 +635,7 @@ export type TeamUncheckedCreateWithoutSandboxInput = {
providers?: Prisma.ProviderUncheckedCreateNestedManyWithoutTeamInput
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutSandboxInput = {
@@ -647,6 +670,7 @@ export type TeamUpdateWithoutSandboxInput = {
providers?: Prisma.ProviderUpdateManyWithoutTeamNestedInput
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutSandboxInput = {
@@ -665,6 +689,7 @@ export type TeamUncheckedUpdateWithoutSandboxInput = {
providers?: Prisma.ProviderUncheckedUpdateManyWithoutTeamNestedInput
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutSkillsInput = {
@@ -683,6 +708,7 @@ export type TeamCreateWithoutSkillsInput = {
providers?: Prisma.ProviderCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutSkillsInput = {
@@ -701,6 +727,7 @@ export type TeamUncheckedCreateWithoutSkillsInput = {
providers?: Prisma.ProviderUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutSkillsInput = {
@@ -735,6 +762,7 @@ export type TeamUpdateWithoutSkillsInput = {
providers?: Prisma.ProviderUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutSkillsInput = {
@@ -753,6 +781,7 @@ export type TeamUncheckedUpdateWithoutSkillsInput = {
providers?: Prisma.ProviderUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutMembersInput = {
@@ -771,6 +800,7 @@ export type TeamCreateWithoutMembersInput = {
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutMembersInput = {
@@ -789,6 +819,7 @@ export type TeamUncheckedCreateWithoutMembersInput = {
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutMembersInput = {
@@ -823,6 +854,7 @@ export type TeamUpdateWithoutMembersInput = {
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutMembersInput = {
@@ -841,6 +873,7 @@ export type TeamUncheckedUpdateWithoutMembersInput = {
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutProjectsInput = {
@@ -859,6 +892,7 @@ export type TeamCreateWithoutProjectsInput = {
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutProjectsInput = {
@@ -877,6 +911,7 @@ export type TeamUncheckedCreateWithoutProjectsInput = {
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutProjectsInput = {
@@ -911,6 +946,7 @@ export type TeamUpdateWithoutProjectsInput = {
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutProjectsInput = {
@@ -929,6 +965,7 @@ export type TeamUncheckedUpdateWithoutProjectsInput = {
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutRootFolderInput = {
@@ -947,6 +984,7 @@ export type TeamCreateWithoutRootFolderInput = {
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutRootFolderInput = {
@@ -965,6 +1003,7 @@ export type TeamUncheckedCreateWithoutRootFolderInput = {
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutRootFolderInput = {
@@ -999,6 +1038,7 @@ export type TeamUpdateWithoutRootFolderInput = {
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutRootFolderInput = {
@@ -1017,6 +1057,7 @@ export type TeamUncheckedUpdateWithoutRootFolderInput = {
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutInvitesInput = {
@@ -1035,6 +1076,7 @@ export type TeamCreateWithoutInvitesInput = {
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutInvitesInput = {
@@ -1053,6 +1095,7 @@ export type TeamUncheckedCreateWithoutInvitesInput = {
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutInvitesInput = {
@@ -1087,6 +1130,7 @@ export type TeamUpdateWithoutInvitesInput = {
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutInvitesInput = {
@@ -1105,6 +1149,7 @@ export type TeamUncheckedUpdateWithoutInvitesInput = {
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutMetadataFieldsInput = {
@@ -1123,6 +1168,7 @@ export type TeamCreateWithoutMetadataFieldsInput = {
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutMetadataFieldsInput = {
@@ -1141,6 +1187,7 @@ export type TeamUncheckedCreateWithoutMetadataFieldsInput = {
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutMetadataFieldsInput = {
@@ -1175,6 +1222,7 @@ export type TeamUpdateWithoutMetadataFieldsInput = {
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutMetadataFieldsInput = {
@@ -1193,6 +1241,7 @@ export type TeamUncheckedUpdateWithoutMetadataFieldsInput = {
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutNotificationsInput = {
@@ -1211,6 +1260,7 @@ export type TeamCreateWithoutNotificationsInput = {
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutNotificationsInput = {
@@ -1229,6 +1279,7 @@ export type TeamUncheckedCreateWithoutNotificationsInput = {
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutNotificationsInput = {
@@ -1263,6 +1314,7 @@ export type TeamUpdateWithoutNotificationsInput = {
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutNotificationsInput = {
@@ -1281,6 +1333,7 @@ export type TeamUncheckedUpdateWithoutNotificationsInput = {
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutAgentsInput = {
@@ -1299,6 +1352,7 @@ export type TeamCreateWithoutAgentsInput = {
providers?: Prisma.ProviderCreateNestedManyWithoutTeamInput
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutAgentsInput = {
@@ -1317,6 +1371,7 @@ export type TeamUncheckedCreateWithoutAgentsInput = {
providers?: Prisma.ProviderUncheckedCreateNestedManyWithoutTeamInput
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutAgentsInput = {
@@ -1351,6 +1406,7 @@ export type TeamUpdateWithoutAgentsInput = {
providers?: Prisma.ProviderUpdateManyWithoutTeamNestedInput
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutAgentsInput = {
@@ -1369,6 +1425,7 @@ export type TeamUncheckedUpdateWithoutAgentsInput = {
providers?: Prisma.ProviderUncheckedUpdateManyWithoutTeamNestedInput
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutUserMetadataInput = {
@@ -1387,6 +1444,7 @@ export type TeamCreateWithoutUserMetadataInput = {
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutUserMetadataInput = {
@@ -1405,6 +1463,7 @@ export type TeamUncheckedCreateWithoutUserMetadataInput = {
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutUserMetadataInput = {
@@ -1439,6 +1498,7 @@ export type TeamUpdateWithoutUserMetadataInput = {
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutUserMetadataInput = {
@@ -1457,6 +1517,7 @@ export type TeamUncheckedUpdateWithoutUserMetadataInput = {
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutProvidersInput = {
@@ -1475,6 +1536,7 @@ export type TeamCreateWithoutProvidersInput = {
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutProvidersInput = {
@@ -1493,6 +1555,7 @@ export type TeamUncheckedCreateWithoutProvidersInput = {
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutProvidersInput = {
@@ -1527,6 +1590,7 @@ export type TeamUpdateWithoutProvidersInput = {
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutProvidersInput = {
@@ -1545,6 +1609,99 @@ export type TeamUncheckedUpdateWithoutProvidersInput = {
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutAiUsagesInput = {
id?: string
name: string
settings?:PrismaJson.Settings | Prisma.NullableJsonNullValueInput
createdAt?: Date | string
updatedAt?: Date | string
rootFolder?: Prisma.AssetCreateNestedOneWithoutTeamRootFolderInput
members?: Prisma.TeamMemberCreateNestedManyWithoutTeamInput
projects?: Prisma.ProjectCreateNestedManyWithoutTeamInput
metadataFields?: Prisma.MetadataFieldCreateNestedManyWithoutTeamInput
invites?: Prisma.InviteCreateNestedManyWithoutTeamInput
notifications?: Prisma.NotificationCreateNestedManyWithoutTeamInput
userMetadata?: Prisma.UserMetadataCreateNestedManyWithoutTeamInput
providers?: Prisma.ProviderCreateNestedManyWithoutTeamInput
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutAiUsagesInput = {
id?: string
name: string
settings?:PrismaJson.Settings | Prisma.NullableJsonNullValueInput
createdAt?: Date | string
updatedAt?: Date | string
rootFolderId?: string | null
members?: Prisma.TeamMemberUncheckedCreateNestedManyWithoutTeamInput
projects?: Prisma.ProjectUncheckedCreateNestedManyWithoutTeamInput
metadataFields?: Prisma.MetadataFieldUncheckedCreateNestedManyWithoutTeamInput
invites?: Prisma.InviteUncheckedCreateNestedManyWithoutTeamInput
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutTeamInput
userMetadata?: Prisma.UserMetadataUncheckedCreateNestedManyWithoutTeamInput
providers?: Prisma.ProviderUncheckedCreateNestedManyWithoutTeamInput
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutAiUsagesInput = {
where: Prisma.TeamWhereUniqueInput
create: Prisma.XOR<Prisma.TeamCreateWithoutAiUsagesInput, Prisma.TeamUncheckedCreateWithoutAiUsagesInput>
}
export type TeamUpsertWithoutAiUsagesInput = {
update: Prisma.XOR<Prisma.TeamUpdateWithoutAiUsagesInput, Prisma.TeamUncheckedUpdateWithoutAiUsagesInput>
create: Prisma.XOR<Prisma.TeamCreateWithoutAiUsagesInput, Prisma.TeamUncheckedCreateWithoutAiUsagesInput>
where?: Prisma.TeamWhereInput
}
export type TeamUpdateToOneWithWhereWithoutAiUsagesInput = {
where?: Prisma.TeamWhereInput
data: Prisma.XOR<Prisma.TeamUpdateWithoutAiUsagesInput, Prisma.TeamUncheckedUpdateWithoutAiUsagesInput>
}
export type TeamUpdateWithoutAiUsagesInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
name?: Prisma.StringFieldUpdateOperationsInput | string
settings?:PrismaJson.Settings | Prisma.NullableJsonNullValueInput
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
rootFolder?: Prisma.AssetUpdateOneWithoutTeamRootFolderNestedInput
members?: Prisma.TeamMemberUpdateManyWithoutTeamNestedInput
projects?: Prisma.ProjectUpdateManyWithoutTeamNestedInput
metadataFields?: Prisma.MetadataFieldUpdateManyWithoutTeamNestedInput
invites?: Prisma.InviteUpdateManyWithoutTeamNestedInput
notifications?: Prisma.NotificationUpdateManyWithoutTeamNestedInput
userMetadata?: Prisma.UserMetadataUpdateManyWithoutTeamNestedInput
providers?: Prisma.ProviderUpdateManyWithoutTeamNestedInput
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutAiUsagesInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
name?: Prisma.StringFieldUpdateOperationsInput | string
settings?:PrismaJson.Settings | Prisma.NullableJsonNullValueInput
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
rootFolderId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
members?: Prisma.TeamMemberUncheckedUpdateManyWithoutTeamNestedInput
projects?: Prisma.ProjectUncheckedUpdateManyWithoutTeamNestedInput
metadataFields?: Prisma.MetadataFieldUncheckedUpdateManyWithoutTeamNestedInput
invites?: Prisma.InviteUncheckedUpdateManyWithoutTeamNestedInput
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutTeamNestedInput
userMetadata?: Prisma.UserMetadataUncheckedUpdateManyWithoutTeamNestedInput
providers?: Prisma.ProviderUncheckedUpdateManyWithoutTeamNestedInput
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
}
@@ -1562,6 +1719,7 @@ export type TeamCountOutputType = {
providers: number
skills: number
agents: number
aiUsages: number
}
export type TeamCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
@@ -1574,6 +1732,7 @@ export type TeamCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.I
providers?: boolean | TeamCountOutputTypeCountProvidersArgs
skills?: boolean | TeamCountOutputTypeCountSkillsArgs
agents?: boolean | TeamCountOutputTypeCountAgentsArgs
aiUsages?: boolean | TeamCountOutputTypeCountAiUsagesArgs
}
/**
@@ -1649,6 +1808,13 @@ export type TeamCountOutputTypeCountAgentsArgs<ExtArgs extends runtime.Types.Ext
where?: Prisma.AgentWhereInput
}
/**
* TeamCountOutputType without action
*/
export type TeamCountOutputTypeCountAiUsagesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
where?: Prisma.AiUsageWhereInput
}
export type TeamSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
id?: boolean
@@ -1668,6 +1834,7 @@ export type TeamSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = r
skills?: boolean | Prisma.Team$skillsArgs<ExtArgs>
sandbox?: boolean | Prisma.Team$sandboxArgs<ExtArgs>
agents?: boolean | Prisma.Team$agentsArgs<ExtArgs>
aiUsages?: boolean | Prisma.Team$aiUsagesArgs<ExtArgs>
_count?: boolean | Prisma.TeamCountOutputTypeDefaultArgs<ExtArgs>
}, ExtArgs["result"]["team"]>
@@ -1713,6 +1880,7 @@ export type TeamInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs =
skills?: boolean | Prisma.Team$skillsArgs<ExtArgs>
sandbox?: boolean | Prisma.Team$sandboxArgs<ExtArgs>
agents?: boolean | Prisma.Team$agentsArgs<ExtArgs>
aiUsages?: boolean | Prisma.Team$aiUsagesArgs<ExtArgs>
_count?: boolean | Prisma.TeamCountOutputTypeDefaultArgs<ExtArgs>
}
export type TeamIncludeCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
@@ -1736,6 +1904,7 @@ export type $TeamPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs =
skills: Prisma.$SkillPayload<ExtArgs>[]
sandbox: Prisma.$SandboxPayload<ExtArgs> | null
agents: Prisma.$AgentPayload<ExtArgs>[]
aiUsages: Prisma.$AiUsagePayload<ExtArgs>[]
}
scalars: runtime.Types.Extensions.GetPayloadResult<{
id: string
@@ -2152,6 +2321,7 @@ export interface Prisma__TeamClient<T, Null = never, ExtArgs extends runtime.Typ
skills<T extends Prisma.Team$skillsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Team$skillsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$SkillPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
sandbox<T extends Prisma.Team$sandboxArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Team$sandboxArgs<ExtArgs>>): Prisma.Prisma__SandboxClient<runtime.Types.Result.GetResult<Prisma.$SandboxPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
agents<T extends Prisma.Team$agentsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Team$agentsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AgentPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
aiUsages<T extends Prisma.Team$aiUsagesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Team$aiUsagesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AiUsagePayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
@@ -2841,6 +3011,30 @@ export type Team$agentsArgs<ExtArgs extends runtime.Types.Extensions.InternalArg
distinct?: Prisma.AgentScalarFieldEnum | Prisma.AgentScalarFieldEnum[]
}
/**
* Team.aiUsages
*/
export type Team$aiUsagesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the AiUsage
*/
select?: Prisma.AiUsageSelect<ExtArgs> | null
/**
* Omit specific fields from the AiUsage
*/
omit?: Prisma.AiUsageOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.AiUsageInclude<ExtArgs> | null
where?: Prisma.AiUsageWhereInput
orderBy?: Prisma.AiUsageOrderByWithRelationInput | Prisma.AiUsageOrderByWithRelationInput[]
cursor?: Prisma.AiUsageWhereUniqueInput
take?: number
skip?: number
distinct?: Prisma.AiUsageScalarFieldEnum | Prisma.AiUsageScalarFieldEnum[]
}
/**
* Team without action
*/
+268
View File
@@ -245,6 +245,7 @@ export type UserWhereInput = {
collections?: Prisma.CollectionListRelationFilter
shareLinks?: Prisma.ShareLinkListRelationFilter
apiTokens?: Prisma.ApiTokenListRelationFilter
aiUsages?: Prisma.AiUsageListRelationFilter
}
export type UserOrderByWithRelationInput = {
@@ -276,6 +277,7 @@ export type UserOrderByWithRelationInput = {
collections?: Prisma.CollectionOrderByRelationAggregateInput
shareLinks?: Prisma.ShareLinkOrderByRelationAggregateInput
apiTokens?: Prisma.ApiTokenOrderByRelationAggregateInput
aiUsages?: Prisma.AiUsageOrderByRelationAggregateInput
}
export type UserWhereUniqueInput = Prisma.AtLeast<{
@@ -310,6 +312,7 @@ export type UserWhereUniqueInput = Prisma.AtLeast<{
collections?: Prisma.CollectionListRelationFilter
shareLinks?: Prisma.ShareLinkListRelationFilter
apiTokens?: Prisma.ApiTokenListRelationFilter
aiUsages?: Prisma.AiUsageListRelationFilter
}, "id" | "email">
export type UserOrderByWithAggregationInput = {
@@ -375,6 +378,7 @@ export type UserCreateInput = {
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateInput = {
@@ -406,6 +410,7 @@ export type UserUncheckedCreateInput = {
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserUpdateInput = {
@@ -437,6 +442,7 @@ export type UserUpdateInput = {
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateInput = {
@@ -468,6 +474,7 @@ export type UserUncheckedUpdateInput = {
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateManyInput = {
@@ -838,6 +845,22 @@ export type UserUpdateOneRequiredWithoutApiTokensNestedInput = {
update?: Prisma.XOR<Prisma.XOR<Prisma.UserUpdateToOneWithWhereWithoutApiTokensInput, Prisma.UserUpdateWithoutApiTokensInput>, Prisma.UserUncheckedUpdateWithoutApiTokensInput>
}
export type UserCreateNestedOneWithoutAiUsagesInput = {
create?: Prisma.XOR<Prisma.UserCreateWithoutAiUsagesInput, Prisma.UserUncheckedCreateWithoutAiUsagesInput>
connectOrCreate?: Prisma.UserCreateOrConnectWithoutAiUsagesInput
connect?: Prisma.UserWhereUniqueInput
}
export type UserUpdateOneWithoutAiUsagesNestedInput = {
create?: Prisma.XOR<Prisma.UserCreateWithoutAiUsagesInput, Prisma.UserUncheckedCreateWithoutAiUsagesInput>
connectOrCreate?: Prisma.UserCreateOrConnectWithoutAiUsagesInput
upsert?: Prisma.UserUpsertWithoutAiUsagesInput
disconnect?: Prisma.UserWhereInput | boolean
delete?: Prisma.UserWhereInput | boolean
connect?: Prisma.UserWhereUniqueInput
update?: Prisma.XOR<Prisma.XOR<Prisma.UserUpdateToOneWithWhereWithoutAiUsagesInput, Prisma.UserUpdateWithoutAiUsagesInput>, Prisma.UserUncheckedUpdateWithoutAiUsagesInput>
}
export type UserCreateWithoutSessionsInput = {
id?: string
type?: $Enums.UserType
@@ -866,6 +889,7 @@ export type UserCreateWithoutSessionsInput = {
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutSessionsInput = {
@@ -896,6 +920,7 @@ export type UserUncheckedCreateWithoutSessionsInput = {
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutSessionsInput = {
@@ -942,6 +967,7 @@ export type UserUpdateWithoutSessionsInput = {
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutSessionsInput = {
@@ -972,6 +998,7 @@ export type UserUncheckedUpdateWithoutSessionsInput = {
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutAccountsInput = {
@@ -1002,6 +1029,7 @@ export type UserCreateWithoutAccountsInput = {
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutAccountsInput = {
@@ -1032,6 +1060,7 @@ export type UserUncheckedCreateWithoutAccountsInput = {
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutAccountsInput = {
@@ -1078,6 +1107,7 @@ export type UserUpdateWithoutAccountsInput = {
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutAccountsInput = {
@@ -1108,6 +1138,7 @@ export type UserUncheckedUpdateWithoutAccountsInput = {
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutAuthTokensInput = {
@@ -1138,6 +1169,7 @@ export type UserCreateWithoutAuthTokensInput = {
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutAuthTokensInput = {
@@ -1168,6 +1200,7 @@ export type UserUncheckedCreateWithoutAuthTokensInput = {
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutAuthTokensInput = {
@@ -1214,6 +1247,7 @@ export type UserUpdateWithoutAuthTokensInput = {
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutAuthTokensInput = {
@@ -1244,6 +1278,7 @@ export type UserUncheckedUpdateWithoutAuthTokensInput = {
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutTeamMembersInput = {
@@ -1274,6 +1309,7 @@ export type UserCreateWithoutTeamMembersInput = {
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutTeamMembersInput = {
@@ -1304,6 +1340,7 @@ export type UserUncheckedCreateWithoutTeamMembersInput = {
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutTeamMembersInput = {
@@ -1350,6 +1387,7 @@ export type UserUpdateWithoutTeamMembersInput = {
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutTeamMembersInput = {
@@ -1380,6 +1418,7 @@ export type UserUncheckedUpdateWithoutTeamMembersInput = {
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutShareLinksInput = {
@@ -1410,6 +1449,7 @@ export type UserCreateWithoutShareLinksInput = {
userMetadata?: Prisma.UserMetadataCreateNestedManyWithoutUserInput
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutShareLinksInput = {
@@ -1440,6 +1480,7 @@ export type UserUncheckedCreateWithoutShareLinksInput = {
userMetadata?: Prisma.UserMetadataUncheckedCreateNestedManyWithoutUserInput
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutShareLinksInput = {
@@ -1486,6 +1527,7 @@ export type UserUpdateWithoutShareLinksInput = {
userMetadata?: Prisma.UserMetadataUpdateManyWithoutUserNestedInput
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutShareLinksInput = {
@@ -1516,6 +1558,7 @@ export type UserUncheckedUpdateWithoutShareLinksInput = {
userMetadata?: Prisma.UserMetadataUncheckedUpdateManyWithoutUserNestedInput
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutAssetsInput = {
@@ -1546,6 +1589,7 @@ export type UserCreateWithoutAssetsInput = {
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutAssetsInput = {
@@ -1576,6 +1620,7 @@ export type UserUncheckedCreateWithoutAssetsInput = {
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutAssetsInput = {
@@ -1622,6 +1667,7 @@ export type UserUpdateWithoutAssetsInput = {
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutAssetsInput = {
@@ -1652,6 +1698,7 @@ export type UserUncheckedUpdateWithoutAssetsInput = {
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutCommentsInput = {
@@ -1682,6 +1729,7 @@ export type UserCreateWithoutCommentsInput = {
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutCommentsInput = {
@@ -1712,6 +1760,7 @@ export type UserUncheckedCreateWithoutCommentsInput = {
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutCommentsInput = {
@@ -1747,6 +1796,7 @@ export type UserCreateWithoutCompletionChangedCommentsInput = {
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutCompletionChangedCommentsInput = {
@@ -1777,6 +1827,7 @@ export type UserUncheckedCreateWithoutCompletionChangedCommentsInput = {
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutCompletionChangedCommentsInput = {
@@ -1823,6 +1874,7 @@ export type UserUpdateWithoutCommentsInput = {
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutCommentsInput = {
@@ -1853,6 +1905,7 @@ export type UserUncheckedUpdateWithoutCommentsInput = {
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserUpsertWithoutCompletionChangedCommentsInput = {
@@ -1894,6 +1947,7 @@ export type UserUpdateWithoutCompletionChangedCommentsInput = {
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutCompletionChangedCommentsInput = {
@@ -1924,6 +1978,7 @@ export type UserUncheckedUpdateWithoutCompletionChangedCommentsInput = {
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutCreatedInvitesInput = {
@@ -1954,6 +2009,7 @@ export type UserCreateWithoutCreatedInvitesInput = {
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutCreatedInvitesInput = {
@@ -1984,6 +2040,7 @@ export type UserUncheckedCreateWithoutCreatedInvitesInput = {
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutCreatedInvitesInput = {
@@ -2030,6 +2087,7 @@ export type UserUpdateWithoutCreatedInvitesInput = {
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutCreatedInvitesInput = {
@@ -2060,6 +2118,7 @@ export type UserUncheckedUpdateWithoutCreatedInvitesInput = {
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutCreatedNotificationsInput = {
@@ -2090,6 +2149,7 @@ export type UserCreateWithoutCreatedNotificationsInput = {
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutCreatedNotificationsInput = {
@@ -2120,6 +2180,7 @@ export type UserUncheckedCreateWithoutCreatedNotificationsInput = {
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutCreatedNotificationsInput = {
@@ -2155,6 +2216,7 @@ export type UserCreateWithoutNotificationsInput = {
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutNotificationsInput = {
@@ -2185,6 +2247,7 @@ export type UserUncheckedCreateWithoutNotificationsInput = {
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutNotificationsInput = {
@@ -2231,6 +2294,7 @@ export type UserUpdateWithoutCreatedNotificationsInput = {
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutCreatedNotificationsInput = {
@@ -2261,6 +2325,7 @@ export type UserUncheckedUpdateWithoutCreatedNotificationsInput = {
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserUpsertWithoutNotificationsInput = {
@@ -2302,6 +2367,7 @@ export type UserUpdateWithoutNotificationsInput = {
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutNotificationsInput = {
@@ -2332,6 +2398,7 @@ export type UserUncheckedUpdateWithoutNotificationsInput = {
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutTasksInput = {
@@ -2362,6 +2429,7 @@ export type UserCreateWithoutTasksInput = {
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutTasksInput = {
@@ -2392,6 +2460,7 @@ export type UserUncheckedCreateWithoutTasksInput = {
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutTasksInput = {
@@ -2438,6 +2507,7 @@ export type UserUpdateWithoutTasksInput = {
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutTasksInput = {
@@ -2468,6 +2538,7 @@ export type UserUncheckedUpdateWithoutTasksInput = {
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutAgentInput = {
@@ -2498,6 +2569,7 @@ export type UserCreateWithoutAgentInput = {
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutAgentInput = {
@@ -2528,6 +2600,7 @@ export type UserUncheckedCreateWithoutAgentInput = {
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutAgentInput = {
@@ -2574,6 +2647,7 @@ export type UserUpdateWithoutAgentInput = {
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutAgentInput = {
@@ -2604,6 +2678,7 @@ export type UserUncheckedUpdateWithoutAgentInput = {
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutAgentSessionsInput = {
@@ -2634,6 +2709,7 @@ export type UserCreateWithoutAgentSessionsInput = {
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutAgentSessionsInput = {
@@ -2664,6 +2740,7 @@ export type UserUncheckedCreateWithoutAgentSessionsInput = {
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutAgentSessionsInput = {
@@ -2710,6 +2787,7 @@ export type UserUpdateWithoutAgentSessionsInput = {
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutAgentSessionsInput = {
@@ -2740,6 +2818,7 @@ export type UserUncheckedUpdateWithoutAgentSessionsInput = {
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutUserMetadataInput = {
@@ -2770,6 +2849,7 @@ export type UserCreateWithoutUserMetadataInput = {
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutUserMetadataInput = {
@@ -2800,6 +2880,7 @@ export type UserUncheckedCreateWithoutUserMetadataInput = {
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutUserMetadataInput = {
@@ -2846,6 +2927,7 @@ export type UserUpdateWithoutUserMetadataInput = {
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutUserMetadataInput = {
@@ -2876,6 +2958,7 @@ export type UserUncheckedUpdateWithoutUserMetadataInput = {
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutCollectionsInput = {
@@ -2906,6 +2989,7 @@ export type UserCreateWithoutCollectionsInput = {
userMetadata?: Prisma.UserMetadataCreateNestedManyWithoutUserInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutCollectionsInput = {
@@ -2936,6 +3020,7 @@ export type UserUncheckedCreateWithoutCollectionsInput = {
userMetadata?: Prisma.UserMetadataUncheckedCreateNestedManyWithoutUserInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutCollectionsInput = {
@@ -2982,6 +3067,7 @@ export type UserUpdateWithoutCollectionsInput = {
userMetadata?: Prisma.UserMetadataUpdateManyWithoutUserNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutCollectionsInput = {
@@ -3012,6 +3098,7 @@ export type UserUncheckedUpdateWithoutCollectionsInput = {
userMetadata?: Prisma.UserMetadataUncheckedUpdateManyWithoutUserNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutApiTokensInput = {
@@ -3042,6 +3129,7 @@ export type UserCreateWithoutApiTokensInput = {
userMetadata?: Prisma.UserMetadataCreateNestedManyWithoutUserInput
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutApiTokensInput = {
@@ -3072,6 +3160,7 @@ export type UserUncheckedCreateWithoutApiTokensInput = {
userMetadata?: Prisma.UserMetadataUncheckedCreateNestedManyWithoutUserInput
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutApiTokensInput = {
@@ -3118,6 +3207,7 @@ export type UserUpdateWithoutApiTokensInput = {
userMetadata?: Prisma.UserMetadataUpdateManyWithoutUserNestedInput
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutApiTokensInput = {
@@ -3148,6 +3238,147 @@ export type UserUncheckedUpdateWithoutApiTokensInput = {
userMetadata?: Prisma.UserMetadataUncheckedUpdateManyWithoutUserNestedInput
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutAiUsagesInput = {
id?: string
type?: $Enums.UserType
name: string
email: string
emailVerified?: boolean
image?: string | null
password?: string | null
agentSettings?:PrismaJson.AgentSettings | Prisma.NullableJsonNullValueInput
guestEmail?: string | null
createdAt?: Date | string
updatedAt?: Date | string
assets?: Prisma.AssetCreateNestedManyWithoutCreatorInput
authTokens?: Prisma.AuthTokenCreateNestedManyWithoutUserInput
tasks?: Prisma.TaskCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationCreateNestedManyWithoutUserInput
sessions?: Prisma.SessionCreateNestedManyWithoutUserInput
accounts?: Prisma.AccountCreateNestedManyWithoutUserInput
agent?: Prisma.AgentCreateNestedOneWithoutUserInput
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutUserInput
userMetadata?: Prisma.UserMetadataCreateNestedManyWithoutUserInput
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutAiUsagesInput = {
id?: string
type?: $Enums.UserType
name: string
email: string
emailVerified?: boolean
image?: string | null
password?: string | null
agentSettings?:PrismaJson.AgentSettings | Prisma.NullableJsonNullValueInput
guestEmail?: string | null
createdAt?: Date | string
updatedAt?: Date | string
assets?: Prisma.AssetUncheckedCreateNestedManyWithoutCreatorInput
authTokens?: Prisma.AuthTokenUncheckedCreateNestedManyWithoutUserInput
tasks?: Prisma.TaskUncheckedCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberUncheckedCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteUncheckedCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutUserInput
sessions?: Prisma.SessionUncheckedCreateNestedManyWithoutUserInput
accounts?: Prisma.AccountUncheckedCreateNestedManyWithoutUserInput
agent?: Prisma.AgentUncheckedCreateNestedOneWithoutUserInput
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutUserInput
userMetadata?: Prisma.UserMetadataUncheckedCreateNestedManyWithoutUserInput
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutAiUsagesInput = {
where: Prisma.UserWhereUniqueInput
create: Prisma.XOR<Prisma.UserCreateWithoutAiUsagesInput, Prisma.UserUncheckedCreateWithoutAiUsagesInput>
}
export type UserUpsertWithoutAiUsagesInput = {
update: Prisma.XOR<Prisma.UserUpdateWithoutAiUsagesInput, Prisma.UserUncheckedUpdateWithoutAiUsagesInput>
create: Prisma.XOR<Prisma.UserCreateWithoutAiUsagesInput, Prisma.UserUncheckedCreateWithoutAiUsagesInput>
where?: Prisma.UserWhereInput
}
export type UserUpdateToOneWithWhereWithoutAiUsagesInput = {
where?: Prisma.UserWhereInput
data: Prisma.XOR<Prisma.UserUpdateWithoutAiUsagesInput, Prisma.UserUncheckedUpdateWithoutAiUsagesInput>
}
export type UserUpdateWithoutAiUsagesInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
type?: Prisma.EnumUserTypeFieldUpdateOperationsInput | $Enums.UserType
name?: Prisma.StringFieldUpdateOperationsInput | string
email?: Prisma.StringFieldUpdateOperationsInput | string
emailVerified?: Prisma.BoolFieldUpdateOperationsInput | boolean
image?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
password?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
agentSettings?:PrismaJson.AgentSettings | Prisma.NullableJsonNullValueInput
guestEmail?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
assets?: Prisma.AssetUpdateManyWithoutCreatorNestedInput
authTokens?: Prisma.AuthTokenUpdateManyWithoutUserNestedInput
tasks?: Prisma.TaskUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUpdateManyWithoutUserNestedInput
sessions?: Prisma.SessionUpdateManyWithoutUserNestedInput
accounts?: Prisma.AccountUpdateManyWithoutUserNestedInput
agent?: Prisma.AgentUpdateOneWithoutUserNestedInput
agentSessions?: Prisma.AgentSessionUpdateManyWithoutUserNestedInput
userMetadata?: Prisma.UserMetadataUpdateManyWithoutUserNestedInput
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutAiUsagesInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
type?: Prisma.EnumUserTypeFieldUpdateOperationsInput | $Enums.UserType
name?: Prisma.StringFieldUpdateOperationsInput | string
email?: Prisma.StringFieldUpdateOperationsInput | string
emailVerified?: Prisma.BoolFieldUpdateOperationsInput | boolean
image?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
password?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
agentSettings?:PrismaJson.AgentSettings | Prisma.NullableJsonNullValueInput
guestEmail?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
assets?: Prisma.AssetUncheckedUpdateManyWithoutCreatorNestedInput
authTokens?: Prisma.AuthTokenUncheckedUpdateManyWithoutUserNestedInput
tasks?: Prisma.TaskUncheckedUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUncheckedUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUncheckedUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUncheckedUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutUserNestedInput
sessions?: Prisma.SessionUncheckedUpdateManyWithoutUserNestedInput
accounts?: Prisma.AccountUncheckedUpdateManyWithoutUserNestedInput
agent?: Prisma.AgentUncheckedUpdateOneWithoutUserNestedInput
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutUserNestedInput
userMetadata?: Prisma.UserMetadataUncheckedUpdateManyWithoutUserNestedInput
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
}
@@ -3172,6 +3403,7 @@ export type UserCountOutputType = {
collections: number
shareLinks: number
apiTokens: number
aiUsages: number
}
export type UserCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
@@ -3191,6 +3423,7 @@ export type UserCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.I
collections?: boolean | UserCountOutputTypeCountCollectionsArgs
shareLinks?: boolean | UserCountOutputTypeCountShareLinksArgs
apiTokens?: boolean | UserCountOutputTypeCountApiTokensArgs
aiUsages?: boolean | UserCountOutputTypeCountAiUsagesArgs
}
/**
@@ -3315,6 +3548,13 @@ export type UserCountOutputTypeCountApiTokensArgs<ExtArgs extends runtime.Types.
where?: Prisma.ApiTokenWhereInput
}
/**
* UserCountOutputType without action
*/
export type UserCountOutputTypeCountAiUsagesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
where?: Prisma.AiUsageWhereInput
}
export type UserSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
id?: boolean
@@ -3345,6 +3585,7 @@ export type UserSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = r
collections?: boolean | Prisma.User$collectionsArgs<ExtArgs>
shareLinks?: boolean | Prisma.User$shareLinksArgs<ExtArgs>
apiTokens?: boolean | Prisma.User$apiTokensArgs<ExtArgs>
aiUsages?: boolean | Prisma.User$aiUsagesArgs<ExtArgs>
_count?: boolean | Prisma.UserCountOutputTypeDefaultArgs<ExtArgs>
}, ExtArgs["result"]["user"]>
@@ -3409,6 +3650,7 @@ export type UserInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs =
collections?: boolean | Prisma.User$collectionsArgs<ExtArgs>
shareLinks?: boolean | Prisma.User$shareLinksArgs<ExtArgs>
apiTokens?: boolean | Prisma.User$apiTokensArgs<ExtArgs>
aiUsages?: boolean | Prisma.User$aiUsagesArgs<ExtArgs>
_count?: boolean | Prisma.UserCountOutputTypeDefaultArgs<ExtArgs>
}
export type UserIncludeCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {}
@@ -3434,6 +3676,7 @@ export type $UserPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs =
collections: Prisma.$CollectionPayload<ExtArgs>[]
shareLinks: Prisma.$ShareLinkPayload<ExtArgs>[]
apiTokens: Prisma.$ApiTokenPayload<ExtArgs>[]
aiUsages: Prisma.$AiUsagePayload<ExtArgs>[]
}
scalars: runtime.Types.Extensions.GetPayloadResult<{
id: string
@@ -3861,6 +4104,7 @@ export interface Prisma__UserClient<T, Null = never, ExtArgs extends runtime.Typ
collections<T extends Prisma.User$collectionsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$collectionsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$CollectionPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
shareLinks<T extends Prisma.User$shareLinksArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$shareLinksArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$ShareLinkPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
apiTokens<T extends Prisma.User$apiTokensArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$apiTokensArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$ApiTokenPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
aiUsages<T extends Prisma.User$aiUsagesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$aiUsagesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AiUsagePayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
@@ -4696,6 +4940,30 @@ export type User$apiTokensArgs<ExtArgs extends runtime.Types.Extensions.Internal
distinct?: Prisma.ApiTokenScalarFieldEnum | Prisma.ApiTokenScalarFieldEnum[]
}
/**
* User.aiUsages
*/
export type User$aiUsagesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the AiUsage
*/
select?: Prisma.AiUsageSelect<ExtArgs> | null
/**
* Omit specific fields from the AiUsage
*/
omit?: Prisma.AiUsageOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.AiUsageInclude<ExtArgs> | null
where?: Prisma.AiUsageWhereInput
orderBy?: Prisma.AiUsageOrderByWithRelationInput | Prisma.AiUsageOrderByWithRelationInput[]
cursor?: Prisma.AiUsageWhereUniqueInput
take?: number
skip?: number
distinct?: Prisma.AiUsageScalarFieldEnum | Prisma.AiUsageScalarFieldEnum[]
}
/**
* User without action
*/
+31
View File
@@ -14,3 +14,34 @@ export const aiProviderSettingsSchema = z.object({
})
export type AiProviderSettings = z.infer<typeof aiProviderSettingsSchema>
export const timeframeSchema = z.enum(['1h', '24h', '7d', '30d'])
export type Timeframe = z.infer<typeof timeframeSchema>
export const getTeamAiUsageQuerySchema = z.object({
timeframe: timeframeSchema.default('30d'),
userId: z.string().optional(),
})
export type GetTeamAiUsageQuery = z.infer<typeof getTeamAiUsageQuerySchema>
export interface AiUsageMetrics {
inputTokens: number
outputTokens: number
cacheReadTokens: number
totalTokens: number
cost: number
}
export interface MemberAiUsageMetrics extends AiUsageMetrics {
userId: string
userName: string
userEmail: string
userImage?: string | null
role: string
}
export interface TeamUsageStatsResponse {
timeframe: Timeframe
team?: AiUsageMetrics
member?: MemberAiUsageMetrics
}
@@ -0,0 +1,265 @@
import { useState } from 'react'
import { useQuery, useQueries } from '@tanstack/react-query'
import type { Timeframe } from '@shumai/dtos'
import { client } from '@/ui/api/client'
import { m } from '@/ui/paraglide/messages.js'
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/ui/components/ui/card'
import { ToggleGroup, ToggleGroupItem } from '@/ui/components/ui/toggle-group'
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from '@/ui/components/ui/table'
import { Avatar, AvatarFallback, AvatarImage } from '@/ui/components/ui/avatar'
import { Loader2 } from 'lucide-react'
interface AiUsageDashboardProps {
teamId: string
}
export function AiUsageDashboard({ teamId }: AiUsageDashboardProps) {
const [viewMode, setViewMode] = useState<'team' | 'members'>('team')
const [timeframe, setTimeframe] = useState<Timeframe>('1h')
// Query team-level usage
const { data: teamUsageData, isLoading: isTeamLoading } = useQuery({
queryKey: ['teams', teamId, 'ai-usage', timeframe, 'team'],
queryFn: async () => {
const res = await client.api.teams[':teamId']['ai-usage'].$get({
param: { teamId },
query: { timeframe },
})
if (!res.ok) throw new Error('Failed to fetch team AI usage')
return await res.json()
},
enabled: !!teamId && viewMode === 'team',
})
// Query member list for members view
const { data: members, isLoading: isMembersListLoading } = useQuery({
queryKey: ['teams', teamId, 'members'],
queryFn: async () => {
const res = await client.api.teams[':teamId'].members.$get({
param: { teamId },
query: {},
})
if (!res.ok) throw new Error('Failed to fetch team members')
return await res.json()
},
enabled: !!teamId && viewMode === 'members',
})
// Query each member's AI usage in parallel
const memberUsageQueries = useQueries({
queries: (members || []).map((member) => ({
queryKey: ['teams', teamId, 'ai-usage', timeframe, member.id],
queryFn: async () => {
const res = await client.api.teams[':teamId']['ai-usage'].$get({
param: { teamId },
query: { timeframe, userId: member.id },
})
if (!res.ok) throw new Error(`Failed to fetch AI usage for member ${member.id}`)
return await res.json()
},
enabled: !!teamId && viewMode === 'members',
})),
})
const isMembersLoading = isMembersListLoading || memberUsageQueries.some((q) => q.isLoading)
const getInitials = (name?: string) => {
if (!name) return 'U'
const names = name.split(' ')
if (names.length > 1) {
return `${names[0][0]}${names[names.length - 1][0]}`.toUpperCase()
}
return name.substring(0, 2).toUpperCase()
}
const localizeRole = (role?: string) => {
if (!role) return ''
switch (role.toLowerCase()) {
case 'owner':
return m.owner()
case 'editor':
return m.editor()
case 'reviewer':
return m.reviewer()
default:
return role
}
}
const formatTokens = (val?: number) => (val ?? 0).toLocaleString()
const formatCost = (val?: number) => `$${(val ?? 0).toFixed(6)}`
return (
<Card className="border-border/60 shadow-sm">
<CardHeader className="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between pb-6">
<div>
<CardTitle className="text-xl font-semibold tracking-tight">{m.ai_usage()}</CardTitle>
<CardDescription className="text-sm text-muted-foreground mt-1">
{m.ai_usage_description()}
</CardDescription>
</div>
<div className="flex flex-wrap items-center gap-3">
<ToggleGroup
type="single"
value={viewMode}
onValueChange={(val) => {
if (val) setViewMode(val as 'team' | 'members')
}}
className="border rounded-lg p-1 bg-muted/30"
>
<ToggleGroupItem value="team" className="px-3 py-1.5 text-xs font-medium">
{m.team_view()}
</ToggleGroupItem>
<ToggleGroupItem value="members" className="px-3 py-1.5 text-xs font-medium">
{m.members_view()}
</ToggleGroupItem>
</ToggleGroup>
<ToggleGroup
type="single"
value={timeframe}
onValueChange={(val) => {
if (val) setTimeframe(val as Timeframe)
}}
className="border rounded-lg p-1 bg-muted/30"
>
<ToggleGroupItem value="1h" className="px-2.5 py-1.5 text-xs font-medium">
1h
</ToggleGroupItem>
<ToggleGroupItem value="24h" className="px-2.5 py-1.5 text-xs font-medium">
24h
</ToggleGroupItem>
<ToggleGroupItem value="7d" className="px-2.5 py-1.5 text-xs font-medium">
7d
</ToggleGroupItem>
<ToggleGroupItem value="30d" className="px-2.5 py-1.5 text-xs font-medium">
30d
</ToggleGroupItem>
</ToggleGroup>
</div>
</CardHeader>
<CardContent>
{viewMode === 'team' ? (
isTeamLoading ? (
<div className="flex h-48 items-center justify-center">
<Loader2 className="h-6 w-6 animate-spin text-muted-foreground" />
</div>
) : (
<div className="rounded-md border">
<Table>
<TableHeader>
<TableRow>
<TableHead>{m.team()}</TableHead>
<TableHead className="text-right">{m.input_tokens()}</TableHead>
<TableHead className="text-right">{m.output_tokens()}</TableHead>
<TableHead className="text-right">{m.cache_read_tokens()}</TableHead>
<TableHead className="text-right">{m.total_tokens()}</TableHead>
<TableHead className="text-right">{m.cost()}</TableHead>
</TableRow>
</TableHeader>
<TableBody>
<TableRow>
<TableCell className="font-medium">{m.team()}</TableCell>
<TableCell className="text-right">
{formatTokens(teamUsageData?.team?.inputTokens)}
</TableCell>
<TableCell className="text-right">
{formatTokens(teamUsageData?.team?.outputTokens)}
</TableCell>
<TableCell className="text-right">
{formatTokens(teamUsageData?.team?.cacheReadTokens)}
</TableCell>
<TableCell className="text-right font-medium">
{formatTokens(teamUsageData?.team?.totalTokens)}
</TableCell>
<TableCell className="text-right font-medium">
{formatCost(teamUsageData?.team?.cost)}
</TableCell>
</TableRow>
</TableBody>
</Table>
</div>
)
) : isMembersLoading ? (
<div className="flex h-48 items-center justify-center">
<Loader2 className="h-6 w-6 animate-spin text-muted-foreground" />
</div>
) : (
<div className="rounded-md border">
<Table>
<TableHeader>
<TableRow>
<TableHead>{m.members()}</TableHead>
<TableHead>{m.role()}</TableHead>
<TableHead className="text-right">{m.input_tokens()}</TableHead>
<TableHead className="text-right">{m.output_tokens()}</TableHead>
<TableHead className="text-right">{m.cache_read_tokens()}</TableHead>
<TableHead className="text-right">{m.total_tokens()}</TableHead>
<TableHead className="text-right">{m.cost()}</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{(members || []).map((member, idx) => {
const usageResult = memberUsageQueries[idx]?.data?.member
return (
<TableRow key={member.id}>
<TableCell>
<div className="flex items-center gap-3">
<Avatar className="h-8 w-8 rounded-full">
{member.image && (
<AvatarImage
src={member.image}
alt={member.name}
className="object-cover"
/>
)}
<AvatarFallback className="bg-primary/20 text-xs">
{getInitials(member.name)}
</AvatarFallback>
</Avatar>
<div className="flex flex-col">
<span className="text-sm font-medium leading-none">{member.name}</span>
<span className="text-xs text-muted-foreground mt-0.5">
{member.email}
</span>
</div>
</div>
</TableCell>
<TableCell className="text-xs text-muted-foreground">
{localizeRole(member.role)}
</TableCell>
<TableCell className="text-right">
{formatTokens(usageResult?.inputTokens)}
</TableCell>
<TableCell className="text-right">
{formatTokens(usageResult?.outputTokens)}
</TableCell>
<TableCell className="text-right">
{formatTokens(usageResult?.cacheReadTokens)}
</TableCell>
<TableCell className="text-right font-medium">
{formatTokens(usageResult?.totalTokens)}
</TableCell>
<TableCell className="text-right font-medium">
{formatCost(usageResult?.cost)}
</TableCell>
</TableRow>
)
})}
</TableBody>
</Table>
</div>
)}
</CardContent>
</Card>
)
}
+13
View File
@@ -146,6 +146,19 @@ export function UserMenu() {
</DropdownMenuPortal>
</DropdownMenuSub>
<DropdownMenuSeparator />
{me?.role?.toLowerCase() === 'owner' && (
<DropdownMenuItem
onClick={() =>
navigate({
to: '/teams/$teamId/dashboard',
params: { teamId: teamId! },
})
}
disabled={!teamId}
>
{m.dashboard()}
</DropdownMenuItem>
)}
<DropdownMenuItem
onClick={() =>
navigate({
+14 -1
View File
@@ -870,5 +870,18 @@
"no_chat_agents_warning": "No chat agents found. Please create a Chat Agent below first.",
"select_agent": "Select Agent",
"delete_comment_confirm": "Delete Comment?",
"delete_comment_description": "Are you sure you want to delete this comment? This action cannot be undone."
"delete_comment_description": "Are you sure you want to delete this comment? This action cannot be undone.",
"ai_usage": "AI Token Usage",
"ai_usage_description": "Monitor AI token consumption and estimated costs for your team and members.",
"usage": "Usage",
"input_tokens": "Input Tokens",
"output_tokens": "Output Tokens",
"cache_read_tokens": "Cache Read Tokens",
"total_tokens": "Total Tokens",
"cost": "Cost",
"team_view": "Team",
"members_view": "Members",
"access_denied": "Access Denied",
"only_owner_dashboard": "Only team owners can access the dashboard.",
"role": "Role"
}
+14 -1
View File
@@ -870,5 +870,18 @@
"no_chat_agents_warning": "未找到聊天智能体。请先在下方创建聊天智能体。",
"select_agent": "选择智能体",
"delete_comment_confirm": "删除评论?",
"delete_comment_description": "您确定要删除这条评论吗?此操作将无法撤回。"
"delete_comment_description": "您确定要删除这条评论吗?此操作将无法撤回。",
"ai_usage": "AI Token 用量",
"ai_usage_description": "查看并监控团队及成员的 AI Token 消耗与预估费用。",
"usage": "用量",
"input_tokens": "输入 Token",
"output_tokens": "输出 Token",
"cache_read_tokens": "缓存读取 Token",
"total_tokens": "总 Token",
"cost": "费用",
"team_view": "团队",
"members_view": "成员",
"access_denied": "访问被拒绝",
"only_owner_dashboard": "只有团队所有者才能访问仪表盘。",
"role": "角色"
}
+13
View File
@@ -817,4 +817,17 @@ export * from "./no_chat_agents_warning.js";
export * from "./select_agent.js";
export * from "./delete_comment_confirm.js";
export * from "./delete_comment_description.js";
export * from "./ai_usage.js";
export * from "./ai_usage_description.js";
export * from "./usage.js";
export * from "./input_tokens.js";
export * from "./output_tokens.js";
export * from "./cache_read_tokens.js";
export * from "./total_tokens.js";
export * from "./cost.js";
export * from "./team_view.js";
export * from "./members_view.js";
export * from "./access_denied.js";
export * from "./only_owner_dashboard.js";
export * from "./role.js";
export type LocalizedString = import("../runtime.js").LocalizedString;
+14 -1
View File
@@ -818,4 +818,17 @@ export * from './select_chatbot_agent.js'
export * from './no_chat_agents_warning.js'
export * from './select_agent.js'
export * from './delete_comment_confirm.js'
export * from './delete_comment_description.js'
export * from './delete_comment_description.js'
export * from './ai_usage.js'
export * from './ai_usage_description.js'
export * from './usage.js'
export * from './input_tokens.js'
export * from './output_tokens.js'
export * from './cache_read_tokens.js'
export * from './total_tokens.js'
export * from './cost.js'
export * from './team_view.js'
export * from './members_view.js'
export * from './access_denied.js'
export * from './only_owner_dashboard.js'
export * from './role.js'
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Access Denied" |
*
* @param {Access_DeniedInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const access_denied: ((inputs?: Access_DeniedInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Access_DeniedInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Access_DeniedInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Access_DeniedInputs */
const en_access_denied = /** @type {(inputs: Access_DeniedInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Access Denied`)
};
const zh_access_denied = /** @type {(inputs: Access_DeniedInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`访问被拒绝`)
};
/**
* | output |
* | --- |
* | "Access Denied" |
*
* @param {Access_DeniedInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const access_denied = /** @type {((inputs?: Access_DeniedInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Access_DeniedInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_access_denied(inputs)
return zh_access_denied(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "AI Token Usage" |
*
* @param {Ai_UsageInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const ai_usage: ((inputs?: Ai_UsageInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Ai_UsageInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Ai_UsageInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Ai_UsageInputs */
const en_ai_usage = /** @type {(inputs: Ai_UsageInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`AI Token Usage`)
};
const zh_ai_usage = /** @type {(inputs: Ai_UsageInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`AI Token 用量`)
};
/**
* | output |
* | --- |
* | "AI Token Usage" |
*
* @param {Ai_UsageInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const ai_usage = /** @type {((inputs?: Ai_UsageInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Ai_UsageInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_ai_usage(inputs)
return zh_ai_usage(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Monitor AI token consumption and estimated costs for your team and members." |
*
* @param {Ai_Usage_DescriptionInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const ai_usage_description: ((inputs?: Ai_Usage_DescriptionInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Ai_Usage_DescriptionInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Ai_Usage_DescriptionInputs = {};
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Ai_Usage_DescriptionInputs */
const en_ai_usage_description = /** @type {(inputs: Ai_Usage_DescriptionInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Monitor AI token consumption and estimated costs for your team and members.`)
};
const zh_ai_usage_description = /** @type {(inputs: Ai_Usage_DescriptionInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`查看并监控团队及成员的 AI Token 消耗与预估费用。`)
};
/**
* | output |
* | --- |
* | "Monitor AI token consumption and estimated costs for your team and members." |
*
* @param {Ai_Usage_DescriptionInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const ai_usage_description = /** @type {((inputs?: Ai_Usage_DescriptionInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Ai_Usage_DescriptionInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_ai_usage_description(inputs)
return zh_ai_usage_description(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Cache Read Tokens" |
*
* @param {Cache_Read_TokensInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const cache_read_tokens: ((inputs?: Cache_Read_TokensInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Cache_Read_TokensInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Cache_Read_TokensInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Cache_Read_TokensInputs */
const en_cache_read_tokens = /** @type {(inputs: Cache_Read_TokensInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Cache Read Tokens`)
};
const zh_cache_read_tokens = /** @type {(inputs: Cache_Read_TokensInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`缓存读取 Token`)
};
/**
* | output |
* | --- |
* | "Cache Read Tokens" |
*
* @param {Cache_Read_TokensInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const cache_read_tokens = /** @type {((inputs?: Cache_Read_TokensInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Cache_Read_TokensInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_cache_read_tokens(inputs)
return zh_cache_read_tokens(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Cost" |
*
* @param {CostInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const cost: ((inputs?: CostInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<CostInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type CostInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} CostInputs */
const en_cost = /** @type {(inputs: CostInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Cost`)
};
const zh_cost = /** @type {(inputs: CostInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`费用`)
};
/**
* | output |
* | --- |
* | "Cost" |
*
* @param {CostInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const cost = /** @type {((inputs?: CostInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<CostInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_cost(inputs)
return zh_cost(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Input Tokens" |
*
* @param {Input_TokensInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const input_tokens: ((inputs?: Input_TokensInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Input_TokensInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Input_TokensInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Input_TokensInputs */
const en_input_tokens = /** @type {(inputs: Input_TokensInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Input Tokens`)
};
const zh_input_tokens = /** @type {(inputs: Input_TokensInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`输入 Token`)
};
/**
* | output |
* | --- |
* | "Input Tokens" |
*
* @param {Input_TokensInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const input_tokens = /** @type {((inputs?: Input_TokensInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Input_TokensInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_input_tokens(inputs)
return zh_input_tokens(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Members" |
*
* @param {Members_ViewInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const members_view: ((inputs?: Members_ViewInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Members_ViewInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Members_ViewInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Members_ViewInputs */
const en_members_view = /** @type {(inputs: Members_ViewInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Members`)
};
const zh_members_view = /** @type {(inputs: Members_ViewInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`成员`)
};
/**
* | output |
* | --- |
* | "Members" |
*
* @param {Members_ViewInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const members_view = /** @type {((inputs?: Members_ViewInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Members_ViewInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_members_view(inputs)
return zh_members_view(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Only team owners can access the dashboard." |
*
* @param {Only_Owner_DashboardInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const only_owner_dashboard: ((inputs?: Only_Owner_DashboardInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Only_Owner_DashboardInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Only_Owner_DashboardInputs = {};
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Only_Owner_DashboardInputs */
const en_only_owner_dashboard = /** @type {(inputs: Only_Owner_DashboardInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Only team owners can access the dashboard.`)
};
const zh_only_owner_dashboard = /** @type {(inputs: Only_Owner_DashboardInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`只有团队所有者才能访问仪表盘。`)
};
/**
* | output |
* | --- |
* | "Only team owners can access the dashboard." |
*
* @param {Only_Owner_DashboardInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const only_owner_dashboard = /** @type {((inputs?: Only_Owner_DashboardInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Only_Owner_DashboardInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_only_owner_dashboard(inputs)
return zh_only_owner_dashboard(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Output Tokens" |
*
* @param {Output_TokensInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const output_tokens: ((inputs?: Output_TokensInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Output_TokensInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Output_TokensInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Output_TokensInputs */
const en_output_tokens = /** @type {(inputs: Output_TokensInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Output Tokens`)
};
const zh_output_tokens = /** @type {(inputs: Output_TokensInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`输出 Token`)
};
/**
* | output |
* | --- |
* | "Output Tokens" |
*
* @param {Output_TokensInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const output_tokens = /** @type {((inputs?: Output_TokensInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Output_TokensInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_output_tokens(inputs)
return zh_output_tokens(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Role" |
*
* @param {RoleInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const role: ((inputs?: RoleInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<RoleInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type RoleInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} RoleInputs */
const en_role = /** @type {(inputs: RoleInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Role`)
};
const zh_role = /** @type {(inputs: RoleInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`角色`)
};
/**
* | output |
* | --- |
* | "Role" |
*
* @param {RoleInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const role = /** @type {((inputs?: RoleInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<RoleInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_role(inputs)
return zh_role(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Team" |
*
* @param {Team_ViewInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const team_view: ((inputs?: Team_ViewInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Team_ViewInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Team_ViewInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Team_ViewInputs */
const en_team_view = /** @type {(inputs: Team_ViewInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Team`)
};
const zh_team_view = /** @type {(inputs: Team_ViewInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`团队`)
};
/**
* | output |
* | --- |
* | "Team" |
*
* @param {Team_ViewInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const team_view = /** @type {((inputs?: Team_ViewInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Team_ViewInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_team_view(inputs)
return zh_team_view(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Total Tokens" |
*
* @param {Total_TokensInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const total_tokens: ((inputs?: Total_TokensInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Total_TokensInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Total_TokensInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Total_TokensInputs */
const en_total_tokens = /** @type {(inputs: Total_TokensInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Total Tokens`)
};
const zh_total_tokens = /** @type {(inputs: Total_TokensInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`总 Token`)
};
/**
* | output |
* | --- |
* | "Total Tokens" |
*
* @param {Total_TokensInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const total_tokens = /** @type {((inputs?: Total_TokensInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Total_TokensInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_total_tokens(inputs)
return zh_total_tokens(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Usage" |
*
* @param {UsageInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const usage: ((inputs?: UsageInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<UsageInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type UsageInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} UsageInputs */
const en_usage = /** @type {(inputs: UsageInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Usage`)
};
const zh_usage = /** @type {(inputs: UsageInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`用量`)
};
/**
* | output |
* | --- |
* | "Usage" |
*
* @param {UsageInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const usage = /** @type {((inputs?: UsageInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<UsageInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_usage(inputs)
return zh_usage(inputs)
});
+21
View File
@@ -17,6 +17,7 @@ import { Route as TeamsTeamIdIndexRouteImport } from './routes/teams/$teamId/ind
import { Route as ShareShareIdIndexRouteImport } from './routes/share/$shareId/index'
import { Route as ProjectsProjectIdIndexRouteImport } from './routes/projects/$projectId/index'
import { Route as TeamsTeamIdSettingsRouteImport } from './routes/teams/$teamId/settings'
import { Route as TeamsTeamIdDashboardRouteImport } from './routes/teams/$teamId/dashboard'
import { Route as ProjectsProjectIdRecentlyDeletedRouteImport } from './routes/projects/$projectId/recently-deleted'
import { Route as ProjectsProjectIdSharesIndexRouteImport } from './routes/projects/$projectId/shares/index'
import { Route as ProjectsProjectIdCollectionsIndexRouteImport } from './routes/projects/$projectId/collections/index'
@@ -67,6 +68,11 @@ const TeamsTeamIdSettingsRoute = TeamsTeamIdSettingsRouteImport.update({
path: '/teams/$teamId/settings',
getParentRoute: () => rootRouteImport,
} as any).lazy(() => import('./routes/teams/$teamId/settings.lazy').then((d) => d.Route))
const TeamsTeamIdDashboardRoute = TeamsTeamIdDashboardRouteImport.update({
id: '/teams/$teamId/dashboard',
path: '/teams/$teamId/dashboard',
getParentRoute: () => rootRouteImport,
} as any).lazy(() => import('./routes/teams/$teamId/dashboard.lazy').then((d) => d.Route))
const ProjectsProjectIdRecentlyDeletedRoute = ProjectsProjectIdRecentlyDeletedRouteImport.update({
id: '/projects/$projectId/recently-deleted',
path: '/projects/$projectId/recently-deleted',
@@ -130,6 +136,7 @@ export interface FileRoutesByFullPath {
'/signup': typeof SignupRoute
'/share/$shareId': typeof ShareShareIdRouteWithChildren
'/projects/$projectId/recently-deleted': typeof ProjectsProjectIdRecentlyDeletedRoute
'/teams/$teamId/dashboard': typeof TeamsTeamIdDashboardRoute
'/teams/$teamId/settings': typeof TeamsTeamIdSettingsRoute
'/projects/$projectId/': typeof ProjectsProjectIdIndexRoute
'/share/$shareId/': typeof ShareShareIdIndexRoute
@@ -148,6 +155,7 @@ export interface FileRoutesByTo {
'/login': typeof LoginRoute
'/signup': typeof SignupRoute
'/projects/$projectId/recently-deleted': typeof ProjectsProjectIdRecentlyDeletedRoute
'/teams/$teamId/dashboard': typeof TeamsTeamIdDashboardRoute
'/teams/$teamId/settings': typeof TeamsTeamIdSettingsRoute
'/projects/$projectId': typeof ProjectsProjectIdIndexRoute
'/share/$shareId': typeof ShareShareIdIndexRoute
@@ -168,6 +176,7 @@ export interface FileRoutesById {
'/signup': typeof SignupRoute
'/share/$shareId': typeof ShareShareIdRouteWithChildren
'/projects/$projectId/recently-deleted': typeof ProjectsProjectIdRecentlyDeletedRoute
'/teams/$teamId/dashboard': typeof TeamsTeamIdDashboardRoute
'/teams/$teamId/settings': typeof TeamsTeamIdSettingsRoute
'/projects/$projectId/': typeof ProjectsProjectIdIndexRoute
'/share/$shareId/': typeof ShareShareIdIndexRoute
@@ -189,6 +198,7 @@ export interface FileRouteTypes {
| '/signup'
| '/share/$shareId'
| '/projects/$projectId/recently-deleted'
| '/teams/$teamId/dashboard'
| '/teams/$teamId/settings'
| '/projects/$projectId/'
| '/share/$shareId/'
@@ -207,6 +217,7 @@ export interface FileRouteTypes {
| '/login'
| '/signup'
| '/projects/$projectId/recently-deleted'
| '/teams/$teamId/dashboard'
| '/teams/$teamId/settings'
| '/projects/$projectId'
| '/share/$shareId'
@@ -226,6 +237,7 @@ export interface FileRouteTypes {
| '/signup'
| '/share/$shareId'
| '/projects/$projectId/recently-deleted'
| '/teams/$teamId/dashboard'
| '/teams/$teamId/settings'
| '/projects/$projectId/'
| '/share/$shareId/'
@@ -246,6 +258,7 @@ export interface RootRouteChildren {
SignupRoute: typeof SignupRoute
ShareShareIdRoute: typeof ShareShareIdRouteWithChildren
ProjectsProjectIdRecentlyDeletedRoute: typeof ProjectsProjectIdRecentlyDeletedRoute
TeamsTeamIdDashboardRoute: typeof TeamsTeamIdDashboardRoute
TeamsTeamIdSettingsRoute: typeof TeamsTeamIdSettingsRoute
ProjectsProjectIdIndexRoute: typeof ProjectsProjectIdIndexRoute
TeamsTeamIdIndexRoute: typeof TeamsTeamIdIndexRoute
@@ -315,6 +328,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof TeamsTeamIdSettingsRouteImport
parentRoute: typeof rootRouteImport
}
'/teams/$teamId/dashboard': {
id: '/teams/$teamId/dashboard'
path: '/teams/$teamId/dashboard'
fullPath: '/teams/$teamId/dashboard'
preLoaderRoute: typeof TeamsTeamIdDashboardRouteImport
parentRoute: typeof rootRouteImport
}
'/projects/$projectId/recently-deleted': {
id: '/projects/$projectId/recently-deleted'
path: '/projects/$projectId/recently-deleted'
@@ -401,6 +421,7 @@ const rootRouteChildren: RootRouteChildren = {
SignupRoute: SignupRoute,
ShareShareIdRoute: ShareShareIdRouteWithChildren,
ProjectsProjectIdRecentlyDeletedRoute: ProjectsProjectIdRecentlyDeletedRoute,
TeamsTeamIdDashboardRoute: TeamsTeamIdDashboardRoute,
TeamsTeamIdSettingsRoute: TeamsTeamIdSettingsRoute,
ProjectsProjectIdIndexRoute: ProjectsProjectIdIndexRoute,
TeamsTeamIdIndexRoute: TeamsTeamIdIndexRoute,
@@ -0,0 +1,91 @@
import { createLazyFileRoute } from '@tanstack/react-router'
import { useState } from 'react'
import { useQuery } from '@tanstack/react-query'
import { client } from '@/ui/api/client'
import { cn } from '@/ui/lib/utils'
import { m } from '@/ui/paraglide/messages.js'
import { AiUsageDashboard } from '@/ui/components/dashboard/AiUsageDashboard'
import { BarChart2, Loader2, ShieldAlert } from 'lucide-react'
type DashboardTab = 'ai-usage'
function TeamDashboardPage() {
const { teamId } = Route.useParams()
const [activeTab, setActiveTab] = useState<DashboardTab>('ai-usage')
const { data: me, isLoading: isMeLoading } = useQuery({
queryKey: ['teams', teamId, 'me'],
queryFn: async () => {
const res = await client.api.teams[':teamId'].me.$get({
param: { teamId: teamId },
})
if (!res.ok) throw new Error('Failed to fetch me')
return await res.json()
},
enabled: !!teamId,
})
if (isMeLoading) {
return (
<div className="flex h-screen items-center justify-center">
<Loader2 className="h-8 w-8 animate-spin text-muted-foreground" />
</div>
)
}
if (me?.role?.toLowerCase() !== 'owner') {
return (
<div className="flex h-full flex-col items-center justify-center p-8 text-center">
<ShieldAlert className="h-12 w-12 text-destructive mb-4" />
<h2 className="text-xl font-bold tracking-tight mb-2">{m.access_denied()}</h2>
<p className="text-sm text-muted-foreground max-w-md">{m.only_owner_dashboard()}</p>
</div>
)
}
return (
<div className="h-full bg-background font-sans selection:bg-primary/20 transition-colors duration-300">
<div className="flex flex-col md:flex-row h-full">
{/* Sidebar */}
<div className="w-full h-full md:w-72 bg-sidebar border-b md:border-b-0 md:border-r border-sidebar-border z-10 md:left-16 overflow-y-auto transition-colors duration-300">
<nav className="p-4 space-y-1 mt-4">
<div className="mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider">
{m.dashboard()}
</div>
<div className="mt-4 mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider pt-4 border-t border-sidebar-border">
{m.ai()}
</div>
<button
onClick={() => setActiveTab('ai-usage')}
className={cn(
'w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all',
activeTab === 'ai-usage'
? 'bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border'
: 'text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',
)}
>
<BarChart2 className="w-5 h-5" />
{m.usage()}
{activeTab === 'ai-usage' && (
<div className="ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary" />
)}
</button>
</nav>
</div>
{/* Main Content Area */}
<div className="flex-1 overflow-y-auto p-4 md:p-8">
<div className="max-w-6xl mx-auto space-y-8">
{activeTab === 'ai-usage' && <AiUsageDashboard teamId={teamId} />}
</div>
</div>
</div>
</div>
)
}
export const Route = createLazyFileRoute('/teams/$teamId/dashboard')({
component: TeamDashboardPage,
})
@@ -0,0 +1,3 @@
import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/teams/$teamId/dashboard')({})