| | |
| | | proxy: { |
| | | '/base': { |
| | | // target: 'http://aiotlink.com:8189', |
| | | //target: 'http://192.168.20.116:8089', |
| | | target: 'http://192.168.20.158:8089', |
| | | target: 'http://192.168.20.116:8089', |
| | | // target: 'http://192.168.20.158:8089', |
| | | changeOrigin: true, |
| | | ws: true, |
| | | // rewrite: (path) => path.replace(new RegExp(`^/basic-api`), ''), |
| | |
| | | }, |
| | | '/api': { |
| | | // target: 'http://aiotlink.com:8189', |
| | | //target: 'http://192.168.20.116:8089', |
| | | target: 'http://192.168.20.158:8089', |
| | | target: 'http://192.168.20.116:8089', |
| | | // target: 'http://192.168.20.158:8089', |
| | | changeOrigin: true, |
| | | ws: true, |
| | | // rewrite: (path) => path.replace(new RegExp(`^/basic-api`), ''), |
| | | }, |
| | | '/api/v1': { |
| | | // target: 'http://aiotlink.com:8189', |
| | | //target: 'http://192.168.20.116:8089', |
| | | target: 'http://192.168.20.158:8089', |
| | | target: 'http://192.168.20.116:8089', |
| | | // target: 'http://192.168.20.158:8089', |
| | | changeOrigin: true, |
| | | ws: true, |
| | | // rewrite: (path) => path.replace(new RegExp(`^/basic-api`), ''), |
| | |
| | | <div class="chatHeader"> |
| | | <div class="chatHeaderBox"> |
| | | <!-- <span class="title">{{agentTitle}}</span>--> |
| | | <a-popover |
| | | position="bottom" |
| | | trigger="click" |
| | | > |
| | | <a-button border |
| | | > |
| | | <span style=" |
| | | <a-popover position="bottom" trigger="click"> |
| | | <a-button border> |
| | | <span |
| | | style=" |
| | | width: 100px; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | white-space: nowrap; |
| | | ">{{ from.name }}</span> |
| | | " |
| | | >{{ from.name }}</span |
| | | > |
| | | <icon-down style="margin-left: 4px" /> |
| | | </a-button> |
| | | <template #content> |
| | |
| | | <template #avatar> |
| | | <img |
| | | class="icon-user-jpg" |
| | | src="../../../assets/images/icon-chart.png" |
| | | src="../../../assets/images/icon-picture.png" |
| | | alt="本地图片" |
| | | /> |
| | | </template> |
| | |
| | | auto-size |
| | | v-model="sessionDetail.content" |
| | | :class="{ chatItemAnswer: theme === 'light' }" |
| | | :style="{ backgroundColor: theme === 'light' ? '#ffffff' : '#000000'}" |
| | | :style="{ |
| | | backgroundColor: theme === 'light' ? '#ffffff' : '#000000', |
| | | }" |
| | | style="border: none" |
| | | > |
| | | </a-textarea> |
| | | </template> |
| | | <template #actions> |
| | | <span class="action" v-if="index != 0" @click="copy(sessionDetail.content)"> |
| | | <span |
| | | class="action" |
| | | v-if="index != 0" |
| | | @click="copy(sessionDetail.content)" |
| | | > |
| | | <icon-copy /> 复制 |
| | | </span> |
| | | <span class="action" v-if="index != 0 && index == sessionDetailList.length - 1" @click="reGenerate()"> |
| | | <span |
| | | class="action" |
| | | v-if="index != 0 && index == sessionDetailList.length - 1" |
| | | @click="reGenerate()" |
| | | > |
| | | <icon-refresh /> 重新生成 |
| | | </span> |
| | | </template> |
| | |
| | | auto-size |
| | | v-model="displayedText" |
| | | :class="{ chatItemAnswer: theme === 'light' }" |
| | | :style="{backgroundColor: theme === 'light' ? '#ffffff' : '#000000'}" |
| | | :style="{ |
| | | backgroundColor: theme === 'light' ? '#ffffff' : '#000000', |
| | | }" |
| | | style="border: none" |
| | | > |
| | | </a-textarea> |
| | | </template> |
| | | <template #actions> |
| | | <div class="action" |
| | | <div |
| | | class="action" |
| | | @click="stopChat" |
| | | style="background: var(--color-bg-2);color: var(--color-primary-light-4);" v-if="displayedText != ''"> |
| | | style=" |
| | | background: var(--color-bg-2); |
| | | color: var(--color-primary-light-4); |
| | | " |
| | | v-if="displayedText != ''" |
| | | > |
| | | <icon-record-stop /> |
| | | 停止生成 |
| | | </div> |
| | |
| | | style="border-radius: 24px" |
| | | :loading="loading" |
| | | > |
| | | <icon-send size="32" style="color: #0960bd;"/> |
| | | </a-button |
| | | > |
| | | <icon-send size="32" style="color: #0960bd" /> |
| | | </a-button> |
| | | </div> |
| | | <!-- <div class="btn-send">--> |
| | | <!-- <!– <icon-send size="32" /> –>--> |
| | |
| | | <!-- >--> |
| | | <!-- </div>--> |
| | | </div> |
| | | <a-modal v-model:visible="visible" title="修改名称" @before-open="handleOpened" @cancel="handleCancel" :footer="false" title-align="start"> |
| | | <a-modal |
| | | v-model:visible="visible" |
| | | title="修改名称" |
| | | @before-open="handleOpened" |
| | | @cancel="handleCancel" |
| | | :footer="false" |
| | | title-align="start" |
| | | > |
| | | <a-form ref="formRef" :rules="rules" :model="from" @submit="handleSubmit" > |
| | | <a-form-item field="name" label="名称"> |
| | | <a-input v-model="from.name" placeholder="请输入名称"/> |
| | |
| | | <a-form-item> |
| | | <div style="width: 100%;text-align: right"> |
| | | <a-button @click="visible = false">取消</a-button> |
| | | <a-button style="margin-left: 10px" type="primary" html-type="submit">确定</a-button> |
| | | <a-button |
| | | style="margin-left: 10px" |
| | | type="primary" |
| | | html-type="submit" |
| | | >确定</a-button |
| | | > |
| | | </div> |
| | | </a-form-item> |
| | | </a-form> |
| | |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | import { defineProps, ref, watch, defineEmits, onMounted, reactive, computed, nextTick, onBeforeUnmount } from "vue"; |
| | | import { |
| | | defineProps, |
| | | ref, |
| | | watch, |
| | | defineEmits, |
| | | onMounted, |
| | | reactive, |
| | | computed, |
| | | nextTick, |
| | | onBeforeUnmount, |
| | | } from 'vue'; |
| | | import { Message } from '@arco-design/web-vue'; |
| | | import { useAppStore } from "@/store"; |
| | | import { getAuthorization } from "@/utils/auth"; |
| | | import { useAppStore } from '@/store'; |
| | | import { getAuthorization } from '@/utils/auth'; |
| | | import { EventSourceParserStream } from 'eventsource-parser/stream'; |
| | | import { agentResetApi, agentSetApi, getAgentSessionDetailsApi } from "@/api/agentSession"; |
| | | import { |
| | | agentResetApi, |
| | | agentSetApi, |
| | | getAgentSessionDetailsApi, |
| | | } from '@/api/agentSession'; |
| | | import EventBus from '@/utils/EventBus'; |
| | | import useClipboard from "vue-clipboard3"; |
| | | import { addSessionApi, getSessionDetailsApi } from "@/api/session"; |
| | | import useClipboard from 'vue-clipboard3'; |
| | | import { addSessionApi, getSessionDetailsApi } from '@/api/session'; |
| | | const props = defineProps({ |
| | | modalObj: Object, |
| | | }); |
| | |
| | | const dialogId = ref(''); |
| | | const chatDis = ref(false); |
| | | const loading = ref(false); |
| | | const agentTitle = ref("未命名会话"); |
| | | |
| | | const agentTitle = ref('未命名会话'); |
| | | |
| | | const currIndex = ref(0); |
| | | const displayedText = ref(''); // 正在显示的文字 |
| | |
| | | const selectValue = ref(''); |
| | | const sectionList = ref({}); |
| | | let chatObj = reactive({}); |
| | | const isStopChat = ref(false) |
| | | const isStopChat = ref(false); |
| | | const appStore = useAppStore(); |
| | | const theme = computed(() => { |
| | | return appStore.theme; |
| | |
| | | let dsl = reactive({}); |
| | | const chatDataMeg = reactive({}); |
| | | |
| | | |
| | | const rules = { |
| | | name: [ |
| | | { |
| | |
| | | message:'名称不允许为空', |
| | | }, |
| | | ], |
| | | } |
| | | }; |
| | | |
| | | const handleSubmit = async({values, errors}) => { |
| | | if(errors) return; |
| | |
| | | let chatData = { |
| | | id:conversation_id.value, |
| | | conversation_id:conversation_id.value, |
| | | name: from.name |
| | | } |
| | | name: from.name, |
| | | }; |
| | | const { code, data } = await addSessionApi(chatData); |
| | | if (data) { |
| | | Message.success("修改成功"); |
| | | handleCancel() |
| | | Message.success('修改成功'); |
| | | handleCancel(); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | const handleClick = () => { |
| | | visible.value = true; |
| | | }; |
| | | const handleCancel = () => { |
| | | visible.value = false; |
| | | } |
| | | }; |
| | | |
| | | const handleOpened =(el) => { |
| | | // Object.assign(form,{ |
| | | // name: '',// 用户名 |
| | | // }); |
| | | // formRef.value.resetFields(); |
| | | } |
| | | |
| | | }; |
| | | |
| | | // 初始化页面 |
| | | const initPage = async () => { |
| | |
| | | Object.assign(agentObj, session); |
| | | isHistory.value = false; |
| | | initPage(); |
| | | } |
| | | }; |
| | | // 调用set方法 |
| | | const agentSet = async () => { |
| | | const res = await agentSetApi({ |
| | |
| | | conversation_id.value = res.data.conversation_id; |
| | | agentReset(); |
| | | } |
| | | } |
| | | }; |
| | | // 调用reset方法 |
| | | const agentReset = async () => { |
| | | const res = await agentResetApi({ |
| | |
| | | // Message.success('修改成功'); |
| | | agentCompletion(); |
| | | } |
| | | } |
| | | }; |
| | | // 调用completion方法 |
| | | const agentCompletion = async () => { |
| | | const response = await fetch( |
| | | '/api/v1/canvas/completion', |
| | | { |
| | | const response = await fetch('/api/v1/canvas/completion', { |
| | | method: 'POST', |
| | | headers: { |
| | | 'Authorization': getAuthorization(), |
| | | 'Content-Type': 'application/json', |
| | | }, |
| | | body: JSON.stringify({ |
| | | id: agentObj.id |
| | | id: agentObj.id, |
| | | }), |
| | | } |
| | | ); |
| | | }); |
| | | |
| | | const reader = response?.body |
| | | ?.pipeThrough(new TextDecoderStream()) |
| | |
| | | chatDis.value = false; |
| | | loading.value = false; |
| | | inputMsg.value = ''; |
| | | } |
| | | }; |
| | | // 调用get方法 |
| | | const queryAgentSessionDetail = async (id) => { |
| | | const { code, data } = await getAgentSessionDetailsApi(id); |
| | |
| | | } |
| | | }; |
| | | |
| | | |
| | | const { toClipboard } = useClipboard(); |
| | | const copy = async (text) => { |
| | | await toClipboard(text); //参数为要复制的文本 |
| | | } |
| | | |
| | | }; |
| | | |
| | | const sentClick = () => { |
| | | sendMessage('click'); |
| | |
| | | |
| | | // 重新生成 |
| | | const reGenerate = () => { |
| | | let inputContent = sessionDetailList.value[sessionDetailList.value.length-2].content |
| | | startChat(inputContent) |
| | | let inputContent = |
| | | sessionDetailList.value[sessionDetailList.value.length - 2].content; |
| | | startChat(inputContent); |
| | | }; |
| | | |
| | | const sendMessage = async (event) => { |
| | |
| | | // } |
| | | |
| | | if (inputMsg.value) { |
| | | startChat(inputMsg.value) |
| | | startChat(inputMsg.value); |
| | | inputMsg.value = ''; |
| | | } else { |
| | | Message.warning('消息不能为空'); |
| | |
| | | } |
| | | } |
| | | }; |
| | | |
| | | |
| | | const startChat = async(valMsg)=>{ |
| | | sessionDetailList.value.push({ |
| | |
| | | let chatStr = { |
| | | id: agentObj.id, |
| | | message: valMsg, |
| | | } |
| | | }; |
| | | if(isHistory.value){ |
| | | chatStr.dsl = dsl; |
| | | } |
| | | const response = await fetch( |
| | | '/api/v1/canvas/completion', |
| | | { |
| | | const response = await fetch('/api/v1/canvas/completion', { |
| | | method: 'POST', |
| | | headers: { |
| | | 'Authorization': getAuthorization(), |
| | | 'Content-Type': 'application/json', |
| | | }, |
| | | body: JSON.stringify(chatStr), |
| | | } |
| | | ); |
| | | }); |
| | | |
| | | const reader = response?.body |
| | | ?.pipeThrough(new TextDecoderStream()) |
| | |
| | | } |
| | | chatDis.value = false; |
| | | loading.value = false; |
| | | } |
| | | }; |
| | | |
| | | const stopChat=async()=>{ |
| | | // const { code, data } = await stopChatApi(agentObj.id); |
| | |
| | | console.log('stopChat'); |
| | | console.log(displayedText.value, 'displayedText'); |
| | | console.log(sessionDetailList.value, 'sessionDetailList'); |
| | | let inputText = sessionDetailList.value[sessionDetailList.value.length-2].content |
| | | let inputText = |
| | | sessionDetailList.value[sessionDetailList.value.length - 2].content; |
| | | // 数组合并 |
| | | let lastArr = [{ |
| | | let lastArr = [ |
| | | { |
| | | content: inputText, |
| | | role: "user" |
| | | },{ |
| | | role: 'user', |
| | | }, |
| | | { |
| | | content: displayedText.value, |
| | | role: "assistant" |
| | | }] |
| | | sessionDetailList.value = sessionDetailList.value.splice(0, sessionDetailList.value.length-2).concat(lastArr); |
| | | role: 'assistant', |
| | | }, |
| | | ]; |
| | | sessionDetailList.value = sessionDetailList.value |
| | | .splice(0, sessionDetailList.value.length - 2) |
| | | .concat(lastArr); |
| | | console.log(sessionDetailList.value, 'sessionDetailList2'); |
| | | console.log(chatObj, 'chatObj对象'); |
| | | chatObj.dsl.messages = chatObj.dsl.messages.concat(lastArr); |
| | |
| | | conversation_id: chatObj.id, |
| | | message: sessionDetailList.value, |
| | | }); |
| | | |
| | | } |
| | | |
| | | }; |
| | | |
| | | const setChatDataMeg = async (chatData) => { |
| | | const { code, data } = await addSessionApi(chatData); |
| | |
| | | event.preventDefault(); |
| | | inputMsg.value += '\n'; |
| | | }; |
| | | |
| | | |
| | | |
| | | //文字动态输出 |
| | | const startDisplayStr = () => { |
| | |
| | | }); |
| | | }; |
| | | |
| | | |
| | | onMounted(() => { |
| | | EventBus.on('createAgent', (data) => { |
| | | createNewAgent(data); |
| | |
| | | if(JSON.stringify(newVal) != '{}'){ |
| | | // initPage(); |
| | | } |
| | | },{ |
| | | }, |
| | | { |
| | | immediate: true, |
| | | deep: true |
| | | deep: true, |
| | | } |
| | | ); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | |
| | | .dark { |
| | | color: gray !important; |
| | | } |
| | |
| | | <div class="myAgent___djnd_ myAgentAnim myAgentlight___yK7Gk"> |
| | | <div data-testid="msh-sidebar-main" class="myAgentHome___PG6IZ"></div> |
| | | <div class="myAgentLine___Isl6E"></div> |
| | | <div class="myAgentTool___Y1_mC" data-testid="msh-sidebar-new" @click="()=>{ |
| | | EventBus.emit('newChat') |
| | | }"> |
| | | <div |
| | | class="myAgentTool___Y1_mC" |
| | | data-testid="msh-sidebar-new" |
| | | @click=" |
| | | () => { |
| | | EventBus.emit('newChat'); |
| | | } |
| | | " |
| | | > |
| | | <div class="myAgentToolIcon___gaAKI myAgentToolIconNew___DBZrW"> |
| | | <img |
| | | src="@/assets/images/talk.png" |
| | | style="width: 24px" |
| | | alt=""> |
| | | <img src="@/assets/images/talk.png" style="width: 24px" alt="" /> |
| | | </div> |
| | | </div> |
| | | <div data-testid="msh-sidebar-history" class="myAgentTool___Y1_mC" @click="()=>{ |
| | | EventBus.emit('history') |
| | | }"> |
| | | <div |
| | | data-testid="msh-sidebar-history" |
| | | class="myAgentTool___Y1_mC" |
| | | @click=" |
| | | () => { |
| | | EventBus.emit('history'); |
| | | } |
| | | " |
| | | > |
| | | <div class="myAgentToolIcon___gaAKI myAgentToolIconHistory___GTLWk" > |
| | | <img |
| | | src="@/assets/images/historybg.png" |
| | | style="width: 24px" |
| | | alt=""> |
| | | alt="" |
| | | /> |
| | | </div> |
| | | </div> |
| | | <div data-testid="msh-sidebar-square" class="myAgentTool___Y1_mC myAgentToolSquare___dbLm1" @click="()=>{ |
| | | EventBus.emit('smartAi') |
| | | }"> |
| | | <div class="myAgentToolIcon___gaAKI myAgentToolIconSquare___Rj1o_"><img |
| | | src="@/assets/images/agent.png" |
| | | style="width: 24px" |
| | | alt=""></div> |
| | | <div |
| | | data-testid="msh-sidebar-square" |
| | | class="myAgentTool___Y1_mC myAgentToolSquare___dbLm1" |
| | | @click=" |
| | | () => { |
| | | EventBus.emit('smartAi'); |
| | | } |
| | | " |
| | | > |
| | | <div class="myAgentToolIcon___gaAKI myAgentToolIconSquare___Rj1o_" |
| | | ><img src="@/assets/images/agent.png" style="width: 24px" alt="" |
| | | /></div> |
| | | </div> |
| | | <div class="myAgentLine___Isl6E" style="margin-top: 4px;"></div> |
| | | <div class="myAgentLine___Isl6E" style="margin-top: 4px"></div> |
| | | <div id="myAgentBox"> |
| | | <!-- <div class="myAgentBox___zrCit">--> |
| | | <!-- <div class="myAgentBoxImg___Mgu9e">--> |
| | |
| | | <img |
| | | :src="item.icon ? httpUrl + item.icon:imgSrc" |
| | | alt="" |
| | | style="border-radius: 50%; width: 100%; height: 100%;"> |
| | | style="border-radius: 50%; width: 100%; height: 100%" |
| | | /> |
| | | </div> |
| | | <span class="myAgentBoxImgLayoutTip___xHV4m">{{item.name}}</span> |
| | | <span class="myAgentBoxImgLayoutTip___xHV4m">{{ |
| | | item.name |
| | | }}</span> |
| | | </div> |
| | | <div data-testid="msh-sidebar-bot-delete" class="myAgentBoxImgDelete___qXZuq" @click.stop="deleteSession(item)"> |
| | | <div |
| | | data-testid="msh-sidebar-bot-delete" |
| | | class="myAgentBoxImgDelete___qXZuq" |
| | | @click.stop="deleteSession(item)" |
| | | > |
| | | <div class="myAgentBoxImgDeleteInner____Hawc" >从侧边栏移除</div> |
| | | </div> |
| | | </div> |
| | |
| | | import { |
| | | IconClose, |
| | | IconSearch, |
| | | IconTiktokColor |
| | | } from "@arco-design/web-vue/es/icon"; |
| | | import { useAppStore, useUserStore } from "@/store"; |
| | | import { computed, nextTick, onMounted, watch, reactive, ref, onBeforeMount, onBeforeUnmount } from "vue"; |
| | | IconTiktokColor, |
| | | } from '@arco-design/web-vue/es/icon'; |
| | | import { useAppStore, useUserStore } from '@/store'; |
| | | import { |
| | | computed, |
| | | nextTick, |
| | | onMounted, |
| | | watch, |
| | | reactive, |
| | | ref, |
| | | onBeforeMount, |
| | | onBeforeUnmount, |
| | | } from 'vue'; |
| | | import { |
| | | addSessionApi, |
| | | chatApi, |
| | | getDialogListApi, |
| | | getSessionDetailsApi, |
| | | deleteSessionApi, |
| | | sessionListApi |
| | | } from "@/api/session"; |
| | | import { Message } from "@arco-design/web-vue"; |
| | | sessionListApi, |
| | | } from '@/api/session'; |
| | | import { Message } from '@arco-design/web-vue'; |
| | | const httpUrl = localStorage.getItem('httpUrl'); |
| | | import EventBus from '@/utils/EventBus'; |
| | | const emit = defineEmits(["querySessionDetail","changeAgentType","createSession"]); |
| | | import { appUsageSessionListApi, deleteAppUsage } from "@/api/Agent"; |
| | | import { getAgentSessionDetailsApi } from "@/api/agentSession"; |
| | | const activeSessionId = ref(""); |
| | | const fieldNames = { value: "id", label: "name" }; |
| | | const emit = defineEmits([ |
| | | 'querySessionDetail', |
| | | 'changeAgentType', |
| | | 'createSession', |
| | | ]); |
| | | import { appUsageSessionListApi, deleteAppUsage } from '@/api/Agent'; |
| | | import { getAgentSessionDetailsApi } from '@/api/agentSession'; |
| | | const activeSessionId = ref(''); |
| | | const fieldNames = { value: 'id', label: 'name' }; |
| | | const dialogs = ref([]); |
| | | const dialogObj = reactive({}); |
| | | const agentObj = reactive({}); |
| | | const agentList = ref([]); |
| | | const searchValue = ref(""); |
| | | const selectValue = ref(""); |
| | | const searchValue = ref(''); |
| | | const selectValue = ref(''); |
| | | const sectionList = ref({}); |
| | | const sessionList = ref([]); //用户操作会话列表 |
| | | import img1 from '@/assets/images/talkbg.png' |
| | | import logo from "@/assets/images/model.png"; |
| | | import img1 from '@/assets/images/talkbg.png'; |
| | | import logo from '@/assets/images/model.png'; |
| | | const imgSrc = ref(logo); |
| | | |
| | | |
| | | |
| | | // 查询历史用户习惯会话列表 |
| | | const querySessionList = async (id) => { |
| | |
| | | sessionList.value = data.map((item) => { |
| | | return { |
| | | ...item, |
| | | } |
| | | }; |
| | | }); |
| | | // sessionList.value.splice(0, 5); |
| | | console.log(sessionList.value,'用户习惯会话列表'); |
| | |
| | | // Message.warning("查询失败"); |
| | | } |
| | | }; |
| | | |
| | | |
| | | // 新增会话 |
| | | const createNewSession = async (session) => { |
| | |
| | | id: session.app_id, |
| | | dsl: data.dsl, |
| | | title: session.name, |
| | | } |
| | | EventBus.emit("createAgent",sessionObj); |
| | | }; |
| | | EventBus.emit('createAgent', sessionObj); |
| | | emit('changeAgentType','2'); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | }; |
| | | |
| | | //根据会话id删除会话 |
| | | const deleteSession = async (session) => { |
| | | const { code } = await deleteAppUsage({ |
| | | app_id:session.app_id |
| | | app_id: session.app_id, |
| | | }); |
| | | if (code === 200) { |
| | | // Message.success('删除成功'); |
| | |
| | | } |
| | | }; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | onBeforeMount(()=>{ |
| | | querySessionList(''); |
| | | }) |
| | | |
| | | onMounted(() => { |
| | | EventBus.on("queryAppUsageList", (data) => { |
| | | querySessionList(''); |
| | | }) |
| | | }) |
| | | onBeforeUnmount(() => { |
| | | EventBus.off("queryAppUsageList"); |
| | | }); |
| | | |
| | | |
| | | |
| | | onMounted(() => { |
| | | EventBus.on('queryAppUsageList', (data) => { |
| | | querySessionList(''); |
| | | }); |
| | | }); |
| | | onBeforeUnmount(() => { |
| | | EventBus.off('queryAppUsageList'); |
| | | }); |
| | | </script> |
| | | <style scoped lang="less"> |
| | | @import "@/views/sessionManager/style/layout.css"; |
| | | @import '@/views/sessionManager/style/layout.css'; |
| | | .layoutNavMoveCenter { |
| | | display: flex; |
| | | justify-content: center; |
| | |
| | | //max-height: 220px; |
| | | //overflow: hidden; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | </style> |
| | |
| | | <template> |
| | | <div class="layoutAgentCenter"> |
| | | <a-scrollbar |
| | | style=" |
| | | height: calc(100vh - 100px); |
| | | overflow-y: auto; |
| | | overflow-x: hidden; |
| | | " |
| | | style="height: calc(100vh - 100px); overflow-y: auto; overflow-x: hidden" |
| | | > |
| | | <div class="search"> |
| | | <!-- 查询框--> |
| | | <img src="@/assets/images/his.png" |
| | | style="width: 100%" |
| | | alt=""> |
| | | |
| | | <img src="@/assets/images/his.png" style="width: 100%" alt="" /> |
| | | </div> |
| | | <div class="agentMainCenter"> |
| | | <a-row class="agentCenter"> |
| | | <a-col :span="8" v-for="item in dialogs"> |
| | | <div |
| | | class="item agentCenter-box" |
| | | @click="createNewSession(item)" |
| | | > |
| | | <div class="item agentCenter-box" @click="createNewSession(item)"> |
| | | <div class="text" > |
| | | <a-avatar> |
| | | <img |
| | | :style="{ width: '100%' }" |
| | | alt="dessert" |
| | | :src="item.avatar || imgSrc" |
| | | :src="item.icon || imgSrc" |
| | | /> |
| | | </a-avatar> |
| | | <span style="margin-left: 10px;font-weight: 500;color: var(--color-text-1)"> |
| | | <span |
| | | style=" |
| | | margin-left: 10px; |
| | | font-weight: 500; |
| | | color: var(--color-text-1); |
| | | " |
| | | > |
| | | {{ item.name }} |
| | | </span> |
| | | </div> |
| | | <div class="time" |
| | | > |
| | | </div> |
| | | <div class="time"> </div> |
| | | </div> |
| | | </a-col> |
| | | <a-col :span="8" v-for="item in agentList"> |
| | | <div |
| | | class="item agentCenter-box" |
| | | @click="createNewSession(item)" |
| | | > |
| | | <div class="item agentCenter-box" @click="createNewSession(item)"> |
| | | <div class="text" > |
| | | <a-avatar> |
| | | <img |
| | |
| | | :src="item.avatar || imgSrc" |
| | | /> |
| | | </a-avatar> |
| | | <span style="margin-left: 10px;font-weight: 500;color: var(--color-text-1)"> |
| | | <span |
| | | style=" |
| | | margin-left: 10px; |
| | | font-weight: 500; |
| | | color: var(--color-text-1); |
| | | " |
| | | > |
| | | {{ item.name }} |
| | | </span> |
| | | </div> |
| | | <div class="time" |
| | | > |
| | | </div> |
| | | <div class="time"> </div> |
| | | </div> |
| | | </a-col> |
| | | </a-row> |
| | |
| | | import { |
| | | IconClose, |
| | | IconSearch, |
| | | IconTiktokColor |
| | | } from "@arco-design/web-vue/es/icon"; |
| | | import { useAppStore, useUserStore } from "@/store"; |
| | | import { computed, nextTick, onMounted, watch, reactive, ref, onBeforeMount, onBeforeUnmount } from "vue"; |
| | | IconTiktokColor, |
| | | } from '@arco-design/web-vue/es/icon'; |
| | | import { useAppStore, useUserStore } from '@/store'; |
| | | import { |
| | | computed, |
| | | nextTick, |
| | | onMounted, |
| | | watch, |
| | | reactive, |
| | | ref, |
| | | onBeforeMount, |
| | | onBeforeUnmount, |
| | | } from 'vue'; |
| | | |
| | | import { Message } from "@arco-design/web-vue"; |
| | | import { Message } from '@arco-design/web-vue'; |
| | | import EventBus from '@/utils/EventBus'; |
| | | import moment from "moment"; |
| | | import moment from 'moment'; |
| | | import { |
| | | addSessionApi, |
| | | chatApi, |
| | | getDialogListApi, |
| | | getSessionDetailsApi, |
| | | sessionListApi |
| | | } from "@/api/session"; |
| | | import { queryCanvasList } from "@/api/Agent"; |
| | | const emit = defineEmits(["querySessionDetail","changeAgentType","createSession"]); |
| | | import logo from "@/assets/images/model.png"; |
| | | sessionListApi, |
| | | } from '@/api/session'; |
| | | import { queryCanvasList } from '@/api/Agent'; |
| | | const emit = defineEmits([ |
| | | 'querySessionDetail', |
| | | 'changeAgentType', |
| | | 'createSession', |
| | | ]); |
| | | import logo from '@/assets/images/model.png'; |
| | | const sessionList = ref([]); //会话列表 |
| | | const activeSessionId = ref(""); |
| | | const fieldNames = { value: "id", label: "name" }; |
| | | const activeSessionId = ref(''); |
| | | const fieldNames = { value: 'id', label: 'name' }; |
| | | const dialogs = ref([]); |
| | | const dialogObj = reactive({}); |
| | | const agentObj = reactive({}); |
| | | const agentList = ref([]); |
| | | const searchValue = ref(""); |
| | | const selectValue = ref(""); |
| | | const searchValue = ref(''); |
| | | const selectValue = ref(''); |
| | | const sectionList = ref({}); |
| | | const imgSrc = ref(logo); |
| | | const DialogList = async () => { |
| | |
| | | dialogs.value = data.map((item) => { |
| | | return { |
| | | ...item, |
| | | type: 1 //智能体 |
| | | type: 1, //智能体 |
| | | }; |
| | | }); |
| | | // console.log(data, "dialogs"); |
| | | |
| | | // console.log(dialogs, 'dialogs'); |
| | | } |
| | | } |
| | | }; |
| | |
| | | const queryCanvas = async (params = {}) => { |
| | | try { |
| | | const { data } = await queryCanvasList(params); |
| | | console.log(data, "agent"); |
| | | |
| | | agentList.value = data.map((item) => { |
| | | return { |
| | | ...item, |
| | | name: item.title, |
| | | type: 2 //agent |
| | | type: 2, //agent |
| | | }; |
| | | }); |
| | | // console.log(agentList, 'agent'); |
| | | // 合并数组 |
| | | // dialogs.value = dialogs.value.concat(agentList.value); |
| | | |
| | | |
| | | } catch (err) { |
| | | // you can report use errorHandler or other |
| | | } finally { |
| | | } |
| | | }; |
| | | |
| | | |
| | | // 查询会话列表 |
| | | const querySessionList = async (id) => { |
| | | const { code, data } = await sessionListApi(id); |
| | | if (code === 200) { |
| | | sessionList.value = data; |
| | | |
| | | |
| | | |
| | | } else { |
| | | Message.warning("查询失败"); |
| | | Message.warning('查询失败'); |
| | | } |
| | | }; |
| | | // 生成智能体新建会话 |
| | |
| | | emit('changeAgentType','1'); |
| | | } else { |
| | | // 生成agent新的对话 |
| | | EventBus.emit("createAgent",session); |
| | | EventBus.emit('createAgent', session); |
| | | emit('changeAgentType','2'); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | }; |
| | | onBeforeMount(()=>{ |
| | | DialogList(); |
| | | queryCanvas(); |
| | | }) |
| | | }); |
| | | |
| | | onMounted(() => { |
| | | EventBus.on("smartAi", () => { |
| | | EventBus.on('smartAi', () => { |
| | | emit('changeAgentType','4'); |
| | | DialogList(); |
| | | queryCanvas(); |
| | | }); |
| | | }) |
| | | onBeforeUnmount(() => { |
| | | EventBus.off("smartAi"); |
| | | }); |
| | | |
| | | |
| | | onBeforeUnmount(() => { |
| | | EventBus.off('smartAi'); |
| | | }); |
| | | </script> |
| | | <style scoped lang="less"> |
| | | .layoutAgentCenter{ |
| | |
| | | color: var(--color-text-2); |
| | | //border: 1px solid var(--color-neutral-3); |
| | | background: var(--color-bg-3); |
| | | box-shadow: 0 1px 2px -2px rgba(0, 0, 0, 0.16), 0 3px 6px 0 rgba(0, 0, 0, 0.12), 0 5px 12px 4px rgba(0, 0, 0, 0.09); |
| | | box-shadow: 0 1px 2px -2px rgba(0, 0, 0, 0.16), |
| | | 0 3px 6px 0 rgba(0, 0, 0, 0.12), 0 5px 12px 4px rgba(0, 0, 0, 0.09); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | </style> |
| | |
| | | <template #avatar> |
| | | <img |
| | | class="icon-user-jpg" |
| | | src="../../assets/images/icon-chart.png" |
| | | src="../../assets/images/icon-picture.png" |
| | | alt="本地图片" |
| | | /> |
| | | </template> |
| | | <template #content> |
| | | <a-card v-if="isExistTip(sessionDetail.content)"> |
| | | <div :class="{ chatItemAnswer: theme === 'light' }" |
| | | :style="{backgroundColor: theme === 'light' ? '#ffffff' : '#000000'}" style="border: none;display: inline;" v-for="(item,tipIndex) in tipMatch(sessionDetail)" |
| | | > |
| | | <span v-if="tipIndex == 0"> |
| | | {{ sessionDetail.content.substring(0, item.index) }} |
| | | <a-tooltip background-color="#3491FA" :content="getTipContent( |
| | | messagenList.reference, |
| | | index |
| | | )"> |
| | | <img style="width: 20px;height: 20px" :src="tipImage" /> |
| | | </a-tooltip> |
| | | </span> |
| | | <span v-else> |
| | | {{ sessionDetail.content.substring(item.preIndex+item.item.length, item.index) }} |
| | | <a-tooltip background-color="#3491FA" :content="getTipContent( |
| | | messagenList.reference, |
| | | index |
| | | )"> |
| | | <img style="width: 20px;height: 20px" :src="tipImage" /> |
| | | </a-tooltip> |
| | | </span> |
| | | |
| | | </div> |
| | | </a-card> |
| | | <a-card v-else> |
| | | <div :class="{ chatItemAnswer: theme === 'light' }" |
| | | <div |
| | | :class="{ chatItemAnswer: theme === 'light' }" |
| | | :style="{ |
| | | backgroundColor: |
| | | theme === 'light' ? '#ffffff' : '#000000', |
| | | }" style="border: none"> |
| | | }" |
| | | style="border: none; display: inline" |
| | | v-for="(item, tipIndex) in tipMatch(sessionDetail)" |
| | | > |
| | | <span v-if="tipIndex == 0"> |
| | | {{ sessionDetail.content.substring(0, item.index) }} |
| | | <a-tooltip |
| | | background-color="#3491FA" |
| | | :content=" |
| | | getTipContent(messagenList.reference, index) |
| | | " |
| | | > |
| | | <img |
| | | style="width: 20px; height: 20px" |
| | | :src="tipImage" |
| | | /> |
| | | </a-tooltip> |
| | | </span> |
| | | <span v-else> |
| | | {{ |
| | | sessionDetail.content.substring( |
| | | item.preIndex + item.item.length, |
| | | item.index |
| | | ) |
| | | }} |
| | | <a-tooltip |
| | | background-color="#3491FA" |
| | | :content=" |
| | | getTipContent(messagenList.reference, index) |
| | | " |
| | | > |
| | | <img |
| | | style="width: 20px; height: 20px" |
| | | :src="tipImage" |
| | | /> |
| | | </a-tooltip> |
| | | </span> |
| | | </div> |
| | | </a-card> |
| | | <a-card v-else> |
| | | <div |
| | | :class="{ chatItemAnswer: theme === 'light' }" |
| | | :style="{ |
| | | backgroundColor: |
| | | theme === 'light' ? '#ffffff' : '#000000', |
| | | }" |
| | | style="border: none" |
| | | > |
| | | {{ sessionDetail.content }} |
| | | </div> |
| | | </a-card> |
| | |
| | | <template #avatar> |
| | | <img |
| | | class="icon-user-jpg" |
| | | src="../../assets/images/icon-chart.png" |
| | | src="../../assets/images/icon-picture.png" |
| | | alt="本地图片" |
| | | /> |
| | | </template> |
| | |
| | | </div> |
| | | </template> |
| | | <script setup lang="ts"> |
| | | import { useAppStore, userModelState, useUserStore } from "@/store"; |
| | | import { useAppStore, userModelState, useUserStore } from '@/store'; |
| | | import { |
| | | computed, |
| | | nextTick, |
| | |
| | | sessionListApi, |
| | | uploadWithoutKb, |
| | | } from '@/api/session'; |
| | | import { getAuthorization } from "@/utils/auth"; |
| | | import { queryCanvasList } from "@/api/Agent"; |
| | | import { getAgentSessionDetailsApi } from "@/api/agentSession"; |
| | | import useClipboard from "vue-clipboard3"; |
| | | import pdfImg1 from "@/assets/session/PDF.png"; |
| | | import pdfImg2 from "@/assets/session/wps-write.png"; |
| | | import pdfImg3 from "@/assets/session/execl.png"; |
| | | import pdfImg4 from "@/assets/session/icon-txt.png"; |
| | | import pdfImg5 from "@/assets/session/txt.png"; |
| | | import tipImage from "@/assets/session/tip.png"; |
| | | import { getAuthorization } from '@/utils/auth'; |
| | | import { queryCanvasList } from '@/api/Agent'; |
| | | import { getAgentSessionDetailsApi } from '@/api/agentSession'; |
| | | import useClipboard from 'vue-clipboard3'; |
| | | import pdfImg1 from '@/assets/session/PDF.png'; |
| | | import pdfImg2 from '@/assets/session/wps-write.png'; |
| | | import pdfImg3 from '@/assets/session/execl.png'; |
| | | import pdfImg4 from '@/assets/session/icon-txt.png'; |
| | | import pdfImg5 from '@/assets/session/txt.png'; |
| | | import tipImage from '@/assets/session/tip.png'; |
| | | |
| | | import docx from "@/views/dmx/knowledgeLib/components/docx.vue"; |
| | | import excel from "@/views/dmx/knowledgeLib/components/excel.vue"; |
| | | import txtPdf from "@/views/dmx/knowledgeLib/components/txtPdf.vue"; |
| | | import docx from '@/views/dmx/knowledgeLib/components/docx.vue'; |
| | | import excel from '@/views/dmx/knowledgeLib/components/excel.vue'; |
| | | import txtPdf from '@/views/dmx/knowledgeLib/components/txtPdf.vue'; |
| | | |
| | | // const url = ref('../../assets/session/PDF.png'); |
| | | |
| | |
| | | let documenttype = ref('docx'); |
| | | let previewSrc = ref(''); |
| | | |
| | | |
| | | const modelStore = userModelState(); |
| | | const httpUrl = modelStore.hrefUrl; |
| | | |
| | |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | }; |
| | | |
| | | const tipMatch = (session: any): any[] => { |
| | | //match session.content中的##[0-9]$$的索引 |
| | |
| | | preTip = i; |
| | | }); |
| | | return indexs; |
| | | } |
| | | }; |
| | | |
| | | const getTxt = (data, role, message, index) => { |
| | | if (isExistTip(message)) { |
| | |
| | | }; |
| | | |
| | | const getTipContent = (data, index): string => { |
| | | let maxSimilarityContent = ""; |
| | | let maxSimilarityContent = ''; |
| | | let i = index / 2 - 1 > 0 ? index / 2 - 1 : 0; |
| | | let maxSimilarity = 0; |
| | | data[i].chunks.forEach((chunk) => { |
| | |
| | | maxSimilarity = chunk.similarity; |
| | | maxSimilarityContent = chunk.content_with_weight; |
| | | } |
| | | } |
| | | ); |
| | | }); |
| | | return maxSimilarityContent; |
| | | }; |
| | | |
| | |
| | | |
| | | const selectFileCallback = (data) => { |
| | | console.log(data, 'selectFileCallback'); |
| | | uploaditemList.value = [ |
| | | ...uploaditemList.value, |
| | | ...data |
| | | ]; |
| | | uploaditemList.value = [...uploaditemList.value, ...data]; |
| | | }; |
| | | |
| | | let onFileSelectedLoading = ref(false); |
| | |
| | | if (res.code == 200) { |
| | | // console.log(res.data.conversation_id); |
| | | activeSessionId.value = res.data?.conversation_id; |
| | | const { code, data } = await getSessionDetailsApi(res.data?.conversation_id); |
| | | const { code, data } = await getSessionDetailsApi( |
| | | res.data?.conversation_id |
| | | ); |
| | | if (code === 200) { |
| | | console.log(data, '新建会话详情'); |
| | | Object.assign(chatObj, data); |