Configure embedding servers and add a Transcript Agent (#561)

* feat: configure embedding servers and transcript agents

* fix(agents): guide Transcript Agent setup

* fix(agents): require a configured embedding server URL

* docs: consolidate embedding and transcript changelog entry

* fix(webui): stabilize transcript menu interactions

* test(e2e): verify transcript scroll interruption by position

* test(webui): check transcript following without frame timing races
This commit is contained in:
Yiling-J
2026-12-05 10:17:36 +08:00
committed by GitHub
parent 72a7f68c92
commit 6c74413375
66 changed files with 2021 additions and 325 deletions
+67 -8
View File
@@ -1040,6 +1040,65 @@ describe('AgentService', () => {
})
})
describe('Transcript Agent', () => {
test('allows one Transcript Agent per team, including when it is disabled', async () => {
const svc = new AgentService()
const team = await prisma.team.create({ data: { name: 'Transcript agent team' } })
const params = {
teamId: team.id,
type: 'transcription' as const,
name: 'Transcript Agent',
avatar: 'custom-transcript-avatar',
enabled: false,
thinkingLevel: 'off' as const,
}
await expect(svc.createAgent(params)).resolves.toMatchObject({
enabled: false,
providerId: null,
})
await expect(svc.createAgent(params)).rejects.toThrow('already exists for this team')
expect(await prisma.agent.count({ where: { teamId: team.id, type: 'transcription' } })).toBe(
1,
)
})
test('provisions and toggles the same read-only agent from the environment', async () => {
const svc = new AgentService()
const team = await prisma.team.create({ data: { name: 'Managed transcript agent team' } })
try {
vi.stubEnv('ENABLE_TRANSCRIPTION_AGENT', 'false')
await svc.ensureSystemAgentsForTeam(team.id)
expect(
await prisma.agent.count({ where: { teamId: team.id, type: 'transcription' } }),
).toBe(0)
vi.stubEnv('ENABLE_TRANSCRIPTION_AGENT', 'true')
await svc.ensureSystemAgents()
const [agent] = await svc.listAgents({ teamId: team.id })
expect(await svc.toAgentInfo(agent)).toMatchObject({
enabled: true,
readOnly: true,
avatarPreset: 'avatar-2',
})
vi.stubEnv('ENABLE_TRANSCRIPTION_AGENT', 'false')
await svc.ensureSystemAgentsForTeam(team.id)
const [disabled] = await svc.listAgents({ teamId: team.id })
expect(await svc.toAgentInfo(disabled)).toMatchObject({
id: agent.id,
enabled: false,
readOnly: true,
})
vi.stubEnv('ENABLE_TRANSCRIPTION_AGENT', undefined)
expect(await svc.toAgentInfo(disabled)).toMatchObject({ enabled: false, readOnly: false })
} finally {
vi.unstubAllEnvs()
}
})
})
describe('ensureEmbeddingAgent', () => {
test('creates embedding agent when ENABLE_EMBEDDING_AGENT is true', async () => {
const db = prisma
@@ -1048,7 +1107,7 @@ describe('AgentService', () => {
process.env.ENABLE_EMBEDDING_AGENT = 'true'
try {
await svc.ensureEmbeddingAgentForTeam(team.id)
await svc.ensureSystemAgentsForTeam(team.id)
const agent = await db.agent.findFirst({
where: { teamId: team.id, type: 'embedding' },
include: { user: true, skills: { include: { skill: true } }, mcpServers: true },
@@ -1063,7 +1122,7 @@ describe('AgentService', () => {
expect(info.readOnly).toBe(true)
// Ensure idempotency
await svc.ensureEmbeddingAgentForTeam(team.id)
await svc.ensureSystemAgentsForTeam(team.id)
const count = await db.agent.count({
where: { teamId: team.id, type: 'embedding' },
})
@@ -1093,7 +1152,7 @@ describe('AgentService', () => {
process.env.ENABLE_EMBEDDING_AGENT = 'true'
try {
await svc.ensureEmbeddingAgentForTeam(team.id)
await svc.ensureSystemAgentsForTeam(team.id)
const agent = await db.agent.findFirst({
where: { teamId: team.id, type: 'embedding' },
include: { user: true, skills: { include: { skill: true } }, mcpServers: true },
@@ -1113,7 +1172,7 @@ describe('AgentService', () => {
const team = await db.team.create({ data: { name: 'Team No Agent' } })
delete process.env.ENABLE_EMBEDDING_AGENT
await svc.ensureEmbeddingAgentForTeam(team.id)
await svc.ensureSystemAgentsForTeam(team.id)
const agent = await db.agent.findFirst({
where: { teamId: team.id, type: 'embedding' },
})
@@ -1127,7 +1186,7 @@ describe('AgentService', () => {
process.env.ENABLE_EMBEDDING_AGENT = 'false'
try {
await svc.ensureEmbeddingAgentForTeam(team.id)
await svc.ensureSystemAgentsForTeam(team.id)
const agent = await db.agent.findFirst({
where: { teamId: team.id, type: 'embedding' },
})
@@ -1157,7 +1216,7 @@ describe('AgentService', () => {
process.env.ENABLE_EMBEDDING_AGENT = 'false'
try {
await svc.ensureEmbeddingAgentForTeam(team.id)
await svc.ensureSystemAgentsForTeam(team.id)
const agent = await db.agent.findFirst({
where: { teamId: team.id, type: 'embedding' },
include: { user: true, skills: { include: { skill: true } }, mcpServers: true },
@@ -1172,7 +1231,7 @@ describe('AgentService', () => {
}
})
test('ensureSystemEmbeddingAgents updates all teams when ENABLE_EMBEDDING_AGENT is false', async () => {
test('ensureSystemAgents updates all teams when ENABLE_EMBEDDING_AGENT is false', async () => {
const db = prisma
const svc = new AgentService()
const { team: team1 } = await setupTestData(db)
@@ -1194,7 +1253,7 @@ describe('AgentService', () => {
process.env.ENABLE_EMBEDDING_AGENT = 'false'
try {
await svc.ensureSystemEmbeddingAgents()
await svc.ensureSystemAgents()
const a1 = await db.agent.findFirst({ where: { teamId: team1.id, type: 'embedding' } })
const a2 = await db.agent.findFirst({ where: { teamId: team2.id, type: 'embedding' } })