diff --git a/apps/stage-tamagotchi/src/renderer/components/ChatHistory.vue b/apps/stage-tamagotchi/src/renderer/components/ChatHistory.vue deleted file mode 100644 index abe1fab98..000000000 --- a/apps/stage-tamagotchi/src/renderer/components/ChatHistory.vue +++ /dev/null @@ -1,207 +0,0 @@ - - - diff --git a/apps/stage-tamagotchi/src/renderer/components/InteractiveArea.vue b/apps/stage-tamagotchi/src/renderer/components/InteractiveArea.vue index cb4819d87..dd05f588a 100644 --- a/apps/stage-tamagotchi/src/renderer/components/InteractiveArea.vue +++ b/apps/stage-tamagotchi/src/renderer/components/InteractiveArea.vue @@ -1,6 +1,7 @@ @@ -23,8 +26,16 @@ const isLoading = ref(true) >
-
- +
+
diff --git a/apps/stage-web/src/components/Layouts/MobileInteractiveArea.vue b/apps/stage-web/src/components/Layouts/MobileInteractiveArea.vue index beea26c01..7bc6add6f 100644 --- a/apps/stage-web/src/components/Layouts/MobileInteractiveArea.vue +++ b/apps/stage-web/src/components/Layouts/MobileInteractiveArea.vue @@ -2,6 +2,7 @@ import type { ChatProvider } from '@xsai-ext/shared-providers' import { HearingConfigDialog } from '@proj-airi/stage-ui/components' +import { ChatHistory } from '@proj-airi/stage-ui/components/scenarios/chat' import { useAudioAnalyzer } from '@proj-airi/stage-ui/composables' import { useAudioContext } from '@proj-airi/stage-ui/stores/audio' import { useChatStore } from '@proj-airi/stage-ui/stores/chat' @@ -16,13 +17,13 @@ import { useI18n } from 'vue-i18n' import { RouterLink } from 'vue-router' import IndicatorMicVolume from '../Widgets/IndicatorMicVolume.vue' -import MobileChatHistory from '../Widgets/MobileChatHistory.vue' import ActionAbout from './InteractiveArea/Actions/About.vue' import ActionViewControls from './InteractiveArea/Actions/ViewControls.vue' import ViewControlInputs from './ViewControls/Inputs.vue' const { isDark, toggleDark } = useTheme() const hearingDialogOpen = ref(false) +const { messages, sending, streamingMessage } = storeToRefs(useChatStore()) const viewControlsActiveMode = ref<'x' | 'y' | 'z' | 'scale'>('scale') const viewControlsInputsRef = useTemplateRef>('viewControlsInputs') @@ -39,7 +40,6 @@ const { themeColorsHueDynamic, stageViewControlsEnabled } = storeToRefs(useSetti const settingsAudioDevice = useSettingsAudioDevice() const { enabled, selectedAudioInput, stream, audioInputs } = storeToRefs(settingsAudioDevice) const { send, onAfterMessageComposed, discoverToolsCompatibility, cleanupMessages } = useChatStore() -const { messages } = storeToRefs(useChatStore()) const { t } = useI18n() const { audioContext } = useAudioContext() const { startAnalyzer, stopAnalyzer, volumeLevel } = useAudioAnalyzer() @@ -133,7 +133,21 @@ onMounted(() => {
- +
@@ -220,3 +234,37 @@ onMounted(() => {
+ + diff --git a/apps/stage-web/src/components/Widgets/ChatArea.vue b/apps/stage-web/src/components/Widgets/ChatArea.vue index 40efd3157..7dd2ffe45 100644 --- a/apps/stage-web/src/components/Widgets/ChatArea.vue +++ b/apps/stage-web/src/components/Widgets/ChatArea.vue @@ -116,7 +116,7 @@ onUnmounted(() => { -import { MarkdownRenderer } from '@proj-airi/stage-ui/components' -import { useChatStore } from '@proj-airi/stage-ui/stores/chat' -import { storeToRefs } from 'pinia' -import { ref, watch } from 'vue' -import { useI18n } from 'vue-i18n' - -const chatHistoryRef = ref() - -const { t } = useI18n() -const { messages, sending, streamingMessage } = storeToRefs(useChatStore()) - -const { onBeforeMessageComposed, onTokenLiteral } = useChatStore() - -function scrollToBottom() { - requestAnimationFrame(() => { - requestAnimationFrame(() => { - if (!chatHistoryRef.value) - return - - chatHistoryRef.value.scrollTop = chatHistoryRef.value.scrollHeight - }) - }) -} - -onBeforeMessageComposed(async () => { - // Scroll down to the new sent message - await scrollToBottom() -}) - -onTokenLiteral(async () => { - // Scroll down to the new responding message - await scrollToBottom() -}) - -watch(sending, () => { - scrollToBottom() -}, { flush: 'post' }) - - - diff --git a/apps/stage-web/src/components/Widgets/MobileChatHistory.vue b/apps/stage-web/src/components/Widgets/MobileChatHistory.vue deleted file mode 100644 index 0202da632..000000000 --- a/apps/stage-web/src/components/Widgets/MobileChatHistory.vue +++ /dev/null @@ -1,129 +0,0 @@ - - - - - diff --git a/packages/stage-ui/histoire.config.ts b/packages/stage-ui/histoire.config.ts index 3ab8833f5..34e227676 100644 --- a/packages/stage-ui/histoire.config.ts +++ b/packages/stage-ui/histoire.config.ts @@ -112,6 +112,10 @@ export default defineConfig({ id: 'widgets', title: 'Widgets', }, + { + id: 'chat', + title: 'Chat', + }, { id: 'gadgets', title: 'Gadgets', diff --git a/packages/stage-ui/src/components/layout/ripple-grid/RippleGrid.story.vue b/packages/stage-ui/src/components/layout/ripple-grid/RippleGrid.story.vue index 0a84e70c8..7eee58028 100644 --- a/packages/stage-ui/src/components/layout/ripple-grid/RippleGrid.story.vue +++ b/packages/stage-ui/src/components/layout/ripple-grid/RippleGrid.story.vue @@ -28,7 +28,7 @@ function handleItemClick({ globalIndex }: { globalIndex: number }) {