From 38e9abbd9e89ccf14389e90fa94b4b8ea36fa60d Mon Sep 17 00:00:00 2001
From: liudong <liudong>
Date: 星期五, 23 八月 2024 14:28:42 +0800
Subject: [PATCH] 修改登录页面提示信息
---
src/views/sessionManager/index.vue | 112 ++++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 80 insertions(+), 32 deletions(-)
diff --git a/src/views/sessionManager/index.vue b/src/views/sessionManager/index.vue
index 09650bd..1ac24f2 100644
--- a/src/views/sessionManager/index.vue
+++ b/src/views/sessionManager/index.vue
@@ -24,7 +24,13 @@
<a-popover position="bottom" trigger="click">
<a-button border
- >{{ agentTitle }}
+ >
+ <span style="
+ width: 100px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ ">{{ from.name }}</span>
<icon-down style="margin-left: 4px" />
</a-button>
<template #content>
@@ -227,8 +233,27 @@
maxRows: 5,
}"
/>
-
- <div class="btn-send">
+ <div style="width: 100%;display: flex;justify-content: space-between">
+ <a-button
+ :disabled="onFileSelectedLoading"
+ @click="selectFile"
+ type="text"
+ style="border-radius: 24px"
+ >
+ <icon-attachment
+ size="28"
+ style="color: #0960bd"
+ />
+ <input
+ ref="fileInput"
+ type="file"
+ style="display: none"
+ @change="onFileSelected"
+ />
+ </a-button>
+ <span
+ style="cursor: pointer;margin-left: 20px;">
+ </span>
<a-button
:disabled="chatDis"
@click="sentClick"
@@ -239,6 +264,17 @@
<icon-send size="32" style="color: #0960bd" />
</a-button>
</div>
+<!-- <div class="btn-send">-->
+<!-- <a-button-->
+<!-- :disabled="chatDis"-->
+<!-- @click="sentClick"-->
+<!-- type="text"-->
+<!-- style="border-radius: 24px"-->
+<!-- :loading="loading"-->
+<!-- >-->
+<!-- <icon-send size="32" style="color: #0960bd" />-->
+<!-- </a-button>-->
+<!-- </div>-->
</div>
<!-- <div style="margin-top: 0px">-->
<!-- <a-upload-->
@@ -253,27 +289,27 @@
<!-- </template>-->
<!-- </a-upload>-->
<!-- </div>-->
- <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"
- type="file"
- style="display: none"
- @change="onFileSelected"
- />
- </span>
+<!-- <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"-->
+<!-- type="file"-->
+<!-- style="display: none"-->
+<!-- @change="onFileSelected"-->
+<!-- />-->
+<!-- </span>-->
<div class="uploadFileList">
<div
class="files"
@@ -283,11 +319,12 @@
>
<a-comment
:author="item.name"
- :content="item.size + ''"
+ :content="(item.size/1024).toFixed(2) + 'K'"
style="
background: var(--color-bg-2);
padding: 10px;
border-radius: 10px;
+ font-size: 12px;
"
>
<template #avatar>
@@ -355,11 +392,11 @@
<a-form
ref="formRef"
:rules="rules"
- :model="chatObj"
+ :model="from"
@submit="handleSubmit"
>
<a-form-item field="name" label="鍚嶇О">
- <a-input v-model="agentTitle" placeholder="璇疯緭鍏ュ悕绉�" />
+ <a-input v-model="from.name" placeholder="璇疯緭鍏ュ悕绉�" />
</a-form-item>
<a-form-item>
<div style="width: 100%; text-align: right">
@@ -434,6 +471,9 @@
const agentType = ref('1');
const agentTitle = ref('鏈懡鍚嶄細璇�');
let chatObj = reactive({});
+ let from = reactive({
+ name:'鏈懡鍚嶄細璇�',
+ });
const isStopChat = ref(false);
const currIndex = ref(0);
const displayedText = ref(''); // 姝e湪鏄剧ず鐨勬枃瀛�
@@ -456,6 +496,7 @@
const fileInput = ref(null);
const chatDataMeg = reactive({});
const visible = ref(false);
+ let toStop = false;
const rules = {
name: [
@@ -468,12 +509,10 @@
const handleSubmit = async ({ values, errors }) => {
if (errors) return;
- // chatObj.name = agentTitle.value;
- // chatObj.conversation_id = chatObj.id;
let chatData = {
id: chatObj.id,
conversation_id: chatObj.id,
- name: agentTitle.value,
+ name: from.name,
};
const { code, data } = await addSessionApi(chatData);
if (data) {
@@ -500,8 +539,8 @@
};
const clickHref = (item) => {
- return Message.warning('鏆傛棤娉曟煡鐪�');
- window.open(`/api/v1/document/get/${item.doc_id}`, '_blank');
+ // return Message.warning('鏆傛棤娉曟煡鐪�');
+ window.open(`/api/v1/document/show/${item.doc_id}`, '_blank');
};
const getIconByExtension = computed(() => (extension) => {
@@ -740,6 +779,7 @@
const startChat = async (valMsg) => {
chatDis.value = true;
loading.value = true;
+ toStop = false;
sessionDetailList.value.push({
content: valMsg,
role: 'user',
@@ -767,6 +807,11 @@
.getReader();
currIndex.value = 0;
while (true) {
+ if (toStop) {
+ displayedText.value = '';
+ setChatDataMeg(chatDataMeg);
+ break;
+ }
const x = await reader?.read();
if (x) {
const { done, value } = x;
@@ -809,6 +854,7 @@
loading.value = false;
chatDis.value = false;
isStopChat.value = true;
+ toStop = true;
console.log('stopChat');
console.log(displayedText.value, 'displayedText');
console.log(sessionDetailList.value, 'sessionDetailList');
@@ -859,6 +905,7 @@
sessionDetailList.value = data.message;
messagenList.value = data;
agentTitle.value = data.name;
+ from.name = data.name;
refreshScroll(); //鍒锋柊婊氬姩鏉′綅缃�
isStopChat.value = false;
}
@@ -872,6 +919,7 @@
const querySessionDetail = async (session) => {
sectionList.value = session;
activeSessionId.value = session.id;
+ from.name = session.name;
const { code, data } = await getSessionDetailsApi(session.id);
if (code === 200) {
sessionDetailList.value = data.message;
--
Gitblit v1.8.0