| | |
| | | " |
| | | ></i> |
| | | </el-tooltip> |
| | | <el-tooltip effect="dark" content="对话测试" placement="top"> |
| | | <i class="ywifont ywicon-ceshi !text-[20px] text-blue-400 cursor-pointer" @click="openChatTest(scope.row)"></i> |
| | | </el-tooltip> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <div |
| | | v-if="chatTestIsShow" |
| | | ref="draggableChatRef" |
| | | :style="style" |
| | | class="fixed z-50 w-[700px] h-[800px] flex flex-col bg-[rgb(239,244,253)] right-0 bottom-0 rounded-lg" |
| | | > |
| | | <div ref="chatDragHandlerRef" class="flex-0"> |
| | | <div class="flex items-center justify-between py-2 px-4"> |
| | | <div class="font-bold cursor-move"> |
| | | WI水务智能管家——【{{ chatTestMapRow?.title }}】测试 |
| | | <!-- <img src="/static/images/logo/logo-mini.svg" width="10" height="10" /> --> |
| | | </div> |
| | | <i class="ywifont ywicon-guanbi font-[10px] font-bold cursor-pointer" @click="closeChatTest"></i> |
| | | </div> |
| | | </div> |
| | | <Chat ref="chatRef" class="flex-auto px-2" :questionApi="questionAi"> </Chat> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <!-- <OptDlg v-model="optDlgIsShow" :item="optDlgMapRow" @insert="insertOpt" @update="updateOpt" :groupId="currentListID"></OptDlg> --> |
| | | <!-- <MetricPrompt v-model="infoDlgIsShow" :metricItem="infoDlgMapRow"></MetricPrompt> |
| | | <MetricName v-model="metricNameIsShow" :metricItem="metricNameMapRow"></MetricName> --> |
| | | </HMContainer> |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | import { computed, onMounted, ref } from 'vue'; |
| | | import { useDraggable } from '@vueuse/core'; |
| | | import axios, { CancelTokenSource } from 'axios'; |
| | | import { computed, nextTick, onMounted, ref } from 'vue'; |
| | | import { useRouter } from 'vue-router'; |
| | | import { SupervisorPublished } from '../../lowCode/sqlAmis/types'; |
| | | import * as agentGroupApi from '/@/api/ai/agentGroup'; |
| | | import * as metricApi from '/@/api/metrics'; |
| | | import Chat from '/@/components/chat/Chat.vue'; |
| | | import HMContainer from '/@/components/layout/HMContainer.vue'; |
| | | import { usePageDisplay } from '/@/hooks/usePageDisplay'; |
| | | import { useQueryTable } from '/@/hooks/useQueryTable'; |
| | | import { useCompRef } from '/@/utils/types'; |
| | | import { convertListToTree } from '/@/utils/util'; |
| | | import { eMetrics_Ops, eMetrics_Ops_Color } from '/@/views/types/metrics'; |
| | | const router = useRouter(); |
| | |
| | | } |
| | | ); |
| | | //#endregion |
| | | //#region ====================== 操作按钮 ====================== |
| | | //#region ====================== 操作按钮 测试 ====================== |
| | | const publishStatusChange = async (status: SupervisorPublished, id: number, index: number) => {}; |
| | | const chatRef = useCompRef(Chat); |
| | | const chatTestMapRow = ref(null); |
| | | const chatTestIsShow = ref(false); |
| | | const openChatTest = (row) => { |
| | | chatTestMapRow.value = row; |
| | | chatTestIsShow.value = true; |
| | | nextTick(() => { |
| | | chatRef.value.clear(); |
| | | // setTimeout(() => { |
| | | // chatRef.value.autoSend(row.title); |
| | | // }, 30); |
| | | }); |
| | | }; |
| | | |
| | | const closeChatTest = () => { |
| | | chatTestMapRow.value = null; |
| | | chatTestIsShow.value = false; |
| | | }; |
| | | |
| | | const draggableChatRef = ref<HTMLElement | null>(null); |
| | | const chatDragHandlerRef = ref<HTMLDivElement>(null); |
| | | const chatDragContainerRef = ref<HTMLDivElement>(null); |
| | | |
| | | // `style` will be a helper computed for `left: ?px; top: ?px;` |
| | | const { x, y, style } = useDraggable(draggableChatRef, { |
| | | handle: chatDragHandlerRef, |
| | | initialValue: { |
| | | x: document.body.clientWidth / 2 - 350, |
| | | y: document.body.clientHeight / 2 - 400, |
| | | }, |
| | | }); |
| | | |
| | | const questionAi = async (text, sourceObj: { source: CancelTokenSource }) => { |
| | | const currentSource = axios.CancelToken.source(); |
| | | sourceObj.source = currentSource; |
| | | const res = await metricApi.checkMetricAgentValidateByPost( |
| | | { |
| | | agent_id: chatTestMapRow.value.id, |
| | | question: text, |
| | | }, |
| | | { |
| | | loading: false, |
| | | cancelToken: currentSource.token, |
| | | } |
| | | ); |
| | | return res; |
| | | }; |
| | | //#endregion |
| | | onMounted(() => { |
| | | initThemeDomainData(); |