This commit is contained in:
IGNY8 VPS (Salman)
2025-12-20 19:49:57 +00:00
parent 3283a83b42
commit 9e8ff4fbb1
18 changed files with 797 additions and 828 deletions

View File

@@ -46,33 +46,20 @@ export default function ValidationCard({
setTestResult(null);
try {
// Get saved settings to get API key and model
// Get saved settings to get model
// fetchAPI extracts data from unified format {success: true, data: {...}}
// So settingsData IS the data object (config object)
const settingsData = await fetchAPI(`/v1/system/settings/integrations/${integrationId}/`);
let apiKey = '';
let model = 'gpt-4.1';
let model = 'gpt-4o-mini';
if (settingsData && typeof settingsData === 'object') {
apiKey = settingsData.apiKey || '';
model = settingsData.model || 'gpt-4.1';
model = settingsData.model || 'gpt-4o-mini';
}
if (!apiKey) {
setTestResult({
success: false,
message: 'API key not configured. Please configure your API key in settings first.',
});
setIsLoading(false);
return;
}
// Call test endpoint
// Call test endpoint (uses platform API key - no apiKey parameter needed)
// For Runware, we don't need with_response or model config
const requestBody: any = {
apiKey: apiKey,
};
const requestBody: any = {};
if (integrationId === 'openai') {
requestBody.config = {

View File

@@ -17,7 +17,6 @@ import {
FileIcon,
UserIcon,
UserCircleIcon,
BoxCubeIcon,
} from "../icons";
import { useSidebar } from "../context/SidebarContext";
import SidebarWidget from "./SidebarWidget";
@@ -216,36 +215,10 @@ const AppSidebar: React.FC = () => {
name: "Profile Settings",
path: "/settings/profile",
},
// Integration is admin-only; hide for non-privileged users (handled in render)
{
icon: <PlugInIcon />,
name: "Integration",
name: "AI Model Settings",
path: "/settings/integration",
adminOnly: true,
},
// Global Settings - Admin only, dropdown with global config pages
{
icon: <BoxCubeIcon />,
name: "Global Settings",
adminOnly: true,
subItems: [
{
name: "Platform API Keys",
path: "/admin/system/globalintegrationsettings/",
},
{
name: "Global Prompts",
path: "/admin/system/globalaiprompt/",
},
{
name: "Global Author Profiles",
path: "/admin/system/globalauthorprofile/",
},
{
name: "Global Strategies",
path: "/admin/system/globalstrategy/",
},
],
},
{
icon: <PageIcon />,

View File

@@ -411,23 +411,24 @@ export default function Integration() {
if (integrationId === 'openai') {
return [
{ label: 'App Name', value: 'OpenAI API' },
{ label: 'API Key', value: config.apiKey ? `${config.apiKey.substring(0, 20)}...` : 'Not configured' },
{ label: 'Model', value: config.model || 'Not set' },
{ label: 'Model', value: config.model || 'gpt-4o-mini' },
{ label: 'Status', value: config.using_global ? 'Using platform defaults' : 'Custom settings' },
];
} else if (integrationId === 'runware') {
return [
{ label: 'App Name', value: 'Runware API' },
{ label: 'API Key', value: config.apiKey ? `${config.apiKey.substring(0, 20)}...` : 'Not configured' },
{ label: 'Status', value: config.using_global ? 'Using platform defaults' : 'Custom settings' },
];
} else if (integrationId === 'image_generation') {
const service = config.service || 'openai';
const modelDisplay = service === 'openai'
? (config.model || 'Not set')
: (config.runwareModel || 'Not set');
? (config.model || config.imageModel || 'dall-e-3')
: (config.runwareModel || 'runware:97@1');
return [
{ label: 'Service', value: service === 'openai' ? 'OpenAI' : 'Runware' },
{ label: 'Service', value: service === 'openai' ? 'OpenAI DALL-E' : 'Runware' },
{ label: 'Model', value: modelDisplay },
{ label: 'Status', value: config.using_global ? 'Using platform defaults' : 'Custom settings' },
];
}
return [];