import { useEffect, useState } from 'react' import { useAtom } from 'jotai' import { Switch } from '@headlessui/react' import { toast } from 'react-hot-toast' import { hashAtom, voiceAtom } from '@/state' import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog' import { Button } from './ui/button' import { Input } from './ui/input' import { ChunkKeys, parseCookies, extraCurlFromCookie, randomIP, encodeHeadersToCookie } from '@/lib/utils' import { ExternalLink } from './external-link' import { useCopyToClipboard } from '@/lib/hooks/use-copy-to-clipboard' export function Settings() { const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2000 }) const [loc, setLoc] = useAtom(hashAtom) const [curlValue, setCurlValue] = useState(extraCurlFromCookie(parseCookies(document.cookie, ChunkKeys))) const [enableTTS, setEnableTTS] = useAtom(voiceAtom) useEffect(() => { if (isCopied) { toast.success('复制成功') } }, [isCopied]) if (loc === 'settings') { return ( setLoc('')} modal> 设置你的用户信息 请使用 Edge 浏览器 打开并登录 Bing ,然后再打开 Challenge 接口 右键 》检查。打开开发者工具,在网络里面找到 Create 接口 》右键复制》复制为 cURL(bash),粘贴到此处,然后保存。
图文示例: 如何获取 BING_HEADER
setCurlValue(e.target.value)} />
) } else if (loc === 'voice') { return ( setLoc('')} modal> 语音设置 目前仅支持 PC 端 Edge 及 Chrome 浏览器
启用语音回答 setEnableTTS(checked)} >
) } return null }