"use client"; // Settings.tsx import { useAppDispatch, useAppSelector } from "@/app/store"; import { setApiKey, setUpsreamUrl, setSystemPrompt, } from "@/app/store/slices/authSlice"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faArrowLeft } from "@fortawesome/free-solid-svg-icons"; import Link from "next/link"; import { useLocalStorage } from "react-use"; // 在 Settings.tsx 或一个单独的配置文件中 const CONFIG_OPTIONS = [ { name: "cocopilot-gpt4(apiKey在前面手动加上ghu)", apiKey: "_pXVxLPBzcvCjSvG0Mv4K7G9ffw3xsM2ZKolZ", upstreamUrl: "https://proxy.cocopilot.org", }, { name: "deepseek-chat(需要手动修改模型为这个)", apiKey: "sk-ffe19ebe9fa44d00884330ff1c18cf82", upstreamUrl: "https://api.deepseek.com", }, { name: "caifree(推荐)", apiKey: "sk-aiHrrRLYUUelHstX69E9484509254dBf92061d6744FfFaD1", upstreamUrl: "https://one.caifree.com", }, { name: "自定义", apiKey: "", upstreamUrl: "", }, ]; const Settings = () => { //redux const dispatch = useAppDispatch(); const apiKey = useAppSelector((state) => state.auth.apiKey); const upstreamUrl = useAppSelector((state) => state.auth.upsreamUrl); const systemPrompt = useAppSelector((state) => state.auth.systemPrompt); //state const [userConfigNumber, setUserConfigNumber] = useLocalStorage( "userConfigNumber", "2" ); return (

settings


{/* 配置选择器 */} {/* api key */}
dispatch(setApiKey(event.target.value))} className="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" /> {/* upstream-url */}
dispatch(setUpsreamUrl(event.target.value))} className="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" />
{/* systemPrompt */}