|
@@ -3,7 +3,7 @@ import { getApiUrl, isMobile } from "@/utils/common";
|
|
import { getUserSession } from "@/utils/user";
|
|
import { getUserSession } from "@/utils/user";
|
|
import { useState, useEffect } from "react";
|
|
import { useState, useEffect } from "react";
|
|
import type { PopconfirmProps } from "antd";
|
|
import type { PopconfirmProps } from "antd";
|
|
-import { theme, Popconfirm, Button, Card, Result } from "antd";
|
|
|
|
|
|
+import { message, theme, Popconfirm, Button, Card, Result } from "antd";
|
|
import { ThemeProvider, css, cx } from "antd-style";
|
|
import { ThemeProvider, css, cx } from "antd-style";
|
|
import { useTheme } from "next-themes";
|
|
import { useTheme } from "next-themes";
|
|
import { ProChat, ProChatInstance } from "@ant-design/pro-chat";
|
|
import { ProChat, ProChatInstance } from "@ant-design/pro-chat";
|
|
@@ -243,17 +243,18 @@ export default function Dialogue() {
|
|
};
|
|
};
|
|
//重命名聊天会话
|
|
//重命名聊天会话
|
|
const renameChatSessionUi = (id: string, name: string) => {
|
|
const renameChatSessionUi = (id: string, name: string) => {
|
|
|
|
+ setChatSessionRenameId("");
|
|
|
|
+ setRename("");
|
|
|
|
+ setChatSessionList(
|
|
|
|
+ chatSessionList.map((v) => (v.id === id ? { ...v, name: name } : v))
|
|
|
|
+ );
|
|
renameChatSession({
|
|
renameChatSession({
|
|
conversationId: id,
|
|
conversationId: id,
|
|
agentId: Storage_getAgentId(),
|
|
agentId: Storage_getAgentId(),
|
|
name: name,
|
|
name: name,
|
|
}).then((res) => {
|
|
}).then((res) => {
|
|
if (res.code == 0) {
|
|
if (res.code == 0) {
|
|
- setChatSessionList(
|
|
|
|
- chatSessionList.map((v) => (v.id === id ? { ...v, name: name } : v))
|
|
|
|
- );
|
|
|
|
- setChatSessionRenameId("");
|
|
|
|
- setRename("");
|
|
|
|
|
|
+ //message.success("会话重命名成功!");
|
|
}
|
|
}
|
|
});
|
|
});
|
|
};
|
|
};
|
|
@@ -419,15 +420,6 @@ export default function Dialogue() {
|
|
setShowVip(false);
|
|
setShowVip(false);
|
|
};
|
|
};
|
|
|
|
|
|
- const NeedBuyVip = () => {
|
|
|
|
- return (
|
|
|
|
- <>
|
|
|
|
- 当前智能体需要会员才能使用,去开通:
|
|
|
|
- <a onClick={() => setShowVip(true)}>会员套餐</a>
|
|
|
|
- </>
|
|
|
|
- );
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
return (
|
|
return (
|
|
<>
|
|
<>
|
|
<div className="flex justify-between items-center bg-[slate-200] dark:bg-[#000] h-full">
|
|
<div className="flex justify-between items-center bg-[slate-200] dark:bg-[#000] h-full">
|
|
@@ -523,7 +515,7 @@ export default function Dialogue() {
|
|
}
|
|
}
|
|
/>
|
|
/>
|
|
|
|
|
|
- {chatSessionRenameId && (
|
|
|
|
|
|
+ {chatSessionRenameId === item.id && (
|
|
<p>
|
|
<p>
|
|
<input
|
|
<input
|
|
value={rename}
|
|
value={rename}
|
|
@@ -541,7 +533,7 @@ export default function Dialogue() {
|
|
/>
|
|
/>
|
|
</p>
|
|
</p>
|
|
)}
|
|
)}
|
|
- {!chatSessionRenameId && (
|
|
|
|
|
|
+ {chatSessionRenameId !== item.id && (
|
|
<h2
|
|
<h2
|
|
className="pb-2"
|
|
className="pb-2"
|
|
onClick={() => changeChatSession(item.id)}
|
|
onClick={() => changeChatSession(item.id)}
|
|
@@ -716,13 +708,6 @@ export default function Dialogue() {
|
|
justify: "space-start",
|
|
justify: "space-start",
|
|
},
|
|
},
|
|
}}
|
|
}}
|
|
- chatItemRenderConfig={{
|
|
|
|
- contentRender: (item) => {
|
|
|
|
- if (item?.originData?.role === "need_pay") {
|
|
|
|
- return <NeedBuyVip />;
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- }}
|
|
|
|
request={async (messages) => {
|
|
request={async (messages) => {
|
|
const response = await fetch(
|
|
const response = await fetch(
|
|
getApiUrl() + "/gpts/chat/submit",
|
|
getApiUrl() + "/gpts/chat/submit",
|
|
@@ -791,7 +776,7 @@ export default function Dialogue() {
|
|
} else if (parsed.need_pay) {
|
|
} else if (parsed.need_pay) {
|
|
controller.enqueue(
|
|
controller.enqueue(
|
|
encoder.encode(
|
|
encoder.encode(
|
|
- "当前智能体需要会员才能使用"
|
|
|
|
|
|
+ "当前智能体需要会员才能使用,去开通:[会员套餐](/vip.html)"
|
|
)
|
|
)
|
|
);
|
|
);
|
|
setTimeout(() => {setShowVip(true);}, 200);
|
|
setTimeout(() => {setShowVip(true);}, 200);
|
|
@@ -897,7 +882,7 @@ export default function Dialogue() {
|
|
)}
|
|
)}
|
|
</div>
|
|
</div>
|
|
|
|
|
|
- {showLeftBox && (
|
|
|
|
|
|
+ {showLeftBox && isMobile() && (
|
|
<div className="pay-box">
|
|
<div className="pay-box">
|
|
<div className="pay-mask"></div>
|
|
<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="pay-div md:p-7 bg-white dark:bg-gray-900 text-base rounded w-full md:container h-screen">
|