mirror of
https://github.com/suitenumerique/meet.git
synced 2026-09-04 14:45:40 +00:00
♻️(backend) control metadata collector agent launch via feature flag
Allow controlling when the metadata collector agent is started, enabling users to try the feature and disable it if needed. Introduce a user-level feature flag to toggle the agent for the initial release.
This commit is contained in:
committed by
aleb_the_flash
parent
fc4b6d679a
commit
3b474ba1c0
@@ -232,11 +232,14 @@ class RecordingOptions(BaseModel):
|
|||||||
When `None`, falls back to the application default.
|
When `None`, falls back to the application default.
|
||||||
original_mode: The original recording mode before any override.
|
original_mode: The original recording mode before any override.
|
||||||
Must be one of the valid RecordingModeChoices values when provided.
|
Must be one of the valid RecordingModeChoices values when provided.
|
||||||
|
collect_metadata: Whether to collect additional metadata during recording.
|
||||||
|
When `None`, no metadata are collected.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
language: str | None = None
|
language: str | None = None
|
||||||
transcribe: bool | None = None
|
transcribe: bool | None = None
|
||||||
|
collect_metadata: bool | None = None
|
||||||
original_mode: Literal["screen_recording", "transcript"] | None = None
|
original_mode: Literal["screen_recording", "transcript"] | None = None
|
||||||
|
|
||||||
model_config = {"extra": "forbid"}
|
model_config = {"extra": "forbid"}
|
||||||
|
|||||||
@@ -343,8 +343,7 @@ class RoomViewSet(
|
|||||||
)
|
)
|
||||||
|
|
||||||
if settings.METADATA_COLLECTOR_ENABLED and (
|
if settings.METADATA_COLLECTOR_ENABLED and (
|
||||||
recording.mode == models.RecordingModeChoices.TRANSCRIPT
|
recording.options.get("collect_metadata", False)
|
||||||
or recording.options.get("transcribe", False)
|
|
||||||
):
|
):
|
||||||
try:
|
try:
|
||||||
MetadataCollectorService().start(recording)
|
MetadataCollectorService().start(recording)
|
||||||
|
|||||||
@@ -178,9 +178,7 @@ class LiveKitEventsService:
|
|||||||
except utils.MetadataUpdateException as e:
|
except utils.MetadataUpdateException as e:
|
||||||
logger.exception("Failed to update room's metadata: %s", e)
|
logger.exception("Failed to update room's metadata: %s", e)
|
||||||
|
|
||||||
if settings.METADATA_COLLECTOR_ENABLED and recording.options.get(
|
if recording.options.get("metadata_collector_dispatch_id", None) is not None:
|
||||||
"metadata_collector_dispatch_id"
|
|
||||||
):
|
|
||||||
try:
|
try:
|
||||||
MetadataCollectorService().stop(recording)
|
MetadataCollectorService().stop(recording)
|
||||||
except MetadataCollectorException:
|
except MetadataCollectorException:
|
||||||
|
|||||||
@@ -5,4 +5,5 @@ export enum FeatureFlags {
|
|||||||
noiseReduction = 'noise-reduction',
|
noiseReduction = 'noise-reduction',
|
||||||
subtitles = 'subtitles',
|
subtitles = 'subtitles',
|
||||||
candidatePolling = 'candidate-polling',
|
candidatePolling = 'candidate-polling',
|
||||||
|
metadataCollector = 'metadata-collector',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import { NoAccessView } from './NoAccessView'
|
|||||||
import { ControlsButton } from './ControlsButton'
|
import { ControlsButton } from './ControlsButton'
|
||||||
import { RowWrapper } from './RowWrapper'
|
import { RowWrapper } from './RowWrapper'
|
||||||
import { useMutateRecording } from '../hooks/useMutateRecording'
|
import { useMutateRecording } from '../hooks/useMutateRecording'
|
||||||
|
import { useIsMetadataCollectorEnabled } from '../hooks/useMetadataCollectorEnabled'
|
||||||
import { useSidePanel } from '@/features/rooms/livekit/hooks/useSidePanel'
|
import { useSidePanel } from '@/features/rooms/livekit/hooks/useSidePanel'
|
||||||
|
|
||||||
export const TranscriptSidePanel = () => {
|
export const TranscriptSidePanel = () => {
|
||||||
@@ -59,6 +60,8 @@ export const TranscriptSidePanel = () => {
|
|||||||
FeatureFlags.Transcript
|
FeatureFlags.Transcript
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const isMetadataCollectorEnabled = useIsMetadataCollectorEnabled()
|
||||||
|
|
||||||
const roomId = useRoomId()
|
const roomId = useRoomId()
|
||||||
|
|
||||||
const { startRecording, isPendingToStart, stopRecording, isPendingToStop } =
|
const { startRecording, isPendingToStart, stopRecording, isPendingToStop } =
|
||||||
@@ -106,6 +109,7 @@ export const TranscriptSidePanel = () => {
|
|||||||
transcribe: true,
|
transcribe: true,
|
||||||
original_mode: RecordingMode.Transcript,
|
original_mode: RecordingMode.Transcript,
|
||||||
}),
|
}),
|
||||||
|
collect_metadata: isMetadataCollectorEnabled,
|
||||||
}
|
}
|
||||||
|
|
||||||
await startRecording({
|
await startRecording({
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import { useFeatureFlagEnabled } from 'posthog-js/react'
|
||||||
|
import { useIsAnalyticsEnabled } from '@/features/analytics/hooks/useIsAnalyticsEnabled'
|
||||||
|
import { FeatureFlags } from '@/features/analytics/enums'
|
||||||
|
|
||||||
|
export const useIsMetadataCollectorEnabled = () => {
|
||||||
|
const featureEnabled = useFeatureFlagEnabled(FeatureFlags.metadataCollector)
|
||||||
|
const isAnalyticsEnabled = useIsAnalyticsEnabled()
|
||||||
|
|
||||||
|
return (featureEnabled && isAnalyticsEnabled) || true
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user