From f687deb802d8a9009863f87b2153dbe1c7a66707 Mon Sep 17 00:00:00 2001 From: sw3205933776 <3205933776@qq.com> Date: Tue, 2 Sep 2025 10:20:50 +0800 Subject: [PATCH] update --- src/components/ChatBox/index.tsx | 55 ++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 7 deletions(-) diff --git a/src/components/ChatBox/index.tsx b/src/components/ChatBox/index.tsx index 0e089569b..721eeb452 100644 --- a/src/components/ChatBox/index.tsx +++ b/src/components/ChatBox/index.tsx @@ -1,5 +1,5 @@ import { useState, useRef, useEffect, useCallback } from "react"; -import { fetchPost } from "@/api/http"; +import { fetchPost, proxyFetchPut } from "@/api/http"; import { BottomInput } from "./BottomInput"; import { TaskCard } from "./TaskCard"; import { MessageCard } from "./MessageCard"; @@ -138,6 +138,22 @@ export default function ChatBox(): JSX.Element { chatStore.setIsPending(_taskId, true); } } else { + if (!privacy) { + const API_FIELDS = [ + "take_screenshot", + "access_local_software", + "access_your_address", + "password_storage", + ]; + const requestData = { + [API_FIELDS[0]]: true, + [API_FIELDS[1]]: true, + [API_FIELDS[2]]: true, + [API_FIELDS[3]]: true, + }; + proxyFetchPut("/api/user/privacy", requestData); + setPrivacy(true); + } chatStore.setIsPending(_taskId, true); chatStore.startTask(_taskId); chatStore.setHasWaitComfirm(_taskId as string, true); @@ -427,15 +443,24 @@ export default function ChatBox(): JSX.Element { "" } onAddTask={() => { - chatStore.setIsTaskEdit(chatStore.activeTaskId as string, true); + chatStore.setIsTaskEdit( + chatStore.activeTaskId as string, + true + ); chatStore.addTaskInfo(); }} onUpdateTask={(taskIndex, content) => { - chatStore.setIsTaskEdit(chatStore.activeTaskId as string, true); + chatStore.setIsTaskEdit( + chatStore.activeTaskId as string, + true + ); chatStore.updateTaskInfo(taskIndex, content); }} onDeleteTask={(taskIndex) => { - chatStore.setIsTaskEdit(chatStore.activeTaskId as string, true); + chatStore.setIsTaskEdit( + chatStore.activeTaskId as string, + true + ); chatStore.deleteTaskInfo(taskIndex); }} /> @@ -491,7 +516,7 @@ export default function ChatBox(): JSX.Element { className="w-full h-[calc(100vh-54px)] flex items-center rounded-xl border border-border-disabled p-2 pr-0 border-solid relative overflow-hidden" onClick={() => { if (!privacy) { - navigate("/setting/privacy"); + // navigate("/setting/privacy"); // setPrivacyDialogOpen(true); } }} @@ -514,7 +539,7 @@ export default function ChatBox(): JSX.Element { onPendingChange={(val) => chatStore.setIsPending(chatStore.activeTaskId as string, val) } - privacy={privacy} + privacy={true} message={message} onMessageChange={setMessage} onKeyDown={handleKeyDown} @@ -540,7 +565,23 @@ export default function ChatBox(): JSX.Element { className="text-icon-information" /> - By using this product, you agree to our Terms of Service and Privacy Policy. + By messaging Eigent, you agree to our{" "} + + Terms of Use + {" "} + and{" "} + + Privacy Policy + + .