CI / Build & Quality Checks (pull_request) Successful in 2m46s
CI / Trigger Desktop Build (pull_request) Skipped
CI / Docker image build & smoke test (pull_request) Skipped
CI / Secret scan (gitleaks) (pull_request) Successful in 7s
CI / Playwright smoke (e2e) (pull_request) Successful in 18m56s
The fork reports what actually runs as io.lotus.denoise_state, but the
host never listened ("unsupported action"), so a failed ML denoiser
silently published the raw mic. Handle it: toast when ML did not start
or fell back to another model. Remove LotusDenoiseFeature, which waited
for a postMessage nothing sends any more and accepted it from any frame.
Refs #260
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
39 lines
1.5 KiB
TypeScript
39 lines
1.5 KiB
TypeScript
import { useEffect, useRef } from 'react';
|
|
import { useSetAtom } from 'jotai';
|
|
import { Icons } from 'folds';
|
|
import { CallEmbed } from '../plugins/call';
|
|
import { toastQueueAtom } from '../state/toast';
|
|
import { useSetting } from '../state/hooks/settings';
|
|
import { settingsAtom } from '../state/settings';
|
|
import { denoiseNotice, DenoiseStateReport } from '../utils/denoiseNotice';
|
|
|
|
/**
|
|
* [Gitea #260] Tell the user when ML noise suppression didn't attach (raw mic)
|
|
* or fell back to another model. The fork's `io.lotus.denoise_state` used to
|
|
* go unanswered ("unsupported action"), so failures were silent.
|
|
*/
|
|
export function useDenoiseNotices(embed: CallEmbed): void {
|
|
const setToast = useSetAtom(toastQueueAtom);
|
|
const [mode] = useSetting(settingsAtom, 'callNoiseSuppression');
|
|
const [model] = useSetting(settingsAtom, 'callDenoiseModel');
|
|
const latest = useRef({ mode, model });
|
|
latest.current = { mode, model };
|
|
useEffect(
|
|
() =>
|
|
embed.listenAction<{ data?: DenoiseStateReport }>('io.lotus.denoise_state', (evt) => {
|
|
if (latest.current.mode !== 'ml') return;
|
|
const body = denoiseNotice(latest.current.model, evt.detail?.data);
|
|
if (!body) return;
|
|
setToast({
|
|
id: `denoise-state-${Date.now()}`,
|
|
iconSrc: Icons.Mic,
|
|
displayName: 'Noise suppression',
|
|
body,
|
|
roomName: embed.room.name ?? 'Voice call',
|
|
roomId: embed.roomId,
|
|
});
|
|
}),
|
|
[embed, setToast],
|
|
);
|
|
}
|