This commit is contained in:
sw3205933776 2025-09-02 10:20:50 +08:00
parent cdbcdea9d2
commit f687deb802

View file

@ -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"
/>
<span className=" flex-1 text-text-information text-xs font-medium leading-[20px]">
By using this product, you agree to our Terms of Service and Privacy Policy.
By messaging Eigent, you agree to our{" "}
<a
href="https://www.eigent.ai/terms-of-use"
target="_blank"
className="text-text-information underline"
>
Terms of Use
</a>{" "}
and{" "}
<a
href="https://www.eigent.ai/privacy-policy"
target="_blank"
className="text-text-information underline"
>
Privacy Policy
</a>
.
</span>
</div>
</div>