feat(frontend): add support for agent selection in GPT plugins in adding functions agent

Add support for selecting an agent in the GPT plugins endpoint. The agent can be selected from a dropdown menu in the AgentSettings component. The default agent is set to 'classic' in the cleanupPreset, getDefaultConversation, and handleSubmit functions.
This commit is contained in:
Daniel Avila 2023-06-13 23:40:25 -04:00 committed by Danny Avila
parent 3caddd6854
commit 198f60c536
7 changed files with 131 additions and 16 deletions

View file

@ -238,6 +238,7 @@ const EditPresetDialog = ({ open, onOpenChange, preset: _preset, title }) => {
)}
{preset?.endpoint === 'gptPlugins' && showAgentSettings && (
<AgentSettings
agent={preset.agent}
model={preset.agentOptions.model}
endpoint={preset.agentOptions.endpoint}
temperature={preset.agentOptions.temperature}

View file

@ -20,6 +20,7 @@ import store from '~/store';
function Settings(props) {
const {
readonly,
agent,
model,
temperature,
// topP,
@ -39,6 +40,7 @@ function Settings(props) {
// const toolsSelected = tools?.length > 0;
const models = endpointsConfig?.[endpoint]?.['availableModels'] || [];
const agents = endpointsConfig?.[endpoint]?.['availableAgents'] || [];
return (
<div className="max-h-[350px] min-h-[305px] overflow-y-auto">
@ -58,6 +60,20 @@ function Settings(props) {
containerClassName="flex w-full resize-none"
/>
</div>
<div className="grid w-full items-center gap-2">
<SelectDropDown
title="Agent Mode"
value={agent}
setValue={setOption('agent')}
availableValues={agents}
disabled={readonly}
className={cn(
defaultTextProps,
'flex w-full resize-none focus:outline-none focus:ring-0 focus:ring-opacity-0 focus:ring-offset-0'
)}
containerClassName="flex w-full resize-none"
/>
</div>
</div>
<div className="col-span-1 flex flex-col items-center justify-start gap-6">
<HoverCard openDelay={300}>

View file

@ -187,6 +187,7 @@ function PluginsOptions() {
<div className="px-4 py-4">
{showAgentSettings ? (
<AgentSettings
agent={agentOptions.agent}
model={agentOptions.model}
endpoint={agentOptions.endpoint}
temperature={agentOptions.temperature}

View file

@ -51,6 +51,7 @@ const cleanupPreset = ({ preset: _preset, endpointsConfig = {} }) => {
};
} else if (endpoint === 'gptPlugins') {
const agentOptions = _preset?.agentOptions ?? {
agent: 'classic',
model: 'gpt-3.5-turbo',
temperature: 0,
// top_p: 1,

View file

@ -67,6 +67,7 @@ const buildDefaultConversation = ({
};
} else if (endpoint === 'gptPlugins') {
const agentOptions = lastConversationSetup?.agentOptions ?? {
agent: 'classic',
model: 'gpt-3.5-turbo',
temperature: 0,
// top_p: 1,

View file

@ -88,6 +88,7 @@ const useMessageHandler = () => {
responseSender = 'ChatGPT';
} else if (endpoint === 'gptPlugins') {
const agentOptions = currentConversation?.agentOptions ?? {
agent: 'classic',
model: 'gpt-3.5-turbo',
temperature: 0,
// top_p: 1,