From 8fedb17183f7a058ddf22aa1f39a7bc097c1a296 Mon Sep 17 00:00:00 2001 From: sijinhui Date: Thu, 19 Sep 2024 22:31:21 +0800 Subject: [PATCH] 123 --- app/api/midjourney/[...path]/route.ts | 2 +- app/api/openai.ts | 2 +- app/app/(admin)/admin/layout.tsx | 2 +- .../components/admin-setting-table.tsx | 2 -- app/app/(admin)/components/sidebar.tsx | 2 +- app/app/(admin)/components/users-table.tsx | 2 +- app/app/(auth)/login/page.tsx | 2 -- app/app/(auth)/login/set-password/page.tsx | 11 +++++----- app/app/(auth)/login/user-login-core.tsx | 13 +++--------- app/components/gpt-prompts.tsx | 2 +- app/components/home.tsx | 2 +- app/components/new-chat.tsx | 1 - app/components/reward.tsx | 2 +- app/components/sd/sd.tsx | 2 +- app/components/ui-lib.tsx | 12 ++--------- app/components/voice-input.tsx | 2 +- app/layout.tsx | 21 +------------------ app/masks/index.ts | 4 ++-- app/utils/hooks.ts | 2 +- lib/auth.ts | 4 ++-- 20 files changed, 26 insertions(+), 66 deletions(-) diff --git a/app/api/midjourney/[...path]/route.ts b/app/api/midjourney/[...path]/route.ts index 55d6bd5ea..3013a3831 100644 --- a/app/api/midjourney/[...path]/route.ts +++ b/app/api/midjourney/[...path]/route.ts @@ -1,5 +1,5 @@ import { NextRequest, NextResponse } from "next/server"; -import { auth, getIP } from "@/app/api/auth"; +import { auth } from "@/app/api/auth"; import { ModelProvider } from "@/app/constant"; import { requestLog } from "@/app/api/common"; diff --git a/app/api/openai.ts b/app/api/openai.ts index aaae96d91..bba4ff11f 100644 --- a/app/api/openai.ts +++ b/app/api/openai.ts @@ -9,7 +9,7 @@ import { import { prettyObject } from "@/app/utils/format"; import { NextRequest, NextResponse } from "next/server"; import { auth } from "./auth"; -import { requestOpenai, requestLog } from "./common"; +import { requestOpenai } from "./common"; // const ALLOWED_PATH = new Set(Object.values({ ...OpenaiPath, ...AZURE_PATH })); const ALLOWD_PATH = new Set(Object.values(OpenaiPath)); diff --git a/app/app/(admin)/admin/layout.tsx b/app/app/(admin)/admin/layout.tsx index 9e737eaa0..644a02294 100644 --- a/app/app/(admin)/admin/layout.tsx +++ b/app/app/(admin)/admin/layout.tsx @@ -2,7 +2,7 @@ import React, { ReactNode, useEffect, useState } from "react"; import { MenuFoldOutlined, MenuUnfoldOutlined } from "@ant-design/icons"; -import { Layout, Menu, Button, theme, ConfigProvider, ThemeConfig } from "antd"; +import { Layout, Button, theme, ConfigProvider } from "antd"; import SideBar from "../components/sidebar"; const { Header, Sider, Content } = Layout; diff --git a/app/app/(admin)/components/admin-setting-table.tsx b/app/app/(admin)/components/admin-setting-table.tsx index 43cfb5327..50418e08c 100644 --- a/app/app/(admin)/components/admin-setting-table.tsx +++ b/app/app/(admin)/components/admin-setting-table.tsx @@ -1,8 +1,6 @@ "use client"; -import type { FormProps } from "antd"; import { Button, - Checkbox, Form, Input, Modal, diff --git a/app/app/(admin)/components/sidebar.tsx b/app/app/(admin)/components/sidebar.tsx index 6e07b3408..6cd855ff8 100644 --- a/app/app/(admin)/components/sidebar.tsx +++ b/app/app/(admin)/components/sidebar.tsx @@ -1,6 +1,6 @@ "use client"; -import React, { useEffect, useState } from "react"; +import React, { useState } from "react"; // import Link from "next/link"; import { useRouter, usePathname } from "next/navigation"; diff --git a/app/app/(admin)/components/users-table.tsx b/app/app/(admin)/components/users-table.tsx index 2cb8bcc4c..073cba45e 100644 --- a/app/app/(admin)/components/users-table.tsx +++ b/app/app/(admin)/components/users-table.tsx @@ -13,7 +13,7 @@ import { Modal, Form, } from "antd"; -import type { GetRef, TableColumnsType } from "antd"; +import type { TableColumnsType } from "antd"; import { LockOutlined } from "@ant-design/icons"; // import { headers } from 'next/headers' import type { NotificationArgsProps } from "antd"; diff --git a/app/app/(auth)/login/page.tsx b/app/app/(auth)/login/page.tsx index 4bddc5131..86a6ef4f9 100644 --- a/app/app/(auth)/login/page.tsx +++ b/app/app/(auth)/login/page.tsx @@ -1,7 +1,5 @@ -import Image from "next/image"; import LoginByGithub from "./loginByGithub"; import UserLoginCore from "./user-login-core"; -import { Suspense } from "react"; export default function LoginPage() { return ( diff --git a/app/app/(auth)/login/set-password/page.tsx b/app/app/(auth)/login/set-password/page.tsx index 6f75dab7c..2ee04158c 100644 --- a/app/app/(auth)/login/set-password/page.tsx +++ b/app/app/(auth)/login/set-password/page.tsx @@ -1,18 +1,17 @@ "use client"; -import { redirect } from "next/navigation"; // import { getSession } from "@/lib/auth"; import { useSession } from "next-auth/react"; -import { Button, Checkbox, Form, FormProps, Input } from "antd"; +import { Form, FormProps, Input } from "antd"; import { LockOutlined } from "@ant-design/icons"; -import React, { useState } from "react"; +// import React from "react"; import { signOut } from "next-auth/react"; type LoginType = "phone" | "account"; export default function SetPasswordPage() { - const [loading, setLoading] = useState(false); + // const [loading, setLoading] = useState(false); const { data: session, status } = useSession(); - const [showOldPassword, setShowOldPassword] = useState(true); + // const [showOldPassword, setShowOldPassword] = useState(true); const [setPasswordForm] = Form.useForm(); // if (typeof window !== "undefined" && loading) return null; // console.log("2222222", session); @@ -34,7 +33,7 @@ export default function SetPasswordPage() { "user[password_confirmation]"?: string; }; const onFinish: FormProps["onFinish"] = (values) => { - setLoading(true); + // setLoading(true); // console.log('-------------', values) // @ts-expect-error fetch(`/api/user/${session?.user?.id}`, { diff --git a/app/app/(auth)/login/user-login-core.tsx b/app/app/(auth)/login/user-login-core.tsx index a14d615a0..55f3c5f9a 100644 --- a/app/app/(auth)/login/user-login-core.tsx +++ b/app/app/(auth)/login/user-login-core.tsx @@ -1,24 +1,17 @@ "use client"; import { signIn } from "next-auth/react"; -import React, { useState, useEffect, useRef, use, useMemo } from "react"; +import React, { useState, useEffect, useMemo } from "react"; import { isName } from "@/lib/auth_list"; import { Form, Tabs, Input, - Button, - InputRef, notification as notificationModule, NotificationArgsProps, } from "antd"; -import { - UserOutlined, - MailOutlined, - LoadingOutlined, - AudioOutlined, -} from "@ant-design/icons"; -import type { FormProps, TabsProps } from "antd"; +import { UserOutlined, MailOutlined, LoadingOutlined } from "@ant-design/icons"; +import type { FormProps } from "antd"; import { SignInOptions } from "next-auth/react"; import { getSession } from "next-auth/react"; diff --git a/app/components/gpt-prompts.tsx b/app/components/gpt-prompts.tsx index ddfd20e67..77c05c8c6 100644 --- a/app/components/gpt-prompts.tsx +++ b/app/components/gpt-prompts.tsx @@ -1,5 +1,5 @@ import styles from "./gpt-prompts.module.scss"; -import { Flex, Radio, Card } from "antd"; +import { Flex, Card } from "antd"; export default function GptPrompts() { return ( diff --git a/app/components/home.tsx b/app/components/home.tsx index b9be3846a..f91754431 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -15,7 +15,7 @@ import dynamic from "next/dynamic"; import { Path, SlotID } from "../constant"; import { ErrorBoundary } from "./error"; -import { getISOLang, getLang } from "../locales"; +import { getISOLang } from "../locales"; import { HashRouter as Router, diff --git a/app/components/new-chat.tsx b/app/components/new-chat.tsx index 5c20d3eec..81d1a3b22 100644 --- a/app/components/new-chat.tsx +++ b/app/components/new-chat.tsx @@ -6,7 +6,6 @@ import styles from "./new-chat.module.scss"; import LeftIcon from "../icons/left.svg"; import LightningIcon from "../icons/lightning.svg"; -import EyeIcon from "../icons/eye.svg"; import { useLocation, useNavigate } from "react-router-dom"; import { Mask, useMaskStore } from "../store/mask"; diff --git a/app/components/reward.tsx b/app/components/reward.tsx index a182ae9b4..f936219e4 100644 --- a/app/components/reward.tsx +++ b/app/components/reward.tsx @@ -1,6 +1,6 @@ import Image from "next/image"; import React from "react"; -import { useLocation, useNavigate } from "react-router-dom"; +import { useNavigate } from "react-router-dom"; import styles from "@/app/components/mask.module.scss"; import Locale from "@/app/locales"; import { IconButton } from "@/app/components/button"; diff --git a/app/components/sd/sd.tsx b/app/components/sd/sd.tsx index aee3307e7..409f41723 100644 --- a/app/components/sd/sd.tsx +++ b/app/components/sd/sd.tsx @@ -36,7 +36,7 @@ import { removeImage } from "@/app/utils/chat"; import { SideBar } from "./sd-sidebar"; import { WindowContent } from "@/app/components/home"; import { params } from "./sd-panel"; -import Image from "next/image"; + function getSdTaskStatus(item: any) { let s: string; let color: Property.Color | undefined = undefined; diff --git a/app/components/ui-lib.tsx b/app/components/ui-lib.tsx index 31f8fe0fe..8fb1ea099 100644 --- a/app/components/ui-lib.tsx +++ b/app/components/ui-lib.tsx @@ -25,20 +25,12 @@ import React, { useRef, } from "react"; import { IconButton } from "./button"; -import { - Card as AntCard, - List as AntList, - Row, - Col, - Grid, - Avatar, - Button, -} from "antd"; +import { List as AntList, Row, Col } from "antd"; import { OpenAIOutlined, GoogleOutlined } from "@ant-design/icons"; // 自定义图标 import Icon from "@ant-design/icons"; -const { Meta } = AntCard; +// const { Meta } = AntCard; import { CheckCard } from "@ant-design/pro-components"; import { CheckGroupValueType } from "@ant-design/pro-card/es/components/CheckCard/Group"; diff --git a/app/components/voice-input.tsx b/app/components/voice-input.tsx index d26820873..fe1984525 100644 --- a/app/components/voice-input.tsx +++ b/app/components/voice-input.tsx @@ -1,4 +1,4 @@ -import { Button, Input, Space } from "antd"; +import { Button, Space } from "antd"; import { Dispatch, SetStateAction, diff --git a/app/layout.tsx b/app/layout.tsx index 82bc6e727..10a4dec12 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -6,29 +6,10 @@ import { getClientConfig } from "./config/client"; import type { Metadata, Viewport } from "next"; import { SpeedInsights } from "@vercel/speed-insights/next"; import { getServerSideConfig } from "./config/server"; +// eslint-disable-next-line unused-imports/no-unused-imports import { GoogleTagManager } from "@next/third-parties/google"; const serverConfig = getServerSideConfig(); import { Providers } from "@/app/providers"; -// import { Viewport } from "next"; - -// export const metadata: Metadata = { -// title: "NextChat", -// description: "Your personal ChatGPT Chat Bot.", -// appleWebApp: { -// title: "NextChat", -// statusBarStyle: "default", -// }, -// }; -// -// export const viewport: Viewport = { -// width: "device-width", -// initialScale: 1, -// maximumScale: 1, -// themeColor: [ -// { media: "(prefers-color-scheme: light)", color: "#fafafa" }, -// { media: "(prefers-color-scheme: dark)", color: "#151515" }, -// ], -// }; export const viewport: Viewport = { themeColor: [ diff --git a/app/masks/index.ts b/app/masks/index.ts index 9e05a944a..883dd2829 100644 --- a/app/masks/index.ts +++ b/app/masks/index.ts @@ -1,6 +1,6 @@ import { Mask } from "../store/mask"; -import { CN_MASKS } from "./cn"; -import { EN_MASKS } from "./en"; +// import { CN_MASKS } from "./cn"; +// import { EN_MASKS } from "./en"; import { type BuiltinMask } from "./typing"; export { type BuiltinMask } from "./typing"; diff --git a/app/utils/hooks.ts b/app/utils/hooks.ts index decfbc34b..c95ded3bf 100644 --- a/app/utils/hooks.ts +++ b/app/utils/hooks.ts @@ -1,6 +1,6 @@ import { useMemo } from "react"; import { useAccessStore, useAppConfig } from "../store"; -import { collectModels, collectModelsWithDefaultModel } from "./model"; +import { collectModelsWithDefaultModel } from "./model"; import { useSession } from "next-auth/react"; export function useAllModels() { diff --git a/lib/auth.ts b/lib/auth.ts index d9d646ad8..b698f82f4 100644 --- a/lib/auth.ts +++ b/lib/auth.ts @@ -7,8 +7,8 @@ import prisma from "@/lib/prisma"; import { User } from "@prisma/client"; import { isEmail, isName } from "@/lib/auth_list"; import {createTransport} from "nodemailer"; -import { comparePassword, hashPassword } from "@/lib/utils"; -import { randomInt, randomBytes } from "crypto"; +import { comparePassword } from "@/lib/utils"; +import { randomBytes } from "crypto"; const SECURE_COOKIES:boolean = !!process.env.SECURE_COOKIES; let verificationTokens = new Map();