fix: address project review bugs

This commit is contained in:
2026-06-12 17:25:30 +08:00
parent f9e55578b3
commit ad4bca31b1
11 changed files with 209 additions and 124 deletions
+13 -14
View File
@@ -12,7 +12,7 @@ import type { WebGenerationPreviewTask } from "../types";
export interface ImageGenInput {
projectId?: string;
conversationId?: number;
model: string;
model?: string;
prompt: string;
ratio?: string;
quality?: string;
@@ -210,18 +210,18 @@ function getStoredSessionRole(): string {
}
function emitImageRouteDebug(label: string, payload: Record<string, unknown>): void {
// Only emit console logs for admin users — hides enterprise routing details
if (getStoredSessionRole() === "admin") {
const entry: ImageRouteDebugEntry = {
at: new Date().toISOString(),
label,
...payload,
};
try {
console.log(`${label} ${JSON.stringify(entry)}`);
} catch {
console.log(label, entry);
}
// Only emit route debug for admin users; provider routing is operational data.
if (getStoredSessionRole() !== "admin") return;
const entry: ImageRouteDebugEntry = {
at: new Date().toISOString(),
label,
...payload,
};
try {
console.log(`${label} ${JSON.stringify(entry)}`);
} catch {
console.log(label, entry);
}
if (typeof window === "undefined") return;
@@ -229,7 +229,6 @@ function emitImageRouteDebug(label: string, payload: Record<string, unknown>): v
const previousEntries = Array.isArray(debugWindow.__OMNIAI_IMAGE_ROUTE_DEBUG__)
? debugWindow.__OMNIAI_IMAGE_ROUTE_DEBUG__
: [];
const entry: ImageRouteDebugEntry = { at: new Date().toISOString(), label, ...payload };
debugWindow.__OMNIAI_IMAGE_ROUTE_DEBUG__ = [...previousEntries.slice(-19), entry];
}