wujingjing
2024-10-15 f9ffa3b42a98edcb1c901c3ad1fde98c9ad8589a
src/stores/chatRoom.ts
@@ -1,10 +1,11 @@
import { computed, ref, watch } from 'vue';
import { computed, ref } from 'vue';
import type { ChatRoomItem } from '../layout/component/sidebar/components/types';
import { Local } from '../utils/storage';
export type RoomConfig = {
   /** 是否直接调用大模型(通义千问)回答 */
   isAnswerByLLM: boolean;
   /** @description 从首页进去获取的第一个回复,回调函数 */
   firstResCb: any;
};
export type RoomConfigKey = keyof RoomConfig;
@@ -23,6 +24,17 @@
   }
};
export const getRoomConfig = <T extends RoomConfigKey>(roomId: string, key: T) => {
   if (!roomConfig.value) {
      return null;
   }
   if (!roomConfig.value[roomId]) {
      return null;
   } else {
      return roomConfig.value[roomId][key];
   }
};
export const chatRoomList = ref<ChatRoomItem[]>([]);
export const activeRoomId = ref(null);
@@ -30,3 +42,10 @@
export const activeSampleId = ref(null);
export const activeSectionAId = ref(null);
export const activeLLMId = ref(null);
/**
 * 全局使用的 ref
 */
export const sectionAList = ref([]);