mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-04 15:14:10 +00:00
fix(agents): guide Transcript Agent setup
This commit is contained in:
@@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- **storage**: Download HTML, SVG, and other unsupported preview formats when opened from local storage.
|
- **storage**: Download HTML, SVG, and other unsupported preview formats when opened from local storage.
|
||||||
|
- **video**: The Transcript Agent settings guide you to set up an embedding server first. Automatically created Transcript Agents have their own default avatar.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ async function start() {
|
|||||||
process.env.NODE_ENV = 'development'
|
process.env.NODE_ENV = 'development'
|
||||||
process.env.SHUMAI_E2E = 'true'
|
process.env.SHUMAI_E2E = 'true'
|
||||||
process.env.ENABLE_EMBEDDING_AGENT = 'false'
|
process.env.ENABLE_EMBEDDING_AGENT = 'false'
|
||||||
|
process.env.ENABLE_TRANSCRIPTION_AGENT = 'false'
|
||||||
|
|
||||||
// Write variables to .env.e2e file so the teardown can load them
|
// Write variables to .env.e2e file so the teardown can load them
|
||||||
const envContent = [
|
const envContent = [
|
||||||
|
|||||||
@@ -1076,7 +1076,11 @@ describe('AgentService', () => {
|
|||||||
vi.stubEnv('ENABLE_TRANSCRIPTION_AGENT', 'true')
|
vi.stubEnv('ENABLE_TRANSCRIPTION_AGENT', 'true')
|
||||||
await svc.ensureSystemAgents()
|
await svc.ensureSystemAgents()
|
||||||
const [agent] = await svc.listAgents({ teamId: team.id })
|
const [agent] = await svc.listAgents({ teamId: team.id })
|
||||||
expect(await svc.toAgentInfo(agent)).toMatchObject({ enabled: true, readOnly: true })
|
expect(await svc.toAgentInfo(agent)).toMatchObject({
|
||||||
|
enabled: true,
|
||||||
|
readOnly: true,
|
||||||
|
avatarPreset: 'avatar-2',
|
||||||
|
})
|
||||||
|
|
||||||
vi.stubEnv('ENABLE_TRANSCRIPTION_AGENT', 'false')
|
vi.stubEnv('ENABLE_TRANSCRIPTION_AGENT', 'false')
|
||||||
await svc.ensureSystemAgentsForTeam(team.id)
|
await svc.ensureSystemAgentsForTeam(team.id)
|
||||||
|
|||||||
@@ -679,7 +679,7 @@ export class AgentService {
|
|||||||
teamId,
|
teamId,
|
||||||
name: type === 'embedding' ? 'embedding-agent' : setting.name,
|
name: type === 'embedding' ? 'embedding-agent' : setting.name,
|
||||||
type,
|
type,
|
||||||
avatar: 'avatar-1',
|
avatar: setting.avatar,
|
||||||
thinkingLevel: 'off',
|
thinkingLevel: 'off',
|
||||||
enabled: true,
|
enabled: true,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,16 +1,20 @@
|
|||||||
import type { AgentType } from '@shumai/dtos'
|
import type { AgentType } from '@shumai/dtos'
|
||||||
|
|
||||||
const systemAgentSettings = {
|
const systemAgentSettings = {
|
||||||
embedding: { envKey: 'ENABLE_EMBEDDING_AGENT', name: 'Embedding agent' },
|
embedding: { envKey: 'ENABLE_EMBEDDING_AGENT', name: 'Embedding agent', avatar: 'avatar-1' },
|
||||||
transcription: { envKey: 'ENABLE_TRANSCRIPTION_AGENT', name: 'Transcript Agent' },
|
transcription: {
|
||||||
|
envKey: 'ENABLE_TRANSCRIPTION_AGENT',
|
||||||
|
name: 'Transcript Agent',
|
||||||
|
avatar: 'avatar-2',
|
||||||
|
},
|
||||||
} as const
|
} as const
|
||||||
|
|
||||||
export function getSystemAgentSetting(type: AgentType) {
|
export function getSystemAgentSetting(type: AgentType) {
|
||||||
if (type !== 'embedding' && type !== 'transcription') return undefined
|
if (type !== 'embedding' && type !== 'transcription') return undefined
|
||||||
|
|
||||||
const { envKey, name } = systemAgentSettings[type]
|
const { envKey, name, avatar } = systemAgentSettings[type]
|
||||||
const value = process.env[envKey]
|
const value = process.env[envKey]
|
||||||
if (value !== 'true' && value !== 'false') return undefined
|
if (value !== 'true' && value !== 'false') return undefined
|
||||||
|
|
||||||
return { name, enabled: value === 'true' }
|
return { name, avatar, enabled: value === 'true' }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,17 @@ const integration: IntegrationDefinition<'embeddingServer'> = {
|
|||||||
export const LOCAL_EMBEDDING_PROVIDER = 'gemma-embedding-2-openai'
|
export const LOCAL_EMBEDDING_PROVIDER = 'gemma-embedding-2-openai'
|
||||||
const defaultLocalBaseUrl = 'http://localhost:9379/v1'
|
const defaultLocalBaseUrl = 'http://localhost:9379/v1'
|
||||||
|
|
||||||
|
export function resolveEmbeddingProvider(
|
||||||
|
{ url, isEnvConfigured }: EmbeddingServerSettingsResponse,
|
||||||
|
providerOverride?: string,
|
||||||
|
): string {
|
||||||
|
return (
|
||||||
|
providerOverride ||
|
||||||
|
process.env.EMBEDDING_PROVIDER ||
|
||||||
|
(url && !isEnvConfigured ? LOCAL_EMBEDDING_PROVIDER : 'gemini-embedding-2')
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
function getOpenAiBaseUrl(url: string): string {
|
function getOpenAiBaseUrl(url: string): string {
|
||||||
const baseUrl = url.replace(/\/embeddings$/, '')
|
const baseUrl = url.replace(/\/embeddings$/, '')
|
||||||
return baseUrl.endsWith('/v1') ? baseUrl : `${baseUrl}/v1`
|
return baseUrl.endsWith('/v1') ? baseUrl : `${baseUrl}/v1`
|
||||||
@@ -36,10 +47,7 @@ const modelListSchema = z.object({
|
|||||||
export class EmbeddingServerService {
|
export class EmbeddingServerService {
|
||||||
async resolveRuntimeConfig(teamId?: string, providerOverride?: string) {
|
async resolveRuntimeConfig(teamId?: string, providerOverride?: string) {
|
||||||
const { url, isEnv } = await resolveIntegrationConfig(integration, teamId ?? null)
|
const { url, isEnv } = await resolveIntegrationConfig(integration, teamId ?? null)
|
||||||
const provider =
|
const provider = resolveEmbeddingProvider({ url, isEnvConfigured: isEnv }, providerOverride)
|
||||||
providerOverride ||
|
|
||||||
process.env.EMBEDDING_PROVIDER ||
|
|
||||||
(url && !isEnv ? LOCAL_EMBEDDING_PROVIDER : 'gemini-embedding-2')
|
|
||||||
const localUrl = url || defaultLocalBaseUrl
|
const localUrl = url || defaultLocalBaseUrl
|
||||||
return {
|
return {
|
||||||
provider,
|
provider,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import * as path from 'path'
|
|||||||
import { prisma } from '@shumai/db'
|
import { prisma } from '@shumai/db'
|
||||||
import { setupTestDbHooks } from '@shumai/db/test'
|
import { setupTestDbHooks } from '@shumai/db/test'
|
||||||
import { teamService } from '@shumai/core/src/team/team'
|
import { teamService } from '@shumai/core/src/team/team'
|
||||||
import { describe, expect, it } from 'vitest'
|
import { describe, expect, it, vi } from 'vitest'
|
||||||
import type { TeamSettingsResponse } from '@shumai/dtos'
|
import type { TeamSettingsResponse } from '@shumai/dtos'
|
||||||
|
|
||||||
describe('TeamService', () => {
|
describe('TeamService', () => {
|
||||||
@@ -357,6 +357,30 @@ describe('TeamService', () => {
|
|||||||
expect(pm1View.find((m) => m.id === projectMember2.id)?.scope).toBe('project')
|
expect(pm1View.find((m) => m.id === projectMember2.id)?.scope).toBe('project')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('reports whether the effective embedding provider supports the Transcript Agent', async () => {
|
||||||
|
const team = await prisma.team.create({
|
||||||
|
data: {
|
||||||
|
name: 'Embedding settings',
|
||||||
|
settings: { embeddingServer: { url: 'http://embedding:9379/v1' } },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
vi.stubEnv('GEMMA_EMBEDDING_OPENAI_BASE_URL', undefined)
|
||||||
|
vi.stubEnv('EMBEDDING_PROVIDER', undefined)
|
||||||
|
try {
|
||||||
|
await expect(teamService.getSettings(team.id)).resolves.toMatchObject({
|
||||||
|
localEmbeddingProviderConfigured: true,
|
||||||
|
transcriptionAgentManagedByEnv: false,
|
||||||
|
})
|
||||||
|
|
||||||
|
vi.stubEnv('EMBEDDING_PROVIDER', 'gemini-embedding-2')
|
||||||
|
await expect(teamService.getSettings(team.id)).resolves.toMatchObject({
|
||||||
|
localEmbeddingProviderConfigured: false,
|
||||||
|
})
|
||||||
|
} finally {
|
||||||
|
vi.unstubAllEnvs()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
it('should get and update settings', async () => {
|
it('should get and update settings', async () => {
|
||||||
const user = await prisma.user.create({
|
const user = await prisma.user.create({
|
||||||
data: { name: 'Test User', email: `test-${Date.now()}@example.com`, password: 'pw' },
|
data: { name: 'Test User', email: `test-${Date.now()}@example.com`, password: 'pw' },
|
||||||
@@ -368,6 +392,7 @@ describe('TeamService', () => {
|
|||||||
const settings = await teamService.getSettings(team.id)
|
const settings = await teamService.getSettings(team.id)
|
||||||
expect(settings).toEqual({
|
expect(settings).toEqual({
|
||||||
semanticSearchEnabled: false,
|
semanticSearchEnabled: false,
|
||||||
|
localEmbeddingProviderConfigured: false,
|
||||||
transcriptionAgentManagedByEnv: false,
|
transcriptionAgentManagedByEnv: false,
|
||||||
embeddingServer: { url: undefined, isEnvConfigured: false },
|
embeddingServer: { url: undefined, isEnvConfigured: false },
|
||||||
transcode: {
|
transcode: {
|
||||||
@@ -406,6 +431,7 @@ describe('TeamService', () => {
|
|||||||
expect(newSettings).toEqual({
|
expect(newSettings).toEqual({
|
||||||
theme: 'dark',
|
theme: 'dark',
|
||||||
semanticSearchEnabled: false,
|
semanticSearchEnabled: false,
|
||||||
|
localEmbeddingProviderConfigured: false,
|
||||||
transcriptionAgentManagedByEnv: false,
|
transcriptionAgentManagedByEnv: false,
|
||||||
embeddingServer: { url: undefined, isEnvConfigured: false },
|
embeddingServer: { url: undefined, isEnvConfigured: false },
|
||||||
transcode: {
|
transcode: {
|
||||||
@@ -453,6 +479,7 @@ describe('TeamService', () => {
|
|||||||
const finalSettings = await teamService.getSettings(team.id)
|
const finalSettings = await teamService.getSettings(team.id)
|
||||||
expect(finalSettings).toEqual({
|
expect(finalSettings).toEqual({
|
||||||
theme: 'dark',
|
theme: 'dark',
|
||||||
|
localEmbeddingProviderConfigured: false,
|
||||||
transcriptionAgentManagedByEnv: false,
|
transcriptionAgentManagedByEnv: false,
|
||||||
embeddingServer: { url: undefined, isEnvConfigured: false },
|
embeddingServer: { url: undefined, isEnvConfigured: false },
|
||||||
transcode: {
|
transcode: {
|
||||||
|
|||||||
@@ -10,7 +10,11 @@ import { AgentService, agentService } from '@shumai/core/src/agent/agent'
|
|||||||
import { getSystemAgentSetting } from '@shumai/core/src/agent/system-agents'
|
import { getSystemAgentSetting } from '@shumai/core/src/agent/system-agents'
|
||||||
import { turntableService } from '@shumai/core/src/turntable/turntable'
|
import { turntableService } from '@shumai/core/src/turntable/turntable'
|
||||||
import { gotenbergService } from '@shumai/core/src/gotenberg/gotenberg'
|
import { gotenbergService } from '@shumai/core/src/gotenberg/gotenberg'
|
||||||
import { embeddingServerService } from '@shumai/core/src/search/embedding-server'
|
import {
|
||||||
|
embeddingServerService,
|
||||||
|
LOCAL_EMBEDDING_PROVIDER,
|
||||||
|
resolveEmbeddingProvider,
|
||||||
|
} from '@shumai/core/src/search/embedding-server'
|
||||||
import {
|
import {
|
||||||
getArchiveStorageConfig,
|
getArchiveStorageConfig,
|
||||||
isArchiveStorageEnabled,
|
isArchiveStorageEnabled,
|
||||||
@@ -361,6 +365,8 @@ export class TeamService {
|
|||||||
settings.turntable = await turntableService.getSettings(teamId)
|
settings.turntable = await turntableService.getSettings(teamId)
|
||||||
settings.gotenberg = await gotenbergService.getSettings(teamId)
|
settings.gotenberg = await gotenbergService.getSettings(teamId)
|
||||||
settings.embeddingServer = await embeddingServerService.getSettings(teamId)
|
settings.embeddingServer = await embeddingServerService.getSettings(teamId)
|
||||||
|
settings.localEmbeddingProviderConfigured =
|
||||||
|
resolveEmbeddingProvider(settings.embeddingServer) === LOCAL_EMBEDDING_PROVIDER
|
||||||
settings.transcriptionAgentManagedByEnv = getSystemAgentSetting('transcription') !== undefined
|
settings.transcriptionAgentManagedByEnv = getSystemAgentSetting('transcription') !== undefined
|
||||||
|
|
||||||
const archiveConfig = getArchiveStorageConfig()
|
const archiveConfig = getArchiveStorageConfig()
|
||||||
|
|||||||
@@ -253,6 +253,7 @@ export interface TeamSettingsResponse {
|
|||||||
turntable?: TurntableSettingsResponse
|
turntable?: TurntableSettingsResponse
|
||||||
gotenberg?: GotenbergSettingsResponse
|
gotenberg?: GotenbergSettingsResponse
|
||||||
embeddingServer?: EmbeddingServerSettingsResponse
|
embeddingServer?: EmbeddingServerSettingsResponse
|
||||||
|
localEmbeddingProviderConfigured?: boolean
|
||||||
transcriptionAgentManagedByEnv?: boolean
|
transcriptionAgentManagedByEnv?: boolean
|
||||||
appearance?: TeamAppearanceSettings
|
appearance?: TeamAppearanceSettings
|
||||||
semanticSearchEnabled?: boolean
|
semanticSearchEnabled?: boolean
|
||||||
|
|||||||
@@ -0,0 +1,88 @@
|
|||||||
|
// @vitest-environment happy-dom
|
||||||
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
||||||
|
import { cleanup, fireEvent, render, screen } from '@testing-library/react'
|
||||||
|
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||||
|
import { AgentsSettings } from './AgentsSettings'
|
||||||
|
|
||||||
|
const getAgents = vi.fn()
|
||||||
|
|
||||||
|
vi.mock('@/ui/api/client', () => ({
|
||||||
|
client: {
|
||||||
|
api: {
|
||||||
|
teams: { ':teamId': { agents: { $get: () => getAgents() } } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
|
||||||
|
vi.mock('@/ui/hooks/use-permissions', () => ({
|
||||||
|
usePermissions: () => ({ canAdmin: true }),
|
||||||
|
}))
|
||||||
|
|
||||||
|
vi.mock('./AgentFormDialog', () => ({
|
||||||
|
AgentFormDialog: ({ title }: { title: string }) => <div role="dialog">{title}</div>,
|
||||||
|
}))
|
||||||
|
|
||||||
|
function renderSettings(initiallyConfigured: boolean) {
|
||||||
|
const queryClient = new QueryClient()
|
||||||
|
const onOpenIntegrations = vi.fn()
|
||||||
|
const view = (configured: boolean) => (
|
||||||
|
<QueryClientProvider client={queryClient}>
|
||||||
|
<AgentsSettings
|
||||||
|
teamId="team"
|
||||||
|
localEmbeddingProviderConfigured={configured}
|
||||||
|
onOpenIntegrations={onOpenIntegrations}
|
||||||
|
/>
|
||||||
|
</QueryClientProvider>
|
||||||
|
)
|
||||||
|
|
||||||
|
const { rerender } = render(view(initiallyConfigured))
|
||||||
|
return {
|
||||||
|
onOpenIntegrations,
|
||||||
|
updateConfigured: (configured: boolean) => rerender(view(configured)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Transcript Agent setup', () => {
|
||||||
|
afterEach(() => {
|
||||||
|
cleanup()
|
||||||
|
vi.resetAllMocks()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('blocks creation and offers to open Integrations when setup is missing', async () => {
|
||||||
|
getAgents.mockResolvedValue(Response.json([]))
|
||||||
|
const { onOpenIntegrations, updateConfigured } = renderSettings(false)
|
||||||
|
|
||||||
|
await screen.findByText('Set up a local embedding server to use the Transcript Agent.')
|
||||||
|
const create = screen.getByRole<HTMLButtonElement>('button', {
|
||||||
|
name: 'Create Transcript Agent',
|
||||||
|
})
|
||||||
|
expect(create.disabled).toBe(true)
|
||||||
|
fireEvent.click(screen.getByRole('button', { name: 'Open Integrations' }))
|
||||||
|
expect(onOpenIntegrations).toHaveBeenCalledOnce()
|
||||||
|
|
||||||
|
updateConfigured(true)
|
||||||
|
expect(create.disabled).toBe(false)
|
||||||
|
fireEvent.click(create)
|
||||||
|
expect(screen.getByRole('dialog')).toBeTruthy()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('keeps an existing Transcript Agent visible with its controls disabled', async () => {
|
||||||
|
getAgents.mockResolvedValue(
|
||||||
|
Response.json([
|
||||||
|
{ id: 'transcriber', name: 'Video Transcriber', type: 'transcription', enabled: true },
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
const { updateConfigured } = renderSettings(false)
|
||||||
|
|
||||||
|
const transcriber = await screen.findByText('Video Transcriber')
|
||||||
|
const enabled = screen.getByRole<HTMLButtonElement>('switch')
|
||||||
|
expect(enabled.disabled).toBe(true)
|
||||||
|
fireEvent.click(transcriber)
|
||||||
|
expect(screen.queryByRole('dialog')).toBeNull()
|
||||||
|
|
||||||
|
updateConfigured(true)
|
||||||
|
expect(enabled.disabled).toBe(false)
|
||||||
|
fireEvent.click(transcriber)
|
||||||
|
expect(screen.getByRole('dialog')).toBeTruthy()
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -50,7 +50,9 @@ import { AgentFormDialog } from './AgentFormDialog'
|
|||||||
|
|
||||||
interface AgentsSettingsProps {
|
interface AgentsSettingsProps {
|
||||||
teamId: string
|
teamId: string
|
||||||
|
localEmbeddingProviderConfigured: boolean
|
||||||
transcriptionAgentManagedByEnv?: boolean
|
transcriptionAgentManagedByEnv?: boolean
|
||||||
|
onOpenIntegrations: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const AGENT_TYPES: {
|
const AGENT_TYPES: {
|
||||||
@@ -64,7 +66,12 @@ const AGENT_TYPES: {
|
|||||||
{ type: 'transcription', title: m.transcript_agent, icon: Captions },
|
{ type: 'transcription', title: m.transcript_agent, icon: Captions },
|
||||||
]
|
]
|
||||||
|
|
||||||
export function AgentsSettings({ teamId, transcriptionAgentManagedByEnv }: AgentsSettingsProps) {
|
export function AgentsSettings({
|
||||||
|
teamId,
|
||||||
|
localEmbeddingProviderConfigured,
|
||||||
|
transcriptionAgentManagedByEnv,
|
||||||
|
onOpenIntegrations,
|
||||||
|
}: AgentsSettingsProps) {
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
const { canAdmin } = usePermissions()
|
const { canAdmin } = usePermissions()
|
||||||
const [isCreateDialogOpen, setIsCreateDialogOpen] = useState(false)
|
const [isCreateDialogOpen, setIsCreateDialogOpen] = useState(false)
|
||||||
@@ -265,8 +272,11 @@ export function AgentsSettings({ teamId, transcriptionAgentManagedByEnv }: Agent
|
|||||||
const typeAgents = agents.filter((a) => a.type === section.type)
|
const typeAgents = agents.filter((a) => a.type === section.type)
|
||||||
const Icon = section.icon
|
const Icon = section.icon
|
||||||
const isSingleAgentType = section.type !== 'chat'
|
const isSingleAgentType = section.type !== 'chat'
|
||||||
const isManagedTranscriptAgent =
|
const isTranscriptSection = section.type === 'transcription'
|
||||||
section.type === 'transcription' && transcriptionAgentManagedByEnv
|
const requiresEmbeddingServer = isTranscriptSection && !localEmbeddingProviderConfigured
|
||||||
|
const isManagedTranscriptAgent = isTranscriptSection && transcriptionAgentManagedByEnv
|
||||||
|
const canCreate =
|
||||||
|
canAdmin && !isManagedTranscriptAgent && !(isSingleAgentType && typeAgents.length > 0)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@@ -289,23 +299,22 @@ export function AgentsSettings({ teamId, transcriptionAgentManagedByEnv }: Agent
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
{canAdmin &&
|
{canCreate && (
|
||||||
!isManagedTranscriptAgent &&
|
<Button
|
||||||
!(isSingleAgentType && typeAgents.length > 0) && (
|
variant="ghost"
|
||||||
<Button
|
size="icon"
|
||||||
variant="ghost"
|
aria-label={m.create_type_agent({ type: getSectionLabel(section.type) })}
|
||||||
size="icon"
|
disabled={requiresEmbeddingServer}
|
||||||
aria-label={m.create_type_agent({ type: getSectionLabel(section.type) })}
|
className="h-8 w-8 rounded-full bg-primary/10 text-primary hover:bg-primary/20"
|
||||||
className="h-8 w-8 rounded-full bg-primary/10 text-primary hover:bg-primary/20"
|
onClick={(e) => {
|
||||||
onClick={(e) => {
|
e.stopPropagation()
|
||||||
e.stopPropagation()
|
setCreateType(section.type)
|
||||||
setCreateType(section.type)
|
setIsCreateDialogOpen(true)
|
||||||
setIsCreateDialogOpen(true)
|
}}
|
||||||
}}
|
>
|
||||||
>
|
<Plus className="w-4 h-4" />
|
||||||
<Plus className="w-4 h-4" />
|
</Button>
|
||||||
</Button>
|
)}
|
||||||
)}
|
|
||||||
{!isSingleAgentType && (
|
{!isSingleAgentType && (
|
||||||
<ChevronDown
|
<ChevronDown
|
||||||
className={cn(
|
className={cn(
|
||||||
@@ -319,19 +328,42 @@ export function AgentsSettings({ teamId, transcriptionAgentManagedByEnv }: Agent
|
|||||||
|
|
||||||
{(isSingleAgentType || expandedSections[section.type]) && (
|
{(isSingleAgentType || expandedSections[section.type]) && (
|
||||||
<div className="px-6 pb-6 pt-2 space-y-3">
|
<div className="px-6 pb-6 pt-2 space-y-3">
|
||||||
{section.type === 'transcription' && (
|
{requiresEmbeddingServer ? (
|
||||||
<p className="text-sm text-muted-foreground">
|
<div className="flex flex-wrap items-center justify-between gap-2 rounded-lg border border-border bg-muted/40 px-4 py-3">
|
||||||
{isManagedTranscriptAgent && typeAgents.length === 0
|
<p className="text-sm text-muted-foreground">
|
||||||
? m.agent_managed_by_system_hint()
|
{m.transcript_agent_setup_required()}
|
||||||
: m.transcript_agent_description()}
|
</p>
|
||||||
</p>
|
<Button
|
||||||
|
type="button"
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
onClick={onOpenIntegrations}
|
||||||
|
>
|
||||||
|
{m.transcript_agent_open_integrations()}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
isTranscriptSection && (
|
||||||
|
<p className="text-sm text-muted-foreground">
|
||||||
|
{isManagedTranscriptAgent && typeAgents.length === 0
|
||||||
|
? m.agent_managed_by_system_hint()
|
||||||
|
: m.transcript_agent_description()}
|
||||||
|
</p>
|
||||||
|
)
|
||||||
)}
|
)}
|
||||||
<div className="grid grid-cols-1 gap-4">
|
<div className="grid grid-cols-1 gap-4">
|
||||||
{typeAgents.map((agent) => (
|
{typeAgents.map((agent) => (
|
||||||
<Card
|
<Card
|
||||||
key={agent.id}
|
key={agent.id}
|
||||||
className="group relative overflow-hidden border-border hover:border-primary/50 transition-all duration-200 cursor-pointer pb-1 pt-1"
|
className={cn(
|
||||||
onClick={() => setAgentToEdit(agent)}
|
'group relative overflow-hidden border-border pb-1 pt-1',
|
||||||
|
requiresEmbeddingServer
|
||||||
|
? 'opacity-60'
|
||||||
|
: 'cursor-pointer transition-all duration-200 hover:border-primary/50',
|
||||||
|
)}
|
||||||
|
onClick={
|
||||||
|
requiresEmbeddingServer ? undefined : () => setAgentToEdit(agent)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<CardContent className="p-4 flex flex-col gap-3">
|
<CardContent className="p-4 flex flex-col gap-3">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
@@ -372,6 +404,7 @@ export function AgentsSettings({ teamId, transcriptionAgentManagedByEnv }: Agent
|
|||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="icon"
|
size="icon"
|
||||||
|
disabled={requiresEmbeddingServer}
|
||||||
className="h-8 w-8 text-muted-foreground hover:text-foreground"
|
className="h-8 w-8 text-muted-foreground hover:text-foreground"
|
||||||
>
|
>
|
||||||
<MoreVertical className="w-4 h-4" />
|
<MoreVertical className="w-4 h-4" />
|
||||||
@@ -436,7 +469,7 @@ export function AgentsSettings({ teamId, transcriptionAgentManagedByEnv }: Agent
|
|||||||
<div onClick={(e) => e.stopPropagation()}>
|
<div onClick={(e) => e.stopPropagation()}>
|
||||||
<Switch
|
<Switch
|
||||||
checked={agent.enabled}
|
checked={agent.enabled}
|
||||||
disabled={agent.readOnly}
|
disabled={agent.readOnly || requiresEmbeddingServer}
|
||||||
onCheckedChange={(enabled) => {
|
onCheckedChange={(enabled) => {
|
||||||
updateAgentMutation.mutate({
|
updateAgentMutation.mutate({
|
||||||
teamId,
|
teamId,
|
||||||
@@ -461,7 +494,7 @@ export function AgentsSettings({ teamId, transcriptionAgentManagedByEnv }: Agent
|
|||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
))}
|
))}
|
||||||
{typeAgents.length === 0 && (
|
{typeAgents.length === 0 && !requiresEmbeddingServer && (
|
||||||
<div className="col-span-full py-8 flex flex-col items-center justify-center border-2 border-dashed border-border rounded-xl bg-muted/30">
|
<div className="col-span-full py-8 flex flex-col items-center justify-center border-2 border-dashed border-border rounded-xl bg-muted/30">
|
||||||
<div className="w-10 h-10 rounded-full bg-card flex items-center justify-center shadow-sm mb-3">
|
<div className="w-10 h-10 rounded-full bg-card flex items-center justify-center shadow-sm mb-3">
|
||||||
<Icon className="w-5 h-5 text-muted-foreground" />
|
<Icon className="w-5 h-5 text-muted-foreground" />
|
||||||
@@ -469,17 +502,19 @@ export function AgentsSettings({ teamId, transcriptionAgentManagedByEnv }: Agent
|
|||||||
<p className="text-sm text-muted-foreground">
|
<p className="text-sm text-muted-foreground">
|
||||||
{m.no_agents_found({ type: getSectionLabel(section.type) })}
|
{m.no_agents_found({ type: getSectionLabel(section.type) })}
|
||||||
</p>
|
</p>
|
||||||
<Button
|
{canCreate && (
|
||||||
variant="link"
|
<Button
|
||||||
size="sm"
|
variant="link"
|
||||||
className="text-primary font-medium h-auto p-0 mt-1"
|
size="sm"
|
||||||
onClick={() => {
|
className="text-primary font-medium h-auto p-0 mt-1"
|
||||||
setCreateType(section.type)
|
onClick={() => {
|
||||||
setIsCreateDialogOpen(true)
|
setCreateType(section.type)
|
||||||
}}
|
setIsCreateDialogOpen(true)
|
||||||
>
|
}}
|
||||||
{m.create_one_now()}
|
>
|
||||||
</Button>
|
{m.create_one_now()}
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -284,6 +284,8 @@
|
|||||||
"agent_type_transcription": "Transcript",
|
"agent_type_transcription": "Transcript",
|
||||||
"transcript_agent": "Transcript Agent",
|
"transcript_agent": "Transcript Agent",
|
||||||
"transcript_agent_description": "Posts an internal comment when a video transcription job fails.",
|
"transcript_agent_description": "Posts an internal comment when a video transcription job fails.",
|
||||||
|
"transcript_agent_setup_required": "Set up a local embedding server to use the Transcript Agent.",
|
||||||
|
"transcript_agent_open_integrations": "Open Integrations",
|
||||||
"integrations": "Integrations",
|
"integrations": "Integrations",
|
||||||
"integrations_settings_description": "Configure third-party service integrations for media rendering and document processing.",
|
"integrations_settings_description": "Configure third-party service integrations for media rendering and document processing.",
|
||||||
"storage": "Storage",
|
"storage": "Storage",
|
||||||
|
|||||||
@@ -273,6 +273,8 @@
|
|||||||
"agent_type_transcription": "음성 기록",
|
"agent_type_transcription": "음성 기록",
|
||||||
"transcript_agent": "음성 기록 에이전트",
|
"transcript_agent": "음성 기록 에이전트",
|
||||||
"transcript_agent_description": "동영상 음성 기록 작업이 실패하면 내부 댓글을 남깁니다.",
|
"transcript_agent_description": "동영상 음성 기록 작업이 실패하면 내부 댓글을 남깁니다.",
|
||||||
|
"transcript_agent_setup_required": "음성 기록 에이전트를 사용하려면 먼저 로컬 임베딩 서버를 설정하세요.",
|
||||||
|
"transcript_agent_open_integrations": "통합 설정 열기",
|
||||||
"integrations": "연동",
|
"integrations": "연동",
|
||||||
"integrations_settings_description": "미디어 렌더링과 문서 처리를 위한 외부 서비스 연동을 설정합니다.",
|
"integrations_settings_description": "미디어 렌더링과 문서 처리를 위한 외부 서비스 연동을 설정합니다.",
|
||||||
"storage": "저장소",
|
"storage": "저장소",
|
||||||
|
|||||||
@@ -284,6 +284,8 @@
|
|||||||
"agent_type_transcription": "转录",
|
"agent_type_transcription": "转录",
|
||||||
"transcript_agent": "转录智能体",
|
"transcript_agent": "转录智能体",
|
||||||
"transcript_agent_description": "视频转录失败时发布内部评论。",
|
"transcript_agent_description": "视频转录失败时发布内部评论。",
|
||||||
|
"transcript_agent_setup_required": "请先配置本地向量模型服务,再使用转录智能体。",
|
||||||
|
"transcript_agent_open_integrations": "打开集成设置",
|
||||||
"integrations": "集成",
|
"integrations": "集成",
|
||||||
"integrations_settings_description": "配置用于媒体渲染与文档处理的第三方服务集成。",
|
"integrations_settings_description": "配置用于媒体渲染与文档处理的第三方服务集成。",
|
||||||
"storage": "存储",
|
"storage": "存储",
|
||||||
|
|||||||
@@ -1230,7 +1230,11 @@ export function TeamSettingsPage() {
|
|||||||
<div className="h-full overflow-y-auto pr-1">
|
<div className="h-full overflow-y-auto pr-1">
|
||||||
<AgentsSettings
|
<AgentsSettings
|
||||||
teamId={teamId}
|
teamId={teamId}
|
||||||
|
localEmbeddingProviderConfigured={
|
||||||
|
settings?.localEmbeddingProviderConfigured ?? false
|
||||||
|
}
|
||||||
transcriptionAgentManagedByEnv={settings?.transcriptionAgentManagedByEnv}
|
transcriptionAgentManagedByEnv={settings?.transcriptionAgentManagedByEnv}
|
||||||
|
onOpenIntegrations={() => handleTabChange('integrations')}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user