From 2d0503f2a92eee5e7174cc6d5a830678f429dd74 Mon Sep 17 00:00:00 2001 From: Jared Palmer Date: Fri, 15 Nov 2024 12:22:19 -0500 Subject: [PATCH] Move ai folder to lib/ --- app/(chat)/actions.ts | 2 +- app/(chat)/api/chat/route.ts | 8 ++++---- app/(chat)/chat/[id]/page.tsx | 2 +- app/(chat)/page.tsx | 2 +- components/model-selector.tsx | 2 +- {ai => lib/ai}/custom-middleware.ts | 0 {ai => lib/ai}/index.ts | 0 {ai => lib/ai}/models.ts | 0 {ai => lib/ai}/prompts.ts | 0 9 files changed, 8 insertions(+), 8 deletions(-) rename {ai => lib/ai}/custom-middleware.ts (100%) rename {ai => lib/ai}/index.ts (100%) rename {ai => lib/ai}/models.ts (100%) rename {ai => lib/ai}/prompts.ts (100%) diff --git a/app/(chat)/actions.ts b/app/(chat)/actions.ts index e67e36a68..2b19fc982 100644 --- a/app/(chat)/actions.ts +++ b/app/(chat)/actions.ts @@ -3,7 +3,7 @@ import { CoreMessage, type CoreUserMessage, generateText } from 'ai'; import { cookies } from 'next/headers'; -import { customModel } from '@/ai'; +import { customModel } from '@/lib/ai'; export async function saveModelId(model: string) { const cookieStore = await cookies(); diff --git a/app/(chat)/api/chat/route.ts b/app/(chat)/api/chat/route.ts index 4f9e01f6a..bf5c5bc1a 100644 --- a/app/(chat)/api/chat/route.ts +++ b/app/(chat)/api/chat/route.ts @@ -1,16 +1,16 @@ import { - convertToCoreMessages, type Message, StreamData, + convertToCoreMessages, streamObject, streamText, } from 'ai'; import { z } from 'zod'; -import { customModel } from '@/ai'; -import { models } from '@/ai/models'; -import { systemPrompt } from '@/ai/prompts'; import { auth } from '@/app/(auth)/auth'; +import { customModel } from '@/lib/ai'; +import { models } from '@/lib/ai/models'; +import { systemPrompt } from '@/lib/ai/prompts'; import { deleteChatById, getChatById, diff --git a/app/(chat)/chat/[id]/page.tsx b/app/(chat)/chat/[id]/page.tsx index 4c175e063..839bc7d16 100644 --- a/app/(chat)/chat/[id]/page.tsx +++ b/app/(chat)/chat/[id]/page.tsx @@ -2,9 +2,9 @@ import { CoreMessage } from 'ai'; import { cookies } from 'next/headers'; import { notFound } from 'next/navigation'; -import { DEFAULT_MODEL_NAME, models } from '@/ai/models'; import { auth } from '@/app/(auth)/auth'; import { Chat as PreviewChat } from '@/components/chat'; +import { DEFAULT_MODEL_NAME, models } from '@/lib/ai/models'; import { getChatById, getMessagesByChatId } from '@/lib/db/queries'; import { convertToUIMessages } from '@/lib/utils'; diff --git a/app/(chat)/page.tsx b/app/(chat)/page.tsx index cad481752..c837e5894 100644 --- a/app/(chat)/page.tsx +++ b/app/(chat)/page.tsx @@ -1,7 +1,7 @@ import { cookies } from 'next/headers'; -import { DEFAULT_MODEL_NAME, models } from '@/ai/models'; import { Chat } from '@/components/chat'; +import { DEFAULT_MODEL_NAME, models } from '@/lib/ai/models'; import { generateUUID } from '@/lib/utils'; export default async function Page() { diff --git a/components/model-selector.tsx b/components/model-selector.tsx index 9e1a4d6d5..aac424f31 100644 --- a/components/model-selector.tsx +++ b/components/model-selector.tsx @@ -2,7 +2,6 @@ import { startTransition, useMemo, useOptimistic, useState } from 'react'; -import { models } from '@/ai/models'; import { saveModelId } from '@/app/(chat)/actions'; import { Button } from '@/components/ui/button'; import { @@ -11,6 +10,7 @@ import { DropdownMenuItem, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu'; +import { models } from '@/lib/ai/models'; import { cn } from '@/lib/utils'; import { CheckCirclFillIcon, ChevronDownIcon } from './icons'; diff --git a/ai/custom-middleware.ts b/lib/ai/custom-middleware.ts similarity index 100% rename from ai/custom-middleware.ts rename to lib/ai/custom-middleware.ts diff --git a/ai/index.ts b/lib/ai/index.ts similarity index 100% rename from ai/index.ts rename to lib/ai/index.ts diff --git a/ai/models.ts b/lib/ai/models.ts similarity index 100% rename from ai/models.ts rename to lib/ai/models.ts diff --git a/ai/prompts.ts b/lib/ai/prompts.ts similarity index 100% rename from ai/prompts.ts rename to lib/ai/prompts.ts