Skip to content
32 changes: 9 additions & 23 deletions app/components/ConfigDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@

"use client";

import React, { useState } from 'react';
import React, { useEffect, useState } from 'react';
import { colors } from '@/app/lib/colors';
import { MODEL_OPTIONS, isGpt5Model } from '@/app/lib/models';
import { SavedConfig } from './SimplifiedConfigEditor';
import { Tool } from '@/app/lib/configTypes';

Expand Down Expand Up @@ -39,27 +40,6 @@ interface ConfigDrawerProps {
onApplyConfig: (configId: string) => void;
}

const MODEL_OPTIONS = {
openai: [
{ value: 'gpt-4o', label: 'GPT-4o' },
{ value: 'gpt-4o-mini', label: 'GPT-4o Mini' },
{ value: 'gpt-4-turbo', label: 'GPT-4 Turbo' },
{ value: 'gpt-4', label: 'GPT-4' },
{ value: 'gpt-3.5-turbo', label: 'GPT-3.5 Turbo' },
],
// anthropic: [
// { value: 'claude-3-5-sonnet-20241022', label: 'Claude 3.5 Sonnet' },
// { value: 'claude-3-opus-20240229', label: 'Claude 3 Opus' },
// { value: 'claude-3-sonnet-20240229', label: 'Claude 3 Sonnet' },
// { value: 'claude-3-haiku-20240307', label: 'Claude 3 Haiku' },
// ],
// google: [
// { value: 'gemini-1.5-pro', label: 'Gemini 1.5 Pro' },
// { value: 'gemini-1.5-flash', label: 'Gemini 1.5 Flash' },
// { value: 'gemini-pro', label: 'Gemini Pro' },
// ],
};

