From 7da88af0d676a460c8f17bc195c65d140b65099d Mon Sep 17 00:00:00 2001 From: eduardruzga Date: Tue, 26 Nov 2024 12:31:25 +0200 Subject: [PATCH] Extract chat box from base chat --- app/components/chat/BaseChat.tsx | 182 ++++----------------------- app/components/chat/ChatBox.tsx | 205 +++++++++++++++++++++++++++++++ 2 files changed, 230 insertions(+), 157 deletions(-) create mode 100644 app/components/chat/ChatBox.tsx diff --git a/app/components/chat/BaseChat.tsx b/app/components/chat/BaseChat.tsx index dc6aecc8f..74ea8cad2 100644 --- a/app/components/chat/BaseChat.tsx +++ b/app/components/chat/BaseChat.tsx @@ -6,62 +6,18 @@ import type { Message } from 'ai'; import React, { type RefCallback, useEffect, useState } from 'react'; import { ClientOnly } from 'remix-utils/client-only'; import { Menu } from '~/components/sidebar/Menu.client'; -import { IconButton } from '~/components/ui/IconButton'; import { Workbench } from '~/components/workbench/Workbench.client'; import { classNames } from '~/utils/classNames'; -import { MODEL_LIST, PROVIDER_LIST, initializeModelList } from '~/utils/constants'; +import { MODEL_LIST, initializeModelList } from '~/utils/constants'; import { Messages } from './Messages.client'; -import { SendButton } from './SendButton.client'; -import { APIKeyManager } from './APIKeyManager'; import Cookies from 'js-cookie'; import * as Tooltip from '@radix-ui/react-tooltip'; import styles from './BaseChat.module.scss'; import type { ProviderInfo } from '~/utils/types'; -import { ExportChatButton } from '~/components/chat/chatExportAndImport/ExportChatButton'; import { ImportButtons } from '~/components/chat/chatExportAndImport/ImportButtons'; import { ExamplePrompts } from '~/components/chat/ExamplePrompts'; - -// @ts-ignore TODO: Introduce proper types -// eslint-disable-next-line @typescript-eslint/no-unused-vars -const ModelSelector = ({ model, setModel, provider, setProvider, modelList, providerList, apiKeys }) => { - return ( -
- - -
- ); -}; - -const TEXTAREA_MIN_HEIGHT = 76; +import { ChatBox } from '~/components/chat/ChatBox'; interface BaseChatProps { textareaRef?: React.RefObject | undefined; @@ -197,118 +153,30 @@ export const BaseChat = React.forwardRef( ) : null; }} -
- - - {provider && ( - updateApiKey(provider.name, key)} - /> - )} - -
-