Skip to content

Commit

Permalink
✨ feat: upgrade to cheaper gpt-4o-mini model and updated deps
Browse files Browse the repository at this point in the history
  • Loading branch information
MakakWasTaken committed Jul 18, 2024
1 parent b06f66b commit f05cf85
Show file tree
Hide file tree
Showing 84 changed files with 501 additions and 489 deletions.
3 changes: 2 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"recommended": true,
"suspicious": {
"noExplicitAny": "off",
"noAsyncPromiseExecutor": "off"
"noAsyncPromiseExecutor": "off",
"noArrayIndexKey": "off"
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion commitlint.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UserConfig } from '@commitlint/types'
import type { UserConfig } from '@commitlint/types'

const config: UserConfig = {
extends: ['@commitlint/config-conventional'],
Expand Down
2 changes: 1 addition & 1 deletion middleware.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import acceptLanguage from 'accept-language'
import { NextRequest, NextResponse } from 'next/server'
import { type NextRequest, NextResponse } from 'next/server'

acceptLanguage.languages(['en', 'da'])

Expand Down
2 changes: 1 addition & 1 deletion next-i18next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ module.exports = {
/** To avoid issues when deploying to some paas (vercel...) */
localePath:
typeof window === 'undefined'
? require('path').resolve('./public/locales')
? require('node:path').resolve('./public/locales')
: '/locales',
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"postbuild": "next-sitemap",
"postinstall": "prisma generate",
"start": "node build/standalone/server.js",
"lint": "biome format --write --no-errors-on-unmatched . && biome lint --apply --no-errors-on-unmatched .",
"lint": "biome format --write --no-errors-on-unmatched . && biome lint --write --no-errors-on-unmatched .",
"prisma:update": "prisma format && prisma generate && prisma db push",
"analyze": "cross-env ANALYZE=true next build",
"prepare": "husky install",
Expand All @@ -20,7 +20,7 @@
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": "biome format --write --no-errors-on-unmatched",
"*.{js,jsx,ts,tsx|json}": "biome lint --apply --no-errors-on-unmatched"
"*.{js,jsx,ts,tsx|json}": "biome lint --write --no-errors-on-unmatched"
},
"dependencies": {
"@auth/prisma-adapter": "^2.4.1",
Expand Down
8 changes: 4 additions & 4 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ import { Header } from '#components/Header'
import createEmotionCache from '#misc/createEmotionCache'
import theme, { darkTheme } from '#misc/theme'
import { api } from '#network/index'
import { CacheProvider, EmotionCache } from '@emotion/react'
import { CacheProvider, type EmotionCache } from '@emotion/react'
import { Box, useMediaQuery } from '@mui/material'
import CssBaseline from '@mui/material/CssBaseline'
import { ThemeProvider } from '@mui/material/styles'
import { initGA } from 'green-analytics-js'
import { Session } from 'next-auth'
import type { Session } from 'next-auth'
import { SessionProvider } from 'next-auth/react'
import { appWithTranslation } from 'next-i18next'
import { NextSeo } from 'next-seo'
import { AppProps } from 'next/app'
import { FC, useEffect, useMemo } from 'react'
import type { AppProps } from 'next/app'
import { type FC, useEffect, useMemo } from 'react'
import { Toaster, toast } from 'sonner'
import { SWRConfig } from 'swr'

Expand Down
4 changes: 2 additions & 2 deletions pages/about.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { GetStaticProps } from 'next'
import type { GetStaticProps } from 'next'
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
import { NextSeo } from 'next-seo'
import { FC } from 'react'
import type { FC } from 'react'

/**
* About page for YourKitchen, describing the project.
Expand Down
6 changes: 3 additions & 3 deletions pages/api/_recipeImage.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
ErrorResponse,
Photo,
PhotosWithTotalResults,
type ErrorResponse,
type Photo,
type PhotosWithTotalResults,
createClient,
} from 'pexels'

Expand Down
4 changes: 2 additions & 2 deletions pages/api/auth/[...nextauth].ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PrismaAdapter } from '@auth/prisma-adapter'
import { PrismaClient, User } from '@prisma/client'
import { PrismaClient, type User } from '@prisma/client'
import { JsonValue } from '@prisma/client/runtime/library'
import NextAuth, { AuthOptions, Session } from 'next-auth'
import NextAuth, { type AuthOptions, type Session } from 'next-auth'
import AppleProvider from 'next-auth/providers/apple'
import EmailProvider from 'next-auth/providers/email'
import FacebookProvider from 'next-auth/providers/facebook'
Expand Down
2 changes: 1 addition & 1 deletion pages/api/cleanup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DateTime } from 'luxon'
import { NextApiRequest, NextApiResponse } from 'next'
import type { NextApiRequest, NextApiResponse } from 'next'
import prisma from './_base'

const handler = async (req: NextApiRequest, res: NextApiResponse) => {
Expand Down
2 changes: 1 addition & 1 deletion pages/api/database/cuisine/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import prisma from '#pages/api/_base'
import { authOptions } from '#pages/api/auth/[...nextauth]'
import { NextApiRequest, NextApiResponse } from 'next'
import type { NextApiRequest, NextApiResponse } from 'next'
import { getServerSession } from 'next-auth'

export const handler = async (req: NextApiRequest, res: NextApiResponse) => {
Expand Down
2 changes: 1 addition & 1 deletion pages/api/database/cuisine/search.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NextApiRequest, NextApiResponse } from 'next'
import type { NextApiRequest, NextApiResponse } from 'next'
import prisma from '#pages/api/_base'

export const handler = async (req: NextApiRequest, res: NextApiResponse) => {
Expand Down
6 changes: 3 additions & 3 deletions pages/api/database/fridge/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import prisma from '#pages/api/_base'
import { authOptions } from '#pages/api/auth/[...nextauth]'
import { FridgeIngredient } from '@prisma/client'
import { NextApiRequest, NextApiResponse } from 'next'
import { Session, getServerSession } from 'next-auth'
import type { FridgeIngredient } from '@prisma/client'
import type { NextApiRequest, NextApiResponse } from 'next'
import { type Session, getServerSession } from 'next-auth'

const handler = async (req: NextApiRequest, res: NextApiResponse) => {
try {
Expand Down
4 changes: 2 additions & 2 deletions pages/api/database/ingredient/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Ingredient, Recipe } from '@prisma/client'
import { NextApiRequest, NextApiResponse } from 'next'
import { type Ingredient, Recipe } from '@prisma/client'
import type { NextApiRequest, NextApiResponse } from 'next'
import { getServerSession } from 'next-auth'
import { ApiError } from 'next/dist/server/api-utils'
import { getIngredientId } from 'src/utils'
Expand Down
2 changes: 1 addition & 1 deletion pages/api/database/ingredient/search.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NextApiRequest, NextApiResponse } from 'next'
import type { NextApiRequest, NextApiResponse } from 'next'
import prisma from '#pages/api/_base'

export const handler = async (req: NextApiRequest, res: NextApiResponse) => {
Expand Down
4 changes: 2 additions & 2 deletions pages/api/database/mealplan/[id].ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import prisma from '#pages/api/_base'
import { authOptions } from '#pages/api/auth/[...nextauth]'
import { updateMealplan } from '#utils/meaplanHelper'
import { DateTime } from 'luxon'
import { NextApiRequest, NextApiResponse } from 'next'
import { Session, getServerSession } from 'next-auth'
import type { NextApiRequest, NextApiResponse } from 'next'
import { type Session, getServerSession } from 'next-auth'

const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const session = await getServerSession(req, res, authOptions)
Expand Down
4 changes: 2 additions & 2 deletions pages/api/database/mealplan/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import prisma from '#pages/api/_base'
import { authOptions } from '#pages/api/auth/[...nextauth]'
import { NextApiRequest, NextApiResponse } from 'next'
import { Session, getServerSession } from 'next-auth'
import type { NextApiRequest, NextApiResponse } from 'next'
import { type Session, getServerSession } from 'next-auth'

const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const session = await getServerSession(req, res, authOptions)
Expand Down
6 changes: 3 additions & 3 deletions pages/api/database/mealplan/own.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import prisma from '#pages/api/_base'
import { authOptions } from '#pages/api/auth/[...nextauth]'
import { sameDate, updateMealplan } from '#utils/meaplanHelper'
import { MealPlanRecipe } from '@prisma/client'
import type { MealPlanRecipe } from '@prisma/client'
import { DateTime } from 'luxon'
import { NextApiRequest, NextApiResponse } from 'next'
import { Session, getServerSession } from 'next-auth'
import type { NextApiRequest, NextApiResponse } from 'next'
import { type Session, getServerSession } from 'next-auth'

const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const session = await getServerSession(req, res, authOptions)
Expand Down
4 changes: 2 additions & 2 deletions pages/api/database/recipe/[id]/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import prisma from '#pages/api/_base'
import { authOptions } from '#pages/api/auth/[...nextauth]'
import { Recipe, RecipeImage } from '@prisma/client'
import { NextApiRequest, NextApiResponse } from 'next'
import type { Recipe, RecipeImage } from '@prisma/client'
import type { NextApiRequest, NextApiResponse } from 'next'
import { getServerSession } from 'next-auth'

const handler = async (req: NextApiRequest, res: NextApiResponse) => {
Expand Down
2 changes: 1 addition & 1 deletion pages/api/database/recipe/[id]/rating/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import prisma from '#pages/api/_base'
import { NextApiRequest, NextApiResponse } from 'next'
import type { NextApiRequest, NextApiResponse } from 'next'

const handler = async (req: NextApiRequest, res: NextApiResponse) => {
try {
Expand Down
6 changes: 3 additions & 3 deletions pages/api/database/recipe/[id]/rating/own.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import prisma from '#pages/api/_base'
import { authOptions } from '#pages/api/auth/[...nextauth]'
import { Rating } from '@prisma/client'
import { NextApiRequest, NextApiResponse } from 'next'
import { Session, getServerSession } from 'next-auth'
import type { Rating } from '@prisma/client'
import type { NextApiRequest, NextApiResponse } from 'next'
import { type Session, getServerSession } from 'next-auth'

const handler = async (req: NextApiRequest, res: NextApiResponse) => {
try {
Expand Down
4 changes: 2 additions & 2 deletions pages/api/database/recipe/image.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { authOptions } from '#pages/api/auth/[...nextauth]'
import { put } from '@vercel/blob'
import { NextApiRequest, NextApiResponse } from 'next'
import { Session, getServerSession } from 'next-auth'
import type { NextApiRequest, NextApiResponse } from 'next'
import { type Session, getServerSession } from 'next-auth'

const handler = async (req: NextApiRequest, res: NextApiResponse) => {
try {
Expand Down
9 changes: 7 additions & 2 deletions pages/api/database/recipe/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { MealType, Prisma, Recipe, RecipeImage } from '@prisma/client'
import { NextApiRequest, NextApiResponse } from 'next'
import {
type MealType,
Prisma,
type Recipe,
type RecipeImage,
} from '@prisma/client'
import type { NextApiRequest, NextApiResponse } from 'next'
import { getServerSession } from 'next-auth'
import { ApiError } from 'next/dist/server/api-utils'
import { authOptions } from '#pages/api/auth/[...nextauth]'
Expand Down
2 changes: 1 addition & 1 deletion pages/api/database/recipe/popular.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DateTime } from 'luxon'
import { NextApiRequest, NextApiResponse } from 'next'
import type { NextApiRequest, NextApiResponse } from 'next'
import { NextRequest, NextResponse } from 'next/server'
import prisma from '#pages/api/_base'

Expand Down
4 changes: 2 additions & 2 deletions pages/api/database/recipe/random.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { api } from '#network/index'
import prisma from '#pages/api/_base'
import { getRecipeImage } from '#pages/api/_recipeImage'
import randomSchema from '#utils/random_schema.json'
import { RecipeImage } from '@prisma/client'
import type { RecipeImage } from '@prisma/client'
import { put } from '@vercel/blob'
import { NextApiRequest, NextApiResponse } from 'next'
import type { NextApiRequest, NextApiResponse } from 'next'
import { OpenAI } from 'openai'
import { ValidationError, validateContent } from 'src/utils/validator'
import { v4 } from 'uuid'
Expand Down
2 changes: 1 addition & 1 deletion pages/api/database/recipe/search/image.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Cuisine, MealType } from '@prisma/client'
import { NextApiRequest, NextApiResponse } from 'next'
import type { NextApiRequest, NextApiResponse } from 'next'
import prisma from '#pages/api/_base'
import { getRecipeImage } from '#pages/api/_recipeImage'

Expand Down
4 changes: 2 additions & 2 deletions pages/api/database/recipe/search/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Cuisine, MealType } from '@prisma/client'
import { NextApiRequest, NextApiResponse } from 'next'
import type { Cuisine, MealType } from '@prisma/client'
import type { NextApiRequest, NextApiResponse } from 'next'
import prisma from '#pages/api/_base'

export const handler = async (req: NextApiRequest, res: NextApiResponse) => {
Expand Down
12 changes: 6 additions & 6 deletions pages/api/database/recipe/structured-data.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import {
MealType,
Recipe,
RecipeImage,
type MealType,
type Recipe,
type RecipeImage,
RecipeIngredient,
RecipeType,
type RecipeType,
} from '@prisma/client'
import axios from 'axios'
import { parseHTML } from 'html-recipe-parser'
import { IRecipe } from 'html-recipe-parser/dist/interfaces'
import { DateTime } from 'luxon'
import { NextApiRequest, NextApiResponse } from 'next'
import { Session, getServerSession } from 'next-auth'
import type { NextApiRequest, NextApiResponse } from 'next'
import { type Session, getServerSession } from 'next-auth'
import { RecipeJsonLdProps } from 'next-seo'
import { NextRequest, NextResponse } from 'next/server'
import { v4 } from 'uuid'
Expand Down
4 changes: 2 additions & 2 deletions pages/api/database/user/[id]/follow.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import prisma from '#pages/api/_base'
import { authOptions } from '#pages/api/auth/[...nextauth]'
import { NextApiRequest, NextApiResponse } from 'next'
import { Session, getServerSession } from 'next-auth'
import type { NextApiRequest, NextApiResponse } from 'next'
import { type Session, getServerSession } from 'next-auth'

const handler = async (req: NextApiRequest, res: NextApiResponse) => {
try {
Expand Down
2 changes: 1 addition & 1 deletion pages/api/database/user/[id]/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import prisma from '#pages/api/_base'
import { NextApiRequest, NextApiResponse } from 'next'
import type { NextApiRequest, NextApiResponse } from 'next'

const handler = async (req: NextApiRequest, res: NextApiResponse) => {
try {
Expand Down
4 changes: 2 additions & 2 deletions pages/api/database/user/image.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { put } from '@vercel/blob'
import { NextApiRequest, NextApiResponse } from 'next'
import { Session, getServerSession } from 'next-auth'
import type { NextApiRequest, NextApiResponse } from 'next'
import { type Session, getServerSession } from 'next-auth'
import { authOptions } from '#pages/api/auth/[...nextauth]'

const handler = async (req: NextApiRequest, res: NextApiResponse) => {
Expand Down
4 changes: 2 additions & 2 deletions pages/auth/signin.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Facebook, Google } from '@mui/icons-material'
import { Box, Button, TextField, Typography } from '@mui/material'
import { GetStaticProps } from 'next'
import type { GetStaticProps } from 'next'
import { signIn, useSession } from 'next-auth/react'
import { useTranslation } from 'next-i18next'
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
import { NextSeo } from 'next-seo'
import { useRouter as useNavigation, useSearchParams } from 'next/navigation'
import { FC, useEffect, useState } from 'react'
import { type FC, useEffect, useState } from 'react'
import { toast } from 'sonner'

export const SigninPage: FC = () => {
Expand Down
2 changes: 1 addition & 1 deletion pages/auth/signout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { signOut } from 'next-auth/react'
import { useRouter as useNavigation } from 'next/navigation'
import React, { FC, useEffect } from 'react'
import React, { type FC, useEffect } from 'react'
import { toast } from 'sonner'

const SignoutPage: FC = () => {
Expand Down
2 changes: 1 addition & 1 deletion pages/feed.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GetStaticProps } from 'next'
import type { GetStaticProps } from 'next'
import { useSession } from 'next-auth/react'
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
import React from 'react'
Expand Down
15 changes: 11 additions & 4 deletions pages/fridge.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import CreateIngredientDialog from '#components/Recipe/StepsTextField/CreateIngredientDialog'
import { YKResponse } from '#models/ykResponse'
import type { YKResponse } from '#models/ykResponse'
import { api } from '#network/index'
import { validUnits } from '#utils/validator'
import {
Autocomplete,
AutocompleteRenderInputParams,
type AutocompleteRenderInputParams,
Box,
Button,
Dialog,
Expand All @@ -21,9 +21,14 @@ import {
Typography,
debounce,
} from '@mui/material'
import { Fridge, FridgeIngredient, Ingredient, Unit } from '@prisma/client'
import {
type Fridge,
type FridgeIngredient,
type Ingredient,
Unit,
} from '@prisma/client'
import { useSession } from 'next-auth/react'
import React, { FC, useMemo, useState } from 'react'
import React, { type FC, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { toast } from 'sonner'
import useSWR from 'swr'
Expand Down Expand Up @@ -262,6 +267,7 @@ const FridgePage: FC = () => {
const ingredient = fridgeIngredient.ingredient
return (
<Box
key={fridgeIngredient.ingredientId}
sx={{
width: 100,
height: 100,
Expand Down Expand Up @@ -290,6 +296,7 @@ const FridgePage: FC = () => {
const ingredient = fridgeIngredient.ingredient
return (
<Box
key={fridgeIngredient.ingredientId}
sx={{
display: 'flex',
flexDirection: 'column',
Expand Down
Loading

0 comments on commit f05cf85

Please sign in to comment.