Răsfoiți Sursa

perf: 优化对话板块的样式

zhupei@smartai.com 1 an în urmă
părinte
comite
2e194ee22a

+ 1 - 1
public/i18n/lang-en.json

@@ -196,7 +196,7 @@
     "history_empty": "Empty",
 
     "hello": "Welcome",
-    "nice_day": "Let's spend a wonderful day together",
+    "nice_day": "Let's spend a wonderful day together!",
 
     "attention": "The content is generated by an AI big model, please carefully identify it",
 

+ 1 - 1
public/i18n/lang-zh.json

@@ -197,7 +197,7 @@
     "history_nomore": "没有更多了",
     "history_empty": "暂无数据",
     "hello": "你好",
-    "nice_day": "让我们一起度过美好的一天",
+    "nice_day": "让我们一起度过美好的一天",
 
     "attention": "内容由 AI 大模型生成,请仔细甄别",
 

+ 10 - 4
src/modules/conversation-board/BoardAgentItem.vue

@@ -52,6 +52,7 @@ const handleClick = () => {
   height: 78px;
 
   display: flex;
+  align-items: center;
 
   color: var(--color-text-1);
 }
@@ -62,7 +63,8 @@ const handleClick = () => {
   background-color: #ccc;
   border-radius: 18px;
 
-  margin-right: 5px;
+  margin-right: 10px;
+  margin-left: 10px;
 
   flex-shrink: 0;
 
@@ -76,10 +78,12 @@ const handleClick = () => {
 .agent-item-intro {
   cursor: pointer;
   overflow: hidden;
+
+  margin-right: 10px;
 }
 
 .agent-item-intro-title {
-  font-size: 18px;
+  font-size: 16px;
   font-weight: bold;
 
   margin-bottom: 8px;
@@ -94,8 +98,10 @@ const handleClick = () => {
 .agent-item-intro-desc {
   display: -webkit-box;
   -webkit-box-orient: vertical;
-  -webkit-line-clamp: 3; /* 这里设置显示的行数 */
-  line-clamp: 3;
+  -webkit-line-clamp: 2; /* 这里设置显示的行数 */
+  line-clamp: 2;
   overflow: hidden;
+
+  font-size: 13px;
 }
 </style>

+ 1 - 1
src/modules/conversation-board/BoardTags.vue

@@ -46,7 +46,7 @@ onMounted(() => {
 .conversation-board-tags {
   display: flex;
   justify-content: center;
-  margin-top: 20px;
+  margin-top: 40px;
   margin-bottom: 20px;
 }
 

+ 7 - 96
src/modules/conversation-dialog/api-dialog.js

@@ -2,42 +2,6 @@ import ajax from '../../base/ajax';
 
 import { kuky_Authorization } from '../../base/storage';
 
-/**
- * 获取会话历史记录,来自于小数系统
- * http://192.168.20.119:9301/api/agent/90d533729c0211efbf6b0242ac160006/sessions
- */
-
-/**
- * 获取某个对话的记录 http://192.168.20.119:9301/api/agent/42e4fcdc9bea11efac300242ac160006/c0f286901bcb48b3a1fb04c5d6f1871b/session_log
- */
-
-/**
- * 新建会话
- * http://192.168.20.119:9301/api/agent/get-chat-id/42e4fcdc9bea11efac300242ac160006
- */
-
-// /**
-//  * 上传文档
-//  * @param {string} id - agentId
-//  * @param {files} files - files
-//  * @returns {Promise<Object>}
-//  */
-// const uploadFiles = (id, file) => {
-//   return ajax.post(`/api/files/upload/${id}`, file, {
-//     headers: {
-//       'Content-Type': 'multipart/form-data'
-//     }
-//   });
-// };
-
-// const uploadExcels = (file) => {
-//   return ajax.post('/api/document/excel/upload', file, {
-//     headers: {
-//       'Content-Type': 'multipart/form-data'
-//     }
-//   });
-// };
-
 /**
  * 上传文件
  * @param {string} agent_id
@@ -184,13 +148,13 @@ export const getDialogChatId = (agent_id) => {
   return ajax.get(`/api/agent/get-chat-id/${agent_id}`);
 };
 
-/**
- * 获取某个agent的所有对话记录
- * @returns {Promise<Object>}
- */
-const getDialogs = (agent_id) => {
-  return ajax.get(`/api/agent/${agent_id}/sessions`);
-};
+// /**
+//  * 获取某个agent的所有对话记录
+//  * @returns {Promise<Object>}
+//  */
+// const getDialogs = (agent_id) => {
+//   return ajax.get(`/api/agent/${agent_id}/sessions`);
+// };
 
 /**
  * 获取某个对话的对话记录
@@ -199,56 +163,3 @@ const getDialogs = (agent_id) => {
 export const getHistoryLogs = (agent_id, conversation_id) => {
   return ajax.get(`/api/agent/${agent_id}/${conversation_id}/session_log`);
 };
-
-// 对话过程:
-
-// ws://localhost/api/chat/ws/42e4fcdc9bea11efac300242ac160006/44f835504943467f9a9cde261299a06f?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyIiwidXNlcl9pZCI6MjEsImV4cCI6MTczNDAxMTU4NH0.tLVyD5ds3BqJ8UCZ1pnaUVBhqZ0leqXNUQhG5U2A2u0
-
-// const create = (token, agentId, dialogId, type) => {
-//   // const wsParam = type === 'report' ? 'report' : 'chat';
-//   // const wsUrl =
-//   //   type === 'excel'
-//   //     ? `ws://${location.host}/api/document/ws/excel`
-//   //     : `ws://${location.host}/api/${wsParam}/ws/${agentId}/${dialogId}?token=${token}`;
-
-//   const wsUrl = getWSUrl(type, agentId, dialogId);
-
-//   const ws = new WebSocket(wsUrl);
-//   // 当 WebSocket 打开时...
-//   ws.onopen = function (event) {
-//     console.log('WebSocket 连接已打开');
-//   };
-
-//   // 当 WebSocket 关闭时...
-//   ws.onclose = function (event) {
-//     console.log(event.code);
-//   };
-
-//   // 当有错误发生时...
-//   ws.onerror = function (error) {
-//     console.error('WebSocket 出错: ', error);
-//   };
-//   return ws;
-// };
-
-// /**
-//  * 获取websocket连接的地址
-//  * @param {string} type - 对话类型,可选值:report/excel/chat
-//  * @param {string} agent_id - 对话使用的agent ID
-//  * @param {string} dialog_id - 对话记录的ID
-//  * @returns
-//  */
-// function getWSUrl(type, agent_id, dialog_id) {
-//   const host = location.host;
-//   const token = kuky_Authorization.get();
-
-//   if (type === 'report') {
-//     return `ws://${host}/api/${type}/ws/${agent_id}/${dialog_id}?token=${token}`;
-//   } else if (type === 'chat') {
-//     return `ws://${host}/api/${type}/ws/${agent_id}/${dialog_id}?token=${token}`;
-//   } else if (type === 'excel') {
-//     return `ws://${host}/api/document/ws/excel`;
-//   } else {
-//     return `ws://${host}/api/chat/ws/${agent_id}/${dialog_id}?token=${token}`;
-//   }
-// }

+ 6 - 6
src/modules/conversation-history/HistoryItem.vue

@@ -160,8 +160,8 @@ const handleDeleteSuccess = () => {
 }
 .conversation-history-section-data {
   background-color: var(--color-bg-1);
-  padding: 20px 30px 20px 30px;
-  border-radius: 20px;
+  padding: 20px 20px 20px 20px;
+  border-radius: 15px;
   margin-top: 10px;
   margin-bottom: 10px;
 
@@ -169,8 +169,8 @@ const handleDeleteSuccess = () => {
 }
 
 .history-item-icon {
-  width: 36px;
-  height: 36px;
+  width: 26px;
+  height: 26px;
   /* background-color: #ccc; */
   border-radius: 18px;
 
@@ -190,8 +190,8 @@ const handleDeleteSuccess = () => {
 }
 
 .history-item-intro-title {
-  font-size: 18px;
-  font-weight: bold;
+  /* font-size: 16px; */
+  /* font-weight: bold; */
 
   cursor: pointer;
 

+ 3 - 1
src/modules/conversation-history/HistoryLoadMore.vue

@@ -41,7 +41,7 @@ const handleClick = () => {
 .history-item-icon {
   background-color: var(--color-bg-1);
   padding: 20px 30px 20px 30px;
-  border-radius: 20px;
+  border-radius: 15px;
   margin-top: 10px;
   margin-bottom: 10px;
 
@@ -50,6 +50,8 @@ const handleClick = () => {
   display: flex;
   justify-content: center;
   align-items: center;
+
+  font-size: 13px;
 }
 
 .history-item-icon.can-loadmore {

+ 4 - 4
src/modules/conversation-history/HistorySearchInput.vue

@@ -78,15 +78,15 @@ const handleInputClear = () => {
 .conversation-search-input {
   text-align: center;
 
-  font-size: 32px;
+  font-size: 26px;
   font-weight: bold;
 
   color: var(--color-text-1);
   background-color: var(--color-bg-1);
 
-  padding: 20px 30px 20px 30px;
+  padding: 20px 20px 20px 20px;
 
-  border-radius: 20px;
+  border-radius: 15px;
 }
 
 .search-input-content {
@@ -119,7 +119,7 @@ const handleInputClear = () => {
   flex-grow: 1;
   outline: none;
   border: none;
-  font-size: 20px;
+  font-size: 16px;
 
   caret-color: var(--color-text-1);
   background-color: var(--color-bg-1);

+ 1 - 1
src/modules/conversation-history/HistoryTypeDropdown.vue

@@ -90,7 +90,7 @@ onMounted(() => {
 
 <style lang="css" scoped>
 .history-type-btn {
-  font-size: 18px;
+  font-size: 16px;
 
   max-width: 100px;
   display: -webkit-box;

+ 7 - 7
src/utils/generate-client-unique-id.js

@@ -2,12 +2,12 @@ import md5 from 'md5';
 
 /**
  * 根据一个字符串,生成一个客户端的ID
- * @param {string} string 
+ * @param {string} string
  */
 export default function generateClientUniqueId(string) {
-    if (!string) {
-        return Date.now() + ''; // 返回当前时间戳
-    } else {
-        return md5(string);
-    }
-}
+  if (!string) {
+    return Date.now() + ''; // 返回当前时间戳
+  } else {
+    return md5(string);
+  }
+}