Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
basic settings done for openAI
Danny Avila580d82ffe822
diff --cc client/package-lock.jsonindex 2c9320b5fb,8ad817c6f8..c7665d2d23--- a/client/package-lock.json+++ b/client/package-lock.json@@@ -12,8 -12,7 +12,9 @@@"@radix-ui/react-alert-dialog": "^1.0.2","@radix-ui/react-dialog": "^1.0.2","@radix-ui/react-dropdown-menu": "^2.0.2",++ "@radix-ui/react-hover-card": "^1.0.5","@radix-ui/react-label": "^2.0.0",+ "@radix-ui/react-slider": "^1.1.1","@radix-ui/react-tabs": "^1.0.3","@types/jest": "^29.5.0","@types/node": "^18.15.10",@@@ -2974,6 -2965,6 +2975,27 @@@"react-dom": "^16.8 || ^17.0 || ^18.0"}},++ "node_modules/@radix-ui/react-hover-card": {++ "version": "1.0.5",++ "resolved": "https://registry.npmjs.org/@radix-ui/react-hover-card/-/react-hover-card-1.0.5.tgz",++ "integrity": "sha512-jXRuZEkxSWdHZbVyL0J46cm7pQjmOMpwJEFKY+VqAJnV+FxS+zIZExI1OCeIiDwCBzUy6If1FfouOsfqBxr86g==",++ "dependencies": {++ "@babel/runtime": "^7.13.10",++ "@radix-ui/primitive": "1.0.0",++ "@radix-ui/react-compose-refs": "1.0.0",++ "@radix-ui/react-context": "1.0.0",++ "@radix-ui/react-dismissable-layer": "1.0.3",++ "@radix-ui/react-popper": "1.1.1",++ "@radix-ui/react-portal": "1.0.2",++ "@radix-ui/react-presence": "1.0.0",++ "@radix-ui/react-primitive": "1.0.2",++ "@radix-ui/react-use-controllable-state": "1.0.0"++ },++ "peerDependencies": {++ "react": "^16.8 || ^17.0 || ^18.0",++ "react-dom": "^16.8 || ^17.0 || ^18.0"++ }++ },"node_modules/@radix-ui/react-id": {"version": "1.0.0","resolved": "https://registry.npmjs.org/@radix-ui/react-id/-/react-id-1.0.0.tgz",@@@ -15802,6 -15751,6 +15824,23 @@@"@radix-ui/react-use-callback-ref": "1.0.0"}},++ "@radix-ui/react-hover-card": {++ "version": "1.0.5",++ "resolved": "https://registry.npmjs.org/@radix-ui/react-hover-card/-/react-hover-card-1.0.5.tgz",++ "integrity": "sha512-jXRuZEkxSWdHZbVyL0J46cm7pQjmOMpwJEFKY+VqAJnV+FxS+zIZExI1OCeIiDwCBzUy6If1FfouOsfqBxr86g==",++ "requires": {++ "@babel/runtime": "^7.13.10",++ "@radix-ui/primitive": "1.0.0",++ "@radix-ui/react-compose-refs": "1.0.0",++ "@radix-ui/react-context": "1.0.0",++ "@radix-ui/react-dismissable-layer": "1.0.3",++ "@radix-ui/react-popper": "1.1.1",++ "@radix-ui/react-portal": "1.0.2",++ "@radix-ui/react-presence": "1.0.0",++ "@radix-ui/react-primitive": "1.0.2",++ "@radix-ui/react-use-controllable-state": "1.0.0"++ }++ },"@radix-ui/react-id": {"version": "1.0.0","resolved": "https://registry.npmjs.org/@radix-ui/react-id/-/react-id-1.0.0.tgz",diff --cc client/package.jsonindex 547e18ee2c,4389315ad7..13610d2f23--- a/client/package.json+++ b/client/package.json@@@ -22,8 -22,7 +22,9 @@@"@radix-ui/react-alert-dialog": "^1.0.2","@radix-ui/react-dialog": "^1.0.2","@radix-ui/react-dropdown-menu": "^2.0.2",++ "@radix-ui/react-hover-card": "^1.0.5","@radix-ui/react-label": "^2.0.0",+ "@radix-ui/react-slider": "^1.1.1","@radix-ui/react-tabs": "^1.0.3","@types/jest": "^29.5.0","@types/node": "^18.15.10",diff --cc client/src/components/Input/OpenAIOptions/OptionHover.jsxindex 0000000000,0000000000..8f36468ee9new file mode 100644--- /dev/null+++ b/client/src/components/Input/OpenAIOptions/OptionHover.jsx@@@ -1,0 -1,0 +1,53 @@@++import React from 'react';++import {++ // HoverCard,++ // HoverCardTrigger,++ HoverCardPortal,++ HoverCardContent++} from '~/components/ui/HoverCard.tsx';++++// import { cn } from '~/utils/';++++const types = {++ temp: {++ description:++ 'Higher values = more random, while lower values = more focused and deterministic. We recommend altering this or Top P but not both.'++ },++ max: {++ description:++ 'The max tokens to generate. The total length of input tokens and generated tokens is limited by the model\'s context length.'++ },++ 'top-p': {++ description:++ 'An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We recommend altering this or temperature but not both.'++ },++ freq: {++ description:++ 'Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model\'s likelihood to repeat the same line verbatim.'++ },++ pres: {++ description:++ 'Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model\'s likelihood to talk about new topics.'++ },++};++++function OptionHover({ type, side }) {++++ const options = {};++++ if (type === 'pres') {++ options.sideOffset = 45;++ }++++ return (++ <HoverCardPortal>++ <HoverCardContent side={side} className="w-52 " {...options}>++ <div className="space-y-2">++ <p className="text-sm text-gray-600 dark:text-gray-300">{types[type].description}</p>++ </div>++ </HoverCardContent>++ </HoverCardPortal>++ );++}++++export default OptionHover;diff --cc client/src/components/Input/OpenAIOptions/Settings.jsxindex 60d06ec1fe,0000000000..6ea499464dmode 100644,000000..100644--- a/client/src/components/Input/OpenAIOptions/Settings.jsx+++ b/client/src/components/Input/OpenAIOptions/Settings.jsx@@@ -1,184 -1,0 +1,256 @@@+import React, { useRef, useState } from 'react';+import TextareaAutosize from 'react-textarea-autosize';+import { Input } from '~/components/ui/Input.tsx';+import { Label } from '~/components/ui/Label.tsx';+import { Slider } from '~/components/ui/Slider.tsx';++import OptionHover from './OptionHover';++import {++ HoverCard,++ HoverCardTrigger++ // HoverCardContent,++} from '~/components/ui/HoverCard.tsx';+import { cn } from '~/utils/';+const defaultTextProps =+ 'rounded-md border border-gray-300 bg-transparent text-sm shadow-[0_0_10px_rgba(0,0,0,0.10)] outline-none placeholder:text-gray-400 focus:outline-none focus:ring-gray-400 focus:ring-opacity-20 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 dark:border-none dark:bg-gray-700 dark:text-gray-50 dark:shadow-[0_0_15px_rgba(0,0,0,0.10)] dark:focus:border-none dark:focus:border-transparent dark:focus:outline-none dark:focus:ring-0 dark:focus:ring-gray-400 dark:focus:ring-offset-0';+- const optionText = 'p-0 shadow-none text-right pr-1 h-8';++const optionText =++ 'p-0 shadow-none text-right pr-1 h-8 border-transparent focus:ring-[#10a37f] focus:ring-offset-0 focus:ring-opacity-100';++function Settings() {+ const [chatGptLabel, setChatGptLabel] = useState('');+ const [promptPrefix, setPromptPrefix] = useState('');+ const [temperature, setTemperature] = useState(1);- const [maxLength, setMaxLength] = useState(2048);++ const [maxTokens, setMaxTokens] = useState(2048);+ const [topP, setTopP] = useState(1);+ const [freqP, setFreqP] = useState(0);+ const [presP, setPresP] = useState(0);+ const textareaRef = useRef(null);+ const inputRef = useRef(null);+ //+ return (+ <div>+ {/* <DialogDescription className="text-gray-600 dark:text-gray-300">+ Note: important instructions are often better placed in your message rather than the prefix.{' '}+ <a+ href="https://platform.openai.com/docs/guides/chat/instructing-chat-models"+ target="_blank"+ rel="noopener noreferrer"+ >+ <u>More info here</u>+ </a>+ </DialogDescription> */}- <div className="grid gap-4 py-4">- <div className="grid grid-cols-4 items-center gap-4">- <Label- htmlFor="chatGptLabel"- className="text-right"- >- Custom Name- </Label>- <Input- id="chatGptLabel"- value={chatGptLabel}- ref={inputRef}- onChange={e => setChatGptLabel(e.target.value)}- placeholder="Set a custom name for ChatGPT"- className=" col-span-3 shadow-[0_0_10px_rgba(0,0,0,0.10)] outline-none placeholder:text-gray-400 dark:bg-gray-700- dark:text-gray-50 dark:shadow-[0_0_15px_rgba(0,0,0,0.10)]"- />- </div>- <div className="grid grid-cols-4 items-center gap-4">- <Label- htmlFor="promptPrefix"- className="text-right"- >- Prompt Prefix- </Label>- <TextareaAutosize- id="promptPrefix"- value={promptPrefix}- onChange={e => setPromptPrefix(e.target.value)}- placeholder="Set custom instructions. Defaults to: 'You are ChatGPT, a large language model trained by OpenAI.'"- className={cn(defaultTextProps, 'col-span-3 flex h-10 max-h-10 w-full resize-none px-3 py-2 ')}- onFocus={() => {- textareaRef.current.classList.remove('max-h-10');- textareaRef.current.classList.add('max-h-52');- }}- onBlur={() => {- textareaRef.current.classList.remove('max-h-52');- textareaRef.current.classList.add('max-h-10');- }}- ref={textareaRef}- />- </div>- <div className="flex justify-around">- <div className="flex w-full items-center justify-end mr-4 gap-4">++ <>++ <div className="grid gap-4 py-4">++ <div className="grid grid-cols-4 items-center gap-4">+ <Label- htmlFor="temperature"- className="mr-2 text-right"++ htmlFor="chatGptLabel"++ className="text-right"+ >- Temperature++ Custom Name+ </Label>+ <Input- id="temp-int"- value={temperature}- onChange={e => setTemperature(e.target.value)}- placeholder="1.0"- className={cn(defaultTextProps, `w-9 ${optionText}`)}++ id="chatGptLabel"++ value={chatGptLabel}++ ref={inputRef}++ onChange={e => setChatGptLabel(e.target.value)}++ placeholder="Set a custom name for ChatGPT"++ className=" col-span-3 shadow-[0_0_10px_rgba(0,0,0,0.10)] outline-none placeholder:text-gray-400 dark:bg-gray-700++ dark:text-gray-50 dark:shadow-[0_0_15px_rgba(0,0,0,0.10)]"+ />+ </div>- <div className="flex w-full items-center justify-end mr-4 gap-4">++ <div className="grid grid-cols-4 items-center gap-4">+ <Label- htmlFor="max-length"- className="mr-2 w-full text-right"++ htmlFor="promptPrefix"++ className="text-right"+ >- Max. length++ Prompt Prefix+ </Label>- <Input- id="max-length-int"- value={maxLength}- onChange={e => setMaxLength(e.target.value)}- placeholder="1.0"- className={cn(defaultTextProps, `w-11 ${optionText}`)}++ <TextareaAutosize++ id="promptPrefix"++ value={promptPrefix}++ onChange={e => setPromptPrefix(e.target.value)}++ placeholder="Set custom instructions. Defaults to: 'You are ChatGPT, a large language model trained by OpenAI.'"++ className={cn(defaultTextProps, 'col-span-3 flex h-10 max-h-10 w-full resize-none px-3 py-2 ')}++ onFocus={() => {++ textareaRef.current.classList.remove('max-h-10');++ textareaRef.current.classList.add('max-h-52');++ }}++ onBlur={() => {++ textareaRef.current.classList.remove('max-h-52');++ textareaRef.current.classList.add('max-h-10');++ }}++ ref={textareaRef}+ />+ </div>- </div>-- <div className="grid grid-cols-2 items-center gap-4">- <Slider- defaultValue={[1]}- onValueChange={value => setTemperature(value)}- max={2}- min={0}- step={0.01}- className="w-full"- />- <Slider- defaultValue={[2048]}- onValueChange={value => setMaxLength(value)}- max={2048}- min={1}- step={1}- className="w-full"- />- </div>++ <div className="flex justify-around">++ <HoverCard>++ <HoverCardTrigger className="group/temp mr-4 flex w-full items-center justify-end gap-4">++ {/* <div className="mr-4 flex w-full items-center justify-end gap-4"> */}++ <Label++ htmlFor="temperature"++ className="mr-2 text-right"++ >++ Temperature++ </Label>++ <Input++ id="temp-int"++ value={temperature}++ onChange={e => setTemperature(e.target.value)}++ className={cn(defaultTextProps, cn(optionText, 'w-10 group-hover/temp:border-gray-200'))}++ />++ {/* </div> */}++ </HoverCardTrigger>++ <OptionHover++ type="temp"++ side="right"++ />++ </HoverCard>++ {/* <div className="mr-4 flex w-full items-center justify-end gap-4"> */}++ <HoverCard>++ <HoverCardTrigger className="group/max mr-4 flex w-full items-center justify-end gap-4">++ <Label++ htmlFor="max-tokens"++ className="mr-2 w-full text-right"++ >++ Max tokens++ </Label>++ <Input++ id="max-tokens-int"++ value={maxTokens}++ onChange={e => setMaxTokens(e.target.value)}++ className={cn(defaultTextProps, cn(optionText, 'w-11 group-hover/max:border-gray-200'))}++ />++ </HoverCardTrigger>++ <OptionHover++ type="max"++ side="left"++ />++ </HoverCard>++ {/* </div> */}++ </div>+- <div className="flex justify-around">- <div className="flex w-full items-center justify-end mr-4 gap-4">- <Label- htmlFor="top-p"- className="mr-2 text-right"- >- Top P- </Label>- <Input- id="top-p-int"- value={topP}- onChange={e => setTopP(e.target.value)}- placeholder="1.0"- className={cn(defaultTextProps, `w-9 ${optionText}`)}++ <div className="grid grid-cols-2 items-center gap-5">++ <Slider++ value={[temperature]}++ onValueChange={value => setTemperature(value)}++ max={2}++ min={0}++ step={0.01}++ className="w-full"++ />++ <Slider++ value={[maxTokens]}++ onValueChange={value => setMaxTokens(value)}++ max={2048} // should be dynamic to the currently selected model++ min={1}++ step={1}++ className="w-full"+ />+ </div>- <div className="flex w-full items-center justify-end mr-4 gap-4">- <Label- htmlFor="freq-penalty"- className="mr-2 w-full text-right"- >- Freq. Penalty- </Label>- <Input- id="freq-penalty-int"- value={freqP}- onChange={e => setFreqP(e.target.value)}- placeholder="1.0"- className={cn(defaultTextProps, `w-9 ${optionText}`)}++ <div className="flex justify-around">++ <HoverCard>++ <HoverCardTrigger className="group/top mr-4 flex w-full items-center justify-end gap-4">++ <Label++ htmlFor="top-p"++ className="mr-2 text-right"++ >++ Top P++ </Label>++ <Input++ id="top-p-int"++ value={topP}++ onChange={e => setTopP(e.target.value)}++ className={cn(defaultTextProps, cn(optionText, 'w-10 group-hover/top:border-gray-200'))}++ />++ <OptionHover++ type="top-p"++ side="right"++ />++ </HoverCardTrigger>++ </HoverCard>++ <HoverCard>++ <HoverCardTrigger className="group/freq mr-4 flex w-full items-center justify-end gap-4">++ <Label++ htmlFor="freq-penalty"++ className="mr-2 w-full text-right"++ >++ Frequency Penalty++ </Label>++ <Input++ id="freq-penalty-int"++ value={freqP}++ onChange={e => setFreqP(e.target.value)}++ className={cn(defaultTextProps, cn(optionText, 'w-10 group-hover/freq:border-gray-200'))}++ />++ </HoverCardTrigger>++ <OptionHover++ type="freq"++ side="left"++ />++ </HoverCard>++ </div>++ <div className="grid grid-cols-2 items-center gap-5">++ <Slider++ value={[topP]}++ onValueChange={value => setTopP(value)}++ max={1}++ min={0}++ step={0.01}++ className="w-full"++ />++ <Slider++ value={[freqP]}++ onValueChange={value => setFreqP(value)}++ max={2}++ min={-2}++ step={0.01}++ className="w-full"++ />++ </div>++ <div className="flex justify-end">++ <HoverCard>++ <HoverCardTrigger className="group/pres mr-4 flex items-center justify-end gap-4">++ <Label++ htmlFor="pres-penalty"++ className="mr-2 text-right"++ >++ Presence Penalty++ </Label>++ <Input++ id="pres-penalty-int"++ value={presP}++ onChange={e => setPresP(e.target.value)}++ className={cn(defaultTextProps, cn(optionText, 'w-10 group-hover/pres:border-gray-200'))}++ />++ </HoverCardTrigger>++ <OptionHover++ type="pres"++ side="left"++ />++ </HoverCard>++ </div>++ <div className="grid grid-cols-2 items-center gap-5">++ <Slider++ value={[presP]}++ onValueChange={value => setPresP(value)}++ max={2}++ min={0}++ step={0.01}++ className="w-full opacity-0"++ />++ <Slider++ value={[0]}++ onValueChange={value => setPresP(value)}++ max={2}++ min={-2}++ step={0.01}++ className="w-full"+ />+ </div>+ </div>- <div className="grid grid-cols-2 items-center gap-4">- <Slider- defaultValue={[0]}- onValueChange={value => setTopP(value)}- max={2}- min={0}- step={0.01}- className="w-full"- />- <Slider- defaultValue={[0]}- onValueChange={value => setFreqP(value)}- max={2}- min={0}- step={0.01}- className="w-full"- />- </div>- </div>++ </>+ </div>+ );+}++export default Settings;diff --cc client/src/components/Input/OpenAIOptions/index.jsxindex 04138e6d77,cbc9b1f15d..0d1050df2c--- a/client/src/components/Input/OpenAIOptions/index.jsx+++ b/client/src/components/Input/OpenAIOptions/index.jsx@@@ -1,8 -1,7 +1,8 @@@- import React, { useState, useEffect, forwardRef } from 'react';- import { Tabs, TabsList, TabsTrigger } from '../../ui/Tabs.tsx';- import { useRecoilValue, useRecoilState } from 'recoil';+ import React, { useEffect, useState } from 'react';+ import { useSetRecoilState } from 'recoil';+ import ModelSelect from './ModelSelect';import { Button } from '../../ui/Button.tsx';+import Settings from './Settings.jsx';import store from '~/store';@@@ -39,12 -84,21 +85,21 @@@ function OpenAIOptions({ conversation<divclassName={cardStyle +- ' p-b-[40px] absolute left-4 right-4 bottom-[40px] flex h-[300px] flex-col rounded-md bg-white'+ ' p-b-[40px] openAIOptions-advanced-container absolute left-4 right-4 bottom-[40px] flex flex-col overflow-hidden rounded-md bg-slate-100 bg-white px-0' ++ (advancedMode ? ' show' : '')}>- <div>hi there</div>- {/* <div>content</div> */}- <Settings />+ <div className="flex w-full items-center justify-between bg-slate-100 px-4 py-2 dark:bg-white/10">+ <span className="text-xs font-medium font-normal">Advanced settings for OpenAI endpoint</span>+ <Button+ type="button"+ className="h-auto bg-transparent px-2 py-1 text-xs font-medium font-normal text-black hover:bg-slate-200 hover:text-black dark:bg-transparent dark:text-white dark:hover:bg-gray-700 dark:hover:text-white"+ onClick={switchToSimpleMode}+ >+ Switch to simple mode+ </Button>+ </div>- <div className="h-[200px]">content</div>++ <div className="h-[375px] p-5"><Settings/></div></div></>);diff --cc client/src/components/ui/HoverCard.tsxindex 0000000000,0000000000..c5282c135cnew file mode 100644--- /dev/null+++ b/client/src/components/ui/HoverCard.tsx@@@ -1,0 -1,0 +1,31 @@@++"use client"++++import * as React from "react"++import * as HoverCardPrimitive from "@radix-ui/react-hover-card"++++import { cn } from "../../utils"++++const HoverCard = HoverCardPrimitive.Root++++const HoverCardTrigger = HoverCardPrimitive.Trigger++++const HoverCardPortal = HoverCardPrimitive.Portal++++const HoverCardContent = React.forwardRef<++ React.ElementRef<typeof HoverCardPrimitive.Content>,++ React.ComponentPropsWithoutRef<typeof HoverCardPrimitive.Content>++>(({ className, align = "center", sideOffset = 6, ...props }, ref) => (++ <HoverCardPrimitive.Content++ ref={ref}++ align={align}++ sideOffset={sideOffset}++ className={cn(++ "animate-in fade-in-0 z-50 w-64 rounded-md border border-gray-100 bg-white p-4 shadow-md outline-none dark:border-gray-800 dark:bg-gray-800",++ className++ )}++ {...props}++ />++))++HoverCardContent.displayName = HoverCardPrimitive.Content.displayName++++export { HoverCard, HoverCardTrigger, HoverCardContent, HoverCardPortal }diff --cc client/src/components/ui/Slider.tsxindex e522d0c7a7,0000000000..64d196e4abmode 100644,000000..100644--- a/client/src/components/ui/Slider.tsx+++ b/client/src/components/ui/Slider.tsx@@@ -1,28 -1,0 +1,28 @@@+"use client"++import * as React from "react"+import * as SliderPrimitive from "@radix-ui/react-slider"++import { cn } from "../../utils"++const Slider = React.forwardRef<+ React.ElementRef<typeof SliderPrimitive.Root>,+ React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>+>(({ className, ...props }, ref) => (+ <SliderPrimitive.Root+ ref={ref}+ className={cn(+ "relative flex w-full touch-none select-none items-center",+ className+ )}+ {...props}+ >- <SliderPrimitive.Track className="relative h-1 w-full grow overflow-hidden rounded-full bg-gray-200 dark:bg-gray-900">- <SliderPrimitive.Range className="absolute h-full bg-gray-700 dark:bg-gray-400" />++ <SliderPrimitive.Track className="relative h-1 w-full grow overflow-hidden rounded-full bg-gray-100 dark:bg-gray-900">++ <SliderPrimitive.Range className="absolute h-full bg-gray-400 dark:bg-gray-400" />+ </SliderPrimitive.Track>- <SliderPrimitive.Thumb className="block h-4 w-4 rounded-full border-2 border-gray-700 bg-white transition-colors focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 dark:border-gray-100 dark:bg-gray-400 dark:focus:ring-gray-400 dark:focus:ring-offset-gray-900" />++ <SliderPrimitive.Thumb className="block h-4 w-4 rounded-full border-2 border-gray-400 bg-white transition-colors focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 dark:border-gray-100 dark:bg-gray-400 dark:focus:ring-gray-400 dark:focus:ring-offset-gray-900" />+ </SliderPrimitive.Root>+))+Slider.displayName = SliderPrimitive.Root.displayName++export { Slider }