| | |
| | | import moment from 'moment'; |
| | | import { Ref, ShallowRef, computed, nextTick, onBeforeUnmount, ref, unref } from 'vue'; |
| | | import { LOAD_CHAT_LIMIT } from '../constants'; |
| | | import { AnswerType, ChatContent, ChatMessage, RoleEnum, StepEnum, StepItem } from '../model/types'; |
| | | import { AnswerType, ChatContent, ChatMessage, MultiChatType, RoleEnum, StepEnum, StepItem } from '../model/types'; |
| | | import { GetHistoryAnswer, QueryHistoryDetail, getShareChatJsonByPost } from '/@/api/ai/chat'; |
| | | import router from '/@/router'; |
| | | import { isSharePage } from '/@/stores/chatRoom'; |
| | |
| | | return { |
| | | status: StepEnum.Success, |
| | | title: processItem.value, |
| | | }; |
| | | } as StepItem; |
| | | }; |
| | | export const convertProcessToStep = (process: any[]) => { |
| | | const stepList = (process ?? []).map<StepItem>((item) => { |
| | | return convertProcessItem(item); |
| | | }); |
| | | const stepList = (process ?? []).reduce((preVal, curVal) => { |
| | | if (curVal.mode === 'question') { |
| | | const last = preVal.at(-1); |
| | | if (!last.subStep) { |
| | | last.subStep = []; |
| | | } |
| | | const sub = { |
| | | data: curVal.value, |
| | | type: MultiChatType.Select, |
| | | }; |
| | | last.subStep.push(sub); |
| | | } else { |
| | | const cur = convertProcessItem(curVal); |
| | | preVal.push(cur); |
| | | } |
| | | return preVal; |
| | | }, []); |
| | | return stepList; |
| | | }; |
| | | |
| | | /** |
| | | * 滚动加载数据 |
| | | * @returns |