From 7d1e44c728a8e436fede1ceb8a62b5c4fb848b09 Mon Sep 17 00:00:00 2001
From: liudong <liudong>
Date: 星期一, 19 八月 2024 17:32:43 +0800
Subject: [PATCH] agent会话名称修改

---
 src/views/sessionManager/components/agentSession.vue |   76 +++++++++++++++++++++++++++++++++++++
 1 files changed, 75 insertions(+), 1 deletions(-)

diff --git a/src/views/sessionManager/components/agentSession.vue b/src/views/sessionManager/components/agentSession.vue
index 53748c6..093bc27 100644
--- a/src/views/sessionManager/components/agentSession.vue
+++ b/src/views/sessionManager/components/agentSession.vue
@@ -3,7 +3,30 @@
   <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>
@@ -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 } from "@/api/session";
 const props = defineProps({
   modalObj: Object,
 });
@@ -177,6 +214,43 @@
   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;
+  const { code, data } = await addSessionApi(agentObj);
+  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();
+}
 
 
 // 鍒濆鍖栭〉闈�

--
Gitblit v1.8.0