mirror of
https://github.com/AppFlowy-IO/AppFlowy-Web.git
synced 2025-12-01 20:08:10 +08:00
chore: ref
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { ChatProps } from '../types';
|
||||
import { ChatProps } from '@/components/chat/types';
|
||||
import { createContext, useContext } from 'react';
|
||||
|
||||
export const ChatContext = createContext<ChatProps | undefined>(undefined);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import Main from './main';
|
||||
import { TooltipProvider } from '../components/ui/tooltip';
|
||||
import { ChatI18nContext, getI18n, initI18n } from '../i18n/config';
|
||||
import { ChatProps } from '../types';
|
||||
import { Toaster } from '../components/ui/toaster';
|
||||
import '../styles/index.scss';
|
||||
import { TooltipProvider } from '@/components/chat/components/ui/tooltip';
|
||||
import { ChatI18nContext, getI18n, initI18n } from '@/components/chat/i18n/config';
|
||||
import { ChatProps } from '@/components/chat/types';
|
||||
import { Toaster } from '@/components/chat/components/ui/toaster';
|
||||
import '@/components/chat/styles/index.scss';
|
||||
|
||||
export * from '../provider/prompt-modal-provider';
|
||||
export * from '../provider/view-loader-provider';
|
||||
export * from '@/components/chat/provider/prompt-modal-provider';
|
||||
export * from '@/components/chat/provider/view-loader-provider';
|
||||
|
||||
initI18n();
|
||||
const i18n = getI18n();
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
// Code: Chat main component
|
||||
import { ChatContext } from './context';
|
||||
import { ChatInput } from '../components/chat-input';
|
||||
import { ChatMessages } from '../components/chat-messages';
|
||||
import { cn } from '../lib/utils';
|
||||
import { MessageAnimationProvider } from '../provider/message-animation-provider';
|
||||
import { EditorProvider } from '../provider/editor-provider';
|
||||
import { MessagesHandlerProvider } from '../provider/messages-handler-provider';
|
||||
import { ChatMessagesProvider } from '../provider/messages-provider';
|
||||
import { PromptModalProvider } from '../provider/prompt-modal-provider';
|
||||
import { ResponseFormatProvider } from '../provider/response-format-provider';
|
||||
import { SelectionModeProvider } from '../provider/selection-mode-provider';
|
||||
import { SuggestionsProvider } from '../provider/suggestions-provider';
|
||||
import { ChatProps } from '../types';
|
||||
import { ChatInput } from '@/components/chat/components/chat-input';
|
||||
import { ChatMessages } from '@/components/chat/components/chat-messages';
|
||||
import { cn } from '@/components/chat/lib/utils';
|
||||
import { MessageAnimationProvider } from '@/components/chat/provider/message-animation-provider';
|
||||
import { EditorProvider } from '@/components/chat/provider/editor-provider';
|
||||
import { MessagesHandlerProvider } from '@/components/chat/provider/messages-handler-provider';
|
||||
import { ChatMessagesProvider } from '@/components/chat/provider/messages-provider';
|
||||
import { PromptModalProvider } from '@/components/chat/provider/prompt-modal-provider';
|
||||
import { ResponseFormatProvider } from '@/components/chat/provider/response-format-provider';
|
||||
import { SelectionModeProvider } from '@/components/chat/provider/selection-mode-provider';
|
||||
import { SuggestionsProvider } from '@/components/chat/provider/suggestions-provider';
|
||||
import { ChatProps } from '@/components/chat/types';
|
||||
import { AnimatePresence, motion } from 'framer-motion';
|
||||
import { ViewLoaderProvider } from '../provider/view-loader-provider';
|
||||
import { ViewLoaderProvider } from '@/components/chat/provider/view-loader-provider';
|
||||
|
||||
function Main(props: ChatProps) {
|
||||
const { currentUser, selectionMode } = props;
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import { useChatContext } from '../../chat/context';
|
||||
import { useChatContext } from '@/components/chat/chat/context';
|
||||
import { SpaceList } from '../add-messages-to-page-wrapper/space-list';
|
||||
import { Label } from '../ui/label';
|
||||
import { SearchInput } from '../ui/search-input';
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '../ui/popover';
|
||||
import { Separator } from '../ui/separator';
|
||||
import { toast } from '../../hooks/use-toast';
|
||||
import { useViewContentInserter } from '../../hooks/use-view-content-inserter';
|
||||
import { useTranslation } from '../../i18n';
|
||||
import { useEditorContext } from '../../provider/editor-provider';
|
||||
import { ChatMessage } from '../../types';
|
||||
import { Label } from '@/components/chat/components/ui/label';
|
||||
import { SearchInput } from '@/components/chat/components/ui/search-input';
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '@/components/chat/components/ui/popover';
|
||||
import { Separator } from '@/components/chat/components/ui/separator';
|
||||
import { toast } from '@/components/chat/hooks/use-toast';
|
||||
import { useViewContentInserter } from '@/components/chat/hooks/use-view-content-inserter';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { useEditorContext } from '@/components/chat/provider/editor-provider';
|
||||
import { ChatMessage } from '@/components/chat/types';
|
||||
import { useCallback, useState } from 'react';
|
||||
import { useViewLoader } from '../../provider/view-loader-provider';
|
||||
import { useViewLoader } from '@/components/chat/provider/view-loader-provider';
|
||||
|
||||
export function AddMessageToPageWrapper({ onFinished, messages, children }: {
|
||||
messages: ChatMessage[];
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import ViewList from '../add-messages-to-page-wrapper/view-list';
|
||||
import { Button } from '../ui/button';
|
||||
import LoadingDots from '../ui/loading-dots';
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../ui/tooltip';
|
||||
import SpaceItem from '../view/space-item';
|
||||
import { useTranslation } from '../../i18n';
|
||||
import { searchViews } from '../../lib/views';
|
||||
import { View } from '../../types';
|
||||
import { Button } from '@/components/chat/components/ui/button';
|
||||
import LoadingDots from '@/components/chat/components/ui/loading-dots';
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/chat/components/ui/tooltip';
|
||||
import SpaceItem from '@/components/chat/components/view/space-item';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { searchViews } from '@/components/chat/lib/views';
|
||||
import { View } from '@/components/chat/types';
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { PlusIcon } from 'lucide-react';
|
||||
import { useViewLoader } from '../../provider/view-loader-provider';
|
||||
import { useViewLoader } from '@/components/chat/provider/view-loader-provider';
|
||||
|
||||
export function SpaceList({
|
||||
searchValue,
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { ReactComponent as ChevronDown } from '../../assets/icons/drop_menu_show.svg';
|
||||
import { Button } from '../ui/button';
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../ui/tooltip';
|
||||
import PageIcon from '../view/page-icon';
|
||||
import { useTranslation } from '../../i18n';
|
||||
import { cn } from '../../lib/utils';
|
||||
import { View } from '../../types';
|
||||
import { ReactComponent as ChevronDown } from '@/components/chat/assets/icons/drop_menu_show.svg';
|
||||
import { Button } from '@/components/chat/components/ui/button';
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/chat/components/ui/tooltip';
|
||||
import PageIcon from '@/components/chat/components/view/page-icon';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { cn } from '@/components/chat/lib/utils';
|
||||
import { View } from '@/components/chat/types';
|
||||
import { PlusIcon } from 'lucide-react';
|
||||
import { useMemo, useState } from 'react';
|
||||
import { ReactComponent as AddPageIcon } from '../../assets/icons/doc-forward.svg';
|
||||
import { ReactComponent as AddPageIcon } from '@/components/chat/assets/icons/doc-forward.svg';
|
||||
|
||||
export function ViewItem({ view, children, onCreateViewWithContent, onInsertContentToView }: {
|
||||
view: View;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ViewItem } from '../add-messages-to-page-wrapper/view-item';
|
||||
import { View } from '../../types';
|
||||
import { View } from '@/components/chat/types';
|
||||
|
||||
function ViewList({
|
||||
item,
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { Button } from '../ui/button';
|
||||
import { Separator } from '../ui/separator';
|
||||
import { useTranslation } from '../../i18n';
|
||||
import { ReactComponent as ImproveWritingIcon } from '../../assets/icons/improve-writing.svg';
|
||||
import { ReactComponent as AskAIIcon } from '../../assets/icons/ai.svg';
|
||||
import { ReactComponent as FixSpellingIcon } from '../../assets/icons/fix-spelling.svg';
|
||||
import { ReactComponent as ExplainIcon } from '../../assets/icons/explain.svg';
|
||||
import { ReactComponent as MakeLongerIcon } from '../../assets/icons/make-longer.svg';
|
||||
import { ReactComponent as MakeShorterIcon } from '../../assets/icons/make-shorter.svg';
|
||||
import { ReactComponent as ContinueWritingIcon } from '../../assets/icons/continue-writing.svg';
|
||||
import { AIAssistantType } from '../../types';
|
||||
import { useWriterContext } from '../../writer/context';
|
||||
import { Button } from '@/components/chat/components/ui/button';
|
||||
import { Separator } from '@/components/chat/components/ui/separator';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { ReactComponent as ImproveWritingIcon } from '@/components/chat/assets/icons/improve-writing.svg';
|
||||
import { ReactComponent as AskAIIcon } from '@/components/chat/assets/icons/ai.svg';
|
||||
import { ReactComponent as FixSpellingIcon } from '@/components/chat/assets/icons/fix-spelling.svg';
|
||||
import { ReactComponent as ExplainIcon } from '@/components/chat/assets/icons/explain.svg';
|
||||
import { ReactComponent as MakeLongerIcon } from '@/components/chat/assets/icons/make-longer.svg';
|
||||
import { ReactComponent as MakeShorterIcon } from '@/components/chat/assets/icons/make-shorter.svg';
|
||||
import { ReactComponent as ContinueWritingIcon } from '@/components/chat/assets/icons/continue-writing.svg';
|
||||
import { AIAssistantType } from '@/components/chat/types';
|
||||
import { useWriterContext } from '@/components/chat/writer/context';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
export function AiWriterMenuContent({ input, onClicked, isFilterOut }: {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { Button } from '../ui/button';
|
||||
import { Button } from '@/components/chat/components/ui/button';
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogDescription, DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from '../ui/dialog';
|
||||
import { useTranslation } from '../../i18n';
|
||||
import { useWriterContext } from '../../writer/context';
|
||||
} from '@/components/chat/components/ui/dialog';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { useWriterContext } from '@/components/chat/writer/context';
|
||||
import React from 'react';
|
||||
|
||||
export const ConfirmDiscard = React.forwardRef<HTMLDivElement, {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useTranslation } from '../../i18n';
|
||||
import { ERROR_CODE_NO_LIMIT } from '../../lib/const';
|
||||
import { useWriterContext } from '../../writer/context';
|
||||
import { ReactComponent as XCircleIcon } from '../../assets/icons/error.svg';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { ERROR_CODE_NO_LIMIT } from '@/components/chat/lib/const';
|
||||
import { useWriterContext } from '@/components/chat/writer/context';
|
||||
import { ReactComponent as XCircleIcon } from '@/components/chat/assets/icons/error.svg';
|
||||
|
||||
export function Error() {
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { usePromptModal } from '../../provider/prompt-modal-provider';
|
||||
import { ConfirmDiscard } from '../ai-writer/confirm-discard';
|
||||
import { Error } from '../ai-writer/error';
|
||||
import { Loading } from '../ai-writer/loading';
|
||||
import { AskAnything } from '../ai-writer/tools/ask-anything';
|
||||
import { Explain } from '../ai-writer/tools/explain';
|
||||
import { FixSpelling } from '../ai-writer/tools/fix-spelling';
|
||||
import { ImproveWriting } from '../ai-writer/tools/improve-writing';
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '../ui/popover';
|
||||
import { useTranslation } from '../../i18n';
|
||||
import { AIAssistantType } from '../../types';
|
||||
import { useWriterContext } from '../../writer/context';
|
||||
import { usePromptModal } from '@/components/chat/provider/prompt-modal-provider';
|
||||
import { ConfirmDiscard } from '@/components/chat/components/ai-writer/confirm-discard';
|
||||
import { Error } from '@/components/chat/components/ai-writer/error';
|
||||
import { Loading } from '@/components/chat/components/ai-writer/loading';
|
||||
import { AskAnything } from '@/components/chat/components/ai-writer/tools/ask-anything';
|
||||
import { Explain } from '@/components/chat/components/ai-writer/tools/explain';
|
||||
import { FixSpelling } from '@/components/chat/components/ai-writer/tools/fix-spelling';
|
||||
import { ImproveWriting } from '@/components/chat/components/ai-writer/tools/improve-writing';
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '@/components/chat/components/ui/popover';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { AIAssistantType } from '@/components/chat/types';
|
||||
import { useWriterContext } from '@/components/chat/writer/context';
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
|
||||
type PointerDownOutsideEvent = CustomEvent<{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Button } from '../ui/button';
|
||||
import LoadingDots from '../ui/loading-dots';
|
||||
import { useTranslation } from '../../i18n';
|
||||
import { useWriterContext } from '../../writer/context';
|
||||
import { ReactComponent as StopIcon } from '../../assets/icons/stop.svg';
|
||||
import { Button } from '@/components/chat/components/ui/button';
|
||||
import LoadingDots from '@/components/chat/components/ui/loading-dots';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { useWriterContext } from '@/components/chat/writer/context';
|
||||
import { ReactComponent as StopIcon } from '@/components/chat/assets/icons/stop.svg';
|
||||
|
||||
export function Loading() {
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Alert, AlertDescription } from '../ui/alert';
|
||||
import { Alert, AlertDescription } from '@/components/chat/components/ui/alert';
|
||||
|
||||
import { Editor, EditorData, useEditor } from '@appflowyinc/editor';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ReactComponent as TryAgainIcon } from '../../../assets/icons/undo.svg';
|
||||
import { ReactComponent as TryAgainIcon } from '@/components/chat/assets/icons/undo.svg';
|
||||
import { CommentWithAskAnything } from './with-comment';
|
||||
import { useTranslation } from '../../../i18n';
|
||||
import { useWriterContext } from '../../../writer/context';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { useWriterContext } from '@/components/chat/writer/context';
|
||||
import { CheckIcon, XIcon } from 'lucide-react';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { RenderEditor } from '../render-editor';
|
||||
import { Button } from '../../ui/button';
|
||||
import { Label } from '../../ui/label';
|
||||
import { useTranslation } from '../../../i18n';
|
||||
import { useWriterContext } from '../../../writer/context';
|
||||
import { Button } from '@/components/chat/components/ui/button';
|
||||
import { Label } from '@/components/chat/components/ui/label';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { useWriterContext } from '@/components/chat/writer/context';
|
||||
import { EditorProvider } from '@appflowyinc/editor';
|
||||
import { XIcon } from 'lucide-react';
|
||||
import { ReactComponent as InsertBelowIcon } from '../../../assets/icons/insert-below.svg';
|
||||
import { ReactComponent as TryAgainIcon } from '../../../assets/icons/undo.svg';
|
||||
import { ReactComponent as InsertBelowIcon } from '@/components/chat/assets/icons/insert-below.svg';
|
||||
import { ReactComponent as TryAgainIcon } from '@/components/chat/assets/icons/undo.svg';
|
||||
|
||||
export function ExplainToolbar() {
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ExplainToolbar } from './explain-toolbar';
|
||||
import { WritingInput } from '../writing-input';
|
||||
import { ApplyingState, useWriterContext } from '../../../writer/context';
|
||||
import { ApplyingState, useWriterContext } from '@/components/chat/writer/context';
|
||||
import { useCallback } from 'react';
|
||||
|
||||
export function Explain() {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { CommentWithAskAnything } from './with-comment';
|
||||
|
||||
import { useTranslation } from '../../../i18n';
|
||||
import { useWriterContext } from '../../../writer/context';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { useWriterContext } from '@/components/chat/writer/context';
|
||||
import { useMemo } from 'react';
|
||||
import { CheckIcon, XIcon } from 'lucide-react';
|
||||
import { ReactComponent as TryAgainIcon } from '../../../assets/icons/undo.svg';
|
||||
import { ReactComponent as InsertBelowIcon } from '../../../assets/icons/insert-below.svg';
|
||||
import { ReactComponent as TryAgainIcon } from '@/components/chat/assets/icons/undo.svg';
|
||||
import { ReactComponent as InsertBelowIcon } from '@/components/chat/assets/icons/insert-below.svg';
|
||||
|
||||
export function FixSpelling() {
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { CommentWithAskAnything } from './with-comment';
|
||||
|
||||
import { useTranslation } from '../../../i18n';
|
||||
import { useWriterContext } from '../../../writer/context';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { useWriterContext } from '@/components/chat/writer/context';
|
||||
import { useMemo } from 'react';
|
||||
import { CheckIcon, XIcon } from 'lucide-react';
|
||||
import { ReactComponent as TryAgainIcon } from '../../../assets/icons/undo.svg';
|
||||
import { ReactComponent as InsertBelowIcon } from '../../../assets/icons/insert-below.svg';
|
||||
import { ReactComponent as TryAgainIcon } from '@/components/chat/assets/icons/undo.svg';
|
||||
import { ReactComponent as InsertBelowIcon } from '@/components/chat/assets/icons/insert-below.svg';
|
||||
|
||||
export function ImproveWriting({
|
||||
title,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { RenderEditor } from '../render-editor';
|
||||
import { WritingInput } from '../writing-input';
|
||||
import { Button } from '../../ui/button';
|
||||
import { Label } from '../../ui/label';
|
||||
import { ApplyingState, useWriterContext } from '../../../writer/context';
|
||||
import { Button } from '@/components/chat/components/ui/button';
|
||||
import { Label } from '@/components/chat/components/ui/label';
|
||||
import { ApplyingState, useWriterContext } from '@/components/chat/writer/context';
|
||||
import { EditorProvider } from '@appflowyinc/editor';
|
||||
import { ReactNode, useCallback, useMemo } from 'react';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ApplyingState, useWriterContext } from '../../writer/context';
|
||||
import { ApplyingState, useWriterContext } from '@/components/chat/writer/context';
|
||||
import throttle from 'lodash-es/throttle';
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import LoadingDots from '../../ui/loading-dots';
|
||||
import { toast } from '../../../hooks/use-toast';
|
||||
import { useTranslation } from '../../../i18n';
|
||||
import { searchViews } from '../../../lib/views';
|
||||
import LoadingDots from '@/components/chat/components/ui/loading-dots';
|
||||
import { toast } from '@/components/chat/hooks/use-toast';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { searchViews } from '@/components/chat/lib/views';
|
||||
import { Spaces } from './spaces';
|
||||
import { Button } from '../../ui/button';
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '../../ui/popover';
|
||||
import { SearchInput } from '../../ui/search-input';
|
||||
import { Separator } from '../../ui/separator';
|
||||
import { useCheckboxTree } from '../../../hooks/use-checkbox-tree';
|
||||
import { View } from '../../../types';
|
||||
import { useWriterContext } from '../../../writer/context';
|
||||
import { Button } from '@/components/chat/components/ui/button';
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '@/components/chat/components/ui/popover';
|
||||
import { SearchInput } from '@/components/chat/components/ui/search-input';
|
||||
import { Separator } from '@/components/chat/components/ui/separator';
|
||||
import { useCheckboxTree } from '@/components/chat/hooks/use-checkbox-tree';
|
||||
import { View } from '@/components/chat/types';
|
||||
import { useWriterContext } from '@/components/chat/writer/context';
|
||||
import { ChevronDown } from 'lucide-react';
|
||||
import { ReactComponent as DocIcon } from '../../../assets/icons/doc.svg';
|
||||
import { ReactComponent as DocIcon } from '@/components/chat/assets/icons/doc.svg';
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
|
||||
export function ViewTree() {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import ViewChildren from '../../view/view-children';
|
||||
import SpaceItem from '../../view/space-item';
|
||||
import LoadingDots from '../../ui/loading-dots';
|
||||
import { useTranslation } from '../../../i18n';
|
||||
import { View } from '../../../types';
|
||||
import { CheckStatus } from '../../../types/checkbox';
|
||||
import ViewChildren from '@/components/chat/components/view/view-children';
|
||||
import SpaceItem from '@/components/chat/components/view/space-item';
|
||||
import LoadingDots from '@/components/chat/components/ui/loading-dots';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { View } from '@/components/chat/types';
|
||||
import { CheckStatus } from '@/components/chat/types/checkbox';
|
||||
|
||||
interface SpacesProps {
|
||||
getCheckStatus: (view: View) => CheckStatus;
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
import { ReactComponent as SendIcon } from '../../assets/icons/arrow-up.svg';
|
||||
import { ReactComponent as AutoTextIcon } from '../../assets/icons/auto-text.svg';
|
||||
import { ReactComponent as ImageTextIcon } from '../../assets/icons/image-text.svg';
|
||||
import { ReactComponent as SendIcon } from '@/components/chat/assets/icons/arrow-up.svg';
|
||||
import { ReactComponent as AutoTextIcon } from '@/components/chat/assets/icons/auto-text.svg';
|
||||
import { ReactComponent as ImageTextIcon } from '@/components/chat/assets/icons/image-text.svg';
|
||||
import { ViewTree } from '../ai-writer/view-tree';
|
||||
import { WritingMore } from '../ai-writer/writing-more';
|
||||
import { Button } from '../ui/button';
|
||||
import { FormatGroup } from '../ui/format-group';
|
||||
import LoadingDots from '../ui/loading-dots';
|
||||
import { Textarea } from '../ui/textarea';
|
||||
import { Button } from '@/components/chat/components/ui/button';
|
||||
import { FormatGroup } from '@/components/chat/components/ui/format-group';
|
||||
import LoadingDots from '@/components/chat/components/ui/loading-dots';
|
||||
import { Textarea } from '@/components/chat/components/ui/textarea';
|
||||
import {
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
TooltipTrigger,
|
||||
} from '../ui/tooltip';
|
||||
import { toast } from '../../hooks/use-toast';
|
||||
import { useTranslation } from '../../i18n';
|
||||
import { cn } from '../../lib/utils';
|
||||
import { usePromptModal } from '../../provider/prompt-modal-provider';
|
||||
import { ChatInputMode } from '../../types';
|
||||
import { AiPrompt } from '../../types/prompt';
|
||||
import { useWriterContext } from '../../writer/context';
|
||||
} from '@/components/chat/components/ui/tooltip';
|
||||
import { toast } from '@/components/chat/hooks/use-toast';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { cn } from '@/components/chat/lib/utils';
|
||||
import { usePromptModal } from '@/components/chat/provider/prompt-modal-provider';
|
||||
import { ChatInputMode } from '@/components/chat/types';
|
||||
import { AiPrompt } from '@/components/chat/types/prompt';
|
||||
import { useWriterContext } from '@/components/chat/writer/context';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { PromptModal } from '../chat-input/prompt-modal';
|
||||
import { PromptModal } from '@/components/chat/components/chat-input/prompt-modal';
|
||||
|
||||
const MAX_HEIGHT = 200;
|
||||
// Prevent focus on page load and cause the page to scroll
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { AiWriterMenuContent } from '../ai-writer/ai-writer-menu-content';
|
||||
import { Button } from '../ui/button';
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '../ui/popover';
|
||||
import { useTranslation } from '../../i18n';
|
||||
import { AIAssistantType } from '../../types';
|
||||
import { useWriterContext } from '../../writer/context';
|
||||
import { Button } from '@/components/chat/components/ui/button';
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '@/components/chat/components/ui/popover';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { AIAssistantType } from '@/components/chat/types';
|
||||
import { useWriterContext } from '@/components/chat/writer/context';
|
||||
import { ChevronDown } from 'lucide-react';
|
||||
import { ReactComponent as MoreIcon } from '../../assets/icons/ai-more.svg';
|
||||
import { ReactComponent as MoreIcon } from '@/components/chat/assets/icons/ai-more.svg';
|
||||
import { useCallback, useState } from 'react';
|
||||
|
||||
export function WritingMore({ input }: {
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
import { motion } from 'framer-motion';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { ReactComponent as SendIcon } from '../../assets/icons/arrow-up.svg';
|
||||
import { ReactComponent as AutoTextIcon } from '../../assets/icons/auto-text.svg';
|
||||
import { ReactComponent as ImageTextIcon } from '../../assets/icons/image-text.svg';
|
||||
import { ReactComponent as StopIcon } from '../../assets/icons/stop.svg';
|
||||
import { useChatContext } from '../../chat/context';
|
||||
import { toast } from '../../hooks/use-toast';
|
||||
import { useTranslation } from '../../i18n';
|
||||
import { MESSAGE_VARIANTS } from '../../lib/animations';
|
||||
import { useMessagesHandlerContext } from '../../provider/messages-handler-provider';
|
||||
import { usePromptModal } from '../../provider/prompt-modal-provider';
|
||||
import { useResponseFormatContext } from '../../provider/response-format-provider';
|
||||
import { ChatInputMode } from '../../types';
|
||||
import { AiPrompt } from '../../types/prompt';
|
||||
import { Button } from '../ui/button';
|
||||
import { FormatGroup } from '../ui/format-group';
|
||||
import LoadingDots from '../ui/loading-dots';
|
||||
import { Textarea } from '../ui/textarea';
|
||||
import { ReactComponent as SendIcon } from '@/components/chat/assets/icons/arrow-up.svg';
|
||||
import { ReactComponent as AutoTextIcon } from '@/components/chat/assets/icons/auto-text.svg';
|
||||
import { ReactComponent as ImageTextIcon } from '@/components/chat/assets/icons/image-text.svg';
|
||||
import { ReactComponent as StopIcon } from '@/components/chat/assets/icons/stop.svg';
|
||||
import { useChatContext } from '@/components/chat/chat/context';
|
||||
import { toast } from '@/components/chat/hooks/use-toast';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { MESSAGE_VARIANTS } from '@/components/chat/lib/animations';
|
||||
import { useMessagesHandlerContext } from '@/components/chat/provider/messages-handler-provider';
|
||||
import { usePromptModal } from '@/components/chat/provider/prompt-modal-provider';
|
||||
import { useResponseFormatContext } from '@/components/chat/provider/response-format-provider';
|
||||
import { ChatInputMode } from '@/components/chat/types';
|
||||
import { AiPrompt } from '@/components/chat/types/prompt';
|
||||
import { Button } from '@/components/chat/components/ui/button';
|
||||
import { FormatGroup } from '@/components/chat/components/ui/format-group';
|
||||
import LoadingDots from '@/components/chat/components/ui/loading-dots';
|
||||
import { Textarea } from '@/components/chat/components/ui/textarea';
|
||||
import {
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
TooltipTrigger,
|
||||
} from '../ui/tooltip';
|
||||
} from '@/components/chat/components/ui/tooltip';
|
||||
import { ModelSelector } from './model-selector';
|
||||
import { PromptModal } from './prompt-modal';
|
||||
import { RelatedViews } from './related-views';
|
||||
@@ -168,7 +168,7 @@ export function ChatInput() {
|
||||
>
|
||||
<div
|
||||
ref={containerRef}
|
||||
className={`relative justify-between gap-1 flex flex-col py-1 px-2 w-full rounded-[12px] border ${focused ? 'border-chat-primary ring-1 ring-ring' : 'border-chat-border'}`}
|
||||
className={`border relative justify-between gap-1 flex flex-col ${focused ? 'ring-1 ring-ring border-primary' : 'ring-0'} border-border py-1 px-2 focus:border-primary w-full rounded-[12px]`}
|
||||
>
|
||||
{responseMode === ChatInputMode.FormatResponse && (
|
||||
<FormatGroup
|
||||
@@ -204,7 +204,7 @@ export function ChatInput() {
|
||||
}}
|
||||
rows={1}
|
||||
className={
|
||||
'resize-none !text-sm caret-primary min-h-[32px] !py-1 !px-1.5 border-none shadow-none w-full !ring-0 h-full !outline-none'
|
||||
'resize-none !text-sm caret-primary min-h-[32px] !py-1 !px-1.5 !border-none !shadow-none w-full !ring-0 h-full !outline-none'
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -240,8 +240,15 @@ export function ChatInput() {
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
|
||||
<ModelSelector
|
||||
className={'h-7'}
|
||||
<Button
|
||||
variant={'ghost'}
|
||||
className={'h-7 text-xs'}
|
||||
>
|
||||
Test Model Button
|
||||
</Button>
|
||||
|
||||
<ModelSelector
|
||||
className={'h-7'}
|
||||
disabled={questionSending || answerApplying}
|
||||
/>
|
||||
|
||||
@@ -318,4 +325,4 @@ export function ChatInput() {
|
||||
</div>
|
||||
</motion.div>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,20 @@
|
||||
import { Check } from 'lucide-react';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
|
||||
import { ReactComponent as AISparksIcon } from '../../../assets/icons/ai_sparks.svg';
|
||||
import { ReactComponent as AISparksIcon } from '@/components/chat/assets/icons/ai_sparks.svg';
|
||||
|
||||
import { useChatContext } from '../../../chat/context';
|
||||
import { ModelCache } from '../../../lib/model-cache';
|
||||
import { cn } from '../../../lib/utils';
|
||||
import { useMessagesHandlerContext } from '../../../provider/messages-handler-provider';
|
||||
import { UpdateChatSettingsParams } from '../../../request/chat-request';
|
||||
import { AvailableModel, toModelDisplayInfo } from '../../../types/ai-model';
|
||||
import { Button } from '../../ui/button';
|
||||
import { useChatContext } from '@/components/chat/chat/context';
|
||||
import { ModelCache } from '@/components/chat/lib/model-cache';
|
||||
import { cn } from '@/components/chat/lib/utils';
|
||||
import { useMessagesHandlerContext } from '@/components/chat/provider/messages-handler-provider';
|
||||
import { UpdateChatSettingsParams } from '@/components/chat/request/chat-request';
|
||||
import { AvailableModel, toModelDisplayInfo } from '@/components/chat/types/ai-model';
|
||||
import { Button } from '@/components/chat/components/ui/button';
|
||||
import {
|
||||
Popover,
|
||||
PopoverContent,
|
||||
PopoverTrigger,
|
||||
} from '../../ui/popover';
|
||||
} from '@/components/chat/components/ui/popover';
|
||||
|
||||
interface ModelSelectorProps {
|
||||
className?: string;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Dialog, DialogContent, DialogTitle, DialogDescription } from '../../ui/dialog';
|
||||
import { useTranslation } from '../../../i18n';
|
||||
import { usePromptModal } from '../../../provider/prompt-modal-provider';
|
||||
import { AiPrompt, AiPromptCategory } from '../../../types/prompt';
|
||||
import { Dialog, DialogContent, DialogTitle, DialogDescription } from '@/components/chat/components/ui/dialog';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { usePromptModal } from '@/components/chat/provider/prompt-modal-provider';
|
||||
import { AiPrompt, AiPromptCategory } from '@/components/chat/types/prompt';
|
||||
import { SearchIcon } from 'lucide-react';
|
||||
import {
|
||||
forwardRef,
|
||||
@@ -13,12 +13,12 @@ import {
|
||||
} from 'react';
|
||||
import { PromptCard } from './prompt-card';
|
||||
import { PromptPreview } from './prompt-preview';
|
||||
import { ReactComponent as CloseCircle } from '../../../assets/icons/close_circle.svg';
|
||||
import { ReactComponent as CloseCircle } from '@/components/chat/assets/icons/close_circle.svg';
|
||||
import { PromptCategory } from './prompt-category';
|
||||
import { SearchInput } from '../../ui/search-input';
|
||||
import { Button } from '../../ui/button';
|
||||
import { SearchInput } from '@/components/chat/components/ui/search-input';
|
||||
import { Button } from '@/components/chat/components/ui/button';
|
||||
import { PromptDatabaseModal } from './prompt-database';
|
||||
import { useViewLoader } from '../../../provider/view-loader-provider';
|
||||
import { useViewLoader } from '@/components/chat/provider/view-loader-provider';
|
||||
|
||||
export const PromptModal = forwardRef<
|
||||
HTMLDivElement,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useTranslation } from '../../../i18n';
|
||||
import { cn } from '../../../lib/utils';
|
||||
import { AiPrompt } from '../../../types/prompt';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { cn } from '@/components/chat/lib/utils';
|
||||
import { AiPrompt } from '@/components/chat/types/prompt';
|
||||
import { useState } from 'react';
|
||||
|
||||
export function PromptCard({
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Button } from '../../ui/button';
|
||||
import { cn } from '../../../lib/utils';
|
||||
import { AiPromptCategory } from '../../../types/prompt';
|
||||
import { Separator } from '../../ui/separator';
|
||||
import { Button } from '@/components/chat/components/ui/button';
|
||||
import { cn } from '@/components/chat/lib/utils';
|
||||
import { AiPromptCategory } from '@/components/chat/types/prompt';
|
||||
import { Separator } from '@/components/chat/components/ui/separator';
|
||||
import { useMemo } from 'react';
|
||||
import { useTranslation } from '../../../i18n';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
|
||||
export function PromptCategory({
|
||||
isFeaturedSelected,
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
import { Button } from '../../../ui/button';
|
||||
import { Dialog, DialogContent, DialogTitle, DialogDescription } from '../../../ui/dialog';
|
||||
import { Button } from '@/components/chat/components/ui/button';
|
||||
import { Dialog, DialogContent, DialogTitle, DialogDescription } from '@/components/chat/components/ui/dialog';
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuRadioGroup,
|
||||
DropdownMenuRadioItem,
|
||||
DropdownMenuTrigger,
|
||||
} from '../../../ui/dropdown-menu';
|
||||
import { useTranslation } from '../../../../i18n';
|
||||
import { cn } from '../../../../lib/utils';
|
||||
import { usePromptModal } from '../../../../provider/prompt-modal-provider';
|
||||
} from '@/components/chat/components/ui/dropdown-menu';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { cn } from '@/components/chat/lib/utils';
|
||||
import { usePromptModal } from '@/components/chat/provider/prompt-modal-provider';
|
||||
import { ChevronDown } from 'lucide-react';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { PromptDatabaseViews } from './prompt-database-views';
|
||||
import { ReactComponent as CloseCircle } from '../../../../assets/icons/close_circle.svg';
|
||||
import { ReactComponent as CloseCircle } from '@/components/chat/assets/icons/close_circle.svg';
|
||||
import { InvalidDatabaseDialog } from './invalid-database-dialog';
|
||||
import { useViewLoader } from '../../../../provider/view-loader-provider';
|
||||
import { useViewLoader } from '@/components/chat/provider/view-loader-provider';
|
||||
|
||||
export function PromptDatabaseModal({
|
||||
isOpen,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Button } from '../../../ui/button';
|
||||
import { Button } from '@/components/chat/components/ui/button';
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
@@ -6,8 +6,8 @@ import {
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from '../../../ui/dialog';
|
||||
import { useTranslation } from '../../../../i18n';
|
||||
} from '@/components/chat/components/ui/dialog';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
|
||||
export function InvalidDatabaseDialog({
|
||||
isOpen,
|
||||
|
||||
@@ -2,9 +2,9 @@ import {
|
||||
Popover,
|
||||
PopoverContent,
|
||||
PopoverTrigger,
|
||||
} from '../../../ui/popover';
|
||||
import { SearchInput } from '../../../ui/search-input';
|
||||
import { Separator } from '../../../ui/separator';
|
||||
} from '@/components/chat/components/ui/popover';
|
||||
import { SearchInput } from '@/components/chat/components/ui/search-input';
|
||||
import { Separator } from '@/components/chat/components/ui/separator';
|
||||
import { ReactNode, useState } from 'react';
|
||||
import { SpaceList } from './space-list';
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { useViewLoader } from '../../../../provider/view-loader-provider';
|
||||
import LoadingDots from '../../../ui/loading-dots';
|
||||
import SpaceItem from '../../../view/space-item';
|
||||
import { useTranslation } from '../../../../i18n';
|
||||
import { hasDatabaseViewChild, searchDatabaseViews } from '../../../../lib/views';
|
||||
import { View } from '../../../../types';
|
||||
import { useViewLoader } from '@/components/chat/provider/view-loader-provider';
|
||||
import LoadingDots from '@/components/chat/components/ui/loading-dots';
|
||||
import SpaceItem from '@/components/chat/components/view/space-item';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { hasDatabaseViewChild, searchDatabaseViews } from '@/components/chat/lib/views';
|
||||
import { View } from '@/components/chat/types';
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import ViewList from './view-list';
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { ReactComponent as ChevronDown } from '../../../../assets/icons/drop_menu_show.svg';
|
||||
import { Button } from '../../../ui/button';
|
||||
import { ReactComponent as ChevronDown } from '@/components/chat/assets/icons/drop_menu_show.svg';
|
||||
import { Button } from '@/components/chat/components/ui/button';
|
||||
import {
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
TooltipProvider,
|
||||
TooltipTrigger,
|
||||
} from '../../../ui/tooltip';
|
||||
import PageIcon from '../../../view/page-icon';
|
||||
import { useTranslation } from '../../../../i18n';
|
||||
import { cn } from '../../../../lib/utils';
|
||||
import { View } from '../../../../types';
|
||||
} from '@/components/chat/components/ui/tooltip';
|
||||
import PageIcon from '@/components/chat/components/view/page-icon';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { cn } from '@/components/chat/lib/utils';
|
||||
import { View } from '@/components/chat/types';
|
||||
import { useMemo, useState } from 'react';
|
||||
|
||||
export function ViewItem({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { View } from '../../types';
|
||||
import { View } from '@/components/chat/types';
|
||||
import { ViewItem } from './view-item';
|
||||
|
||||
function ViewList({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Button } from '../../ui/button';
|
||||
import { useTranslation } from '../../../i18n';
|
||||
import { AiPrompt } from '../../../types/prompt';
|
||||
import { Button } from '@/components/chat/components/ui/button';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { AiPrompt } from '@/components/chat/types/prompt';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
export function PromptPreview({
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import LoadingDots from '../../ui/loading-dots';
|
||||
import { SearchInput } from '../../ui/search-input';
|
||||
import LoadingDots from '@/components/chat/components/ui/loading-dots';
|
||||
import { SearchInput } from '@/components/chat/components/ui/search-input';
|
||||
import { Spaces } from './spaces';
|
||||
import { Button } from '../../ui/button';
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '../../ui/popover';
|
||||
import { ReactComponent as DocIcon } from '../../../assets/icons/doc.svg';
|
||||
import { Separator } from '../../ui/separator';
|
||||
import { useChatSettingsLoader } from '../../../hooks/use-chat-settings-loader';
|
||||
import { useCheckboxTree } from '../../../hooks/use-checkbox-tree';
|
||||
import { searchViews } from '../../../lib/views';
|
||||
import { View } from '../../../types';
|
||||
import { Button } from '@/components/chat/components/ui/button';
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '@/components/chat/components/ui/popover';
|
||||
import { ReactComponent as DocIcon } from '@/components/chat/assets/icons/doc.svg';
|
||||
import { Separator } from '@/components/chat/components/ui/separator';
|
||||
import { useChatSettingsLoader } from '@/components/chat/hooks/use-chat-settings-loader';
|
||||
import { useCheckboxTree } from '@/components/chat/hooks/use-checkbox-tree';
|
||||
import { searchViews } from '@/components/chat/lib/views';
|
||||
import { View } from '@/components/chat/types';
|
||||
import { ChevronDown } from 'lucide-react';
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import debounce from 'lodash-es/debounce';
|
||||
import { useViewLoader } from '../../..';
|
||||
import { useViewLoader } from '@/components/chat';
|
||||
|
||||
export function RelatedViews() {
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import ViewChildren from '../../view/view-children';
|
||||
import SpaceItem from '../../view/space-item';
|
||||
import LoadingDots from '../../ui/loading-dots';
|
||||
import { useTranslation } from '../../../i18n';
|
||||
import { View } from '../../../types';
|
||||
import { CheckStatus } from '../../../types/checkbox';
|
||||
import ViewChildren from '@/components/chat/components/view/view-children';
|
||||
import SpaceItem from '@/components/chat/components/view/space-item';
|
||||
import LoadingDots from '@/components/chat/components/ui/loading-dots';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { View } from '@/components/chat/types';
|
||||
import { CheckStatus } from '@/components/chat/types/checkbox';
|
||||
|
||||
interface SpacesProps {
|
||||
getCheckStatus: (view: View) => CheckStatus;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { AddMessageToPageWrapper } from '../add-messages-to-page-wrapper';
|
||||
import { Button } from '../ui/button';
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '../ui/tooltip';
|
||||
import { ReactComponent as AddPageIcon } from '../../assets/icons/doc-forward.svg';
|
||||
import { useTranslation } from '../../i18n';
|
||||
import { useChatMessagesContext } from '../../provider/messages-provider';
|
||||
import { AddMessageToPageWrapper } from '@/components/chat/components/add-messages-to-page-wrapper';
|
||||
import { Button } from '@/components/chat/components/ui/button';
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/chat/components/ui/tooltip';
|
||||
import { ReactComponent as AddPageIcon } from '@/components/chat/assets/icons/doc-forward.svg';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { useChatMessagesContext } from '@/components/chat/provider/messages-provider';
|
||||
|
||||
export function AddMessageTo({ id }: {
|
||||
id: number
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { AnswerMd } from '../chat-messages/answer-md';
|
||||
import { MessageActions } from '../chat-messages/message-actions';
|
||||
import MessageSources from '../chat-messages/message-sources';
|
||||
import { ChatMessageMetadata } from '../../types';
|
||||
import { ChatMessageMetadata } from '@/components/chat/types';
|
||||
import { EditorProvider } from '@appflowyinc/editor';
|
||||
import MessageCheckbox from './message-checkbox';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Alert, AlertDescription } from '../ui/alert';
|
||||
import { useEditorContext } from '../../provider/editor-provider';
|
||||
import { Alert, AlertDescription } from '@/components/chat/components/ui/alert';
|
||||
import { useEditorContext } from '@/components/chat/provider/editor-provider';
|
||||
import { Editor, useEditor } from '@appflowyinc/editor';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
|
||||
@@ -2,17 +2,17 @@ import { AnswerMd } from '../chat-messages/answer-md';
|
||||
import { MessageActions } from '../chat-messages/message-actions';
|
||||
import MessageSources from '../chat-messages/message-sources';
|
||||
import { MessageSuggestions } from '../chat-messages/message-suggestions';
|
||||
import LoadingDots from '../ui/loading-dots';
|
||||
import { useTranslation } from '../../i18n';
|
||||
import { useMessagesHandlerContext } from '../../provider/messages-handler-provider';
|
||||
import { useChatMessagesContext } from '../../provider/messages-provider';
|
||||
import { useResponseFormatContext } from '../../provider/response-format-provider';
|
||||
import { useSuggestionsContext } from '../../provider/suggestions-provider';
|
||||
import { ChatInputMode } from '../../types';
|
||||
import LoadingDots from '@/components/chat/components/ui/loading-dots';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { useMessagesHandlerContext } from '@/components/chat/provider/messages-handler-provider';
|
||||
import { useChatMessagesContext } from '@/components/chat/provider/messages-provider';
|
||||
import { useResponseFormatContext } from '@/components/chat/provider/response-format-provider';
|
||||
import { useSuggestionsContext } from '@/components/chat/provider/suggestions-provider';
|
||||
import { ChatInputMode } from '@/components/chat/types';
|
||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { Alert, AlertDescription } from '../ui/alert';
|
||||
import { Alert, AlertDescription } from '@/components/chat/components/ui/alert';
|
||||
import { EditorProvider } from '@appflowyinc/editor';
|
||||
import { ReactComponent as Error } from '../../assets/icons/error.svg';
|
||||
import { ReactComponent as Error } from '@/components/chat/assets/icons/error.svg';
|
||||
import MessageCheckbox from './message-checkbox';
|
||||
|
||||
export function AssistantMessage({ id, isHovered }: { id: number; isHovered: boolean }) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Button } from '../ui/button';
|
||||
import { Label } from '../ui/label';
|
||||
import { useTranslation } from '../../i18n';
|
||||
import { useMessagesHandlerContext } from '../../provider/messages-handler-provider';
|
||||
import { User } from '../../types';
|
||||
import { ReactComponent as Logo } from '../../assets/logo.svg';
|
||||
import { Button } from '@/components/chat/components/ui/button';
|
||||
import { Label } from '@/components/chat/components/ui/label';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { useMessagesHandlerContext } from '@/components/chat/provider/messages-handler-provider';
|
||||
import { User } from '@/components/chat/types';
|
||||
import { ReactComponent as Logo } from '@/components/chat/assets/logo.svg';
|
||||
import { useCallback } from 'react';
|
||||
|
||||
export function EmptyMessages({ currentUser }: {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Avatar, AvatarFallback } from '../ui/avatar';
|
||||
import { stringToColor } from '../../lib/utils';
|
||||
import { User } from '../../types';
|
||||
import { Avatar, AvatarFallback } from '@/components/chat/components/ui/avatar';
|
||||
import { stringToColor } from '@/components/chat/lib/utils';
|
||||
import { User } from '@/components/chat/types';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
function HumanQuestion({
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { useChatContext } from '../../chat/context';
|
||||
import { useChatContext } from '@/components/chat/chat/context';
|
||||
import { EmptyMessages } from '../chat-messages/empty-messages';
|
||||
import { Message } from '../chat-messages/message';
|
||||
import { useChatMessages } from '../chat-messages/use-chat-messages';
|
||||
import { Button } from '../ui/button';
|
||||
import LoadingDots from '../ui/loading-dots';
|
||||
import { useUserLoader } from '../../hooks/use-user-loader';
|
||||
import { ANIMATION_PRESETS } from '../../lib/animations';
|
||||
import { User } from '../../types';
|
||||
import { Button } from '@/components/chat/components/ui/button';
|
||||
import LoadingDots from '@/components/chat/components/ui/loading-dots';
|
||||
import { useUserLoader } from '@/components/chat/hooks/use-user-loader';
|
||||
import { ANIMATION_PRESETS } from '@/components/chat/lib/animations';
|
||||
import { User } from '@/components/chat/types';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import InfiniteScroll from 'react-infinite-scroll-component';
|
||||
import { ArrowDown } from 'lucide-react';
|
||||
import { motion } from 'framer-motion';
|
||||
import { cn } from '../../lib/utils';
|
||||
import { cn } from '@/components/chat/lib/utils';
|
||||
|
||||
const LoadingIndicator = () => (
|
||||
<div className="flex items-center justify-center w-full h-[48px]">
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import { ReactComponent as CopyIcon } from '../../assets/icons/copy.svg';
|
||||
import { ReactComponent as CopyIcon } from '@/components/chat/assets/icons/copy.svg';
|
||||
|
||||
import { useChatContext } from '../../chat/context';
|
||||
import { useChatContext } from '@/components/chat/chat/context';
|
||||
import AddMessageTo from '../chat-messages/add-message-to';
|
||||
import Regenerations from '../chat-messages/regenerations';
|
||||
import { Button } from '../ui/button';
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '../ui/tooltip';
|
||||
import { useToast } from '../../hooks/use-toast';
|
||||
import { useTranslation } from '../../i18n';
|
||||
import { convertToAppFlowyFragment } from '../../lib/copy';
|
||||
import { cn, convertToPageData } from '../../lib/utils';
|
||||
import { useEditorContext } from '../../provider/editor-provider';
|
||||
import { useChatMessagesContext } from '../../provider/messages-provider';
|
||||
import { Button } from '@/components/chat/components/ui/button';
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/chat/components/ui/tooltip';
|
||||
import { useToast } from '@/components/chat/hooks/use-toast';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { convertToAppFlowyFragment } from '@/components/chat/lib/copy';
|
||||
import { cn, convertToPageData } from '@/components/chat/lib/utils';
|
||||
import { useEditorContext } from '@/components/chat/provider/editor-provider';
|
||||
import { useChatMessagesContext } from '@/components/chat/provider/messages-provider';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
|
||||
export function MessageActions({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useChatContext } from '../../chat/context';
|
||||
import { Button } from '../ui/button';
|
||||
import { useChatMessagesContext } from '../../provider/messages-provider';
|
||||
import { useSelectionModeContext } from '../../provider/selection-mode-provider';
|
||||
import { useChatContext } from '@/components/chat/chat/context';
|
||||
import { Button } from '@/components/chat/components/ui/button';
|
||||
import { useChatMessagesContext } from '@/components/chat/provider/messages-provider';
|
||||
import { useSelectionModeContext } from '@/components/chat/provider/selection-mode-provider';
|
||||
import { useMemo } from 'react';
|
||||
import { CheckSquare, Square } from 'lucide-react';
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { useChatContext } from '../../chat/context';
|
||||
import { Button } from '../ui/button';
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '../ui/tooltip';
|
||||
import { useTranslation } from '../../i18n';
|
||||
import { ChatMessageMetadata, View } from '../../types';
|
||||
import { useChatContext } from '@/components/chat/chat/context';
|
||||
import { Button } from '@/components/chat/components/ui/button';
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/chat/components/ui/tooltip';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { ChatMessageMetadata, View } from '@/components/chat/types';
|
||||
import { ChevronDown } from 'lucide-react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { ReactComponent as DocumentIcon } from '../../assets/icons/doc.svg';
|
||||
import { useViewLoader } from '../../provider/view-loader-provider';
|
||||
import { ReactComponent as DocumentIcon } from '@/components/chat/assets/icons/doc.svg';
|
||||
import { useViewLoader } from '@/components/chat/provider/view-loader-provider';
|
||||
|
||||
function MessageSources({
|
||||
sources,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { useChatContext } from '../../chat/context';
|
||||
import { Button } from '../ui/button';
|
||||
import { Label } from '../ui/label';
|
||||
import { useTranslation } from '../../i18n';
|
||||
import { MESSAGE_VARIANTS } from '../../lib/animations';
|
||||
import { useMessagesHandlerContext } from '../../provider/messages-handler-provider';
|
||||
import { Suggestions } from '../../types';
|
||||
import { ReactComponent as ChatIcon } from '../../assets/icons/chat-outlined.svg';
|
||||
import { useChatContext } from '@/components/chat/chat/context';
|
||||
import { Button } from '@/components/chat/components/ui/button';
|
||||
import { Label } from '@/components/chat/components/ui/label';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { MESSAGE_VARIANTS } from '@/components/chat/lib/animations';
|
||||
import { useMessagesHandlerContext } from '@/components/chat/provider/messages-handler-provider';
|
||||
import { Suggestions } from '@/components/chat/types';
|
||||
import { ReactComponent as ChatIcon } from '@/components/chat/assets/icons/chat-outlined.svg';
|
||||
import { motion } from 'framer-motion';
|
||||
|
||||
interface MessageSuggestionsProps {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { AIAnswer } from '../chat-messages/ai-answer';
|
||||
import { AssistantMessage } from '../chat-messages/assistant-message';
|
||||
import HumanQuestion from '../chat-messages/human-question';
|
||||
import { MESSAGE_VARIANTS } from '../../lib/animations';
|
||||
import { cn } from '../../lib/utils';
|
||||
import { useMessageAnimation } from '../../provider/message-animation-provider';
|
||||
import { useChatMessagesContext } from '../../provider/messages-provider';
|
||||
import { useSelectionModeContext } from '../../provider/selection-mode-provider';
|
||||
import { AuthorType, User } from '../../types';
|
||||
import { MESSAGE_VARIANTS } from '@/components/chat/lib/animations';
|
||||
import { cn } from '@/components/chat/lib/utils';
|
||||
import { useMessageAnimation } from '@/components/chat/provider/message-animation-provider';
|
||||
import { useChatMessagesContext } from '@/components/chat/provider/messages-provider';
|
||||
import { useSelectionModeContext } from '@/components/chat/provider/selection-mode-provider';
|
||||
import { AuthorType, User } from '@/components/chat/types';
|
||||
import { motion } from 'framer-motion';
|
||||
import { useCallback, useMemo } from 'react';
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import { ReactComponent as RegenerateIcon } from '../../assets/icons/change-font.svg';
|
||||
import { ReactComponent as ChevronIcon } from '../../assets/icons/chevron.svg';
|
||||
import { ReactComponent as RegenerateCircleIcon } from '../../assets/icons/regenerate-circle.svg';
|
||||
import { ReactComponent as TryAgainIcon } from '../../assets/icons/undo.svg';
|
||||
import { FormatGroup } from '../ui/format-group';
|
||||
import { Button } from '../ui/button';
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '../ui/popover';
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '../ui/tooltip';
|
||||
import { useTranslation } from '../../i18n';
|
||||
import { useMessagesHandlerContext } from '../../provider/messages-handler-provider';
|
||||
import { useChatMessagesContext } from '../../provider/messages-provider';
|
||||
import { useResponseFormatContext } from '../../provider/response-format-provider';
|
||||
import { OutputContent, OutputLayout } from '../../types';
|
||||
import { ReactComponent as RegenerateIcon } from '@/components/chat/assets/icons/change-font.svg';
|
||||
import { ReactComponent as ChevronIcon } from '@/components/chat/assets/icons/chevron.svg';
|
||||
import { ReactComponent as RegenerateCircleIcon } from '@/components/chat/assets/icons/regenerate-circle.svg';
|
||||
import { ReactComponent as TryAgainIcon } from '@/components/chat/assets/icons/undo.svg';
|
||||
import { FormatGroup } from '@/components/chat/components/ui/format-group';
|
||||
import { Button } from '@/components/chat/components/ui/button';
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '@/components/chat/components/ui/popover';
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/chat/components/ui/tooltip';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { useMessagesHandlerContext } from '@/components/chat/provider/messages-handler-provider';
|
||||
import { useChatMessagesContext } from '@/components/chat/provider/messages-provider';
|
||||
import { useResponseFormatContext } from '@/components/chat/provider/response-format-provider';
|
||||
import { OutputContent, OutputLayout } from '@/components/chat/types';
|
||||
import { useCallback, useState } from 'react';
|
||||
|
||||
export function Regenerations({ id }: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useMessagesHandlerContext } from '../../provider/messages-handler-provider';
|
||||
import { useChatMessagesContext } from '../../provider/messages-provider';
|
||||
import { useMessagesHandlerContext } from '@/components/chat/provider/messages-handler-provider';
|
||||
import { useChatMessagesContext } from '@/components/chat/provider/messages-provider';
|
||||
import { useCallback, useRef, useState } from 'react';
|
||||
|
||||
const DEFAULT_LIMIT = 20;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { useChatContext } from '../../chat/context';
|
||||
import { AddMessageToPageWrapper } from '../add-messages-to-page-wrapper';
|
||||
import { Button } from '../ui/button';
|
||||
import { useTranslation } from '../../i18n';
|
||||
import { ChatMessage } from '../../types';
|
||||
import { CheckStatus } from '../../types/checkbox';
|
||||
import { useChatContext } from '@/components/chat/chat/context';
|
||||
import { AddMessageToPageWrapper } from '@/components/chat/components/add-messages-to-page-wrapper';
|
||||
import { Button } from '@/components/chat/components/ui/button';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { ChatMessage } from '@/components/chat/types';
|
||||
import { CheckStatus } from '@/components/chat/types/checkbox';
|
||||
import { CheckSquare, Minus, Square, X } from 'lucide-react';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ChatMessage } from '../../types';
|
||||
import { ChatMessage } from '@/components/chat/types';
|
||||
import { createContext, useContext } from 'react';
|
||||
|
||||
interface SelectionContextType {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Slot } from '@radix-ui/react-slot';
|
||||
import { cva, type VariantProps } from 'class-variance-authority';
|
||||
import * as React from 'react';
|
||||
|
||||
import { cn } from '../../lib/utils';
|
||||
import { cn } from '@/components/chat/lib/utils';
|
||||
|
||||
const buttonVariants = cva(
|
||||
'inline-flex items-center justify-center gap-2 whitespace-nowrap disabled:pointer-events-none [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none aria-invalid:ring-border-error-thick aria-invalid:border-border-error-thick-hover aria-readonly:cursor-not-allowed',
|
||||
|
||||
@@ -3,9 +3,9 @@ import { cva } from 'class-variance-authority';
|
||||
import * as React from 'react';
|
||||
import { forwardRef } from 'react';
|
||||
|
||||
import { ReactComponent as Close } from '../../assets/icons/close.svg';
|
||||
import { ReactComponent as Close } from '@/components/chat/assets/icons/close.svg';
|
||||
import { buttonVariants } from './button';
|
||||
import { cn } from '../../lib/utils';
|
||||
import { cn } from '@/components/chat/lib/utils';
|
||||
|
||||
function Dialog({
|
||||
...props
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as React from 'react';
|
||||
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
||||
import { Check, ChevronRight } from 'lucide-react';
|
||||
|
||||
import { cn } from '../../lib/utils';
|
||||
import { cn } from '@/components/chat/lib/utils';
|
||||
|
||||
const DropdownMenu = DropdownMenuPrimitive.Root;
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { Button } from './button';
|
||||
import { ReactComponent as TextIcon } from '../../assets/icons/text.svg';
|
||||
import { ReactComponent as TextWithIcon } from '../../assets/icons/image-text.svg';
|
||||
import { ReactComponent as ImageIcon } from '../../assets/icons/image.svg';
|
||||
import { ReactComponent as ParagraphIcon } from '../../assets/icons/paragraph.svg';
|
||||
import { ReactComponent as BulletedListIcon } from '../../assets/icons/bullet-list.svg';
|
||||
import { ReactComponent as NumberedListIcon } from '../../assets/icons/num-list.svg';
|
||||
import { ReactComponent as TableIcon } from '../../assets/icons/table.svg';
|
||||
import { ReactComponent as TextIcon } from '@/components/chat/assets/icons/text.svg';
|
||||
import { ReactComponent as TextWithIcon } from '@/components/chat/assets/icons/image-text.svg';
|
||||
import { ReactComponent as ImageIcon } from '@/components/chat/assets/icons/image.svg';
|
||||
import { ReactComponent as ParagraphIcon } from '@/components/chat/assets/icons/paragraph.svg';
|
||||
import { ReactComponent as BulletedListIcon } from '@/components/chat/assets/icons/bullet-list.svg';
|
||||
import { ReactComponent as NumberedListIcon } from '@/components/chat/assets/icons/num-list.svg';
|
||||
import { ReactComponent as TableIcon } from '@/components/chat/assets/icons/table.svg';
|
||||
import { Separator } from './separator';
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from './tooltip';
|
||||
import { useTranslation } from '../../i18n';
|
||||
import { OutputContent, OutputLayout } from '../../types';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { OutputContent, OutputLayout } from '@/components/chat/types';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
export function FormatGroup({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
|
||||
import { cn } from '../../lib/utils';
|
||||
import { cn } from '@/components/chat/lib/utils';
|
||||
|
||||
const Input = React.forwardRef<HTMLInputElement, React.ComponentProps<'input'>>(
|
||||
({ className, type, ...props }, ref) => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
||||
import { forwardRef } from 'react';
|
||||
|
||||
import { cn } from '../../lib/utils';
|
||||
import { cn } from '@/components/chat/lib/utils';
|
||||
|
||||
function Popover({
|
||||
...props
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Input } from './input';
|
||||
import { useTranslation } from '../../i18n';
|
||||
import { cn } from '../../lib/utils';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { cn } from '@/components/chat/lib/utils';
|
||||
import { SearchIcon } from 'lucide-react';
|
||||
import { useState } from 'react';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as React from 'react';
|
||||
import * as SelectPrimitive from '@radix-ui/react-select';
|
||||
import { Check, ChevronDown, ChevronUp } from 'lucide-react';
|
||||
|
||||
import { cn } from '../../lib/utils';
|
||||
import { cn } from '@/components/chat/lib/utils';
|
||||
|
||||
const Select = SelectPrimitive.Root;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import * as SwitchPrimitives from '@radix-ui/react-switch';
|
||||
|
||||
import { cn } from '../../lib/utils';
|
||||
import { cn } from '@/components/chat/lib/utils';
|
||||
|
||||
const Switch = React.forwardRef<
|
||||
React.ElementRef<typeof SwitchPrimitives.Root>,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
|
||||
import { cn } from '../../lib/utils';
|
||||
import { cn } from '@/components/chat/lib/utils';
|
||||
|
||||
const Textarea = React.forwardRef<
|
||||
HTMLTextAreaElement,
|
||||
|
||||
@@ -4,7 +4,7 @@ import * as ToastPrimitives from '@radix-ui/react-toast';
|
||||
import { cva, type VariantProps } from 'class-variance-authority';
|
||||
import { X, CircleX, CircleCheck } from 'lucide-react';
|
||||
|
||||
import { cn } from '../../lib/utils';
|
||||
import { cn } from '@/components/chat/lib/utils';
|
||||
|
||||
const ToastContext = React.createContext<{ variant?: 'default' | 'destructive' | 'success' | null | undefined }>({});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useToast } from '../../hooks/use-toast';
|
||||
import { useToast } from '@/components/chat/hooks/use-toast';
|
||||
import {
|
||||
Toast,
|
||||
ToastClose,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
||||
|
||||
import { cn } from '../../lib/utils';
|
||||
import { cn } from '@/components/chat/lib/utils';
|
||||
|
||||
const TooltipProvider = TooltipPrimitive.Provider;
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { ReactComponent as BoardIcon } from '../../assets/icons/board.svg';
|
||||
import { ReactComponent as CalendarIcon } from '../../assets/icons/calendar.svg';
|
||||
import { ReactComponent as DocIcon } from '../../assets/icons/doc.svg';
|
||||
import { ReactComponent as GridIcon } from '../../assets/icons/grid.svg';
|
||||
import { cn, getIcon, renderColor } from '../../lib/utils';
|
||||
import { View, ViewIconType, ViewLayout } from '../../types';
|
||||
import { ReactComponent as BoardIcon } from '@/components/chat/assets/icons/board.svg';
|
||||
import { ReactComponent as CalendarIcon } from '@/components/chat/assets/icons/calendar.svg';
|
||||
import { ReactComponent as DocIcon } from '@/components/chat/assets/icons/doc.svg';
|
||||
import { ReactComponent as GridIcon } from '@/components/chat/assets/icons/grid.svg';
|
||||
import { cn, getIcon, renderColor } from '@/components/chat/lib/utils';
|
||||
import { View, ViewIconType, ViewLayout } from '@/components/chat/types';
|
||||
import DOMPurify from 'dompurify';
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../ui/tooltip';
|
||||
import { useTranslation } from '../../i18n';
|
||||
import { cn, getIcon, renderColor, stringToColor } from '../../lib/utils';
|
||||
import { View } from '../../types';
|
||||
import { ReactComponent as ChevronDown } from '../../assets/icons/drop_menu_show.svg';
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/chat/components/ui/tooltip';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { cn, getIcon, renderColor, stringToColor } from '@/components/chat/lib/utils';
|
||||
import { View } from '@/components/chat/types';
|
||||
import { ReactComponent as ChevronDown } from '@/components/chat/assets/icons/drop_menu_show.svg';
|
||||
import { ReactNode, useEffect, useMemo, useState } from 'react';
|
||||
import DOMPurify from 'dompurify';
|
||||
import { Button } from '../ui/button';
|
||||
import { Button } from '@/components/chat/components/ui/button';
|
||||
|
||||
function SpaceItem({
|
||||
view,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ViewItem } from '../view/view-item';
|
||||
import { View } from '../../types';
|
||||
import { CheckStatus } from '../../types/checkbox';
|
||||
import { ViewItem } from '@/components/chat/components/view/view-item';
|
||||
import { View } from '@/components/chat/types';
|
||||
import { CheckStatus } from '@/components/chat/types/checkbox';
|
||||
|
||||
export function ViewChildren({
|
||||
item,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { ReactComponent as ChevronDown } from '../../assets/icons/drop_menu_show.svg';
|
||||
import { Button } from '../ui/button';
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../ui/tooltip';
|
||||
import PageIcon from '../view/page-icon';
|
||||
import { useTranslation } from '../../i18n';
|
||||
import { cn } from '../../lib/utils';
|
||||
import { View } from '../../types';
|
||||
import { CheckStatus } from '../../types/checkbox';
|
||||
import { ReactComponent as ChevronDown } from '@/components/chat/assets/icons/drop_menu_show.svg';
|
||||
import { Button } from '@/components/chat/components/ui/button';
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/chat/components/ui/tooltip';
|
||||
import PageIcon from '@/components/chat/components/view/page-icon';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { cn } from '@/components/chat/lib/utils';
|
||||
import { View } from '@/components/chat/types';
|
||||
import { CheckStatus } from '@/components/chat/types/checkbox';
|
||||
import { CheckSquare, Minus, Square } from 'lucide-react';
|
||||
import { useMemo, useState } from 'react';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useChatContext } from '../chat/context';
|
||||
import { useChatContext } from '@/components/chat/chat/context';
|
||||
import { useToast } from './use-toast';
|
||||
import { ChatSettings } from '../types';
|
||||
import { ChatSettings } from '@/components/chat/types';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
|
||||
export function useChatSettingsLoader() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { findAncestors } from '../lib/views';
|
||||
import { View } from '../types';
|
||||
import { CheckStatus } from '../types/checkbox';
|
||||
import { findAncestors } from '@/components/chat/lib/views';
|
||||
import { View } from '@/components/chat/types';
|
||||
import { CheckStatus } from '@/components/chat/types/checkbox';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
|
||||
export const useCheckboxTree = (initialSelected: string[] = [], source: View[]) => {
|
||||
|
||||
@@ -6,7 +6,7 @@ import * as React from 'react';
|
||||
import type {
|
||||
ToastActionElement,
|
||||
ToastProps,
|
||||
} from '../components/ui/toast';
|
||||
} from '@/components/chat/components/ui/toast';
|
||||
|
||||
const TOAST_LIMIT = 1;
|
||||
const TOAST_REMOVE_DELAY = 1000000;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useChatContext } from '../chat/context';
|
||||
import { User } from '../types';
|
||||
import { useChatContext } from '@/components/chat/chat/context';
|
||||
import { User } from '@/components/chat/types';
|
||||
import { useCallback, useRef } from 'react';
|
||||
|
||||
export function useUserLoader() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useChatContext } from '../chat/context';
|
||||
import { useChatContext } from '@/components/chat/chat/context';
|
||||
import { EditorData } from '@appflowyinc/editor';
|
||||
import { useCallback } from 'react';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export * from './chat';
|
||||
export * from './request';
|
||||
export * from './writer';
|
||||
export * from './types';
|
||||
export * from './provider/prompt-modal-provider';
|
||||
export * from '@/components/chat/chat';
|
||||
export * from '@/components/chat/request';
|
||||
export * from '@/components/chat/writer';
|
||||
export * from '@/components/chat/types';
|
||||
export * from '@/components/chat/provider/prompt-modal-provider';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { EditorData, EditorNode } from '@appflowyinc/editor';
|
||||
import { clsx, type ClassValue } from 'clsx';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
import { AiPrompt, AiPromptCategory, RawPromptData } from '../types/prompt';
|
||||
import { AiPrompt, AiPromptCategory, RawPromptData } from '@/components/chat/types/prompt';
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { View, ViewLayout } from '../types';
|
||||
import { View, ViewLayout } from '@/components/chat/types';
|
||||
|
||||
export function findView(views: View[], id: string): View | undefined {
|
||||
for (const view of views) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { ConfirmDiscard } from '../components/ai-writer/confirm-discard';
|
||||
import { TooltipProvider } from '../components/ui/tooltip';
|
||||
import { toast } from '../hooks/use-toast';
|
||||
import { useTranslation } from '../i18n';
|
||||
import { ChatI18nContext, getI18n, initI18n } from '../i18n/config';
|
||||
import { WriterRequest } from '../request';
|
||||
import { ConfirmDiscard } from '@/components/chat/components/ai-writer/confirm-discard';
|
||||
import { TooltipProvider } from '@/components/chat/components/ui/tooltip';
|
||||
import { toast } from '@/components/chat/hooks/use-toast';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
import { ChatI18nContext, getI18n, initI18n } from '@/components/chat/i18n/config';
|
||||
import { WriterRequest } from '@/components/chat/request';
|
||||
import {
|
||||
AIAssistantType,
|
||||
ChatInputMode,
|
||||
@@ -12,8 +12,8 @@ import {
|
||||
OutputContent,
|
||||
OutputLayout,
|
||||
ResponseFormat,
|
||||
} from '../types';
|
||||
import { ApplyingState, WriterContext } from '../writer/context';
|
||||
} from '@/components/chat/types';
|
||||
import { ApplyingState, WriterContext } from '@/components/chat/writer/context';
|
||||
import { EditorData } from '@appflowyinc/editor';
|
||||
import { findLast } from 'lodash-es';
|
||||
import { ReactNode, useCallback, useEffect, useRef, useState } from 'react';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { AppFlowyEditor } from '@appflowyinc/editor';
|
||||
import { createContext, ReactNode, useCallback, useContext, useEffect, useRef } from 'react';
|
||||
import { useChatContext } from '../chat/context';
|
||||
import { useChatContext } from '@/components/chat/chat/context';
|
||||
|
||||
interface EditorContextTypes {
|
||||
getEditor: (messageId: number) => AppFlowyEditor | undefined;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useChatContext } from '../chat/context';
|
||||
import { useToast } from '../hooks/use-toast';
|
||||
import { ERROR_CODE_NO_LIMIT } from '../lib/const';
|
||||
import { useChatContext } from '@/components/chat/chat/context';
|
||||
import { useToast } from '@/components/chat/hooks/use-toast';
|
||||
import { ERROR_CODE_NO_LIMIT } from '@/components/chat/lib/const';
|
||||
import { useMessageAnimation } from './message-animation-provider';
|
||||
import { useChatMessagesContext } from './messages-provider';
|
||||
import { useResponseFormatContext } from './response-format-provider';
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
OutputContent,
|
||||
OutputLayout, RepeatedChatMessage,
|
||||
ResponseFormat,
|
||||
} from '../types';
|
||||
} from '@/components/chat/types';
|
||||
import { createContext, ReactNode, useCallback, useContext, useEffect, useRef, useState } from 'react';
|
||||
import { usePromptModal } from './prompt-modal-provider';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useChatContext } from '../chat/context';
|
||||
import { ChatMessage, ChatMessageMetadata } from '../types';
|
||||
import { useChatContext } from '@/components/chat/chat/context';
|
||||
import { ChatMessage, ChatMessageMetadata } from '@/components/chat/types';
|
||||
import { createContext, ReactNode, useCallback, useContext, useEffect, useRef, useState } from 'react';
|
||||
|
||||
export interface ChatMessagesContextTypes {
|
||||
|
||||
@@ -7,15 +7,15 @@ import {
|
||||
useRef,
|
||||
useState,
|
||||
} from 'react';
|
||||
import promptsData from '../data/built_in_prompts.json';
|
||||
import { parsePromptData } from '../lib/utils';
|
||||
import promptsData from '@/components/chat/data/built_in_prompts.json';
|
||||
import { parsePromptData } from '@/components/chat/lib/utils';
|
||||
import {
|
||||
AiPrompt,
|
||||
AiPromptCategory,
|
||||
PromptDatabaseField,
|
||||
RawPromptData,
|
||||
} from '../types/prompt';
|
||||
import { useTranslation } from '../i18n';
|
||||
} from '@/components/chat/types/prompt';
|
||||
import { useTranslation } from '@/components/chat/i18n';
|
||||
|
||||
const STORAGE_KEY = 'appflowy_prompt_db_config';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useChatContext } from '../chat/context';
|
||||
import { ChatInputMode, OutputContent, OutputLayout, ResponseFormat } from '../types';
|
||||
import { useChatContext } from '@/components/chat/chat/context';
|
||||
import { ChatInputMode, OutputContent, OutputLayout, ResponseFormat } from '@/components/chat/types';
|
||||
import { createContext, ReactNode, useCallback, useContext, useEffect, useRef, useState } from 'react';
|
||||
|
||||
interface ResponseFormatContextTypes {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { Banner } from '../components/multi-selection/banner';
|
||||
import { ANIMATION_PRESETS, MESSAGE_VARIANTS } from '../lib/animations';
|
||||
import { cn } from '../lib/utils';
|
||||
import { Banner } from '@/components/chat/components/multi-selection/banner';
|
||||
import { ANIMATION_PRESETS, MESSAGE_VARIANTS } from '@/components/chat/lib/animations';
|
||||
import { cn } from '@/components/chat/lib/utils';
|
||||
import { useChatMessagesContext } from './messages-provider';
|
||||
import { AuthorType, ChatMessage } from '../types';
|
||||
import { CheckStatus } from '../types/checkbox';
|
||||
import { AuthorType, ChatMessage } from '@/components/chat/types';
|
||||
import { CheckStatus } from '@/components/chat/types/checkbox';
|
||||
import { AnimatePresence, motion } from 'framer-motion';
|
||||
import { createContext, ReactNode, useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
||||
import { useChatContext } from '../chat/context';
|
||||
import { useChatContext } from '@/components/chat/chat/context';
|
||||
|
||||
interface SelectionModeContextTypes {
|
||||
messages: ChatMessage[];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useToast } from '../hooks/use-toast';
|
||||
import { Suggestions } from '../types';
|
||||
import { useToast } from '@/components/chat/hooks/use-toast';
|
||||
import { Suggestions } from '@/components/chat/types';
|
||||
import { createContext, ReactNode, useCallback, useContext, useEffect, useRef, useState } from 'react';
|
||||
import { useChatContext } from '../chat/context';
|
||||
import { useChatContext } from '@/components/chat/chat/context';
|
||||
|
||||
interface SuggestionsContextTypes {
|
||||
registerFetchSuggestions: (messageId: number) => void;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useToast } from '../hooks/use-toast';
|
||||
import { filterDocumentViews } from '../lib/views';
|
||||
import { View } from '../types/request';
|
||||
import { useToast } from '@/components/chat/hooks/use-toast';
|
||||
import { filterDocumentViews } from '@/components/chat/lib/views';
|
||||
import { View } from '@/components/chat/types/request';
|
||||
import { createContext, useCallback, useContext, useState } from 'react';
|
||||
|
||||
interface ViewLoaderProviderProps {
|
||||
|
||||
@@ -3,9 +3,9 @@ import {
|
||||
getAccessToken,
|
||||
readableStreamToAsyncIterator,
|
||||
requestInterceptor,
|
||||
} from '../lib/requets';
|
||||
import { convertToPageData } from '../lib/utils';
|
||||
import { findView } from '../lib/views';
|
||||
} from '@/components/chat/lib/requets';
|
||||
import { convertToPageData } from '@/components/chat/lib/utils';
|
||||
import { findView } from '@/components/chat/lib/views';
|
||||
import {
|
||||
ChatMessage,
|
||||
GetChatMessagesPayload,
|
||||
@@ -15,8 +15,8 @@ import {
|
||||
Suggestions,
|
||||
User, View, ViewLayout,
|
||||
ChatMessageMetadata, StreamType,
|
||||
} from '../types';
|
||||
import { ModelList } from '../types/ai-model';
|
||||
} from '@/components/chat/types';
|
||||
import { ModelList } from '@/components/chat/types/ai-model';
|
||||
import { EditorData } from '@appflowyinc/editor';
|
||||
import { AxiosInstance } from 'axios';
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
getAccessToken,
|
||||
readableStreamToAsyncIterator,
|
||||
requestInterceptor,
|
||||
} from '../lib/requets';
|
||||
} from '@/components/chat/lib/requets';
|
||||
import {
|
||||
AIAssistantType,
|
||||
CompletionResult,
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
ResponseFormat,
|
||||
StreamType,
|
||||
View,
|
||||
} from '../types';
|
||||
} from '@/components/chat/types';
|
||||
import { AxiosInstance } from 'axios';
|
||||
|
||||
export class WriterRequest {
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
import { ChatRequest } from '../request/chat-request';
|
||||
import { ChatRequest } from '@/components/chat/request/chat-request';
|
||||
import { User } from './request';
|
||||
import { PromptDatabaseConfiguration } from '../provider/prompt-modal-provider';
|
||||
import { PromptDatabaseConfiguration } from '@/components/chat/provider/prompt-modal-provider';
|
||||
import { RawPromptData, PromptDatabaseField } from './prompt';
|
||||
|
||||
export * from './ai-model';
|
||||
export * from './checkbox';
|
||||
export * from './prompt';
|
||||
export * from './request';
|
||||
export * from './writer';
|
||||
export * from '@/components/chat/request';
|
||||
export * from '@/components/chat/writer';
|
||||
|
||||
export interface ChatProps {
|
||||
workspaceId: string;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { AiWriterMenuContent } from '../components/ai-writer/ai-writer-menu-content';
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '../components/ui/popover';
|
||||
import { AIAssistantType } from '../types';
|
||||
import { AiWriterMenuContent } from '@/components/chat/components/ai-writer/ai-writer-menu-content';
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '@/components/chat/components/ui/popover';
|
||||
import { AIAssistantType } from '@/components/chat/types';
|
||||
|
||||
interface AIWriterMenuProps {
|
||||
children?: React.ReactNode;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { AIAssistant } from '../components/ai-writer';
|
||||
import { RenderEditor } from '../components/ai-writer/render-editor';
|
||||
import { Toaster } from '../components/ui/toaster';
|
||||
import useEnsureBottomVisible from '../components/ai-writer/use-ensure-bottom-visible';
|
||||
import { AIAssistantType } from '../types';
|
||||
import { AIAssistant } from '@/components/chat/components/ai-writer';
|
||||
import { RenderEditor } from '@/components/chat/components/ai-writer/render-editor';
|
||||
import { Toaster } from '@/components/chat/components/ui/toaster';
|
||||
import useEnsureBottomVisible from '@/components/chat/components/ai-writer/use-ensure-bottom-visible';
|
||||
import { AIAssistantType } from '@/components/chat/types';
|
||||
import { useWriterContext } from './context';
|
||||
import { EditorProvider } from '@appflowyinc/editor';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { AIAssistantType, ChatInputMode, ResponseFormat, View } from '../types';
|
||||
import { AIAssistantType, ChatInputMode, ResponseFormat, View } from '@/components/chat/types';
|
||||
import { EditorData } from '@appflowyinc/editor';
|
||||
import { createContext, useContext } from 'react';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export * from './use-ai-writer';
|
||||
export * from '../provider/ai-assistant-provider';
|
||||
export * from '@/components/chat/provider/ai-assistant-provider';
|
||||
export * from './ai-writer-menu';
|
||||
export * from './context-placeholder';
|
||||
|
||||
|
||||
@@ -21,6 +21,12 @@ module.exports = {
|
||||
foreground: 'hsl(var(--primary-foreground))',
|
||||
},
|
||||
'chat-border': 'hsl(var(--border))',
|
||||
// Missing color classes for template.css and app.scss
|
||||
'border-primary': 'var(--line-border)',
|
||||
'fill-default': 'var(--fill-default)',
|
||||
},
|
||||
caretColor: {
|
||||
'fill-default': 'var(--fill-default)',
|
||||
},
|
||||
boxShadow,
|
||||
borderRadius: {
|
||||
|
||||
Reference in New Issue
Block a user