| | |
| | | srcset="" |
| | | /> |
| | | <div class="flex-auto flex" :class="{ 'justify-end': item.role === RoleEnum.user }"> |
| | | <div class="inline-flex flex-col" :class="{ 'w-full': item.role === RoleEnum.assistant }"> |
| | | <div class="inline-flex flex-col w-full" :class="{ 'w-full': item.role === RoleEnum.assistant }"> |
| | | <div class="w-full" v-if="item.content?.values"> |
| | | <div |
| | | class="text-sm rounded-[6px] p-4 leading-relaxed" |
| | |
| | | </div> |
| | | </div> |
| | | |
| | | <Loading v-if="isTalking && index === messageList.length - 1" class="w-fit" /> |
| | | <Loading v-if="isTalking && index === computedMessageList.length - 1" class="w-fit my-auto" /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="sticky bottom-0 w-full pb-3 flex justify-center"> |
| | | <div class="sticky bottom-0 w-full py-6 flex justify-center"> |
| | | <PlayBar |
| | | v-model:voicePageIsShow="voicePageIsShow" |
| | | :isTalking="isTalking" |
| | |
| | | import { GetHistoryAnswer, extCallQuery } from '/@/api/ai/chat'; |
| | | import PlayBar from '/@/components/chat/components/playBar/PlayBar.vue'; |
| | | import { ErrorCode } from '/@/utils/request'; |
| | | |
| | | const emit = defineEmits<{ |
| | | (event: 'question', inputText): any; |
| | | }>(); |
| | | import { CancelTokenSource } from 'axios'; |
| | | |
| | | const props = defineProps({ |
| | | questionApi: Function as PropType<(...params: any[]) => any>, |
| | | questionApi: Function as PropType<(text: string, sourceObj: { source: CancelTokenSource }) => any>, |
| | | }); |
| | | |
| | | const chatWidth = '100%'; |
| | |
| | | type: AnswerType.Text, |
| | | values: '解析失败!', |
| | | }; |
| | | |
| | | switch (res.answer_type) { |
| | | case AnswerType.RecordSet: |
| | | content = { |
| | |
| | | }; |
| | | |
| | | let questionRes = null; |
| | | // 作为参数传进去,携带参数出来 |
| | | let lastSourceObj: { source: CancelTokenSource } = { |
| | | source:null |
| | | }; |
| | | |
| | | const questionAi = async (text) => { |
| | | const res = await props.questionApi(text); |
| | | const res = await props.questionApi(text, lastSourceObj); |
| | | questionRes = res?.values; |
| | | const content = parseContent(res?.values); |
| | | return content; |
| | |
| | | history_id: historyId, |
| | | }); |
| | | }; |
| | | |
| | | const sendChatMessage = async (content: ChatContent = messageContent.value, cb?: any, isCallExtParams?: any) => { |
| | | if (!content?.values || isTalking.value) return; |
| | | const isNewChat = messageList.value.length === 0; |
| | |
| | | }; |
| | | |
| | | const clearContent = () => { |
| | | lastSourceObj.source?.cancel(); |
| | | messageList.value = []; |
| | | // 清空输入框 |
| | | clearMessageContent(); |
| | |
| | | |
| | | defineExpose({ |
| | | autoSend, |
| | | clear:clearContent |
| | | clear: clearContent, |
| | | }); |
| | | |
| | | //#region ====================== 关联查询 ====================== |