From 0db4fa3f7cbfc25f3ff740a40ad4bf8a4e90e404 Mon Sep 17 00:00:00 2001 From: Neko Ayaka Date: Mon, 21 Jul 2025 01:52:48 +0800 Subject: [PATCH] feat(stage-*): dramatically improved mobile --- .../src/components/ChatSimulator.vue | 1 + .../components/Layouts/InteractiveArea.vue | 58 +--- .../InteractiveArea/Actions/ViewControls.vue | 73 +++++ .../src/components/Layouts/MobileHeader.vue | 11 + .../Layouts/MobileInteractiveArea.vue | 108 +++++-- .../Layouts/ViewControls/Inputs.vue | 203 +++++++++++++ .../src/components/Widgets/ChatHistory.vue | 15 +- .../components/Widgets/MobileChatHistory.vue | 21 +- apps/stage-web/src/layouts/settings.vue | 2 +- apps/stage-web/src/pages/index.vue | 8 +- .../src/pages/settings/models/index.vue | 11 +- apps/stage-web/src/pages/stage/index.vue | 31 +- apps/stage-web/src/styles/main.css | 1 + apps/stage-web/src/styles/vue-transitions.css | 48 +++ .../Form/Range/RoundRange.story.vue | 28 ++ .../src/components/Layouts/Callout.vue | 8 +- .../stage-ui/src/components/Misc/Button.vue | 45 ++- .../Settings/ModelSettings/Live2DScene.vue | 42 --- .../Scenarios/Settings/ModelSettings/VRM.vue | 209 +++++++------ .../Settings/ModelSettings/VRMScene.vue | 53 ---- .../Scenarios/Settings/ModelSettings/index.ts | 4 - .../Settings/ModelSettings/index.vue | 35 ++- .../stage-ui/src/components/Scenes/Live2D.vue | 92 +----- .../stage-ui/src/components/Scenes/Stage.vue | 3 +- .../stage-ui/src/components/Scenes/VRM.vue | 180 ++---------- .../src/components/Scenes/VRM/Model.vue | 22 +- packages/stage-ui/src/stores/settings.ts | 2 + packages/stage-ui/src/stores/vrm.ts | 14 +- .../ui/src/components/Form/Range/Range.vue | 3 + .../src/components/Form/Range/RoundRange.vue | 277 ++++++++++++++++++ .../ui/src/components/Form/Range/index.ts | 1 + 31 files changed, 1016 insertions(+), 593 deletions(-) create mode 100644 apps/stage-web/src/components/Layouts/InteractiveArea/Actions/ViewControls.vue create mode 100644 apps/stage-web/src/components/Layouts/MobileHeader.vue create mode 100644 apps/stage-web/src/components/Layouts/ViewControls/Inputs.vue create mode 100644 apps/stage-web/src/styles/vue-transitions.css create mode 100644 packages/stage-ui/src/components/Form/Range/RoundRange.story.vue delete mode 100644 packages/stage-ui/src/components/Scenarios/Settings/ModelSettings/Live2DScene.vue delete mode 100644 packages/stage-ui/src/components/Scenarios/Settings/ModelSettings/VRMScene.vue create mode 100644 packages/ui/src/components/Form/Range/RoundRange.vue diff --git a/apps/playground-prompt-engineering/src/components/ChatSimulator.vue b/apps/playground-prompt-engineering/src/components/ChatSimulator.vue index 55184359..5175a362 100644 --- a/apps/playground-prompt-engineering/src/components/ChatSimulator.vue +++ b/apps/playground-prompt-engineering/src/components/ChatSimulator.vue @@ -331,6 +331,7 @@ watch(() => messages.value.length, () => { .line-clamp-2 { display: -webkit-box; + line-clamp: 2; -webkit-line-clamp: 2; -webkit-box-orient: vertical; } diff --git a/apps/stage-web/src/components/Layouts/InteractiveArea.vue b/apps/stage-web/src/components/Layouts/InteractiveArea.vue index ac805b47..ed4764fb 100644 --- a/apps/stage-web/src/components/Layouts/InteractiveArea.vue +++ b/apps/stage-web/src/components/Layouts/InteractiveArea.vue @@ -6,7 +6,7 @@ import WhisperWorker from '@proj-airi/stage-ui/libs/workers/worker?worker&url' import { toWAVBase64 } from '@proj-airi/audio' import { useMicVAD, useWhisper } from '@proj-airi/stage-ui/composables' import { useAudioContext, useChatStore, useConsciousnessStore, useProvidersStore, useSettings } from '@proj-airi/stage-ui/stores' -import { BasicTextarea, TransitionVertical } from '@proj-airi/ui' +import { BasicTextarea } from '@proj-airi/ui' import { useDevicesList } from '@vueuse/core' import { storeToRefs } from 'pinia' import { onMounted, ref, watch } from 'vue' @@ -24,8 +24,8 @@ const providersStore = useProvidersStore() const { activeProvider, activeModel } = storeToRefs(useConsciousnessStore()) const { themeColorsHueDynamic } = storeToRefs(useSettings()) -const { audioInputs, ensurePermissions } = useDevicesList({ constraints: { audio: true } }) -const { selectedAudioDevice, isAudioInputOn, selectedAudioDeviceId } = storeToRefs(useSettings()) +const { ensurePermissions } = useDevicesList({ constraints: { audio: true } }) +const { isAudioInputOn, selectedAudioDeviceId } = storeToRefs(useSettings()) const { send, onAfterSend, discoverToolsCompatibility } = useChatStore() const { messages } = storeToRefs(useChatStore()) const { audioContext } = useAudioContext() @@ -104,17 +104,6 @@ async function handleTranscription(buffer: ArrayBufferLike) { generate({ type: 'generate', data: { audio: audioBase64, language: 'en' } }) } -async function handleAudioInputChange(event: Event) { - const target = event.target as HTMLSelectElement - const found = audioInputs.value.find(d => d.deviceId === target.value) - if (!found) { - selectedAudioDevice.value = undefined - return - } - - selectedAudioDevice.value = found -} - watch(isAudioInputOn, async (value) => { if (value === 'false') { destroy() @@ -195,46 +184,5 @@ onAfterSend(async () => { - diff --git a/apps/stage-web/src/components/Layouts/InteractiveArea/Actions/ViewControls.vue b/apps/stage-web/src/components/Layouts/InteractiveArea/Actions/ViewControls.vue new file mode 100644 index 00000000..a03e2b9b --- /dev/null +++ b/apps/stage-web/src/components/Layouts/InteractiveArea/Actions/ViewControls.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/apps/stage-web/src/components/Layouts/MobileHeader.vue b/apps/stage-web/src/components/Layouts/MobileHeader.vue new file mode 100644 index 00000000..1664c0d7 --- /dev/null +++ b/apps/stage-web/src/components/Layouts/MobileHeader.vue @@ -0,0 +1,11 @@ + + + diff --git a/apps/stage-web/src/components/Layouts/MobileInteractiveArea.vue b/apps/stage-web/src/components/Layouts/MobileInteractiveArea.vue index b359c11c..f92311cf 100644 --- a/apps/stage-web/src/components/Layouts/MobileInteractiveArea.vue +++ b/apps/stage-web/src/components/Layouts/MobileInteractiveArea.vue @@ -4,11 +4,20 @@ import type { ChatProvider } from '@xsai-ext/shared-providers' import { useMicVAD } from '@proj-airi/stage-ui/composables' import { useChatStore, useConsciousnessStore, useProvidersStore, useSettings } from '@proj-airi/stage-ui/stores' import { BasicTextarea } from '@proj-airi/ui' +import { useDark } from '@vueuse/core' import { storeToRefs } from 'pinia' -import { onMounted, ref, watch } from 'vue' +import { onMounted, ref, useTemplateRef, watch } from 'vue' import { useI18n } from 'vue-i18n' +import { RouterLink } from 'vue-router' import MobileChatHistory from '../Widgets/MobileChatHistory.vue' +import ActionViewControls from './InteractiveArea/Actions/ViewControls.vue' +import ViewControlInputs from './ViewControls/Inputs.vue' + +const isDark = useDark({ disableTransition: false }) + +const viewControlsActiveMode = ref<'x' | 'y' | 'z' | 'scale'>('scale') +const viewControlsInputsRef = useTemplateRef>('viewControlsInputs') const messageInput = ref('') const listening = ref(false) @@ -19,7 +28,7 @@ const { activeProvider, activeModel } = storeToRefs(useConsciousnessStore()) // const { audioInputs } = useDevicesList({ constraints: { audio: true }, requestPermissions: true }) // const { selectedAudioDevice, isAudioInputOn, selectedAudioDeviceId } = storeToRefs(useSettings()) -const { isAudioInputOn, selectedAudioDeviceId, themeColorsHueDynamic } = storeToRefs(useSettings()) +const { isAudioInputOn, selectedAudioDeviceId, themeColorsHueDynamic, stageView, stageViewControlsEnabled } = storeToRefs(useSettings()) const { send, onAfterSend, discoverToolsCompatibility } = useChatStore() const { messages } = storeToRefs(useChatStore()) const { t } = useI18n() @@ -100,34 +109,75 @@ onMounted(() => { diff --git a/apps/stage-web/src/components/Layouts/ViewControls/Inputs.vue b/apps/stage-web/src/components/Layouts/ViewControls/Inputs.vue new file mode 100644 index 00000000..89d9fb5a --- /dev/null +++ b/apps/stage-web/src/components/Layouts/ViewControls/Inputs.vue @@ -0,0 +1,203 @@ + + + + + diff --git a/apps/stage-web/src/components/Widgets/ChatHistory.vue b/apps/stage-web/src/components/Widgets/ChatHistory.vue index 3c64e5c7..cd370b49 100644 --- a/apps/stage-web/src/components/Widgets/ChatHistory.vue +++ b/apps/stage-web/src/components/Widgets/ChatHistory.vue @@ -1,7 +1,6 @@ diff --git a/apps/stage-web/src/components/Widgets/MobileChatHistory.vue b/apps/stage-web/src/components/Widgets/MobileChatHistory.vue index 96440d85..5e5515c1 100644 --- a/apps/stage-web/src/components/Widgets/MobileChatHistory.vue +++ b/apps/stage-web/src/components/Widgets/MobileChatHistory.vue @@ -1,7 +1,6 @@