From 08b529136889c9a40b12674ebdd06cb34ede84da Mon Sep 17 00:00:00 2001 From: liudong <liudong> Date: 星期一, 19 八月 2024 17:44:59 +0800 Subject: [PATCH] agent会话名称修改 --- src/views/sessionManager/index.vue | 105 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 98 insertions(+), 7 deletions(-) diff --git a/src/views/sessionManager/index.vue b/src/views/sessionManager/index.vue index 3c71541..e7a30f1 100644 --- a/src/views/sessionManager/index.vue +++ b/src/views/sessionManager/index.vue @@ -20,7 +20,32 @@ <div class="header___lEPyH"> <div class="chatHeader"> <div class="chatHeaderBox"> - <span class="title">{{ agentTitle }}</span> +<!-- <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> @@ -175,7 +200,7 @@ <!-- </template>--> <!-- </a-upload>--> <!-- </div>--> - <spa style="position: absolute;top:96px;left: 10px;z-index: 10000;cursor: pointer"> + <span style="position: absolute;top:94px;left: 20px;z-index: 999;cursor: pointer"> <icon-attachment size="28" @click="selectFile" style="color: #0960bd;" /> <input ref="fileInput" @@ -183,7 +208,7 @@ style="display: none;" @change="onFileSelected" /> - </spa> + </span> <div class="uploadFileList"> <div class="files" v-for="(item,index) in uploaditemList" :key="index" style="position: relative;width: 200px;margin-top: 10px;"> @@ -193,7 +218,12 @@ style="background: var(--color-bg-2);padding:10px;border-radius: 10px" > <template #avatar> - <a-button type="text" :loading="onFileSelectedLoading" v-if="onFileSelectedLoading"></a-button> + <a-spin :loading="onFileSelectedLoading" v-if="onFileSelectedLoading"> + <template #icon> + <icon-sync /> + </template> + </a-spin> +<!-- <a-button type="text" :loading="onFileSelectedLoading" v-if="onFileSelectedLoading"></a-button>--> <a-avatar v-if="!onFileSelectedLoading"> <icon-file style="color: #0960bd" /> </a-avatar> @@ -230,6 +260,19 @@ </div> </a-col> </a-row> + <a-modal v-model:visible="visible" title="淇敼鍚嶇О" @before-open="handleOpened" @cancel="handleCancel" :footer="false" title-align="start"> + <a-form ref="formRef" :rules="rules" :model="chatObj" @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> <script setup lang="ts"> @@ -258,6 +301,7 @@ import agentSession from "@/views/sessionManager/components/agentSession.vue"; import historySession from "@/views/sessionManager/components/historySession.vue"; import smartAi from "@/views/sessionManager/components/smartAi.vue"; +import setName from "@/views/sessionManager/components/setName.vue"; import EventBus from "@/utils/EventBus"; import { addSessionApi, @@ -300,6 +344,48 @@ const files = ref([]); const file = ref(''); const fileInput = ref(null); + +const visible = ref(false); + + + +const rules = { + name: [ + { + required: true, + message:'鍚嶇О涓嶅厑璁镐负绌�', + }, + ], +} + +const handleSubmit = async({values, errors}) => { + if(errors) return; + chatObj.name = agentTitle.value; + const { code, data } = await addSessionApi(chatObj); + if (data) { + Message.success("淇敼鎴愬姛"); + handleCancel() + queryNewSessionDetail(activeSessionId.value); + } +} + +const handleClick = () => { + visible.value = true; +}; +const handleCancel = () => { + visible.value = false; +} + +const handleOpened =(el) => { + // Object.assign(form,{ + // name: '',// 鐢ㄦ埛鍚� + // }); + // formRef.value.resetFields(); +} + + + + const selectFile = () => { fileInput.value.click(); @@ -569,6 +655,8 @@ // Message.success("宸插仠姝�"); // queryNewSessionDetail(activeSessionId.value); // } + loading.value = false; + chatDis.value = false; isStopChat.value = true; console.log("stopChat"); console.log(displayedText.value, "displayedText"); @@ -596,9 +684,12 @@ // displayedText.value = ""; // queryNewSessionDetail(activeSessionId.value); // } - - }; + + + + + const queryNewSessionDetail = async (id) => { activeSessionId.value = id; @@ -888,7 +979,7 @@ .btn-send { position: absolute !important; - right: 10px; + right: 4px; top: 90px; z-index: 10; } -- Gitblit v1.8.0