Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/settings/image-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,10 @@ export function ImageSettings({ selectedProviderId }: ImageSettingsProps) {
</div>
<div className="flex justify-end gap-2">
<Button variant="outline" size="sm" onClick={() => setShowModelDialog(false)}>
{t('common.cancel')}
{t('settings.cancelEdit')}
</Button>
<Button size="sm" onClick={handleSaveModel} disabled={!modelForm.id.trim()}>
{t('common.save')}
{t('settings.saveModel')}
</Button>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions components/settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,7 @@ export function SettingsDialog({ open, onOpenChange, initialSection }: SettingsD
baseUrl={providersConfig[selectedProviderId]?.baseUrl}
providerType={providersConfig[selectedProviderId]?.type}
requiresApiKey={providersConfig[selectedProviderId]?.requiresApiKey}
isServerConfigured={providersConfig[selectedProviderId]?.isServerConfigured}
/>

{/* Add Provider Dialog */}
Expand Down
12 changes: 8 additions & 4 deletions components/settings/model-edit-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ interface ModelEditDialogProps {
baseUrl?: string;
providerType?: string;
requiresApiKey?: boolean;
isServerConfigured?: boolean;
}

export function ModelEditDialog({
Expand All @@ -38,6 +39,7 @@ export function ModelEditDialog({
baseUrl,
providerType,
requiresApiKey,
isServerConfigured,
}: ModelEditDialogProps) {
const { t } = useI18n();
const [testStatus, setTestStatus] = useState<'idle' | 'testing' | 'success' | 'error'>('idle');
Expand All @@ -59,9 +61,7 @@ export function ModelEditDialog({
};

const handleTestModel = useCallback(async () => {
if (!editingModel || !apiKey) {
setTestStatus('error');
setTestMessage(t('settings.apiKeyRequired') || 'API Key is required');
if (!editingModel) {
return;
}

Expand Down Expand Up @@ -305,7 +305,11 @@ export function ModelEditDialog({
variant="outline"
size="sm"
onClick={handleTestModel}
disabled={!editingModel.model.id || testStatus === 'testing'}
disabled={
!editingModel.model.id ||
testStatus === 'testing' ||
(requiresApiKey && !apiKey && !isServerConfigured)
}
className={cn(
testStatus === 'success' && 'border-green-600 text-green-600 hover:bg-green-50',
testStatus === 'error' && 'border-red-600 text-red-600 hover:bg-red-50',
Expand Down
4 changes: 2 additions & 2 deletions components/settings/video-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,10 @@ export function VideoSettings({ selectedProviderId }: VideoSettingsProps) {
</div>
<div className="flex justify-end gap-2">
<Button variant="outline" size="sm" onClick={() => setShowModelDialog(false)}>
{t('common.cancel')}
{t('settings.cancelEdit')}
</Button>
<Button size="sm" onClick={handleSaveModel} disabled={!modelForm.id.trim()}>
{t('common.save')}
{t('settings.saveModel')}
</Button>
</div>
</div>
Expand Down
Loading