This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Required parameters for this function: | |
// @param {string} topic - The topic of the coding questions (e.g., array, linked list, etc.) | |
// @param {string} level - The difficulty level of the questions (e.g., easy, medium, hard) | |
import dotenv from "dotenv"; | |
import OpenAI from "openai"; | |
dotenv.config(); | |
const openai = new OpenAI(process.env.OPENAI_API_KEY); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect, useState } from "react"; | |
import axios from "axios"; | |
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | |
import { faPlay, faPause } from '@fortawesome/free-solid-svg-icons'; | |
import { ChainlitAPI, sessionState, useChatSession } from "@chainlit/react-client"; | |
import { IoChatbubble } from "react-icons/io5"; | |
import { useRecoilValue } from "recoil"; | |
import { useNavigate } from 'react-router-dom'; | |
const CHAINLIT_SERVER = "http://localhost:8000"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Input } from "@/components/ui/input"; | |
import { Button } from "@/components/ui/button"; | |
import { v4 as uuidv4 } from "uuid"; | |
import { useEffect } from "react"; | |
import { useRecoilValue } from "recoil"; | |
import { useParams } from 'react-router-dom'; | |
import { | |
useChatInteract, | |
useChatMessages, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db connection and schema | |
require("dotenv").config(); | |
const mongoose = require("mongoose"); | |
const dbConnect = async () => { | |
try { | |
const db_url = process.env.DB_URL; | |
console.log(process.env.DB_URL) | |
await mongoose.connect(db_url); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import aiohttp | |
from typing import List | |
import chainlit as cl | |
from openai import AsyncOpenAI | |
from fastapi.responses import JSONResponse | |
from chainlit.auth import create_jwt | |
from chainlit.server import app | |
from langchain_openai import OpenAIEmbeddings | |
from langchain.text_splitter import RecursiveCharacterTextSplitter |