yangyin
2024-10-29 d739ce91a7d0bb28f46af771036ccc1b150856c3
src/stores/chatRoom.ts
@@ -1,6 +1,6 @@
import { computed, ref } from 'vue';
import type { ChatRoomItem } from '../layout/component/sidebar/components/types';
import { getSectionList } from '../api/ai/chat';
import type { ChatRoomItem } from '../layout/component/sidebar/components/types';
/**
 * Room 关联的一些配置
@@ -49,12 +49,14 @@
export const activeChatRoom = computed(() => chatRoomList.value?.find((item) => item.id === activeRoomId.value));
export const activeSampleId = ref(null);
export const activeSectionAId = ref(null);
export const topGroupId = ref(null);
export const activeLLMId = ref(null);
/** @description 当前聊天室 groupType */
export const activeGroupType = computed({
   get: () => {
      const result = getRoomConfig(activeRoomId.value, 'activeGroupType');
      const result = getRoomConfig(activeRoomId.value, 'activeGroupType') ?? '业务场景';
      return result;
   },
   set: (value) => {
@@ -72,18 +74,24 @@
export const sceneGroupList = ref([]);
// groupType 列表
export const groupTypeList = computed(() => Array.from(new Set(sceneGroupList.value.map((item) => item.group_type))));
// 办公/模板 列表
export const exampleSceneList = ref([]);
export const officeList = ref([]);
export const groupTypeMapIcon = {
   办公助手: 'ywicon-bangong',
   知识库: 'ywicon-changyonggongjuzhishisuoyin',
   业务场景: 'ywicon-yewu',
};
//获取场景选择列表
const getSceneGroupList = async () => {
   const res = await getSectionList();
   sceneGroupList.value = res?.groups ?? [];
};
/**
 * 获取全局所有数据
 */
export const getAllData = async () => {
   const res = await getSectionList();
   sceneGroupList.value = res?.groups ?? [];
   getSceneGroupList();
};
//#endregion