rename(phase 1): CapaKraken → Nexus across code, UI, docs, CI (#61)
CI / Architecture Guardrails (push) Successful in 2m38s
CI / Assistant Split Regression (push) Successful in 3m33s
CI / Typecheck (push) Successful in 3m51s
CI / Lint (push) Successful in 5m2s
CI / E2E Tests (push) Has been cancelled
CI / Fresh-Linux Docker Deploy (push) Has been cancelled
CI / Release Images (push) Has been cancelled
CI / Build (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Architecture Guardrails (push) Successful in 2m38s
CI / Assistant Split Regression (push) Successful in 3m33s
CI / Typecheck (push) Successful in 3m51s
CI / Lint (push) Successful in 5m2s
CI / E2E Tests (push) Has been cancelled
CI / Fresh-Linux Docker Deploy (push) Has been cancelled
CI / Release Images (push) Has been cancelled
CI / Build (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
rename(phase 1): CapaKraken → Nexus across code, UI, docs, CI (#61) Co-authored-by: Hartmut Nörenberg <hn@hartmut-noerenberg.com> Co-committed-by: Hartmut Nörenberg <hn@hartmut-noerenberg.com>
This commit was merged in pull request #61.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { DEFAULT_OPENAI_MODEL } from "@capakraken/shared";
|
||||
import { DEFAULT_OPENAI_MODEL } from "@nexus/shared";
|
||||
import OpenAI, { AzureOpenAI } from "openai";
|
||||
import { logger } from "./lib/logger.js";
|
||||
import { resolveSystemSettingsRuntime } from "./lib/system-settings-runtime.js";
|
||||
@@ -60,7 +60,11 @@ export function isDalleConfigured(settings: AiSettings | null | undefined): bool
|
||||
const runtimeSettings = resolveSystemSettingsRuntime(settings);
|
||||
// DALL-E needs its own deployment (or a non-Azure key with model name)
|
||||
if (runtimeSettings.aiProvider === "azure") {
|
||||
return !!(runtimeSettings.azureDalleDeployment && (runtimeSettings.azureDalleEndpoint || runtimeSettings.azureOpenAiEndpoint) && (runtimeSettings.azureDalleApiKey || runtimeSettings.azureOpenAiApiKey));
|
||||
return !!(
|
||||
runtimeSettings.azureDalleDeployment &&
|
||||
(runtimeSettings.azureDalleEndpoint || runtimeSettings.azureOpenAiEndpoint) &&
|
||||
(runtimeSettings.azureDalleApiKey || runtimeSettings.azureOpenAiApiKey)
|
||||
);
|
||||
}
|
||||
// For direct OpenAI, the chat API key works for DALL-E too
|
||||
return !!runtimeSettings.azureOpenAiApiKey;
|
||||
@@ -101,7 +105,10 @@ export async function loggedAiCall<T>(
|
||||
} catch (err) {
|
||||
const responseTimeMs = Math.round(performance.now() - start);
|
||||
const errorMessage = sanitizeDiagnosticError(err);
|
||||
logger.warn({ provider, model, promptLength, responseTimeMs, errorMessage }, "External API call failed");
|
||||
logger.warn(
|
||||
{ provider, model, promptLength, responseTimeMs, errorMessage },
|
||||
"External API call failed",
|
||||
);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
@@ -111,16 +118,29 @@ export function parseAiError(err: unknown): string {
|
||||
const msg = err instanceof Error ? err.message : String(err);
|
||||
const lower = msg.toLowerCase();
|
||||
|
||||
if (lower.includes("401") || lower.includes("unauthorized") || lower.includes("invalid_api_key") || lower.includes("incorrect api key")) {
|
||||
if (
|
||||
lower.includes("401") ||
|
||||
lower.includes("unauthorized") ||
|
||||
lower.includes("invalid_api_key") ||
|
||||
lower.includes("incorrect api key")
|
||||
) {
|
||||
return "Invalid API key — make sure you copied it correctly from your provider's dashboard.";
|
||||
}
|
||||
if (lower.includes("insufficient_quota") || lower.includes("exceeded your current quota") || lower.includes("billing")) {
|
||||
if (
|
||||
lower.includes("insufficient_quota") ||
|
||||
lower.includes("exceeded your current quota") ||
|
||||
lower.includes("billing")
|
||||
) {
|
||||
return "Account quota exceeded or billing issue — check your usage limits at platform.openai.com.";
|
||||
}
|
||||
if (lower.includes("403") || lower.includes("forbidden")) {
|
||||
return "Access denied — your key may not have permission to use this model/deployment.";
|
||||
}
|
||||
if (lower.includes("deploymentnotfound") || lower.includes("model_not_found") || (lower.includes("404") && lower.includes("deployment"))) {
|
||||
if (
|
||||
lower.includes("deploymentnotfound") ||
|
||||
lower.includes("model_not_found") ||
|
||||
(lower.includes("404") && lower.includes("deployment"))
|
||||
) {
|
||||
return "Deployment not found — check the deployment name matches exactly what's configured in Azure.";
|
||||
}
|
||||
if (lower.includes("404") || lower.includes("not found")) {
|
||||
@@ -129,7 +149,12 @@ export function parseAiError(err: unknown): string {
|
||||
if (lower.includes("429") || lower.includes("rate limit") || lower.includes("ratelimiterror")) {
|
||||
return "Rate limit exceeded — wait a moment and try again.";
|
||||
}
|
||||
if (lower.includes("econnrefused") || lower.includes("enotfound") || lower.includes("fetch failed") || lower.includes("failed to fetch")) {
|
||||
if (
|
||||
lower.includes("econnrefused") ||
|
||||
lower.includes("enotfound") ||
|
||||
lower.includes("fetch failed") ||
|
||||
lower.includes("failed to fetch")
|
||||
) {
|
||||
return "Cannot reach the API endpoint — check the endpoint URL and your network connection.";
|
||||
}
|
||||
if (lower.includes("context_length_exceeded") || lower.includes("maximum context")) {
|
||||
|
||||
Reference in New Issue
Block a user