mirror of
https://github.com/StanGirard/quivr.git
synced 2024-09-11 13:15:41 +03:00
Merge branch 'main' into fix/remove-duplicated-prompt-template
This commit is contained in:
commit
97d63b886d
@ -1,6 +1,7 @@
|
|||||||
from langchain.prompts.prompt import PromptTemplate
|
from langchain.prompts.prompt import PromptTemplate
|
||||||
|
|
||||||
prompt_template = """Use the following pieces of context to answer the question in the language of the question. If you don't know the answer, just say that you don't know, don't try to make up an answer.
|
|
||||||
|
prompt_template = """Your name is Quivr. You are a second brain. A person will ask you a question and you will provide a helpful answer. Write the answer in the same language as the question. If you don't know the answer, just say that you don't know. Don't try to make up an answer. Use the following context to answer the question:
|
||||||
|
|
||||||
{context}
|
{context}
|
||||||
|
|
||||||
|
@ -2,15 +2,17 @@ import os
|
|||||||
from typing import Any, Dict, List
|
from typing import Any, Dict, List
|
||||||
|
|
||||||
from langchain.chains import ConversationalRetrievalChain
|
from langchain.chains import ConversationalRetrievalChain
|
||||||
|
from langchain.chains.question_answering import load_qa_chain
|
||||||
from langchain.chat_models import ChatOpenAI, ChatVertexAI
|
from langchain.chat_models import ChatOpenAI, ChatVertexAI
|
||||||
from langchain.chat_models.anthropic import ChatAnthropic
|
from langchain.chat_models.anthropic import ChatAnthropic
|
||||||
from langchain.docstore.document import Document
|
from langchain.docstore.document import Document
|
||||||
from langchain.embeddings.openai import OpenAIEmbeddings
|
from langchain.embeddings.openai import OpenAIEmbeddings
|
||||||
from langchain.llms import VertexAI
|
from langchain.llms import OpenAI, VertexAI
|
||||||
from langchain.memory import ConversationBufferMemory
|
from langchain.memory import ConversationBufferMemory
|
||||||
from langchain.vectorstores import SupabaseVectorStore
|
from langchain.vectorstores import SupabaseVectorStore
|
||||||
from llm import LANGUAGE_PROMPT
|
from llm import LANGUAGE_PROMPT
|
||||||
from models.chats import ChatMessage
|
from models.chats import ChatMessage
|
||||||
|
|
||||||
from supabase import Client, create_client
|
from supabase import Client, create_client
|
||||||
|
|
||||||
|
|
||||||
@ -101,11 +103,11 @@ def get_qa_llm(chat_message: ChatMessage, user_id: str, user_openai_api_key: str
|
|||||||
memory = ConversationBufferMemory(
|
memory = ConversationBufferMemory(
|
||||||
memory_key="chat_history", return_messages=True)
|
memory_key="chat_history", return_messages=True)
|
||||||
|
|
||||||
ConversationalRetrievalChain.prompts = LANGUAGE_PROMPT
|
|
||||||
|
|
||||||
qa = None
|
qa = None
|
||||||
# this overwrites the built-in prompt of the ConversationalRetrievalChain
|
# this overwrites the built-in prompt of the ConversationalRetrievalChain
|
||||||
ConversationalRetrievalChain.prompts = LANGUAGE_PROMPT
|
|
||||||
if chat_message.model.startswith("gpt"):
|
if chat_message.model.startswith("gpt"):
|
||||||
qa = ConversationalRetrievalChain.from_llm(
|
qa = ConversationalRetrievalChain.from_llm(
|
||||||
ChatOpenAI(
|
ChatOpenAI(
|
||||||
@ -114,10 +116,12 @@ def get_qa_llm(chat_message: ChatMessage, user_id: str, user_openai_api_key: str
|
|||||||
vector_store.as_retriever(), memory=memory, verbose=True,
|
vector_store.as_retriever(), memory=memory, verbose=True,
|
||||||
return_source_documents=with_sources,
|
return_source_documents=with_sources,
|
||||||
max_tokens_limit=1024)
|
max_tokens_limit=1024)
|
||||||
|
qa.combine_docs_chain = load_qa_chain(OpenAI(temperature=0), chain_type="stuff", prompt=LANGUAGE_PROMPT.QA_PROMPT)
|
||||||
elif chat_message.model.startswith("vertex"):
|
elif chat_message.model.startswith("vertex"):
|
||||||
qa = ConversationalRetrievalChain.from_llm(
|
qa = ConversationalRetrievalChain.from_llm(
|
||||||
ChatVertexAI(), vector_store.as_retriever(), memory=memory, verbose=False,
|
ChatVertexAI(), vector_store.as_retriever(), memory=memory, verbose=True,
|
||||||
return_source_documents=with_sources, max_tokens_limit=1024)
|
return_source_documents=with_sources, max_tokens_limit=1024)
|
||||||
|
qa.combine_docs_chain = load_qa_chain(ChatVertexAI(), chain_type="stuff", prompt=LANGUAGE_PROMPT.QA_PROMPT)
|
||||||
elif anthropic_api_key and chat_message.model.startswith("claude"):
|
elif anthropic_api_key and chat_message.model.startswith("claude"):
|
||||||
qa = ConversationalRetrievalChain.from_llm(
|
qa = ConversationalRetrievalChain.from_llm(
|
||||||
ChatAnthropic(
|
ChatAnthropic(
|
||||||
@ -125,4 +129,6 @@ def get_qa_llm(chat_message: ChatMessage, user_id: str, user_openai_api_key: str
|
|||||||
vector_store.as_retriever(), memory=memory, verbose=False,
|
vector_store.as_retriever(), memory=memory, verbose=False,
|
||||||
return_source_documents=with_sources,
|
return_source_documents=with_sources,
|
||||||
max_tokens_limit=102400)
|
max_tokens_limit=102400)
|
||||||
|
qa.combine_docs_chain = load_qa_chain(ChatAnthropic(), chain_type="stuff", prompt=LANGUAGE_PROMPT.QA_PROMPT)
|
||||||
|
|
||||||
return qa
|
return qa
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Button from "@/app/components/ui/Button";
|
import Button from "@/lib/components/ui/Button";
|
||||||
|
|
||||||
import { useGoogleLogin } from "./hooks/useGoogleLogin";
|
import { useGoogleLogin } from "./hooks/useGoogleLogin";
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import Button from "@/app/components/ui/Button";
|
|
||||||
import { useSupabase } from "@/app/supabase-provider";
|
import { useSupabase } from "@/app/supabase-provider";
|
||||||
|
import Button from "@/lib/components/ui/Button";
|
||||||
import { useToast } from "@/lib/hooks/useToast";
|
import { useToast } from "@/lib/hooks/useToast";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import Button from "@/app/components/ui/Button";
|
|
||||||
import Card from "@/app/components/ui/Card";
|
|
||||||
import { Divider } from "@/app/components/ui/Divider";
|
|
||||||
import Field from "@/app/components/ui/Field";
|
|
||||||
import PageHeading from "@/app/components/ui/PageHeading";
|
|
||||||
import { useSupabase } from "@/app/supabase-provider";
|
import { useSupabase } from "@/app/supabase-provider";
|
||||||
|
import Button from "@/lib/components/ui/Button";
|
||||||
|
import Card from "@/lib/components/ui/Card";
|
||||||
|
import { Divider } from "@/lib/components/ui/Divider";
|
||||||
|
import Field from "@/lib/components/ui/Field";
|
||||||
|
import PageHeading from "@/lib/components/ui/PageHeading";
|
||||||
import { useToast } from "@/lib/hooks/useToast";
|
import { useToast } from "@/lib/hooks/useToast";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import Button from "@/app/components/ui/Button";
|
|
||||||
import Card from "@/app/components/ui/Card";
|
|
||||||
import PageHeading from "@/app/components/ui/PageHeading";
|
|
||||||
import { useSupabase } from "@/app/supabase-provider";
|
import { useSupabase } from "@/app/supabase-provider";
|
||||||
|
import Button from "@/lib/components/ui/Button";
|
||||||
|
import Card from "@/lib/components/ui/Card";
|
||||||
|
import PageHeading from "@/lib/components/ui/PageHeading";
|
||||||
import { useToast } from "@/lib/hooks/useToast";
|
import { useToast } from "@/lib/hooks/useToast";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import Button from "@/app/components/ui/Button";
|
|
||||||
import Card from "@/app/components/ui/Card";
|
|
||||||
import Field from "@/app/components/ui/Field";
|
|
||||||
import PageHeading from "@/app/components/ui/PageHeading";
|
|
||||||
import { useSupabase } from "@/app/supabase-provider";
|
import { useSupabase } from "@/app/supabase-provider";
|
||||||
|
import Button from "@/lib/components/ui/Button";
|
||||||
|
import Card from "@/lib/components/ui/Card";
|
||||||
|
import Field from "@/lib/components/ui/Field";
|
||||||
|
import PageHeading from "@/lib/components/ui/PageHeading";
|
||||||
import { useToast } from "@/lib/hooks/useToast";
|
import { useToast } from "@/lib/hooks/useToast";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import Card from "@/lib/components/ui/Card";
|
||||||
import { FC, ReactNode } from "react";
|
import { FC, ReactNode } from "react";
|
||||||
import {
|
import {
|
||||||
GiArtificialIntelligence,
|
GiArtificialIntelligence,
|
||||||
@ -7,7 +8,6 @@ import {
|
|||||||
GiLockedDoor,
|
GiLockedDoor,
|
||||||
GiOpenBook,
|
GiOpenBook,
|
||||||
} from "react-icons/gi";
|
} from "react-icons/gi";
|
||||||
import Card from "../components/ui/Card";
|
|
||||||
|
|
||||||
const Features: FC = () => {
|
const Features: FC = () => {
|
||||||
return (
|
return (
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
import Button from "@/lib/components/ui/Button";
|
||||||
import { motion, useScroll, useSpring, useTransform } from "framer-motion";
|
import { motion, useScroll, useSpring, useTransform } from "framer-motion";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { FC, useRef } from "react";
|
import { FC, useRef } from "react";
|
||||||
import { MdNorthEast } from "react-icons/md";
|
import { MdNorthEast } from "react-icons/md";
|
||||||
import Button from "../components/ui/Button";
|
|
||||||
|
|
||||||
const Hero: FC = () => {
|
const Hero: FC = () => {
|
||||||
const targetRef = useRef<HTMLDivElement | null>(null);
|
const targetRef = useRef<HTMLDivElement | null>(null);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
import PageHeading from "@/lib/components/ui/PageHeading";
|
||||||
|
import useChatsContext from "@/lib/context/ChatsProvider/hooks/useChatsContext";
|
||||||
import { UUID } from "crypto";
|
import { UUID } from "crypto";
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import PageHeading from "../../components/ui/PageHeading";
|
|
||||||
import useChatsContext from "../ChatsProvider/hooks/useChatsContext";
|
|
||||||
import { ChatInput, ChatMessages } from "../components";
|
import { ChatInput, ChatMessages } from "../components";
|
||||||
|
|
||||||
interface ChatPageProps {
|
interface ChatPageProps {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
import Button from "@/lib/components/ui/Button";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { MdSettings } from "react-icons/md";
|
import { MdSettings } from "react-icons/md";
|
||||||
import Button from "../../../../components/ui/Button";
|
|
||||||
|
|
||||||
export function ConfigButton() {
|
export function ConfigButton() {
|
||||||
return (
|
return (
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
import Button from "@/lib/components/ui/Button";
|
||||||
|
import { useSpeech } from "@/lib/context/ChatsProvider/hooks/useSpeech";
|
||||||
import { MdMic, MdMicOff } from "react-icons/md";
|
import { MdMic, MdMicOff } from "react-icons/md";
|
||||||
import Button from "../../../../components/ui/Button";
|
|
||||||
import { useSpeech } from "../../../ChatsProvider/hooks/useSpeech";
|
|
||||||
|
|
||||||
export function MicButton() {
|
export function MicButton() {
|
||||||
const { isListening, speechSupported, startListening } = useSpeech();
|
const { isListening, speechSupported, startListening } = useSpeech();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import useChatsContext from "@/app/chat/ChatsProvider/hooks/useChatsContext";
|
import Button from "@/lib/components/ui/Button";
|
||||||
import Button from "../../../../components/ui/Button";
|
import useChatsContext from "@/lib/context/ChatsProvider/hooks/useChatsContext";
|
||||||
import { ConfigButton } from "./ConfigButton";
|
import { ConfigButton } from "./ConfigButton";
|
||||||
import { MicButton } from "./MicButton";
|
import { MicButton } from "./MicButton";
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import Card from "@/app/components/ui/Card";
|
import Card from "@/lib/components/ui/Card";
|
||||||
|
import useChatsContext from "@/lib/context/ChatsProvider/hooks/useChatsContext";
|
||||||
import { FC, useEffect, useRef } from "react";
|
import { FC, useEffect, useRef } from "react";
|
||||||
import useChatsContext from "../../ChatsProvider/hooks/useChatsContext";
|
|
||||||
import ChatMessage from "./ChatMessage";
|
import ChatMessage from "./ChatMessage";
|
||||||
|
|
||||||
export const ChatMessages: FC = () => {
|
export const ChatMessages: FC = () => {
|
||||||
|
@ -5,7 +5,7 @@ import { usePathname } from "next/navigation";
|
|||||||
import { FC } from "react";
|
import { FC } from "react";
|
||||||
import { FiTrash2 } from "react-icons/fi";
|
import { FiTrash2 } from "react-icons/fi";
|
||||||
import { MdChatBubbleOutline } from "react-icons/md";
|
import { MdChatBubbleOutline } from "react-icons/md";
|
||||||
import { Chat } from "../../types";
|
import { Chat } from "../../../../lib/types/Chat";
|
||||||
|
|
||||||
interface ChatsListItemProps {
|
interface ChatsListItemProps {
|
||||||
chat: Chat;
|
chat: Chat;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import useChatsContext from "../../ChatsProvider/hooks/useChatsContext";
|
import useChatsContext from "@/lib/context/ChatsProvider/hooks/useChatsContext";
|
||||||
import ChatsListItem from "./ChatsListItem";
|
import ChatsListItem from "./ChatsListItem";
|
||||||
import { NewChatButton } from "./NewChatButton";
|
import { NewChatButton } from "./NewChatButton";
|
||||||
export function ChatsList() {
|
export function ChatsList() {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
import { ChatsProvider } from "@/lib/context/ChatsProvider/chats-provider";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import { FC, ReactNode } from "react";
|
import { FC, ReactNode } from "react";
|
||||||
import { useSupabase } from "../supabase-provider";
|
import { useSupabase } from "../supabase-provider";
|
||||||
import { ChatsProvider } from "./ChatsProvider/chats-provider";
|
|
||||||
import { ChatsList } from "./components";
|
import { ChatsList } from "./components";
|
||||||
|
|
||||||
interface LayoutProps {
|
interface LayoutProps {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import Field from "@/lib/components/ui/Field";
|
||||||
import { BrainConfig } from "@/lib/context/BrainConfigProvider/types";
|
import { BrainConfig } from "@/lib/context/BrainConfigProvider/types";
|
||||||
import { UseFormRegister } from "react-hook-form";
|
import { UseFormRegister } from "react-hook-form";
|
||||||
import Field from "../../components/ui/Field";
|
|
||||||
|
|
||||||
interface BackendConfigProps {
|
interface BackendConfigProps {
|
||||||
register: UseFormRegister<BrainConfig>;
|
register: UseFormRegister<BrainConfig>;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import Button from "@/lib/components/ui/Button";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import Button from "../../components/ui/Button";
|
|
||||||
import { useConfig } from "../hooks/useConfig";
|
import { useConfig } from "../hooks/useConfig";
|
||||||
import { BackendConfig } from "./BackendConfig";
|
import { BackendConfig } from "./BackendConfig";
|
||||||
import { ModelConfig } from "./ModelConfig";
|
import { ModelConfig } from "./ModelConfig";
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import Field from "@/lib/components/ui/Field";
|
||||||
import {
|
import {
|
||||||
BrainConfig,
|
BrainConfig,
|
||||||
Model,
|
Model,
|
||||||
@ -8,7 +9,6 @@ import {
|
|||||||
paidModels,
|
paidModels,
|
||||||
} from "@/lib/context/BrainConfigProvider/types";
|
} from "@/lib/context/BrainConfigProvider/types";
|
||||||
import { UseFormRegister } from "react-hook-form";
|
import { UseFormRegister } from "react-hook-form";
|
||||||
import Field from "../../components/ui/Field";
|
|
||||||
|
|
||||||
interface ModelConfigProps {
|
interface ModelConfigProps {
|
||||||
register: UseFormRegister<BrainConfig>;
|
register: UseFormRegister<BrainConfig>;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useSupabase } from "@/app/supabase-provider";
|
import { useSupabase } from "@/app/supabase-provider";
|
||||||
|
import Button from "@/lib/components/ui/Button";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import Button from "../../components/ui/Button";
|
|
||||||
|
|
||||||
export const UserAccountSection = (): JSX.Element => {
|
export const UserAccountSection = (): JSX.Element => {
|
||||||
const { session } = useSupabase();
|
const { session } = useSupabase();
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import Ellipsis from "@/app/components/ui/Ellipsis";
|
|
||||||
import { useSupabase } from "@/app/supabase-provider";
|
import { useSupabase } from "@/app/supabase-provider";
|
||||||
|
import Button from "@/lib/components/ui/Button";
|
||||||
|
import { AnimatedCard } from "@/lib/components/ui/Card";
|
||||||
|
import Ellipsis from "@/lib/components/ui/Ellipsis";
|
||||||
|
import Modal from "@/lib/components/ui/Modal";
|
||||||
import { useToast } from "@/lib/hooks/useToast";
|
import { useToast } from "@/lib/hooks/useToast";
|
||||||
import { useAxios } from "@/lib/useAxios";
|
import { useAxios } from "@/lib/useAxios";
|
||||||
import {
|
import {
|
||||||
@ -10,10 +13,7 @@ import {
|
|||||||
forwardRef,
|
forwardRef,
|
||||||
useState,
|
useState,
|
||||||
} from "react";
|
} from "react";
|
||||||
import Button from "../../components/ui/Button";
|
import { Document } from "../../../lib/types/Document";
|
||||||
import { AnimatedCard } from "../../components/ui/Card";
|
|
||||||
import Modal from "../../components/ui/Modal";
|
|
||||||
import { Document } from "../types";
|
|
||||||
import DocumentData from "./DocumentData";
|
import DocumentData from "./DocumentData";
|
||||||
|
|
||||||
interface DocumentProps {
|
interface DocumentProps {
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
import Button from "@/lib/components/ui/Button";
|
||||||
|
import Spinner from "@/lib/components/ui/Spinner";
|
||||||
|
|
||||||
|
import { Document } from "@/lib/types/Document";
|
||||||
import { useAxios } from "@/lib/useAxios";
|
import { useAxios } from "@/lib/useAxios";
|
||||||
import { AnimatePresence, motion } from "framer-motion";
|
import { AnimatePresence, motion } from "framer-motion";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import Button from "../components/ui/Button";
|
|
||||||
import Spinner from "../components/ui/Spinner";
|
|
||||||
import { useSupabase } from "../supabase-provider";
|
import { useSupabase } from "../supabase-provider";
|
||||||
import DocumentItem from "./DocumentItem";
|
import DocumentItem from "./DocumentItem";
|
||||||
import { Document } from "./types";
|
|
||||||
|
|
||||||
export default function ExplorePage() {
|
export default function ExplorePage() {
|
||||||
const [documents, setDocuments] = useState<Document[]>([]);
|
const [documents, setDocuments] = useState<Document[]>([]);
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
|
import Footer from "@/lib/components/Footer";
|
||||||
|
import { NavBar } from "@/lib/components/NavBar";
|
||||||
|
import { ToastProvider } from "@/lib/components/ui/Toast";
|
||||||
import { createServerComponentSupabaseClient } from "@supabase/auth-helpers-nextjs";
|
import { createServerComponentSupabaseClient } from "@supabase/auth-helpers-nextjs";
|
||||||
import { Analytics } from "@vercel/analytics/react";
|
import { Analytics } from "@vercel/analytics/react";
|
||||||
import { Inter } from "next/font/google";
|
import { Inter } from "next/font/google";
|
||||||
import { cookies, headers } from "next/headers";
|
import { cookies, headers } from "next/headers";
|
||||||
import { BrainConfigProvider } from "../lib/context/BrainConfigProvider/brain-config-provider";
|
import { BrainConfigProvider } from "../lib/context/BrainConfigProvider/brain-config-provider";
|
||||||
import Footer from "./components/Footer";
|
|
||||||
import { NavBar } from "./components/NavBar";
|
|
||||||
import { ToastProvider } from "./components/ui/Toast";
|
|
||||||
import "./globals.css";
|
import "./globals.css";
|
||||||
import SupabaseProvider from "./supabase-provider";
|
import SupabaseProvider from "./supabase-provider";
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import Button from "@/app/components/ui/Button";
|
import Button from "@/lib/components/ui/Button";
|
||||||
import Card from "@/app/components/ui/Card";
|
import Card from "@/lib/components/ui/Card";
|
||||||
import Field from "@/app/components/ui/Field";
|
import Field from "@/lib/components/ui/Field";
|
||||||
import { useCrawler } from "./hooks/useCrawler";
|
import { useCrawler } from "./hooks/useCrawler";
|
||||||
|
|
||||||
export const Crawler = (): JSX.Element => {
|
export const Crawler = (): JSX.Element => {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
import Button from "@/lib/components/ui/Button";
|
||||||
|
import Card from "@/lib/components/ui/Card";
|
||||||
import { AnimatePresence } from "framer-motion";
|
import { AnimatePresence } from "framer-motion";
|
||||||
import Button from "../../../components/ui/Button";
|
|
||||||
import Card from "../../../components/ui/Card";
|
|
||||||
import FileComponent from "./components/FileComponent";
|
import FileComponent from "./components/FileComponent";
|
||||||
import { useFileUploader } from "./hooks/useFileUploader";
|
import { useFileUploader } from "./hooks/useFileUploader";
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
import Button from "@/lib/components/ui/Button";
|
||||||
|
import { Divider } from "@/lib/components/ui/Divider";
|
||||||
|
import PageHeading from "@/lib/components/ui/PageHeading";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import Button from "../components/ui/Button";
|
|
||||||
import { Divider } from "../components/ui/Divider";
|
|
||||||
import PageHeading from "../components/ui/PageHeading";
|
|
||||||
import { Crawler } from "./components/Crawler";
|
import { Crawler } from "./components/Crawler";
|
||||||
import { FileUploader } from "./components/FileUploader";
|
import { FileUploader } from "./components/FileUploader";
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { GiBrain } from "react-icons/gi";
|
import { GiBrain } from "react-icons/gi";
|
||||||
import { UserStats } from "../types";
|
import { UserStats } from "../../../lib/types/User";
|
||||||
|
|
||||||
export const BrainConsumption = (userStats: UserStats): JSX.Element => {
|
export const BrainConsumption = (userStats: UserStats): JSX.Element => {
|
||||||
const { current_brain_size, max_brain_size } = userStats;
|
const { current_brain_size, max_brain_size } = userStats;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { HTMLAttributes } from "react";
|
import { HTMLAttributes } from "react";
|
||||||
import { UserStats } from "../types";
|
import { UserStats } from "../../../lib/types/User";
|
||||||
|
|
||||||
interface DateComponentProps extends HTMLAttributes<HTMLSpanElement> {
|
interface DateComponentProps extends HTMLAttributes<HTMLSpanElement> {
|
||||||
date: UserStats["date"];
|
date: UserStats["date"];
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import Button from "@/app/components/ui/Button";
|
import Button from "@/lib/components/ui/Button";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import prettyBytes from "pretty-bytes";
|
import prettyBytes from "pretty-bytes";
|
||||||
import { HTMLAttributes } from "react";
|
import { HTMLAttributes } from "react";
|
||||||
import { UserStats } from "../types";
|
import { UserStats } from "../../../lib/types/User";
|
||||||
import { BrainConsumption } from "./BrainConsumption";
|
import { BrainConsumption } from "./BrainConsumption";
|
||||||
import { DateComponent } from "./Date";
|
import { DateComponent } from "./Date";
|
||||||
import BrainSpaceChart from "./Graphs/BrainSpaceChart";
|
import BrainSpaceChart from "./Graphs/BrainSpaceChart";
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
import Spinner from "@/lib/components/ui/Spinner";
|
||||||
import { useAxios } from "@/lib/useAxios";
|
import { useAxios } from "@/lib/useAxios";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import Spinner from "../components/ui/Spinner";
|
import { UserStats } from "../../lib/types/User";
|
||||||
import { useSupabase } from "../supabase-provider";
|
import { useSupabase } from "../supabase-provider";
|
||||||
import { UserStatistics } from "./components/UserStatistics";
|
import { UserStatistics } from "./components/UserStatistics";
|
||||||
import { UserStats } from "./types";
|
|
||||||
|
|
||||||
export default function UserPage() {
|
export default function UserPage() {
|
||||||
const [userStats, setUserStats] = useState<UserStats>();
|
const [userStats, setUserStats] = useState<UserStats>();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Button from "@/app/components/ui/Button";
|
import Button from "@/lib/components/ui/Button";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { usePathname } from "next/navigation";
|
import { usePathname } from "next/navigation";
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
import Button from "@/lib/components/ui/Button";
|
||||||
import { FC, useEffect, useLayoutEffect, useState } from "react";
|
import { FC, useEffect, useLayoutEffect, useState } from "react";
|
||||||
import { MdDarkMode, MdLightMode } from "react-icons/md";
|
import { MdDarkMode, MdLightMode } from "react-icons/md";
|
||||||
import Button from "../../../../ui/Button";
|
|
||||||
|
|
||||||
export const DarkModeToggle: FC = () => {
|
export const DarkModeToggle: FC = () => {
|
||||||
const [dark, setDark] = useState(false);
|
const [dark, setDark] = useState(false);
|
@ -1,10 +1,10 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import { useSupabase } from "@/app/supabase-provider";
|
import { useSupabase } from "@/app/supabase-provider";
|
||||||
|
import Button from "@/lib/components/ui/Button";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { Dispatch, FC, HTMLAttributes, SetStateAction } from "react";
|
import { Dispatch, FC, HTMLAttributes, SetStateAction } from "react";
|
||||||
import { MdPerson, MdSettings } from "react-icons/md";
|
import { MdPerson, MdSettings } from "react-icons/md";
|
||||||
import Button from "../../../ui/Button";
|
|
||||||
import { AuthButtons } from "./components/AuthButtons";
|
import { AuthButtons } from "./components/AuthButtons";
|
||||||
import { DarkModeToggle } from "./components/DarkModeToggle";
|
import { DarkModeToggle } from "./components/DarkModeToggle";
|
||||||
import { NavLink } from "./components/NavLink";
|
import { NavLink } from "./components/NavLink";
|
@ -4,7 +4,7 @@ import { FC } from "react";
|
|||||||
import { Header } from "./components/Header";
|
import { Header } from "./components/Header";
|
||||||
import { Logo } from "./components/Logo";
|
import { Logo } from "./components/Logo";
|
||||||
import { MobileMenu } from "./components/MobileMenu";
|
import { MobileMenu } from "./components/MobileMenu";
|
||||||
import { NavItems } from "./components/NavItems/";
|
import { NavItems } from "./components/NavItems";
|
||||||
|
|
||||||
export const NavBar: FC = () => {
|
export const NavBar: FC = () => {
|
||||||
return (
|
return (
|
@ -29,9 +29,9 @@ export const anthropicModels = [
|
|||||||
// "claude-instant-v1.1-100k",
|
// "claude-instant-v1.1-100k",
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
// export const googleModels = ["vertexai"] as const; ## TODO activate when not in demo mode
|
export const googleModels = ["vertexai"] as const; // TODO activate when not in demo mode
|
||||||
|
|
||||||
export const googleModels = [] as const;
|
// export const googleModels = [] as const;
|
||||||
export const models = [
|
export const models = [
|
||||||
...openAiModels,
|
...openAiModels,
|
||||||
...anthropicModels,
|
...anthropicModels,
|
||||||
@ -40,6 +40,7 @@ export const models = [
|
|||||||
|
|
||||||
export const paidModels= [
|
export const paidModels= [
|
||||||
...openAiPaidModels,
|
...openAiPaidModels,
|
||||||
|
...googleModels,
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export type PaidModels = (typeof paidModels)[number];
|
export type PaidModels = (typeof paidModels)[number];
|
||||||
|
@ -4,7 +4,7 @@ import { useAxios } from "@/lib/useAxios";
|
|||||||
import { UUID } from "crypto";
|
import { UUID } from "crypto";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useCallback, useEffect, useState } from "react";
|
import { useCallback, useEffect, useState } from "react";
|
||||||
import { Chat, ChatMessage } from "../../types";
|
import { Chat, ChatMessage } from "../../../types/Chat";
|
||||||
|
|
||||||
export default function useChats() {
|
export default function useChats() {
|
||||||
const [allChats, setAllChats] = useState<Chat[]>([]);
|
const [allChats, setAllChats] = useState<Chat[]>([]);
|
@ -1,5 +1,5 @@
|
|||||||
|
import { isSpeechRecognitionSupported } from "@/lib/helpers/isSpeechRecognitionSupported";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { isSpeechRecognitionSupported } from "../../helpers/isSpeechRecognitionSupported";
|
|
||||||
import useChatsContext from "./useChatsContext";
|
import useChatsContext from "./useChatsContext";
|
||||||
|
|
||||||
export const useSpeech = () => {
|
export const useSpeech = () => {
|
@ -1,5 +1,5 @@
|
|||||||
|
import { ToastContext } from "@/lib/components/ui/Toast/domain/ToastContext";
|
||||||
import { useContext } from "react";
|
import { useContext } from "react";
|
||||||
import { ToastContext } from "../../app/components/ui/Toast/domain/ToastContext";
|
|
||||||
|
|
||||||
export const useToast = () => {
|
export const useToast = () => {
|
||||||
const { publish } = useContext(ToastContext);
|
const { publish } = useContext(ToastContext);
|
||||||
|
0
frontend/lib/types/index.ts
Normal file
0
frontend/lib/types/index.ts
Normal file
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 43 KiB |
@ -5,6 +5,7 @@ module.exports = {
|
|||||||
'./pages/**/*.{js,ts,jsx,tsx,mdx}',
|
'./pages/**/*.{js,ts,jsx,tsx,mdx}',
|
||||||
'./components/**/*.{js,ts,jsx,tsx,mdx}',
|
'./components/**/*.{js,ts,jsx,tsx,mdx}',
|
||||||
'./app/**/*.{js,ts,jsx,tsx,mdx}',
|
'./app/**/*.{js,ts,jsx,tsx,mdx}',
|
||||||
|
'./lib/**/*.{js,ts,jsx,tsx,mdx}',
|
||||||
],
|
],
|
||||||
theme: {
|
theme: {
|
||||||
extend: {
|
extend: {
|
||||||
|
Loading…
Reference in New Issue
Block a user