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 + + .