|
@@ -15,6 +15,7 @@ import {
|
|
|
RiVipDiamondFill,
|
|
|
RiDeleteBinLine,
|
|
|
RiCloseFill,
|
|
|
+ RiArrowDropRightLine,
|
|
|
} from "react-icons/ri";
|
|
|
import {
|
|
|
getChatSession,
|
|
@@ -60,6 +61,7 @@ export default function Dialogue() {
|
|
|
[]
|
|
|
);
|
|
|
const [showVip, setShowVip] = useState(false);
|
|
|
+ const [showLeftBox, setShowLeftBox] = useState(false);
|
|
|
const [balance, setBalance] = useState<number>(0);
|
|
|
|
|
|
//历史记录和智能体列表 显示隐藏
|
|
@@ -103,6 +105,8 @@ export default function Dialogue() {
|
|
|
} else {
|
|
|
chatInit(id, Storage_getAgentId());
|
|
|
}
|
|
|
+
|
|
|
+ setShowLeftBox(false);
|
|
|
};
|
|
|
//助手列表 - 点击
|
|
|
const changeChatListForLocal = (id: number) => {
|
|
@@ -124,6 +128,7 @@ export default function Dialogue() {
|
|
|
}
|
|
|
loadChatSession(id, "");
|
|
|
}
|
|
|
+ setShowLeftBox(false);
|
|
|
};
|
|
|
//新对话
|
|
|
const newChat = () => {
|
|
@@ -147,6 +152,7 @@ export default function Dialogue() {
|
|
|
setTimeout(() => {
|
|
|
setShowComponent(true);
|
|
|
}, 200);
|
|
|
+ setShowLeftBox(false);
|
|
|
};
|
|
|
//设置新会话的ID
|
|
|
const setConversationId = (id: string) => {
|
|
@@ -262,11 +268,10 @@ export default function Dialogue() {
|
|
|
if (conversationId !== null && conversationId !== "") {
|
|
|
setConversationId(conversationId);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
loadChatSession(agentId, chatSessionLastId);
|
|
|
|
|
|
getBalance();
|
|
|
-
|
|
|
}, [loginShow, chatSessionLastId]);
|
|
|
|
|
|
//样式覆盖
|
|
@@ -370,24 +375,11 @@ export default function Dialogue() {
|
|
|
|
|
|
return (
|
|
|
<>
|
|
|
- <div
|
|
|
- className="flex justify-between items-center bg-[slate-200] dark:bg-[#000]"
|
|
|
- style={{ height: "100%" }}
|
|
|
- >
|
|
|
+ <div className="flex justify-between items-center bg-[slate-200] dark:bg-[#000] h-full">
|
|
|
{showLeftLetter && (
|
|
|
- <div
|
|
|
- className="bg-[#f8f9fa] dark:bg-[#202123] border-r-1 border-indigo-100 dark:border-blue-950"
|
|
|
- style={{
|
|
|
- height: "calc(100vh - 5rem)",
|
|
|
- width: "20rem",
|
|
|
- }}
|
|
|
- >
|
|
|
+ <div className="bg-[#f8f9fa] dark:bg-[#202123] border-r-1 border-indigo-100 dark:border-blue-950 w-80 h-calc-8 md:h-calc-5 hidden md:block">
|
|
|
<div
|
|
|
- className={`bg-[#f8f9fa] dark:bg-[#202123] border-r-1 border-indigo-100 dark:border-blue-950 overflow-auto scroll-smooth shrink-0`}
|
|
|
- style={{
|
|
|
- height: "calc(100vh - 10rem)",
|
|
|
- width: "20rem",
|
|
|
- }}
|
|
|
+ className={`bg-[#f8f9fa] dark:bg-[#202123] border-r-1 border-indigo-100 dark:border-blue-950 overflow-auto scroll-smooth shrink-0 w-80 h-calc-13 md:h-calc-10`}
|
|
|
>
|
|
|
<div className="sticky top-0 z-50 dark:shadow-[rgba(255,255,255,.15)] backdrop-blur dark:bg-transparent transition-all">
|
|
|
<div className="flex justify-between items-center pt-2 px-2">
|
|
@@ -550,13 +542,7 @@ export default function Dialogue() {
|
|
|
)}
|
|
|
</div>
|
|
|
|
|
|
- <div
|
|
|
- className="text-sm"
|
|
|
- style={{
|
|
|
- height: "5rem",
|
|
|
- width: "20rem",
|
|
|
- }}
|
|
|
- >
|
|
|
+ <div className="text-sm h-20 w-80">
|
|
|
<div className="px-3 py-3 border-t-2 border-blue-50 shadow-sm dark:border-blue-950 dark:text-[#bc900c]">
|
|
|
<p className="flex items-center">
|
|
|
<RiVipDiamondFill className="text-[#f4a629]" />
|
|
@@ -581,10 +567,7 @@ export default function Dialogue() {
|
|
|
}}
|
|
|
>
|
|
|
<div
|
|
|
- className={`bg-[#fcfdff] dark:bg-[#202123] grow`}
|
|
|
- style={{
|
|
|
- height: "calc(100vh - 5rem)",
|
|
|
- }}
|
|
|
+ className={`bg-[#fcfdff] dark:bg-[#202123] grow h-calc-8 md:h-calc-5`}
|
|
|
>
|
|
|
{showComponent && (
|
|
|
<ProChat
|
|
@@ -723,11 +706,7 @@ export default function Dialogue() {
|
|
|
|
|
|
{employeeSearch != null && (
|
|
|
<div
|
|
|
- className={`bg-[#ecf1f9] dark:bg-[#202123] border-l-1 border-indigo-100 dark:border-blue-950 overflow-auto scroll-smooth shrink-0`}
|
|
|
- style={{
|
|
|
- height: "calc(100vh - 5rem)",
|
|
|
- width: "25rem",
|
|
|
- }}
|
|
|
+ className={`bg-[#ecf1f9] dark:bg-[#202123] border-l-1 border-indigo-100 dark:border-blue-950 overflow-auto scroll-smooth shrink-0 h-calc-8 md:h-calc-5 w-96 hidden xl:block`}
|
|
|
>
|
|
|
<div className="">
|
|
|
<div className="h-96 w-11/12 mx-auto relative">
|
|
@@ -798,15 +777,222 @@ export default function Dialogue() {
|
|
|
)}
|
|
|
</div>
|
|
|
|
|
|
+ <div
|
|
|
+ className="absolute -left-5 top-1/2 transform -translate-y-1/2 rounded-full bg-[#ecf1f9] p-1 shadow-lg md:hidden block dark:bg-blue-950"
|
|
|
+ onClick={() => {
|
|
|
+ setShowLeftBox(true);
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <RiArrowDropRightLine className="text-3xl text-[#0061ff] ml-3" />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ {showLeftBox && (
|
|
|
+ <div className="pay-box">
|
|
|
+ <div className="pay-mask"></div>
|
|
|
+ <div className="pay-div md:p-7 bg-white dark:bg-gray-900 text-base rounded w-full md:container h-screen">
|
|
|
+ <div className="h-full overflow-y-auto">
|
|
|
+ <div className="bg-[#f8f9fa] dark:bg-[#202123] w-full">
|
|
|
+ <div
|
|
|
+ className={`bg-[#f8f9fa] dark:bg-[#202123] overflow-auto scroll-smooth shrink-0 w-full h-calc-5`}
|
|
|
+ >
|
|
|
+ <div className="sticky top-0 z-50 dark:shadow-[rgba(255,255,255,.15)] backdrop-blur dark:bg-transparent transition-all">
|
|
|
+ <div className="flex justify-between items-center pt-2 px-2">
|
|
|
+ <div>
|
|
|
+ <button
|
|
|
+ className="inline-flex py-1 px-1 rounded-lg items-center text-white global-bg-color"
|
|
|
+ onClick={newChat}
|
|
|
+ >
|
|
|
+ <RiAddCircleFill className="w-6 h-6" />
|
|
|
+ <span className="ml-1 pr-2 flex items-start flex-col leading-none">
|
|
|
+ <span className="title-font font-medium">
|
|
|
+ 新对话
|
|
|
+ </span>
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ className="cursor-pointer text-gray-400 hover:text-blue-600"
|
|
|
+ onClick={() => {
|
|
|
+ setShowLeftBox(false);
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <RiCloseFill className="absolute right-2.5 top-2.5 w-8 h-8 cursor-pointer transform duration-500 ease-in-out hover:scale-125 text-gray-500"></RiCloseFill>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div className="w-full mt-4">
|
|
|
+ <div className="flex mx-auto flex-wrap justify-center border-b-2 border-blue-50 shadow-sm dark:border-blue-950 pb-2">
|
|
|
+ <a
|
|
|
+ className={`cursor-pointer py-1 px-4 mx-4 rounded-lg ${
|
|
|
+ historyOrChatList === 0
|
|
|
+ ? "global-txt-color"
|
|
|
+ : "dark:text-gray-500"
|
|
|
+ }`}
|
|
|
+ onClick={() => {
|
|
|
+ setHistoryOrChatList(0);
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 对话历史
|
|
|
+ </a>
|
|
|
+ <a
|
|
|
+ className={`cursor-pointer py-1 px-4 mx-4 rounded-lg ${
|
|
|
+ historyOrChatList === 1
|
|
|
+ ? "global-txt-color"
|
|
|
+ : "dark:text-gray-500"
|
|
|
+ }`}
|
|
|
+ onClick={() => {
|
|
|
+ setHistoryOrChatList(1);
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 助手列表
|
|
|
+ </a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ {historyOrChatList === 0 &&
|
|
|
+ chatSessionList !== null &&
|
|
|
+ chatSessionList.length > 0 && (
|
|
|
+ <div className="py-4 px-2">
|
|
|
+ <div className="mx-auto flex flex-col">
|
|
|
+ {chatSessionList.map((item) => (
|
|
|
+ <div
|
|
|
+ className="w-full mt-3 cursor-pointer"
|
|
|
+ key={item.id}
|
|
|
+ onClick={() => changeChatSession(item.id)}
|
|
|
+ >
|
|
|
+ <div
|
|
|
+ className={`flex rounded border ${
|
|
|
+ Storage_getConversationId() == item.id &&
|
|
|
+ Storage_getListType() === historyOrChatList
|
|
|
+ ? "dark:border-[#0061ff] bg-blue-50 dark:bg-gray-800 text-[#0061ff]"
|
|
|
+ : "border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400"
|
|
|
+ } p-3 sm:flex-row flex-col`}
|
|
|
+ >
|
|
|
+ <div className="flex-grow text-ellipsis line-clamp-2">
|
|
|
+ <h2 className="pb-2">{item.name}</h2>
|
|
|
+ <p className="text-sm text-gray-400">
|
|
|
+ {new Date(item.createdAt).toLocaleString()}
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ ))}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
+ {historyOrChatList === 0 &&
|
|
|
+ (chatSessionList === null ||
|
|
|
+ chatSessionList.length == 0) && (
|
|
|
+ <div className="w-full px-5 text-gray-200 dark:text-gray-600 flex flex-col mt-20">
|
|
|
+ <div className="flex justify-center">
|
|
|
+ <RiCalendarCloseLine className="w-16 h-16 text-center" />
|
|
|
+ </div>
|
|
|
+ <div className="text-center mt-4">对话历史空空如也</div>
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
+
|
|
|
+ {historyOrChatList === 1 &&
|
|
|
+ chatAiModelList !== null &&
|
|
|
+ chatAiModelList.length > 0 && (
|
|
|
+ <div className="py-4 px-2">
|
|
|
+ <div className="mx-auto flex flex-col">
|
|
|
+ {chatAiModelList.map((item) => (
|
|
|
+ <div className="w-full mt-3" key={item.id}>
|
|
|
+ <div
|
|
|
+ className={`flex rounded border group ${
|
|
|
+ Storage_getAgentId() == item.id &&
|
|
|
+ Storage_getListType() === historyOrChatList
|
|
|
+ ? "dark:border-[#0061ff] bg-blue-50 dark:bg-gray-800 text-[#0061ff]"
|
|
|
+ : "border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400"
|
|
|
+ } p-3 sm:flex-row flex-col`}
|
|
|
+ >
|
|
|
+ <div className="flex flex-row relative">
|
|
|
+ <Popconfirm
|
|
|
+ title="删除提醒"
|
|
|
+ description="确定删除当前智能助手吗?"
|
|
|
+ onConfirm={() =>
|
|
|
+ confirmDeletLocalChat(item.id)
|
|
|
+ }
|
|
|
+ okText="确定"
|
|
|
+ cancelText="取消"
|
|
|
+ >
|
|
|
+ <RiDeleteBinLine className="absolute top-0.5 right-0.5 cursor-pointer group-hover:block hidden" />
|
|
|
+ </Popconfirm>
|
|
|
+ <div className="shrink-0 inline-flex items-center justify-center h-16 overflow-hidden">
|
|
|
+ <img
|
|
|
+ src={item.avatar}
|
|
|
+ className="h-16 cursor-pointer"
|
|
|
+ onClick={() =>
|
|
|
+ changeChatListForLocal(item.id)
|
|
|
+ }
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div className="flex-grow pl-2 pt-2">
|
|
|
+ <h2
|
|
|
+ className="text-base mb-1 line-clamp-1 text-ellipsis pr-5 cursor-pointer"
|
|
|
+ onClick={() =>
|
|
|
+ changeChatListForLocal(item.id)
|
|
|
+ }
|
|
|
+ >
|
|
|
+ {item.name}
|
|
|
+ </h2>
|
|
|
+ <p
|
|
|
+ className="text-sm line-clamp-1 text-ellipsis cursor-pointer"
|
|
|
+ onClick={() =>
|
|
|
+ changeChatListForLocal(item.id)
|
|
|
+ }
|
|
|
+ >
|
|
|
+ {item.estimate}
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ ))}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
+ {historyOrChatList === 1 &&
|
|
|
+ (chatAiModelList === null ||
|
|
|
+ chatAiModelList.length == 0) && (
|
|
|
+ <div className="w-full px-5 text-gray-200 dark:text-gray-600 flex flex-col mt-20">
|
|
|
+ <div className="flex justify-center">
|
|
|
+ <RiCalendarCloseLine className="w-16 h-16 text-center" />
|
|
|
+ </div>
|
|
|
+ <div className="text-center mt-4">当前助手空空如也</div>
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div className="text-sm h-20 w-full">
|
|
|
+ <div className="px-3 py-3 border-t-2 border-blue-50 dark:border-blue-950 dark:text-[#bc900c]">
|
|
|
+ <p className="flex items-center">
|
|
|
+ <RiVipDiamondFill className="text-[#f4a629]" />
|
|
|
+ <span className="ml-2">普通额度 {balance} 积分</span>
|
|
|
+ </p>
|
|
|
+ <p className="flex items-center mt-2">
|
|
|
+ <RiVipDiamondFill className="text-[#c81021]" />
|
|
|
+ <span className="ml-2">高级额度 {balance} 积分</span>
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
+
|
|
|
{showVip && (
|
|
|
<div className="pay-box">
|
|
|
<div className="pay-mask"></div>
|
|
|
- <div className="pay-div p-7 bg-white dark:bg-gray-900 text-base rounded container">
|
|
|
+ <div className="pay-div pt-12 md:p-7 bg-white dark:bg-gray-900 text-base rounded w-full md:container h-screen">
|
|
|
<RiCloseFill
|
|
|
className="absolute right-2.5 top-2.5 w-8 h-8 cursor-pointer transform duration-500 ease-in-out hover:scale-125 text-gray-500"
|
|
|
onClick={closeVipBox}
|
|
|
></RiCloseFill>
|
|
|
- <VipPage></VipPage>
|
|
|
+ <div className="h-full overflow-y-auto">
|
|
|
+ <VipPage></VipPage>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
)}
|