This commit is contained in:
Timothy Jaeryang Baek committed 2026-11-16 19:14:07 +09:00
1 parent 5d55ce7246
commit 21605e268d
35 files changed
+387 -174

No files matched your search

@@ -1,5 +1,5 @@
<script lang="ts">
import { config, models, settings, showCallOverlay, TTSWorker } from '$lib/stores';
import { config, settings, voiceCall, TTSWorker } from '$lib/stores';
import { onMount, tick, getContext, onDestroy, createEventDispatcher } from 'svelte';
const dispatch = createEventDispatcher();
@@ -18,6 +18,9 @@
import type { RealtimeCall } from '$lib/utils/realtime';
import VoiceAvatar from './CallOverlay/VoiceAvatar.svelte';
import type { AvatarAnimationCommand } from '$lib/utils/voice-avatar';
import { getChatContext } from '$lib/components/chat/context';
const { models } = getChatContext();
const i18n: any = getContext('i18n');
@@ -82,7 +85,7 @@
command.result = { status: 'cancelled' };
} else if (
!destroyed &&
$showCallOverlay &&
$voiceCall &&
showAvatar &&
!camera &&
readyAvatar === avatar?.file_id
@@ -274,8 +277,8 @@
};
const stopRecordingCallback = async (_continue = true) => {
// $showCallOverlay stays true when the chat page unmounts
if ($showCallOverlay && !destroyed) {
// $voiceCall stays true when the chat page unmounts
if ($voiceCall && !destroyed) {
console.log('%c%s', 'color: red; font-size: 20px;', '🚨 stopRecordingCallback 🚨');
// deep copy the audioChunks array
@@ -322,7 +325,7 @@
};
const startRecording = async () => {
if ($showCallOverlay && !destroyed) {
if ($voiceCall && !destroyed) {
if (!audioStream) {
audioStream = await navigator.mediaDevices.getUserMedia({
audio: {
@@ -416,7 +419,7 @@
const detectSound = () => {
const processFrame = () => {
if (!mediaRecorder || !$showCallOverlay) {
if (!mediaRecorder || !$voiceCall) {
return;
}
@@ -497,7 +500,7 @@
};
const speakSpeechSynthesisHandler = (content) => {
if (!$showCallOverlay) return Promise.resolve();
if (!$voiceCall) return Promise.resolve();
const signal = audioAbortController.signal;
return new Promise<void>((resolve) => {
let utterance: SpeechSynthesisUtterance | null = null;
@@ -534,7 +537,7 @@
};
const playAudio = (audio: HTMLAudioElement) => {
if ($showCallOverlay) {
if ($voiceCall) {
return new Promise((resolve) => {
const audioElement = callAudioElement;
if (!audioElement) {
@@ -910,7 +913,7 @@
});
</script>
{#if $showCallOverlay}
{#if $voiceCall}
<!-- A media element can only have one Web Audio source, even after its context closes. -->
<audio bind:this={callAudioElement} class="hidden"></audio>
<div
@@ -1019,7 +1022,7 @@
speaking={avatarSpeaking}
listening={hasStartedSpeaking && !muted && !avatarSpeaking}
level={outputLevel}
active={!destroyed && $showCallOverlay}
active={!destroyed && $voiceCall}
on:ready={() => {
readyAvatar = selectedAvatar.file_id;
}}
@@ -1309,7 +1312,7 @@
await stopVideoStream();
}
showCallOverlay.set(false);
voiceCall.set(false);
dispatch('close');
}}
type="button"
@@ -1,10 +1,13 @@
<script lang="ts">
import { createEventDispatcher, getContext, onMount } from 'svelte';
import { models, showCallOverlay } from '$lib/stores';
import { voiceCall } from '$lib/stores';
import type { RealtimeCall } from '$lib/utils/realtime';
import Spinner from '$lib/components/common/Spinner.svelte';
import VoiceOrb from './VoiceOrb.svelte';
import VoiceAvatar from './VoiceAvatar.svelte';
import { getChatContext } from '$lib/components/chat/context';
const { models } = getChatContext();
export let bridge: RealtimeCall;
export let modelId = '';
@@ -31,7 +34,7 @@
const endCall = () => {
bridge.end();
showCallOverlay.set(false);
voiceCall.set(false);
dispatch('close');
};
@@ -1,6 +1,6 @@
<script lang="ts">
import { createEventDispatcher, getContext, onMount } from 'svelte';
import { config, showCallOverlay } from '$lib/stores';
import { config, voiceCall } from '$lib/stores';
import type { RealtimeCall } from '$lib/utils/realtime';
import CallOverlay from './CallOverlay.svelte';
import BridgeCallOverlay from './CallOverlay/BridgeCallOverlay.svelte';
@@ -19,7 +19,7 @@
const dispatch = createEventDispatcher();
const close = () => {
showCallOverlay.set(false);
voiceCall.set(false);
dispatch('close');
};
@@ -4,15 +4,7 @@
import { getContext, onDestroy, onMount, tick } from 'svelte';
import type { Readable } from 'svelte/store';
import {
chatId as activeChatId,
folders,
models,
settings,
terminalServers,
temporaryChatEnabled,
user
} from '$lib/stores';
import { folders, settings, terminalServers, user } from '$lib/stores';
import { WEBUI_API_BASE_URL } from '$lib/constants';
import { getFolders } from '$lib/apis/folders';
import { searchKnowledgeBases, searchKnowledgeFiles } from '$lib/apis/knowledge';
@@ -31,6 +23,9 @@
import GlobeAlt from '$lib/components/icons/GlobeAlt.svelte';
import Youtube from '$lib/components/icons/Youtube.svelte';
import { toast } from 'svelte-sonner';
import { getChatContext } from '$lib/components/chat/context';
const { chatId: activeChatId, models, temporary } = getChatContext();
const i18n = getContext<any>('i18n');
@@ -161,7 +156,7 @@
if (
($terminalServers ?? []).find((server) => server.id === $selectedTerminalId)?.scope ===
'chat' &&
($temporaryChatEnabled || isTemporaryChatId($activeChatId))
($temporary || isTemporaryChatId($activeChatId))
)
return null;
return target;
@@ -4,13 +4,15 @@
import { createEventDispatcher, onDestroy, onMount } from 'svelte';
import { tick, getContext } from 'svelte';
import { models } from '$lib/stores';
import { WEBUI_API_BASE_URL, WEBUI_BASE_URL } from '$lib/constants';
import Tooltip from '$lib/components/common/Tooltip.svelte';
import {
resolveLocalizedModelDescription,
resolveLocalizedModelName
} from '$lib/utils/localizedContent';
import { getChatContext } from '$lib/components/chat/context';
const { models } = getChatContext();
const i18n = getContext<typeof import('$lib/i18n').default>('i18n');
@@ -9,9 +9,12 @@
resolveTerminalTarget,
type TerminalSkill
} from '$lib/apis/terminal';
import { chatId, settings, terminalServers } from '$lib/stores';
import { settings, terminalServers } from '$lib/stores';
import Tooltip from '$lib/components/common/Tooltip.svelte';
import Cube from '$lib/components/icons/Cube.svelte';
import { getChatContext } from '$lib/components/chat/context';
const { chatId } = getChatContext();
const i18n = getContext('i18n');
@@ -10,7 +10,7 @@
resolveTerminalTarget,
type TerminalSkill
} from '$lib/apis/terminal';
import { user, chatId, settings, terminalServers, visibleControls } from '$lib/stores';
import { user, settings, terminalServers, visibleControls } from '$lib/stores';
import Tooltip from '$lib/components/common/Tooltip.svelte';
import ChatBubbleDotted from '$lib/components/icons/ChatBubbleDotted.svelte';
import ChatBubbleDottedChecked from '$lib/components/icons/ChatBubbleDottedChecked.svelte';
@@ -20,6 +20,9 @@
import Icon from '$lib/components/chat/FileNav/Icon.svelte';
import Plus from '$lib/components/icons/Plus.svelte';
import Sparkles from '$lib/components/icons/Sparkles.svelte';
import { getChatContext } from '$lib/components/chat/context';
const { chatId } = getChatContext();
const i18n: any = getContext('i18n');
@@ -1,6 +1,6 @@
<script lang="ts">
import { getContext, onMount, tick } from 'svelte';
import { models, config } from '$lib/stores';
import { config } from '$lib/stores';
import { toast } from 'svelte-sonner';
import { copyToClipboard } from '$lib/utils';
@@ -9,6 +9,9 @@
import Modal from '$lib/components/common/Modal.svelte';
import Spinner from '$lib/components/common/Spinner.svelte';
import MapSelector from '$lib/components/common/Valves/MapSelector.svelte';
import { getChatContext } from '$lib/components/chat/context';
const { models } = getChatContext();
const i18n = getContext<typeof import('$lib/i18n').default>('i18n');
@@ -6,7 +6,6 @@
import { fly } from 'svelte/transition';
import {
chatId,
config,
settings,
terminalServers,
@@ -40,6 +39,9 @@
import ChevronRight from '$lib/components/icons/ChevronRight.svelte';
import ChevronLeft from '$lib/components/icons/ChevronLeft.svelte';
import LinkSlash from '$lib/components/icons/LinkSlash.svelte';
import { getChatContext } from '$lib/components/chat/context';
const { chatId } = getChatContext();
const i18n = getContext('i18n') as any;
export let selectedTerminalId: Readable<string | null>;
@@ -1,6 +1,6 @@
<script lang="ts">
import { getContext, tick } from 'svelte';
import { models as _models, mobile, settings, user, type Model } from '$lib/stores';
import { mobile, settings, user, type Model } from '$lib/stores';
import Controls from '../Controls/Controls.svelte';
import ChevronDown from '$lib/components/icons/ChevronDown.svelte';
import Dropdown from '$lib/components/common/Dropdown.svelte';
@@ -16,8 +16,9 @@
import Tooltip from '$lib/components/common/Tooltip.svelte';
import Knobs from '$lib/components/icons/Knobs.svelte';
import { localizeModelControls, resolveLocalizedModelName } from '$lib/utils/localizedContent';
import { getChatContext } from '$lib/components/chat/context';
const models = getContext<typeof _models>('chatModels') ?? _models;
const { models } = getChatContext();
const i18n: any = getContext('i18n');
export let selectedModels: string[] = [];
@@ -11,15 +11,7 @@
import WorkingDirectoryMenu from './WorkingDirectoryMenu.svelte';
import type { TerminalContext } from '$lib/types';
import {
chatId as activeChatId,
config,
settings,
showSettings,
terminalServers,
temporaryChatEnabled,
user
} from '$lib/stores';
import { config, settings, showSettings, terminalServers, user } from '$lib/stores';
import { selectTerminal } from '$lib/utils/terminal';
import { isTemporaryChatId, isSavedChatId } from '$lib/utils/chatId';
@@ -36,6 +28,9 @@
import TerminalItemMenu from './TerminalItemMenu.svelte';
import ConfirmDialog from '$lib/components/common/ConfirmDialog.svelte';
import Check from '$lib/components/icons/Check.svelte';
import { getChatContext } from '$lib/components/chat/context';
const { chatId: activeChatId, temporary } = getChatContext();
const i18n = getContext<any>('i18n');
export let selectedTerminalId: Pick<Writable<string | null>, 'subscribe' | 'set'>;
@@ -121,8 +116,7 @@
};
$: systemTerminals = ($terminalServers ?? []).filter(
(t) =>
t.id && !(($temporaryChatEnabled || isTemporaryChatId($activeChatId)) && t.scope === 'chat')
(t) => t.id && !(($temporary || isTemporaryChatId($activeChatId)) && t.scope === 'chat')
);
// Tether presences are the user's own paired devices, listed apart from servers.
const isDevice = (terminal: any) => terminal.id.startsWith('tether:');