function generateDiff(text1: string, text2: string): { left: DiffLine[], right: DiffLine[] } {
const lines1 = text1.split('\n');
const lines2 = text2.split('\n');
Expand Down Expand Up @@ -106,8 +86,10 @@ export default function ConfigDrawer({
const [expandedConfigs, setExpandedConfigs] = useState<Set<string>>(new Set());
const [isCreatingNew, setIsCreatingNew] = useState(false);

const isGpt5 = isGpt5Model(currentConfig.modelName);

// Sync isCreatingNew with selectedConfigId
React.useEffect(() => {
useEffect(() => {
if (selectedConfigId) {
setIsCreatingNew(false);
}
Expand Down Expand Up @@ -525,6 +507,7 @@ export default function ConfigDrawer({
</div>

{/* Temperature */}
{!isGpt5 && (
<div>
<label
style={{
Expand Down Expand Up @@ -560,6 +543,7 @@ export default function ConfigDrawer({
<span>Creative (1)</span>
</div>
</div>
)}

{/* Tools Section */}
<div>
Expand Down Expand Up @@ -653,6 +637,7 @@ export default function ConfigDrawer({
}}
/>
</div>
{!isGpt5 && (
<div>
<label
style={{
Expand All @@ -679,6 +664,7 @@ export default function ConfigDrawer({
}}
/>
</div>
)}
</div>
))}
</div>
Expand Down
32 changes: 8 additions & 24 deletions app/components/prompt-editor/ConfigEditorPane.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React, { useState, useMemo } from 'react';
import { useState, useMemo } from 'react';
import { colors } from '@/app/lib/colors';
import { ConfigBlob, Tool } from '@/app/configurations/prompt-editor/types';
import { SavedConfig, formatRelativeTime } from '@/app/lib/useConfigs';
import { MODEL_OPTIONS, isGpt5Model } from '@/app/lib/models';

interface ConfigEditorPaneProps {
configBlob: ConfigBlob;
Expand All @@ -28,28 +29,6 @@ interface ConfigGroupForDropdown {
versions: SavedConfig[];
}

// Provider-specific models
const MODEL_OPTIONS = {
openai: [
{ value: 'gpt-4o', label: 'GPT-4o' },
{ value: 'gpt-4o-mini', label: 'GPT-4o Mini' },
{ value: 'gpt-4-turbo', label: 'GPT-4 Turbo' },
{ value: 'gpt-4', label: 'GPT-4' },
{ value: 'gpt-3.5-turbo', label: 'GPT-3.5 Turbo' },
],
// anthropic: [
// { value: 'claude-3-5-sonnet-20241022', label: 'Claude 3.5 Sonnet' },
// { value: 'claude-3-opus-20240229', label: 'Claude 3 Opus' },
// { value: 'claude-3-sonnet-20240229', label: 'Claude 3 Sonnet' },
// { value: 'claude-3-haiku-20240307', label: 'Claude 3 Haiku' },
// ],
// google: [
// { value: 'gemini-1.5-pro', label: 'Gemini 1.5 Pro' },
// { value: 'gemini-1.5-flash', label: 'Gemini 1.5 Flash' },
// { value: 'gemini-pro', label: 'Gemini Pro' },
// ],
};

export default function ConfigEditorPane({
configBlob,
onConfigChange,
Expand All @@ -70,6 +49,7 @@ export default function ConfigEditorPane({

const provider = configBlob.completion.provider;
const params = configBlob.completion.params;
const isGpt5 = isGpt5Model(params.model);
const tools = (params.tools || []) as Tool[];

// Group configs by config_id for nested dropdown
Expand Down Expand Up @@ -531,7 +511,8 @@ export default function ConfigEditorPane({
</select>
</div>

{/* Temperature */}
{/* Temperature - hidden for GPT-5 models */}
{!isGpt5 && (
<div>
<label
className="block text-xs font-semibold mb-2"
Expand All @@ -557,6 +538,7 @@ export default function ConfigEditorPane({
<span>2</span>
</div>
</div>
)}

{/* Tools */}
<div>
Expand Down Expand Up @@ -626,6 +608,7 @@ export default function ConfigEditorPane({
}}
/>
</div>
{!isGpt5 && (
<div>
<div className="flex items-center gap-1 mb-1">
<label
Expand Down Expand Up @@ -703,6 +686,7 @@ export default function ConfigEditorPane({
}}
/>
</div>
)}
</div>
))}
</div>
Expand Down
15 changes: 10 additions & 5 deletions app/components/prompt-editor/CurrentConfigTab.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useState } from 'react';
import { useState } from 'react';
import { colors } from '@/app/lib/colors';
import { Config, Tool } from '@/app/configurations/prompt-editor/types';
import { MODEL_OPTIONS, isGpt5Model } from '@/app/lib/models';

interface CurrentConfigTabProps {
configs: Config[];
Expand Down Expand Up @@ -46,6 +47,7 @@ export default function CurrentConfigTab({
onUseCurrentPrompt,
}: CurrentConfigTabProps) {
const [isCreatingNew, setIsCreatingNew] = useState(false);
const isGpt5 = isGpt5Model(model);

const addTool = () => {
onToolsChange([
Expand Down Expand Up @@ -223,10 +225,9 @@ export default function CurrentConfigTab({
backgroundColor: colors.bg.primary,
}}
>
<option value="gpt-4o-mini">gpt-4o-mini</option>
<option value="gpt-4o">gpt-4o</option>
<option value="gpt-4-turbo">gpt-4-turbo</option>
<option value="gpt-3.5-turbo">gpt-3.5-turbo</option>
{MODEL_OPTIONS.openai.map((m) => (
<option key={m.value} value={m.value}>{m.label}</option>
))}
</select>
</div>

Expand Down Expand Up @@ -282,6 +283,7 @@ export default function CurrentConfigTab({
</div>

{/* Temperature Slider */}
{!isGpt5 && (
<div>
<label
style={{
Expand Down Expand Up @@ -317,6 +319,7 @@ export default function CurrentConfigTab({
<span>Creative (1)</span>
</div>
</div>
)}

{/* Tools Section */}
<div>
Expand Down Expand Up @@ -410,6 +413,7 @@ export default function CurrentConfigTab({
}}
/>
</div>
{!isGpt5 && (
<div>
<label
style={{
Expand All @@ -436,6 +440,7 @@ export default function CurrentConfigTab({
}}
/>
</div>
)}
</div>
))}
</div>
Expand Down
Loading
Loading