diff --git a/src/App.vue b/src/App.vue index 7611ab84..0ce0f3d3 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,15 +1,19 @@ @@ -44,11 +48,14 @@ onMounted(async () => { - + (v ? null : chatStore.closeScreenCaptureModal())" + :open="layoutStore.showScreenCaptureModal" + :image-data="layoutStore.screenCaptureImage" + @update:open="(v) => (v ? null : layoutStore.closeScreenCaptureModal())" /> diff --git a/src/components/analysis/ai/ChatExplorer.vue b/src/components/analysis/ai/ChatExplorer.vue index 0bdfabef..3bf611b3 100644 --- a/src/components/analysis/ai/ChatExplorer.vue +++ b/src/components/analysis/ai/ChatExplorer.vue @@ -1,6 +1,5 @@ - + @@ -105,7 +105,7 @@ watch( color="neutral" variant="ghost" size="sm" - @click="chatStore.closeChatRecordDrawer()" + @click="layoutStore.closeChatRecordDrawer()" /> @@ -141,4 +141,3 @@ watch( - diff --git a/src/components/common/ChatRecord/MessageList.vue b/src/components/common/ChatRecord/MessageList.vue index 863b1c3f..1bf812c7 100644 --- a/src/components/common/ChatRecord/MessageList.vue +++ b/src/components/common/ChatRecord/MessageList.vue @@ -4,9 +4,9 @@ * 支持无限滚动加载 */ import { ref, watch, nextTick, toRaw } from 'vue' -import { useChatStore } from '@/stores/chat' import MessageItem from './MessageItem.vue' import type { ChatRecordMessage, ChatRecordQuery } from './types' +import { useSessionStore } from '@/stores/session' const props = defineProps<{ /** 当前查询条件 */ @@ -18,7 +18,7 @@ const emit = defineEmits<{ (e: 'count-change', count: number): void }>() -const chatStore = useChatStore() +const sessionStore = useSessionStore() // 消息列表 const messages = ref([]) @@ -41,7 +41,7 @@ function buildFilterParams(query: ChatRecordQuery) { // 初始加载消息 async function loadInitialMessages() { - const sessionId = chatStore.currentSessionId + const sessionId = sessionStore.currentSessionId if (!sessionId) { messages.value = [] emit('count-change', 0) @@ -99,7 +99,7 @@ async function loadInitialMessages() { async function loadMoreBefore() { if (isLoadingMore.value || !hasMoreBefore.value || messages.value.length === 0) return - const sessionId = chatStore.currentSessionId + const sessionId = sessionStore.currentSessionId if (!sessionId) return const firstMessage = messages.value[0] @@ -142,7 +142,7 @@ async function loadMoreBefore() { async function loadMoreAfter() { if (isLoadingMore.value || !hasMoreAfter.value || messages.value.length === 0) return - const sessionId = chatStore.currentSessionId + const sessionId = sessionStore.currentSessionId if (!sessionId) return const lastMessage = messages.value[messages.value.length - 1] @@ -269,4 +269,3 @@ defineExpose({ - diff --git a/src/components/common/Sidebar.vue b/src/components/common/Sidebar.vue index 9042bdc6..61a3dc0c 100644 --- a/src/components/common/Sidebar.vue +++ b/src/components/common/Sidebar.vue @@ -1,5 +1,4 @@ @@ -105,7 +105,7 @@ const { isSidebarCollapsed: isCollapsed } = storeToRefs(chatStore) :class="[isCollapsed ? 'flex w-12 items-center justify-center px-0' : 'justify-start pl-4']" color="gray" variant="ghost" - @click="chatStore.showSettingModal = true" + @click="layoutStore.showSettingModal = true" > 设置 diff --git a/src/composables/useAIChat.ts b/src/composables/useAIChat.ts index 034fdca8..b894d102 100644 --- a/src/composables/useAIChat.ts +++ b/src/composables/useAIChat.ts @@ -4,8 +4,8 @@ */ import { ref, computed } from 'vue' -import { useChatStore } from '@/stores/chat' import { storeToRefs } from 'pinia' +import { usePromptStore } from '@/stores/prompt' // 工具调用记录 export interface ToolCallRecord { @@ -81,8 +81,8 @@ export function useAIChat( chatType: 'group' | 'private' = 'group' ) { // 获取 chat store 中的提示词配置和全局设置 - const chatStore = useChatStore() - const { activeGroupPreset, activePrivatePreset, aiGlobalSettings } = storeToRefs(chatStore) + const promptStore = usePromptStore() + const { activeGroupPreset, activePrivatePreset, aiGlobalSettings } = storeToRefs(promptStore) // 获取当前聊天类型对应的提示词配置 const currentPromptConfig = computed(() => { diff --git a/src/composables/useScreenCapture.ts b/src/composables/useScreenCapture.ts index 148912d0..1f7c7e43 100644 --- a/src/composables/useScreenCapture.ts +++ b/src/composables/useScreenCapture.ts @@ -3,9 +3,9 @@ * 提供简洁的 API 用于捕获页面/元素截图 */ import { ref } from 'vue' -import { useChatStore } from '@/stores/chat' import { captureAsImageData } from '@/utils/snapCapture' import { useToast } from '@nuxt/ui/runtime/composables/useToast.js' +import { useLayoutStore } from '@/stores/layout' export interface ScreenCaptureOptions { /** 截屏时要隐藏的元素选择器列表 */ @@ -22,7 +22,7 @@ export interface ScreenCaptureOptions { * 截屏功能 Composable */ export function useScreenCapture() { - const chatStore = useChatStore() + const layoutStore = useLayoutStore() const toast = useToast() const isCapturing = ref(false) const captureError = ref(null) @@ -87,7 +87,7 @@ export function useScreenCapture() { icon: 'i-heroicons-eye', onClick: () => { if (lastCapturedImage) { - chatStore.openScreenCaptureModal(lastCapturedImage) + layoutStore.openScreenCaptureModal(lastCapturedImage) } }, }, @@ -388,7 +388,7 @@ export function useScreenCapture() { color: 'warning', duration: 3000, }) - chatStore.openScreenCaptureModal(imageData) + layoutStore.openScreenCaptureModal(imageData) } return true diff --git a/src/pages/group-chat/index.vue b/src/pages/group-chat/index.vue index 76e295ac..b87d9bec 100644 --- a/src/pages/group-chat/index.vue +++ b/src/pages/group-chat/index.vue @@ -1,7 +1,6 @@