| | |
| | | <div class="header___lEPyH"> |
| | | <div class="chatHeader"> |
| | | <div class="chatHeaderBox"> |
| | | <span class="title">{{agentTitle}}</span> |
| | | <!-- <a-popover--> |
| | | <!-- position="bottom"--> |
| | | <!-- trigger="click"--> |
| | | <!-- >--> |
| | | <!-- <a-button border--> |
| | | <!-- >{{agentTitle}}--> |
| | | <!-- <icon-down style="margin-left: 4px" />--> |
| | | <!-- </a-button>--> |
| | | <!-- <template #content>--> |
| | | <!-- <a-button--> |
| | | <!-- type="text"--> |
| | | <!-- class="button"--> |
| | | <!-- style="color: #2a2a2b"--> |
| | | <!-- @click="handleClick()"--> |
| | | <!-- >--> |
| | | <!-- <template #icon>--> |
| | | <!-- <icon-edit />--> |
| | | <!-- </template>--> |
| | | <!-- 修改名称--> |
| | | <!-- </a-button>--> |
| | | <!-- <!– <a-divider style="margin: 10px 0" />–>--> |
| | | <!-- </template>--> |
| | | <!-- </a-popover>--> |
| | | <!-- <span class="title">{{agentTitle}}</span>--> |
| | | <a-popover |
| | | position="bottom" |
| | | trigger="click" |
| | | > |
| | | <a-button border |
| | | >{{agentTitle}} |
| | | <icon-down style="margin-left: 4px" /> |
| | | </a-button> |
| | | <template #content> |
| | | <a-button |
| | | type="text" |
| | | class="button" |
| | | style="color: #2a2a2b" |
| | | @click="handleClick()" |
| | | > |
| | | <template #icon> |
| | | <icon-edit /> |
| | | </template> |
| | | 修改名称 |
| | | </a-button> |
| | | <!-- <a-divider style="margin: 10px 0" />--> |
| | | </template> |
| | | </a-popover> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | maxRows: 5, |
| | | }" |
| | | /> |
| | | <div style="height: 40px"></div> |
| | | <div class="btn-send"> |
| | | <!-- <icon-send size="32" /> --> |
| | | <a-button |
| | |
| | | import { agentResetApi, agentSetApi, getAgentSessionDetailsApi } from "@/api/agentSession"; |
| | | import EventBus from '@/utils/EventBus'; |
| | | import useClipboard from "vue-clipboard3"; |
| | | import { addSessionApi } from "@/api/session"; |
| | | import { addSessionApi, getSessionDetailsApi } from "@/api/session"; |
| | | const props = defineProps({ |
| | | modalObj: Object, |
| | | }); |
| | |
| | | }); |
| | | |
| | | const visible = ref(false); |
| | | let isHistory = ref(false);//是否是历史记录 |
| | | let dsl = reactive({}); |
| | | |
| | | |
| | | |
| | |
| | | // agentObj.name = agentTitle.value; |
| | | // agentObj.conversation_id = agentObj.id; |
| | | console.log(agentObj, 'agentObj'); |
| | | |
| | | |
| | | // let chatData = { |
| | | // id:agentObj.id, |
| | | // conversation_id:agentObj.id, |
| | | // name: agentTitle.value |
| | | // } |
| | | // const { code, data } = await addSessionApi(chatData); |
| | | // if (data) { |
| | | // Message.success("修改成功"); |
| | | // handleCancel() |
| | | // queryAgentSessionDetail(agentObj.id); |
| | | // } |
| | | let chatData = { |
| | | id:activeSessionId.value, |
| | | conversation_id:activeSessionId.value, |
| | | name: agentTitle.value |
| | | } |
| | | const { code, data } = await addSessionApi(chatData); |
| | | if (data) { |
| | | Message.success("修改成功"); |
| | | handleCancel() |
| | | // queryAgentSessionDetail(agentObj.id); |
| | | } |
| | | } |
| | | |
| | | const handleClick = () => { |
| | |
| | | |
| | | const createNewAgent = async (session) => { |
| | | Object.assign(agentObj, session); |
| | | isHistory.value = false; |
| | | initPage(); |
| | | |
| | | |
| | |
| | | } |
| | | }; |
| | | |
| | | // 获取agent会话详情 |
| | | const querySessionDetail = async (session) => { |
| | | Object.assign(agentObj, session); |
| | | agentObj.id = session.dialog_id; |
| | | activeSessionId.value = session.id; |
| | | agentTitle.value = session.name; |
| | | console.log(agentTitle.value, '会话名称'); |
| | | const { code, data } = await getSessionDetailsApi(session.id); |
| | | if (code == 200) { |
| | | sessionDetailList.value = data.message.messages; |
| | | const res = await getAgentSessionDetailsApi(session.dialog_id); |
| | | if (res.code == 0) { |
| | | console.log(res.data,'会话详情'); |
| | | Object.assign(dsl, res.data.dsl); |
| | | refreshScroll(); //刷新滚动条位置 |
| | | } |
| | | } |
| | | }; |
| | | |
| | | |
| | | const { toClipboard } = useClipboard(); |
| | | const copy = async (text) => { |
| | |
| | | |
| | | |
| | | const startChat = async(valMsg)=>{ |
| | | |
| | | sessionDetailList.value.push({ |
| | | content: valMsg, |
| | | role: 'user', |
| | | }); |
| | | sessionDetailList.value.push({ role: 'last' }); |
| | | refreshScroll(); |
| | | let chatStr = { |
| | | id: agentObj.id, |
| | | message: valMsg, |
| | | } |
| | | if(isHistory.value){ |
| | | chatStr.dsl = dsl; |
| | | } |
| | | const response = await fetch( |
| | | '/api/v1/canvas/completion', |
| | | { |
| | |
| | | 'Authorization': getAuthorization(), |
| | | 'Content-Type': 'application/json', |
| | | }, |
| | | body: JSON.stringify({ |
| | | id: agentObj.id, |
| | | message: valMsg, |
| | | }), |
| | | body: JSON.stringify(chatStr), |
| | | } |
| | | ); |
| | | |
| | |
| | | createNewAgent(data); |
| | | }); |
| | | EventBus.on('queryAgentSessionDetail', (data) => { |
| | | Object.assign(agentObj, data); |
| | | queryAgentSessionDetail(data.id); |
| | | isHistory.value = true; |
| | | querySessionDetail(data); |
| | | }); |
| | | }); |
| | | onBeforeUnmount(() => { |