mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-04 23:24:21 +00:00
feat: configure embedding servers and transcript agents
This commit is contained in:
@@ -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 = [
|
||||
|
||||
Reference in New Issue
Block a user