mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-22 22:08:51 +00:00
feat(dashboard): add agent sessions view for team owners
This commit is contained in:
@@ -193,4 +193,40 @@ describe('Agent API', () => {
|
||||
expect(res.status).toBe(500)
|
||||
})
|
||||
})
|
||||
|
||||
describe('GET /teams/:teamId/agent-sessions', () => {
|
||||
it('returns paginated agent sessions for team', async () => {
|
||||
const mockSessionsData = {
|
||||
data: [
|
||||
{
|
||||
id: 'session1',
|
||||
name: 'Session 1',
|
||||
type: 'chat',
|
||||
createdAt: new Date().toISOString(),
|
||||
creator: { id: 'u1', name: 'User 1', email: 'u1@shumai.ai', image: null },
|
||||
agentId: 'agent1',
|
||||
},
|
||||
],
|
||||
pageInfo: { total: 1 },
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
vi.mocked(agentService.listSessions).mockResolvedValue(mockSessionsData as any)
|
||||
|
||||
const res = await app.request('/teams/team1/agent-sessions?first=20', {
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
})
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const data = (await res.json()) as typeof mockSessionsData
|
||||
expect(data.data).toHaveLength(1)
|
||||
expect(data.data[0].id).toBe('session1')
|
||||
expect(data.pageInfo.total).toBe(1)
|
||||
expect(authzService.hasPermission).toHaveBeenCalledWith({
|
||||
user: undefined,
|
||||
permission: 'Admin',
|
||||
type: 'team',
|
||||
id: 'team1',
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -6,6 +6,7 @@ import { getAvatarUrl } from '@shumai/core/src/user/avatar'
|
||||
import {
|
||||
createAgentRequestSchema,
|
||||
updateAgentRequestSchema,
|
||||
paginationParamsSchema,
|
||||
AgentInfo,
|
||||
AgentType,
|
||||
} from '@shumai/dtos'
|
||||
@@ -171,5 +172,20 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
|
||||
return c.json(infos, 200)
|
||||
})
|
||||
.get('/teams/:teamId/agent-sessions', zValidator('query', paginationParamsSchema), async (c) => {
|
||||
const teamId = c.req.param('teamId')
|
||||
const userReq = c.get('user')
|
||||
const query = c.req.valid('query')
|
||||
|
||||
await authzService.hasPermission({
|
||||
user: userReq,
|
||||
permission: Permission.Admin,
|
||||
type: ResourceType.Team,
|
||||
id: teamId,
|
||||
})
|
||||
|
||||
const res = await agentService.listSessions(teamId, query)
|
||||
return c.json(res, 200)
|
||||
})
|
||||
|
||||
export default route
|
||||
|
||||
@@ -339,4 +339,64 @@ describe('AgentService', () => {
|
||||
expect(entries[1].id).toBe(entry2.id)
|
||||
})
|
||||
})
|
||||
|
||||
describe('listSessions', () => {
|
||||
test('lists sessions for team and excludes pending id', async () => {
|
||||
const db = prisma
|
||||
const svc = new AgentService()
|
||||
const { team, agent } = await setupTestData(db)
|
||||
|
||||
const user = await db.user.create({
|
||||
data: {
|
||||
name: 'Regular User',
|
||||
email: 'user@shumai.ai',
|
||||
},
|
||||
})
|
||||
|
||||
const session1 = await db.agentSession.create({
|
||||
data: {
|
||||
name: 'Session One',
|
||||
agentId: agent.id,
|
||||
userId: user.id,
|
||||
type: 'chat',
|
||||
cwd: '/tmp',
|
||||
},
|
||||
})
|
||||
|
||||
const session2 = await db.agentSession.create({
|
||||
data: {
|
||||
name: 'Session Two',
|
||||
agentId: agent.id,
|
||||
userId: user.id,
|
||||
type: 'comment',
|
||||
cwd: '/tmp',
|
||||
},
|
||||
})
|
||||
|
||||
// Pending session - should be excluded!
|
||||
await db.agentSession.create({
|
||||
data: {
|
||||
id: 'pending',
|
||||
name: 'Pending Session',
|
||||
agentId: agent.id,
|
||||
userId: user.id,
|
||||
type: 'chat',
|
||||
cwd: '/tmp',
|
||||
},
|
||||
})
|
||||
|
||||
const res = await svc.listSessions(team.id, { first: 10 })
|
||||
|
||||
expect(res.data).toHaveLength(2)
|
||||
expect(res.data.map((s) => s.id)).not.toContain('pending')
|
||||
const sessionIds = res.data.map((s) => s.id)
|
||||
expect(sessionIds).toContain(session1.id)
|
||||
expect(sessionIds).toContain(session2.id)
|
||||
|
||||
const found = res.data.find((s) => s.id === session1.id)
|
||||
expect(found?.name).toBe('Session One')
|
||||
expect(found?.type).toBe('chat')
|
||||
expect(found?.creator?.name).toBe('Regular User')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
import { prisma } from '@shumai/db'
|
||||
import { prisma, type Prisma } from '@shumai/db'
|
||||
import {
|
||||
CreateAgentParams,
|
||||
DeleteAgentParams,
|
||||
ListAgentsParams,
|
||||
UpdateAgentParams,
|
||||
AgentSessionInfo,
|
||||
} from '@shumai/dtos'
|
||||
import {
|
||||
paginateQuery,
|
||||
type PaginatedData,
|
||||
type PaginationParams,
|
||||
} from '@shumai/core/src/pagination'
|
||||
import '@shumai/db/src/prisma-json-types'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import AdmZip from 'adm-zip'
|
||||
@@ -388,6 +394,59 @@ export class AgentService {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async listSessions(
|
||||
teamId: string,
|
||||
params: PaginationParams,
|
||||
): Promise<PaginatedData<AgentSessionInfo[]>> {
|
||||
const where: Prisma.AgentSessionWhereInput = {
|
||||
id: { not: 'pending' },
|
||||
agent: {
|
||||
teamId,
|
||||
},
|
||||
}
|
||||
|
||||
return await paginateQuery(
|
||||
async (skip, take) => {
|
||||
const sessions = await this.prismaClient.agentSession.findMany({
|
||||
where,
|
||||
skip,
|
||||
take,
|
||||
orderBy: { id: 'desc' },
|
||||
include: {
|
||||
user: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
email: true,
|
||||
image: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
return sessions.map((s) => ({
|
||||
id: s.id,
|
||||
name: s.name,
|
||||
type: s.type,
|
||||
createdAt: s.createdAt.toISOString(),
|
||||
creator: s.user
|
||||
? {
|
||||
id: s.user.id,
|
||||
name: s.user.name,
|
||||
email: s.user.email,
|
||||
image: s.user.image,
|
||||
}
|
||||
: null,
|
||||
agentId: s.agentId,
|
||||
}))
|
||||
},
|
||||
async () => {
|
||||
return this.prismaClient.agentSession.count({ where })
|
||||
},
|
||||
params,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export const agentService = new AgentService()
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
import { assetService } from '@shumai/core/src/asset/asset'
|
||||
import { PaginatedData, PaginationParams, paginateQuery } from '@shumai/core/src/pagination'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import {
|
||||
AssetStatus,
|
||||
AssetType,
|
||||
Prisma,
|
||||
TaskStatus,
|
||||
prisma,
|
||||
} from '@shumai/db'
|
||||
import { AssetStatus, AssetType, Prisma, TaskStatus, prisma } from '@shumai/db'
|
||||
import {
|
||||
ConfirmFileUploadRequest,
|
||||
CreateUploadTaskRequest,
|
||||
|
||||
@@ -110,3 +110,21 @@ export const agentSessionEntrySchema = z.object({
|
||||
entry: z.unknown(),
|
||||
})
|
||||
export type AgentSessionEntryInfo = z.infer<typeof agentSessionEntrySchema>
|
||||
|
||||
export const agentSessionSchema = z.object({
|
||||
id: z.string(),
|
||||
name: z.string().nullable().optional(),
|
||||
type: z.string(),
|
||||
createdAt: z.string(),
|
||||
creator: z
|
||||
.object({
|
||||
id: z.string(),
|
||||
name: z.string().nullable().optional(),
|
||||
email: z.string().nullable().optional(),
|
||||
image: z.string().nullable().optional(),
|
||||
})
|
||||
.nullable()
|
||||
.optional(),
|
||||
agentId: z.string().optional(),
|
||||
})
|
||||
export type AgentSessionInfo = z.infer<typeof agentSessionSchema>
|
||||
|
||||
@@ -0,0 +1,342 @@
|
||||
import React from 'react'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { client } from '@/ui/api/client'
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogDescription,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from '@/ui/components/ui/dialog'
|
||||
import { Separator } from '@/ui/components/ui/separator'
|
||||
import { Skeleton } from '@/ui/components/ui/skeleton'
|
||||
import { formatTimeAgo } from '@/ui/lib/time'
|
||||
import { m } from '@/ui/paraglide/messages.js'
|
||||
import { Terminal } from 'lucide-react'
|
||||
import Markdown from 'react-markdown'
|
||||
|
||||
interface AgentSessionLogsDialogProps {
|
||||
sessionId?: string | null
|
||||
open: boolean
|
||||
onOpenChange: (open: boolean) => void
|
||||
}
|
||||
|
||||
const preprocessMarkdown = (text: string): string => {
|
||||
return text.replace(/<@([a-zA-Z0-9_-]+)>/g, '@$1').replace(/^\[([^\]]+)\]:/gm, '\\[$1\\]:')
|
||||
}
|
||||
|
||||
export function AgentSessionLogsDialog({
|
||||
sessionId,
|
||||
open,
|
||||
onOpenChange,
|
||||
}: AgentSessionLogsDialogProps) {
|
||||
const { data: logs, isLoading: isLogsLoading } = useQuery({
|
||||
queryKey: ['agent-sessions', sessionId, 'entries'],
|
||||
queryFn: async () => {
|
||||
if (!sessionId) return []
|
||||
const res = await client.api['agent-sessions'][':sessionId'].entries.$get({
|
||||
param: { sessionId },
|
||||
})
|
||||
if (!res.ok) throw new Error('Failed to fetch session logs')
|
||||
return await res.json()
|
||||
},
|
||||
enabled: open && !!sessionId,
|
||||
})
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogContent className="sm:max-w-2xl max-h-[80vh] flex flex-col p-6 overflow-hidden bg-background/95 backdrop-blur-md border border-foreground/15 shadow-2xl">
|
||||
<DialogHeader className="pb-4 border-b border-foreground/15">
|
||||
<DialogTitle className="flex items-center gap-2 text-xl font-bold">
|
||||
<Terminal className="w-5 h-5 text-violet-500" />
|
||||
{m.agent_session_logs()}
|
||||
</DialogTitle>
|
||||
<DialogDescription>{m.agent_logs_description()}</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="flex-1 overflow-y-auto pr-1 py-4 space-y-4 min-h-0 select-text">
|
||||
{isLogsLoading ? (
|
||||
<div className="space-y-4">
|
||||
<div className="flex gap-4">
|
||||
<Skeleton className="h-5 w-5 rounded-full shrink-0" />
|
||||
<div className="flex-1 space-y-2">
|
||||
<Skeleton className="h-4 w-1/4" />
|
||||
<Skeleton className="h-20 w-full" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex gap-4">
|
||||
<Skeleton className="h-5 w-5 rounded-full shrink-0" />
|
||||
<div className="flex-1 space-y-2">
|
||||
<Skeleton className="h-4 w-1/4" />
|
||||
<Skeleton className="h-12 w-full" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : logs && logs.length > 0 ? (
|
||||
<div className="flex flex-col">
|
||||
{logs.map((entry) => {
|
||||
const piEntry = entry.entry as Record<string, unknown> | null
|
||||
const timestampStr =
|
||||
piEntry?.timestamp || (entry as Record<string, unknown>).timestamp
|
||||
let timestamp = ''
|
||||
if (typeof timestampStr === 'string' || typeof timestampStr === 'number') {
|
||||
const dateObj = new Date(timestampStr)
|
||||
if (!isNaN(dateObj.getTime())) {
|
||||
timestamp = formatTimeAgo(dateObj.toISOString())
|
||||
}
|
||||
}
|
||||
|
||||
if (piEntry && typeof piEntry === 'object') {
|
||||
if (piEntry.type === 'message' && piEntry.message) {
|
||||
const msg = piEntry.message as Record<string, unknown>
|
||||
let badgeColor = 'bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200'
|
||||
let roleName: string = String(msg.role || '')
|
||||
|
||||
if (msg.role === 'user') {
|
||||
badgeColor =
|
||||
'bg-slate-100 text-slate-800 dark:bg-slate-900/30 dark:text-slate-300'
|
||||
roleName = m.role_user()
|
||||
} else if (msg.role === 'assistant') {
|
||||
badgeColor =
|
||||
'bg-violet-100 text-violet-800 dark:bg-violet-900/30 dark:text-violet-300'
|
||||
roleName = m.role_agent()
|
||||
} else if (msg.role === 'toolResult') {
|
||||
badgeColor = msg.isError
|
||||
? 'bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300'
|
||||
: 'bg-emerald-100 text-emerald-800 dark:bg-emerald-900/30 dark:text-emerald-300'
|
||||
roleName = m.tool_result_with_name({
|
||||
name: String(msg.toolName || m.unknown()),
|
||||
})
|
||||
} else if (msg.role === 'thought') {
|
||||
badgeColor =
|
||||
'bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-300'
|
||||
roleName = m.role_thinking()
|
||||
}
|
||||
|
||||
const renderToolCallArguments = (args: unknown) => {
|
||||
let parsedArgs: unknown = args
|
||||
if (typeof args === 'string') {
|
||||
try {
|
||||
parsedArgs = JSON.parse(args)
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
parsedArgs &&
|
||||
typeof parsedArgs === 'object' &&
|
||||
!Array.isArray(parsedArgs)
|
||||
) {
|
||||
const obj = parsedArgs as Record<string, unknown>
|
||||
return (
|
||||
<div className="mt-1 space-y-1.5 pt-3">
|
||||
{Object.entries(obj).map(([key, value]) => {
|
||||
const valueStr =
|
||||
value && typeof value === 'object'
|
||||
? JSON.stringify(value, null, 2)
|
||||
: String(value)
|
||||
return (
|
||||
<div key={key} className="text-xs leading-relaxed break-words">
|
||||
<span className="font-semibold text-violet-600 dark:text-violet-400">
|
||||
{key}:
|
||||
</span>{' '}
|
||||
<span className="text-foreground/90 font-mono whitespace-pre-wrap">
|
||||
{valueStr}
|
||||
</span>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="text-xs font-mono whitespace-pre-wrap">{String(args)}</div>
|
||||
)
|
||||
}
|
||||
|
||||
const renderMessageContent = () => {
|
||||
const content = msg.content
|
||||
if (!content) return null
|
||||
|
||||
if (typeof content === 'string') {
|
||||
if (!content.trim()) return null
|
||||
return (
|
||||
<div className="text-xs text-foreground/80 dark:text-foreground/95 leading-relaxed prose prose-sm dark:prose-invert max-w-none break-words">
|
||||
<Markdown>{preprocessMarkdown(content)}</Markdown>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
if (Array.isArray(content)) {
|
||||
const renderedBlocks: React.ReactNode[] = []
|
||||
|
||||
content.forEach((item, idx) => {
|
||||
if (!item) return
|
||||
|
||||
if (typeof item === 'string') {
|
||||
if (!item.trim()) return
|
||||
renderedBlocks.push(
|
||||
<div
|
||||
key={`str-${idx}`}
|
||||
className="text-xs text-foreground/80 dark:text-foreground/95 leading-relaxed prose prose-sm dark:prose-invert max-w-none break-words"
|
||||
>
|
||||
<Markdown>{preprocessMarkdown(item)}</Markdown>
|
||||
</div>,
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
if (typeof item === 'object') {
|
||||
const itemObj = item as Record<string, unknown>
|
||||
const type = itemObj.type
|
||||
if (type === 'text') {
|
||||
const text = itemObj.text
|
||||
if (typeof text !== 'string' || !text.trim()) return
|
||||
renderedBlocks.push(
|
||||
<div
|
||||
key={`txt-${idx}`}
|
||||
className="text-xs text-foreground/80 dark:text-foreground/95 leading-relaxed prose prose-sm dark:prose-invert max-w-none break-words"
|
||||
>
|
||||
<Markdown>{preprocessMarkdown(text)}</Markdown>
|
||||
</div>,
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
if (type === 'toolCall') {
|
||||
const toolName = String(
|
||||
itemObj.name || itemObj.toolName || m.unknown(),
|
||||
)
|
||||
const toolArgs = itemObj.arguments || itemObj.args
|
||||
renderedBlocks.push(
|
||||
<div key={`tool-${idx}`} className="text-xs space-y-2 py-1">
|
||||
<div className="font-semibold text-violet-600 dark:text-violet-400 flex items-center gap-1.5">
|
||||
{m.calling_tool()}{' '}
|
||||
<span className="font-mono bg-violet-500/10 px-1 py-0.5 rounded text-[11px]">
|
||||
{toolName}
|
||||
</span>
|
||||
</div>
|
||||
{!!toolArgs && (
|
||||
<div className="space-y-1 pt-3">
|
||||
<div className="text-[10px] text-muted-foreground/60 uppercase font-bold tracking-wider">
|
||||
{m.tool_arguments()}
|
||||
</div>
|
||||
{renderToolCallArguments(toolArgs)}
|
||||
</div>
|
||||
)}
|
||||
</div>,
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
if (type === 'image') {
|
||||
renderedBlocks.push(
|
||||
<div
|
||||
key={`img-${idx}`}
|
||||
className="text-xs text-muted-foreground italic flex items-center gap-1.5 py-1"
|
||||
>
|
||||
{m.image_object()}
|
||||
</div>,
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
// Fallback for other object types
|
||||
const stringified = JSON.stringify(item, null, 2)
|
||||
if (stringified === '{}') return
|
||||
renderedBlocks.push(
|
||||
<pre
|
||||
key={`other-${idx}`}
|
||||
className="text-xs text-foreground/80 font-mono whitespace-pre-wrap break-words bg-muted/20 p-2 rounded"
|
||||
>
|
||||
{stringified}
|
||||
</pre>,
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
if (renderedBlocks.length === 0) return null
|
||||
|
||||
return (
|
||||
<div className="space-y-3 w-full">
|
||||
{renderedBlocks.map((block, index) => (
|
||||
<React.Fragment key={index}>
|
||||
{index > 0 && <Separator className="my-3 opacity-50" />}
|
||||
{block}
|
||||
</React.Fragment>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<div key={entry.id} className="relative pl-6 pb-6 last:pb-0">
|
||||
{/* Timeline Line */}
|
||||
<div className="absolute left-[9px] top-2 bottom-0 w-0.5 bg-foreground/10 last:hidden" />
|
||||
|
||||
{/* Timeline Node */}
|
||||
<div
|
||||
className={`absolute left-0 top-1.5 h-5 w-5 rounded-full border-4 border-background flex items-center justify-center ${
|
||||
msg.role === 'user'
|
||||
? 'bg-slate-500'
|
||||
: msg.role === 'assistant'
|
||||
? 'bg-violet-500'
|
||||
: msg.role === 'toolResult'
|
||||
? msg.isError
|
||||
? 'bg-red-500'
|
||||
: 'bg-emerald-500'
|
||||
: 'bg-amber-500'
|
||||
}`}
|
||||
/>
|
||||
|
||||
<div className="flex flex-col gap-1.5 bg-muted/30 dark:bg-muted/10 p-3 rounded-lg border border-foreground/5 backdrop-blur-xs w-full">
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
<span
|
||||
className={`text-[10px] px-2 py-0.5 rounded-full font-semibold uppercase tracking-wider ${badgeColor}`}
|
||||
>
|
||||
{roleName}
|
||||
</span>
|
||||
<span className="text-[10px] text-muted-foreground/60">
|
||||
{timestamp}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{renderMessageContent()}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback for non-message entries or arbitrary entries
|
||||
return (
|
||||
<div key={entry.id} className="relative pl-6 pb-6 last:pb-0">
|
||||
<div className="absolute left-[9px] top-2 bottom-0 w-0.5 bg-foreground/10 last:hidden" />
|
||||
<div className="absolute left-0 top-1.5 h-5 w-5 rounded-full border-4 border-background bg-gray-400" />
|
||||
<div className="bg-muted/30 p-3 rounded-lg border border-foreground/5">
|
||||
<div className="text-[10px] text-muted-foreground/60">{timestamp}</div>
|
||||
<pre className="text-xs text-foreground/80 font-mono whitespace-pre-wrap break-words">
|
||||
{JSON.stringify(entry.entry, null, 2)}
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex flex-col items-center justify-center py-12 text-center text-muted-foreground">
|
||||
<Terminal className="w-8 h-8 text-muted-foreground/40 mb-2 animate-pulse" />
|
||||
<p className="text-sm font-medium">{m.no_logs_found()}</p>
|
||||
<p className="text-xs text-muted-foreground/60 mt-1">{m.session_no_entries_yet()}</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
)
|
||||
}
|
||||
@@ -1,12 +1,5 @@
|
||||
import { client } from '@/ui/api/client'
|
||||
import { Button } from '@/ui/components/ui/button'
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogDescription,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from '@/ui/components/ui/dialog'
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
@@ -23,11 +16,9 @@ import {
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
} from '@/ui/components/ui/alert-dialog'
|
||||
import { Separator } from '@/ui/components/ui/separator'
|
||||
import { formatTimeAgo } from '@/ui/lib/time'
|
||||
import type { AttachmentInfo, CommentInfo, UserInfo } from '@shumai/dtos'
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
|
||||
import { Download, File, Terminal, MoreHorizontal, Trash2 } from 'lucide-react'
|
||||
import { Download, File, MoreHorizontal, Trash2 } from 'lucide-react'
|
||||
import React from 'react'
|
||||
import Markdown from 'react-markdown'
|
||||
import { Avatar, AvatarFallback, AvatarImage } from '../ui/avatar'
|
||||
@@ -37,6 +28,7 @@ import { formatTimecode } from '../viewers/video/utils'
|
||||
import { m } from '@/ui/paraglide/messages.js'
|
||||
import { useUiStore } from '@/ui/stores/ui'
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../ui/tooltip'
|
||||
import { AgentSessionLogsDialog } from '../agent/agent-session-logs-dialog'
|
||||
|
||||
interface MessageCardProps {
|
||||
teamId?: string
|
||||
@@ -192,18 +184,6 @@ export const MessageCard: React.FC<MessageCardProps> = ({
|
||||
return false
|
||||
}, [me, message.creator?.id])
|
||||
|
||||
const { data: logs, isLoading: isLogsLoading } = useQuery({
|
||||
queryKey: ['agent-sessions', message.sessionId, 'entries'],
|
||||
queryFn: async () => {
|
||||
const res = await client.api['agent-sessions'][':sessionId'].entries.$get({
|
||||
param: { sessionId: message.sessionId! },
|
||||
})
|
||||
if (!res.ok) throw new Error('Failed to fetch session logs')
|
||||
return await res.json()
|
||||
},
|
||||
enabled: isLogsOpen && !!message.sessionId,
|
||||
})
|
||||
|
||||
const renderFormattedMessage = (text: string) => {
|
||||
const parts = text.split(/(<@[a-zA-Z0-9_-]+>)/g)
|
||||
return parts.map((part, index) => {
|
||||
@@ -442,305 +422,11 @@ export const MessageCard: React.FC<MessageCardProps> = ({
|
||||
</div>
|
||||
|
||||
{/* Logs Dialog */}
|
||||
<Dialog open={isLogsOpen} onOpenChange={setIsLogsOpen}>
|
||||
<DialogContent className="sm:max-w-2xl max-h-[80vh] flex flex-col p-6 overflow-hidden bg-background/95 backdrop-blur-md border border-foreground/15 shadow-2xl">
|
||||
<DialogHeader className="pb-4 border-b border-foreground/15">
|
||||
<DialogTitle className="flex items-center gap-2 text-xl font-bold">
|
||||
<Terminal className="w-5 h-5 text-violet-500" />
|
||||
{m.agent_session_logs()}
|
||||
</DialogTitle>
|
||||
<DialogDescription>{m.agent_logs_description()}</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="flex-1 overflow-y-auto pr-1 py-4 space-y-4 min-h-0 select-text">
|
||||
{isLogsLoading ? (
|
||||
<div className="space-y-4">
|
||||
<div className="flex gap-4">
|
||||
<Skeleton className="h-5 w-5 rounded-full shrink-0" />
|
||||
<div className="flex-1 space-y-2">
|
||||
<Skeleton className="h-4 w-1/4" />
|
||||
<Skeleton className="h-20 w-full" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex gap-4">
|
||||
<Skeleton className="h-5 w-5 rounded-full shrink-0" />
|
||||
<div className="flex-1 space-y-2">
|
||||
<Skeleton className="h-4 w-1/4" />
|
||||
<Skeleton className="h-12 w-full" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : logs && logs.length > 0 ? (
|
||||
<div className="flex flex-col">
|
||||
{logs.map((entry) => {
|
||||
const piEntry = entry.entry as Record<string, unknown> | null
|
||||
const timestampStr =
|
||||
piEntry?.timestamp || (entry as Record<string, unknown>).timestamp
|
||||
let timestamp = ''
|
||||
if (typeof timestampStr === 'string' || typeof timestampStr === 'number') {
|
||||
const dateObj = new Date(timestampStr)
|
||||
if (!isNaN(dateObj.getTime())) {
|
||||
timestamp = formatTimeAgo(dateObj.toISOString())
|
||||
}
|
||||
}
|
||||
|
||||
if (piEntry && typeof piEntry === 'object') {
|
||||
if (piEntry.type === 'message' && piEntry.message) {
|
||||
const msg = piEntry.message as Record<string, unknown>
|
||||
let badgeColor =
|
||||
'bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200'
|
||||
let roleName: string = String(msg.role || '')
|
||||
|
||||
if (msg.role === 'user') {
|
||||
badgeColor =
|
||||
'bg-slate-100 text-slate-800 dark:bg-slate-900/30 dark:text-slate-300'
|
||||
roleName = m.role_user()
|
||||
} else if (msg.role === 'assistant') {
|
||||
badgeColor =
|
||||
'bg-violet-100 text-violet-800 dark:bg-violet-900/30 dark:text-violet-300'
|
||||
roleName = m.role_agent()
|
||||
} else if (msg.role === 'toolResult') {
|
||||
badgeColor = msg.isError
|
||||
? 'bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300'
|
||||
: 'bg-emerald-100 text-emerald-800 dark:bg-emerald-900/30 dark:text-emerald-300'
|
||||
roleName = m.tool_result_with_name({
|
||||
name: String(msg.toolName || m.unknown()),
|
||||
})
|
||||
} else if (msg.role === 'thought') {
|
||||
badgeColor =
|
||||
'bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-300'
|
||||
roleName = m.role_thinking()
|
||||
}
|
||||
|
||||
const renderToolCallArguments = (args: unknown) => {
|
||||
let parsedArgs: unknown = args
|
||||
if (typeof args === 'string') {
|
||||
try {
|
||||
parsedArgs = JSON.parse(args)
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
parsedArgs &&
|
||||
typeof parsedArgs === 'object' &&
|
||||
!Array.isArray(parsedArgs)
|
||||
) {
|
||||
const obj = parsedArgs as Record<string, unknown>
|
||||
return (
|
||||
<div className="mt-1 space-y-1.5 pt-3">
|
||||
{Object.entries(obj).map(([key, value]) => {
|
||||
const valueStr =
|
||||
value && typeof value === 'object'
|
||||
? JSON.stringify(value, null, 2)
|
||||
: String(value)
|
||||
return (
|
||||
<div key={key} className="text-xs leading-relaxed break-words">
|
||||
<span className="font-semibold text-violet-600 dark:text-violet-400">
|
||||
{key}:
|
||||
</span>{' '}
|
||||
<span className="text-foreground/90 font-mono whitespace-pre-wrap">
|
||||
{valueStr}
|
||||
</span>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="text-xs font-mono whitespace-pre-wrap">
|
||||
{String(args)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const renderMessageContent = () => {
|
||||
const content = msg.content
|
||||
if (!content) return null
|
||||
|
||||
if (typeof content === 'string') {
|
||||
if (!content.trim()) return null
|
||||
return (
|
||||
<div className="text-xs text-foreground/80 dark:text-foreground/95 leading-relaxed prose prose-sm dark:prose-invert max-w-none break-words">
|
||||
<Markdown>{preprocessMarkdown(content)}</Markdown>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
if (Array.isArray(content)) {
|
||||
const renderedBlocks: React.ReactNode[] = []
|
||||
|
||||
content.forEach((item, idx) => {
|
||||
if (!item) return
|
||||
|
||||
if (typeof item === 'string') {
|
||||
if (!item.trim()) return
|
||||
renderedBlocks.push(
|
||||
<div
|
||||
key={`str-${idx}`}
|
||||
className="text-xs text-foreground/80 dark:text-foreground/95 leading-relaxed prose prose-sm dark:prose-invert max-w-none break-words"
|
||||
>
|
||||
<Markdown>{preprocessMarkdown(item)}</Markdown>
|
||||
</div>,
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
if (typeof item === 'object') {
|
||||
const itemObj = item as Record<string, unknown>
|
||||
const type = itemObj.type
|
||||
if (type === 'text') {
|
||||
const text = itemObj.text
|
||||
if (typeof text !== 'string' || !text.trim()) return
|
||||
renderedBlocks.push(
|
||||
<div
|
||||
key={`txt-${idx}`}
|
||||
className="text-xs text-foreground/80 dark:text-foreground/95 leading-relaxed prose prose-sm dark:prose-invert max-w-none break-words"
|
||||
>
|
||||
<Markdown>{preprocessMarkdown(text)}</Markdown>
|
||||
</div>,
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
if (type === 'toolCall') {
|
||||
const toolName = String(
|
||||
itemObj.name || itemObj.toolName || m.unknown(),
|
||||
)
|
||||
const toolArgs = itemObj.arguments || itemObj.args
|
||||
renderedBlocks.push(
|
||||
<div key={`tool-${idx}`} className="text-xs space-y-2 py-1">
|
||||
<div className="font-semibold text-violet-600 dark:text-violet-400 flex items-center gap-1.5">
|
||||
{m.calling_tool()}{' '}
|
||||
<span className="font-mono bg-violet-500/10 px-1 py-0.5 rounded text-[11px]">
|
||||
{toolName}
|
||||
</span>
|
||||
</div>
|
||||
{!!toolArgs && (
|
||||
<div className="space-y-1 pt-3">
|
||||
<div className="text-[10px] text-muted-foreground/60 uppercase font-bold tracking-wider">
|
||||
{m.tool_arguments()}
|
||||
</div>
|
||||
{renderToolCallArguments(toolArgs)}
|
||||
</div>
|
||||
)}
|
||||
</div>,
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
if (type === 'image') {
|
||||
renderedBlocks.push(
|
||||
<div
|
||||
key={`img-${idx}`}
|
||||
className="text-xs text-muted-foreground italic flex items-center gap-1.5 py-1"
|
||||
>
|
||||
{m.image_object()}
|
||||
</div>,
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
// Fallback for other object types
|
||||
const stringified = JSON.stringify(item, null, 2)
|
||||
if (stringified === '{}') return
|
||||
renderedBlocks.push(
|
||||
<pre
|
||||
key={`other-${idx}`}
|
||||
className="text-xs text-foreground/80 font-mono whitespace-pre-wrap break-words bg-muted/20 p-2 rounded"
|
||||
>
|
||||
{stringified}
|
||||
</pre>,
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
if (renderedBlocks.length === 0) return null
|
||||
|
||||
return (
|
||||
<div className="space-y-3 w-full">
|
||||
{renderedBlocks.map((block, index) => (
|
||||
<React.Fragment key={index}>
|
||||
{index > 0 && <Separator className="my-3 opacity-50" />}
|
||||
{block}
|
||||
</React.Fragment>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<div key={entry.id} className="relative pl-6 pb-6 last:pb-0">
|
||||
{/* Timeline Line */}
|
||||
<div className="absolute left-[9px] top-2 bottom-0 w-0.5 bg-foreground/10 last:hidden" />
|
||||
|
||||
{/* Timeline Node */}
|
||||
<div
|
||||
className={`absolute left-0 top-1.5 h-5 w-5 rounded-full border-4 border-background flex items-center justify-center ${
|
||||
msg.role === 'user'
|
||||
? 'bg-slate-500'
|
||||
: msg.role === 'assistant'
|
||||
? 'bg-violet-500'
|
||||
: msg.role === 'toolResult'
|
||||
? msg.isError
|
||||
? 'bg-red-500'
|
||||
: 'bg-emerald-500'
|
||||
: 'bg-amber-500'
|
||||
}`}
|
||||
/>
|
||||
|
||||
<div className="flex flex-col gap-1.5 bg-muted/30 dark:bg-muted/10 p-3 rounded-lg border border-foreground/5 backdrop-blur-xs w-full">
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
<span
|
||||
className={`text-[10px] px-2 py-0.5 rounded-full font-semibold uppercase tracking-wider ${badgeColor}`}
|
||||
>
|
||||
{roleName}
|
||||
</span>
|
||||
<span className="text-[10px] text-muted-foreground/60">
|
||||
{timestamp}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{renderMessageContent()}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback for non-message entries or arbitrary entries
|
||||
return (
|
||||
<div key={entry.id} className="relative pl-6 pb-6 last:pb-0">
|
||||
<div className="absolute left-[9px] top-2 bottom-0 w-0.5 bg-foreground/10 last:hidden" />
|
||||
<div className="absolute left-0 top-1.5 h-5 w-5 rounded-full border-4 border-background bg-gray-400" />
|
||||
<div className="bg-muted/30 p-3 rounded-lg border border-foreground/5">
|
||||
<div className="text-[10px] text-muted-foreground/60">{timestamp}</div>
|
||||
<pre className="text-xs text-foreground/80 font-mono whitespace-pre-wrap break-words">
|
||||
{JSON.stringify(entry.entry, null, 2)}
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex flex-col items-center justify-center py-12 text-center text-muted-foreground">
|
||||
<Terminal className="w-8 h-8 text-muted-foreground/40 mb-2 animate-pulse" />
|
||||
<p className="text-sm font-medium">{m.no_logs_found()}</p>
|
||||
<p className="text-xs text-muted-foreground/60 mt-1">
|
||||
{m.session_no_entries_yet()}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
<AgentSessionLogsDialog
|
||||
sessionId={message.sessionId}
|
||||
open={isLogsOpen}
|
||||
onOpenChange={setIsLogsOpen}
|
||||
/>
|
||||
|
||||
<AlertDialog open={isDeleteDialogOpen} onOpenChange={setIsDeleteDialogOpen}>
|
||||
<AlertDialogContent onClick={(e) => e.stopPropagation()}>
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useInfiniteQuery } from '@tanstack/react-query'
|
||||
import { useInView } from 'react-intersection-observer'
|
||||
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 {
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from '@/ui/components/ui/table'
|
||||
import { Avatar, AvatarFallback, AvatarImage } from '@/ui/components/ui/avatar'
|
||||
import { Badge } from '@/ui/components/ui/badge'
|
||||
import { Loader2, MessagesSquare } from 'lucide-react'
|
||||
import { formatTimeAgo } from '@/ui/lib/time'
|
||||
import { AgentSessionLogsDialog } from '../agent/agent-session-logs-dialog'
|
||||
|
||||
interface AgentSessionsDashboardProps {
|
||||
teamId: string
|
||||
}
|
||||
|
||||
export function AgentSessionsDashboard({ teamId }: AgentSessionsDashboardProps) {
|
||||
const [selectedSessionId, setSelectedSessionId] = useState<string | null>(null)
|
||||
const { ref: loadMoreRef, inView } = useInView()
|
||||
|
||||
const { data, isLoading, isError, fetchNextPage, hasNextPage, isFetchingNextPage } =
|
||||
useInfiniteQuery({
|
||||
queryKey: ['teams', teamId, 'agent-sessions'],
|
||||
queryFn: async ({ pageParam }) => {
|
||||
const res = await client.api.teams[':teamId']['agent-sessions'].$get({
|
||||
param: { teamId },
|
||||
query: {
|
||||
first: '20',
|
||||
after: pageParam ? String(pageParam) : undefined,
|
||||
},
|
||||
})
|
||||
if (!res.ok) throw new Error('Failed to fetch agent sessions')
|
||||
return await res.json()
|
||||
},
|
||||
initialPageParam: '',
|
||||
getNextPageParam: (lastPage) => lastPage.pageInfo.cursor || undefined,
|
||||
enabled: !!teamId,
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
if (inView && hasNextPage && !isFetchingNextPage) {
|
||||
fetchNextPage()
|
||||
}
|
||||
}, [inView, hasNextPage, isFetchingNextPage, fetchNextPage])
|
||||
|
||||
const allSessions =
|
||||
data?.pages.flatMap((page) => page.data).filter((s) => s.id !== 'pending') || []
|
||||
const totalCount = data?.pages[0]?.pageInfo.total ?? allSessions.length
|
||||
|
||||
const getSessionTypeBadge = (type: string) => {
|
||||
switch (type) {
|
||||
case 'comment':
|
||||
return (
|
||||
<Badge
|
||||
variant="outline"
|
||||
className="bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20"
|
||||
>
|
||||
{m.session_type_comment()}
|
||||
</Badge>
|
||||
)
|
||||
case 'chat':
|
||||
return (
|
||||
<Badge
|
||||
variant="outline"
|
||||
className="bg-violet-500/10 text-violet-600 dark:text-violet-400 border-violet-500/20"
|
||||
>
|
||||
{m.session_type_chat()}
|
||||
</Badge>
|
||||
)
|
||||
case 'naming':
|
||||
return (
|
||||
<Badge
|
||||
variant="outline"
|
||||
className="bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/20"
|
||||
>
|
||||
{m.session_type_naming()}
|
||||
</Badge>
|
||||
)
|
||||
default:
|
||||
return (
|
||||
<Badge variant="outline" className="bg-muted text-muted-foreground border-border">
|
||||
{type}
|
||||
</Badge>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<Card className="border border-border/50 shadow-xs">
|
||||
<CardHeader className="pb-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<CardTitle className="text-xl font-bold flex items-center gap-2">
|
||||
<MessagesSquare className="w-5 h-5 text-violet-500" />
|
||||
{m.sessions()} ({totalCount})
|
||||
</CardTitle>
|
||||
<CardDescription className="mt-1 text-sm text-muted-foreground">
|
||||
{m.sessions_description()}
|
||||
</CardDescription>
|
||||
</div>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
{isLoading ? (
|
||||
<div className="flex h-64 items-center justify-center">
|
||||
<Loader2 className="h-8 w-8 animate-spin text-muted-foreground" />
|
||||
</div>
|
||||
) : isError ? (
|
||||
<div className="flex h-64 items-center justify-center text-destructive">
|
||||
Failed to load agent sessions.
|
||||
</div>
|
||||
) : allSessions.length === 0 ? (
|
||||
<div className="flex flex-col items-center justify-center py-12 text-center text-muted-foreground">
|
||||
<MessagesSquare className="w-10 h-10 text-muted-foreground/40 mb-3" />
|
||||
<p className="text-base font-medium">{m.no_sessions_found()}</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="rounded-md border border-border/50 overflow-hidden">
|
||||
<Table>
|
||||
<TableHeader className="bg-muted/40">
|
||||
<TableRow>
|
||||
<TableHead>{m.session_name()}</TableHead>
|
||||
<TableHead>{m.creator()}</TableHead>
|
||||
<TableHead>{m.session_type()}</TableHead>
|
||||
<TableHead className="text-right">{m.create_time()}</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{allSessions.map((session) => (
|
||||
<TableRow
|
||||
key={session.id}
|
||||
onClick={() => setSelectedSessionId(session.id)}
|
||||
className="cursor-pointer hover:bg-muted/50 transition-colors"
|
||||
>
|
||||
<TableCell className="font-medium">
|
||||
<div className="flex flex-col">
|
||||
<span className="text-sm font-semibold text-foreground">
|
||||
{session.name || m.untitled_session()}
|
||||
</span>
|
||||
<span className="text-xs font-mono text-muted-foreground/70">
|
||||
{session.id}
|
||||
</span>
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<div className="flex items-center gap-2">
|
||||
<Avatar className="h-6 w-6">
|
||||
<AvatarImage src={session.creator?.image || undefined} />
|
||||
<AvatarFallback className="text-[10px]">
|
||||
{session.creator?.name?.[0]?.toUpperCase() || '?'}
|
||||
</AvatarFallback>
|
||||
</Avatar>
|
||||
<span className="text-sm text-foreground/90">
|
||||
{session.creator?.name || 'System / Agent'}
|
||||
</span>
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell>{getSessionTypeBadge(session.type)}</TableCell>
|
||||
<TableCell className="text-right text-xs text-muted-foreground">
|
||||
{formatTimeAgo(session.createdAt)}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
<div ref={loadMoreRef} className="py-4 flex justify-center">
|
||||
{isFetchingNextPage && (
|
||||
<Loader2 className="h-6 w-6 animate-spin text-muted-foreground" />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<AgentSessionLogsDialog
|
||||
sessionId={selectedSessionId}
|
||||
open={!!selectedSessionId}
|
||||
onOpenChange={(open) => {
|
||||
if (!open) setSelectedSessionId(null)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -885,5 +885,16 @@
|
||||
"members_view": "Members",
|
||||
"access_denied": "Access Denied",
|
||||
"only_owner_dashboard": "Only team owners can access the dashboard.",
|
||||
"role": "Role"
|
||||
"role": "Role",
|
||||
"sessions": "Sessions",
|
||||
"sessions_description": "View and inspect all agent sessions created within the team.",
|
||||
"session_name": "Session Name",
|
||||
"creator": "Creator",
|
||||
"create_time": "Create Time",
|
||||
"session_type": "Session Type",
|
||||
"no_sessions_found": "No sessions found",
|
||||
"session_type_comment": "Comment",
|
||||
"session_type_chat": "Chat",
|
||||
"session_type_naming": "Naming",
|
||||
"untitled_session": "Untitled Session"
|
||||
}
|
||||
|
||||
@@ -885,5 +885,16 @@
|
||||
"members_view": "成员",
|
||||
"access_denied": "访问被拒绝",
|
||||
"only_owner_dashboard": "只有团队所有者才能访问仪表盘。",
|
||||
"role": "角色"
|
||||
"role": "角色",
|
||||
"sessions": "会话列表",
|
||||
"sessions_description": "查看并检查团队内创建的所有 Agent 会话。",
|
||||
"session_name": "会话名称",
|
||||
"creator": "创建者",
|
||||
"create_time": "创建时间",
|
||||
"session_type": "会话类型",
|
||||
"no_sessions_found": "未找到会话",
|
||||
"session_type_comment": "评论",
|
||||
"session_type_chat": "对话",
|
||||
"session_type_naming": "命名",
|
||||
"untitled_session": "未命名会话"
|
||||
}
|
||||
|
||||
+10
@@ -832,4 +832,14 @@ export * from "./members_view.js";
|
||||
export * from "./access_denied.js";
|
||||
export * from "./only_owner_dashboard.js";
|
||||
export * from "./role.js";
|
||||
export * from "./sessions.js";
|
||||
export * from "./sessions_description.js";
|
||||
export * from "./session_name.js";
|
||||
export * from "./create_time.js";
|
||||
export * from "./session_type.js";
|
||||
export * from "./no_sessions_found.js";
|
||||
export * from "./session_type_comment.js";
|
||||
export * from "./session_type_chat.js";
|
||||
export * from "./session_type_naming.js";
|
||||
export * from "./untitled_session.js";
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
|
||||
+11
-1
@@ -833,4 +833,14 @@ 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 * from './role.js'
|
||||
export * from './sessions.js'
|
||||
export * from './sessions_description.js'
|
||||
export * from './session_name.js'
|
||||
export * from './create_time.js'
|
||||
export * from './session_type.js'
|
||||
export * from './no_sessions_found.js'
|
||||
export * from './session_type_comment.js'
|
||||
export * from './session_type_chat.js'
|
||||
export * from './session_type_naming.js'
|
||||
export * from './untitled_session.js'
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Create Time" |
|
||||
*
|
||||
* @param {Create_TimeInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const create_time: ((inputs?: Create_TimeInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Create_TimeInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Create_TimeInputs = {};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Create_TimeInputs */
|
||||
|
||||
const en_create_time = /** @type {(inputs: Create_TimeInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Create Time`)
|
||||
};
|
||||
|
||||
const zh_create_time = /** @type {(inputs: Create_TimeInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`创建时间`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Create Time" |
|
||||
*
|
||||
* @param {Create_TimeInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const create_time = /** @type {((inputs?: Create_TimeInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Create_TimeInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_create_time(inputs)
|
||||
return zh_create_time(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "No sessions found" |
|
||||
*
|
||||
* @param {No_Sessions_FoundInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const no_sessions_found: ((inputs?: No_Sessions_FoundInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<No_Sessions_FoundInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type No_Sessions_FoundInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} No_Sessions_FoundInputs */
|
||||
|
||||
const en_no_sessions_found = /** @type {(inputs: No_Sessions_FoundInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`No sessions found`)
|
||||
};
|
||||
|
||||
const zh_no_sessions_found = /** @type {(inputs: No_Sessions_FoundInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`未找到会话`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "No sessions found" |
|
||||
*
|
||||
* @param {No_Sessions_FoundInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const no_sessions_found = /** @type {((inputs?: No_Sessions_FoundInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<No_Sessions_FoundInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_no_sessions_found(inputs)
|
||||
return zh_no_sessions_found(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Session Name" |
|
||||
*
|
||||
* @param {Session_NameInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const session_name: ((inputs?: Session_NameInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Session_NameInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Session_NameInputs = {};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Session_NameInputs */
|
||||
|
||||
const en_session_name = /** @type {(inputs: Session_NameInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Session Name`)
|
||||
};
|
||||
|
||||
const zh_session_name = /** @type {(inputs: Session_NameInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`会话名称`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Session Name" |
|
||||
*
|
||||
* @param {Session_NameInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const session_name = /** @type {((inputs?: Session_NameInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Session_NameInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_session_name(inputs)
|
||||
return zh_session_name(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Session Type" |
|
||||
*
|
||||
* @param {Session_TypeInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const session_type: ((inputs?: Session_TypeInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Session_TypeInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Session_TypeInputs = {};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Session_TypeInputs */
|
||||
|
||||
const en_session_type = /** @type {(inputs: Session_TypeInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Session Type`)
|
||||
};
|
||||
|
||||
const zh_session_type = /** @type {(inputs: Session_TypeInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`会话类型`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Session Type" |
|
||||
*
|
||||
* @param {Session_TypeInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const session_type = /** @type {((inputs?: Session_TypeInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Session_TypeInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_session_type(inputs)
|
||||
return zh_session_type(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Chat" |
|
||||
*
|
||||
* @param {Session_Type_ChatInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const session_type_chat: ((inputs?: Session_Type_ChatInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Session_Type_ChatInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Session_Type_ChatInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Session_Type_ChatInputs */
|
||||
|
||||
const en_session_type_chat = /** @type {(inputs: Session_Type_ChatInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Chat`)
|
||||
};
|
||||
|
||||
const zh_session_type_chat = /** @type {(inputs: Session_Type_ChatInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`对话`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Chat" |
|
||||
*
|
||||
* @param {Session_Type_ChatInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const session_type_chat = /** @type {((inputs?: Session_Type_ChatInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Session_Type_ChatInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_session_type_chat(inputs)
|
||||
return zh_session_type_chat(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Comment" |
|
||||
*
|
||||
* @param {Session_Type_CommentInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const session_type_comment: ((inputs?: Session_Type_CommentInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Session_Type_CommentInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Session_Type_CommentInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Session_Type_CommentInputs */
|
||||
|
||||
const en_session_type_comment = /** @type {(inputs: Session_Type_CommentInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Comment`)
|
||||
};
|
||||
|
||||
const zh_session_type_comment = /** @type {(inputs: Session_Type_CommentInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`评论`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Comment" |
|
||||
*
|
||||
* @param {Session_Type_CommentInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const session_type_comment = /** @type {((inputs?: Session_Type_CommentInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Session_Type_CommentInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_session_type_comment(inputs)
|
||||
return zh_session_type_comment(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Naming" |
|
||||
*
|
||||
* @param {Session_Type_NamingInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const session_type_naming: ((inputs?: Session_Type_NamingInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Session_Type_NamingInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Session_Type_NamingInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Session_Type_NamingInputs */
|
||||
|
||||
const en_session_type_naming = /** @type {(inputs: Session_Type_NamingInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Naming`)
|
||||
};
|
||||
|
||||
const zh_session_type_naming = /** @type {(inputs: Session_Type_NamingInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`命名`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Naming" |
|
||||
*
|
||||
* @param {Session_Type_NamingInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const session_type_naming = /** @type {((inputs?: Session_Type_NamingInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Session_Type_NamingInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_session_type_naming(inputs)
|
||||
return zh_session_type_naming(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Sessions" |
|
||||
*
|
||||
* @param {SessionsInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sessions: ((inputs?: SessionsInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<SessionsInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type SessionsInputs = {};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} SessionsInputs */
|
||||
|
||||
const en_sessions = /** @type {(inputs: SessionsInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Sessions`)
|
||||
};
|
||||
|
||||
const zh_sessions = /** @type {(inputs: SessionsInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`会话列表`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Sessions" |
|
||||
*
|
||||
* @param {SessionsInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sessions = /** @type {((inputs?: SessionsInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<SessionsInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_sessions(inputs)
|
||||
return zh_sessions(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "View and inspect all agent sessions created within the team." |
|
||||
*
|
||||
* @param {Sessions_DescriptionInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sessions_description: ((inputs?: Sessions_DescriptionInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Sessions_DescriptionInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Sessions_DescriptionInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Sessions_DescriptionInputs */
|
||||
|
||||
const en_sessions_description = /** @type {(inputs: Sessions_DescriptionInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`View and inspect all agent sessions created within the team.`)
|
||||
};
|
||||
|
||||
const zh_sessions_description = /** @type {(inputs: Sessions_DescriptionInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`查看并检查团队内创建的所有 Agent 会话。`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "View and inspect all agent sessions created within the team." |
|
||||
*
|
||||
* @param {Sessions_DescriptionInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sessions_description = /** @type {((inputs?: Sessions_DescriptionInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Sessions_DescriptionInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_sessions_description(inputs)
|
||||
return zh_sessions_description(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Untitled Session" |
|
||||
*
|
||||
* @param {Untitled_SessionInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const untitled_session: ((inputs?: Untitled_SessionInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Untitled_SessionInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Untitled_SessionInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Untitled_SessionInputs */
|
||||
|
||||
const en_untitled_session = /** @type {(inputs: Untitled_SessionInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Untitled Session`)
|
||||
};
|
||||
|
||||
const zh_untitled_session = /** @type {(inputs: Untitled_SessionInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`未命名会话`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Untitled Session" |
|
||||
*
|
||||
* @param {Untitled_SessionInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const untitled_session = /** @type {((inputs?: Untitled_SessionInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Untitled_SessionInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_untitled_session(inputs)
|
||||
return zh_untitled_session(inputs)
|
||||
});
|
||||
@@ -5,9 +5,10 @@ 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'
|
||||
import { AgentSessionsDashboard } from '@/ui/components/dashboard/AgentSessionsDashboard'
|
||||
import { BarChart2, Loader2, MessagesSquare, ShieldAlert } from 'lucide-react'
|
||||
|
||||
type DashboardTab = 'ai-usage'
|
||||
type DashboardTab = 'ai-usage' | 'ai-sessions'
|
||||
|
||||
function TeamDashboardPage() {
|
||||
const { teamId } = Route.useParams()
|
||||
@@ -72,6 +73,22 @@ function TeamDashboardPage() {
|
||||
<div className="ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary" />
|
||||
)}
|
||||
</button>
|
||||
|
||||
<button
|
||||
onClick={() => setActiveTab('ai-sessions')}
|
||||
className={cn(
|
||||
'w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all',
|
||||
activeTab === 'ai-sessions'
|
||||
? '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',
|
||||
)}
|
||||
>
|
||||
<MessagesSquare className="w-5 h-5" />
|
||||
{m.sessions()}
|
||||
{activeTab === 'ai-sessions' && (
|
||||
<div className="ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary" />
|
||||
)}
|
||||
</button>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
@@ -79,6 +96,7 @@ function TeamDashboardPage() {
|
||||
<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} />}
|
||||
{activeTab === 'ai-sessions' && <AgentSessionsDashboard teamId={teamId} />}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user