feat: configure embedding servers and transcript agents

This commit is contained in:
yiling
2026-12-04 18:54:29 +08:00
parent 72a7f68c92
commit 553269012c
57 changed files with 1686 additions and 271 deletions
+30
View File
@@ -71,6 +71,36 @@ describe('Agent API', () => {
})
})
it.each(['true', 'false'])(
'protects the Transcript Agent when ENABLE_TRANSCRIPTION_AGENT=%s',
async (value) => {
vi.stubEnv('ENABLE_TRANSCRIPTION_AGENT', value)
try {
vi.mocked(agentService.getAgent).mockResolvedValue({
id: 'transcript1',
teamId: 'team1',
type: 'transcription',
} as Awaited<ReturnType<typeof agentService.getAgent>>)
const payload = JSON.stringify({ type: 'transcription', name: 'Transcript Agent' })
const headers = { 'Content-Type': 'application/json' }
for (const [path, method, body] of [
['/teams/team1/agents', 'POST', payload],
['/agents/transcript1', 'PUT', payload],
['/agents/transcript1/permission', 'PATCH', JSON.stringify({ permission: 'editor' })],
['/agents/transcript1', 'DELETE', undefined],
] as const) {
expect((await app.request(path, { method, headers, body })).status).toBe(403)
}
expect(agentService.createAgent).not.toHaveBeenCalled()
expect(agentService.updateAgent).not.toHaveBeenCalled()
expect(agentService.updateAgentPermission).not.toHaveBeenCalled()
expect(agentService.deleteAgent).not.toHaveBeenCalled()
} finally {
vi.unstubAllEnvs()
}
},
)
describe('GET /teams/:teamId/agents', () => {
it('returns list of agents', async () => {
const mockAgents = [