From a0d37a5078faea38bd7c46953f228cfb99a600c2 Mon Sep 17 00:00:00 2001
From: liudong <liudong>
Date: 星期二, 20 八月 2024 19:27:36 +0800
Subject: [PATCH] agent 聊天记录
---
src/views/sessionManager/components/agentSession.vue | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 107 insertions(+), 10 deletions(-)
diff --git a/src/views/sessionManager/components/agentSession.vue b/src/views/sessionManager/components/agentSession.vue
index 53748c6..7dcc9a6 100644
--- a/src/views/sessionManager/components/agentSession.vue
+++ b/src/views/sessionManager/components/agentSession.vue
@@ -4,6 +4,29 @@
<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>-->
</div>
</div>
</div>
@@ -85,14 +108,14 @@
>
</a-textarea>
</template>
- <template #actions>
- <div class="action"
- @click="stopChat"
- style="background: var(--color-bg-2);color: var(--color-primary-light-4);" v-if="displayedText != ''">
- <icon-record-stop />
- 鍋滄鐢熸垚
- </div>
- </template>
+<!-- <template #actions>-->
+<!-- <div class="action"-->
+<!-- @click="stopChat"-->
+<!-- style="background: var(--color-bg-2);color: var(--color-primary-light-4);" v-if="displayedText != ''">-->
+<!-- <icon-record-stop />-->
+<!-- 鍋滄鐢熸垚-->
+<!-- </div>-->
+<!-- </template>-->
</a-comment>
</div>
<!-- <div class="chartStart" v-if="isStart" @click="startChat"
@@ -132,6 +155,19 @@
>
</div>
</div>
+ <a-modal v-model:visible="visible" title="淇敼鍚嶇О" @before-open="handleOpened" @cancel="handleCancel" :footer="false" title-align="start">
+ <a-form ref="formRef" :rules="rules" :model="agentObj" @submit="handleSubmit" >
+ <a-form-item field="name" label="鍚嶇О">
+ <a-input v-model="agentTitle" placeholder="璇疯緭鍏ュ悕绉�"/>
+ </a-form-item>
+ <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>
+ </div>
+ </a-form-item>
+ </a-form>
+ </a-modal>
</div>
</template>
@@ -144,6 +180,7 @@
import { agentResetApi, agentSetApi, getAgentSessionDetailsApi } from "@/api/agentSession";
import EventBus from '@/utils/EventBus';
import useClipboard from "vue-clipboard3";
+import { addSessionApi, getSessionDetailsApi } from "@/api/session";
const props = defineProps({
modalObj: Object,
});
@@ -177,6 +214,52 @@
return appStore.theme;
});
+const visible = ref(false);
+
+
+
+const rules = {
+ name: [
+ {
+ required: true,
+ message:'鍚嶇О涓嶅厑璁镐负绌�',
+ },
+ ],
+}
+
+const handleSubmit = async({values, errors}) => {
+ if(errors) return;
+ // 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);
+ // }
+}
+
+const handleClick = () => {
+ visible.value = true;
+};
+const handleCancel = () => {
+ visible.value = false;
+}
+
+const handleOpened =(el) => {
+ // Object.assign(form,{
+ // name: '',// 鐢ㄦ埛鍚�
+ // });
+ // formRef.value.resetFields();
+}
// 鍒濆鍖栭〉闈�
@@ -274,6 +357,17 @@
console.log(data,'浼氳瘽璇︽儏');
sessionDetailList.value = data.dsl.messages;
agentTitle.value = `鍜�${data.title}鐨勪細璇漙 || '鏈懡鍚嶄細璇�';
+ refreshScroll(); //鍒锋柊婊氬姩鏉′綅缃�
+ }
+};
+
+
+const querySessionDetail = async (session) => {
+ sectionList.value = session;
+ activeSessionId.value = session.id;
+ const { code, data } = await getSessionDetailsApi(session.id);
+ if (code === 200) {
+ sessionDetailList.value = data.message;
refreshScroll(); //鍒锋柊婊氬姩鏉′綅缃�
}
};
@@ -392,6 +486,8 @@
// Message.success("宸插仠姝�");
// queryNewSessionDetail(activeSessionId.value);
// }
+ loading.value = false;
+ chatDis.value = false;
isStopChat.value = true;
console.log('stopChat');
console.log(displayedText.value, 'displayedText');
@@ -463,7 +559,8 @@
});
EventBus.on('queryAgentSessionDetail', (data) => {
Object.assign(agentObj, data);
- queryAgentSessionDetail(data.id);
+ // queryAgentSessionDetail(data.id);
+ querySessionDetail(data);
});
});
onBeforeUnmount(() => {
@@ -591,7 +688,7 @@
.btn-send {
position: absolute !important;
- right: 10px;
+ right: 4px;
top: 80px;
z-index: 10;
}
--
Gitblit v1.8.0