feat: project cover art with AI generation, branding rename, RBAC fix, computation graph
- Add DALL-E cover art generation for projects (Azure OpenAI + standard OpenAI)
- CoverArtSection component with generate/upload/remove/focus-point controls
- Client-side image compression (10MB input → WebP/JPEG, max 1920px)
- DALL-E settings in admin panel (deployment, endpoint, API key)
- MCP assistant tools for cover art (generate_project_cover, remove_project_cover)
- Rename "Planarchy" → "plANARCHY" across all UI-facing text (13 files)
- Fix hardcoded canEdit={true} on project detail page — now checks user role
- Computation graph visualization (2D/3D) for calculation rules
- OG image and OpenGraph metadata
Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
@@ -8,6 +8,9 @@ type AiSettings = {
|
||||
azureApiVersion?: string | null;
|
||||
aiMaxCompletionTokens?: number | null;
|
||||
aiTemperature?: number | null;
|
||||
azureDalleDeployment?: string | null;
|
||||
azureDalleEndpoint?: string | null;
|
||||
azureDalleApiKey?: string | null;
|
||||
};
|
||||
|
||||
/** Returns true if the settings have enough information to make an API call. */
|
||||
@@ -31,6 +34,32 @@ export function createAiClient(settings: AiSettings): OpenAI {
|
||||
return new OpenAI({ apiKey: settings.azureOpenAiApiKey! });
|
||||
}
|
||||
|
||||
/** Returns true if DALL-E image generation is configured. */
|
||||
export function isDalleConfigured(settings: AiSettings | null | undefined): boolean {
|
||||
if (!settings) return false;
|
||||
// DALL-E needs its own deployment (or a non-Azure key with model name)
|
||||
if (settings.aiProvider === "azure") {
|
||||
return !!(settings.azureDalleDeployment && (settings.azureDalleEndpoint || settings.azureOpenAiEndpoint) && (settings.azureDalleApiKey || settings.azureOpenAiApiKey));
|
||||
}
|
||||
// For direct OpenAI, the chat API key works for DALL-E too
|
||||
return !!settings.azureOpenAiApiKey;
|
||||
}
|
||||
|
||||
/** Creates an OpenAI client configured for DALL-E image generation. */
|
||||
export function createDalleClient(settings: AiSettings): OpenAI {
|
||||
if (settings.aiProvider === "azure") {
|
||||
const endpoint = settings.azureDalleEndpoint || settings.azureOpenAiEndpoint!;
|
||||
const apiKey = settings.azureDalleApiKey || settings.azureOpenAiApiKey!;
|
||||
return new AzureOpenAI({
|
||||
endpoint,
|
||||
apiKey,
|
||||
apiVersion: settings.azureApiVersion ?? "2025-01-01-preview",
|
||||
deployment: settings.azureDalleDeployment!,
|
||||
});
|
||||
}
|
||||
return new OpenAI({ apiKey: settings.azureOpenAiApiKey! });
|
||||
}
|
||||
|
||||
/** Turns raw API errors into actionable human-readable messages. */
|
||||
export function parseAiError(err: unknown): string {
|
||||
const msg = err instanceof Error ? err.message : String(err);
|
||||
|
||||
Reference in New Issue
Block a user