| | |
| | | 知识库: 'ywicon-changyonggongjuzhishisuoyin', |
| | | 业务场景: 'ywicon-yewu', |
| | | }; |
| | | //获取场景选择列表 |
| | | const getSceneGroupList = () => { |
| | | return new Promise((resolve, reject) => { |
| | | getSectionList() |
| | | .then((res) => { |
| | | sceneGroupList.value = res?.groups ?? []; |
| | | resolve(true); |
| | | }) |
| | | .catch((error) => { |
| | | reject(error); |
| | | }); |
| | | }); |
| | | }; |
| | | |
| | | const getSelectListSample = async () => { |
| | | const getSelectListSample = async (res1, res2) => { |
| | | try { |
| | | const [res1, res2] = await Promise.all([getSelectSample({}), getUserTemplateList()]); |
| | | const samples = res1?.samples ?? []; |
| | | const templateSamples = (res2?.templates ?? []).map((item) => ({ |
| | | group_id: item.template_group, |
| | |
| | | * 获取全局所有数据 |
| | | */ |
| | | export const getAllData = async () => { |
| | | return new Promise(async (resolve, reject) => { |
| | | try { |
| | | await getSceneGroupList(); |
| | | await getSelectListSample(); |
| | | await getHistoryChatRooms(); |
| | | resolve(true); |
| | | } catch (error) { |
| | | reject(error); |
| | | } |
| | | }); |
| | | Promise.all([getSectionList(), getSelectSample({}), getUserTemplateList()]) |
| | | .then((res) => { |
| | | let [sectionList, selectSample, userTemplateList] = res; |
| | | sceneGroupList.value = sectionList?.groups ?? []; |
| | | getSelectListSample(selectSample, userTemplateList); |
| | | }) |
| | | .catch((err) => {}); |
| | | getHistoryChatRooms(); |
| | | }; |
| | | |
| | | //#endregion |