fix: route image presets through direct image mode
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled

This commit is contained in:
Your Name 2026-03-24 16:42:22 +08:00
parent 406bc6418e
commit f18f9733df
3 changed files with 22 additions and 4 deletions

View File

@ -3884,6 +3884,16 @@ export async function POST(request: Request) {
.trim();
const autoContextText = typeof autoContext === "string" ? autoContext.trim() : "";
if (composerMode === "agent" && !agentPresetId) {
return NextResponse.json(
{
code: "bad_request:api",
message: "智能体模式缺少生图模式配置,请刷新页面后重新选择生图模式再试",
},
{ status: 400 },
);
}
const now = Date.now();
for (const [key, startedAt] of inFlightChatRequests.entries()) {
if (now - startedAt > IN_FLIGHT_REQUEST_TTL_MS) {

View File

@ -1081,8 +1081,12 @@ export function AgentGenerationWorkspaceDarkV2({
hiddenPrompt: hiddenPromptRef.current || undefined,
agentPresetId:
transportState.selectedAgentPresetId || selectedAgentPresetId || undefined,
selectedChatModel: transportState.selectedModelId,
composerMode: "agent" as const,
selectedChatModel:
transportState.selectedModelId !== "auto"
? transportState.selectedModelId
: selectedAgentPreset?.defaultModelId || transportState.selectedModelId,
composerMode:
selectedAgentPreset?.type === "image" ? ("image" as const) : ("agent" as const),
selectedVisibilityType: "private",
imageParams: transportState.imageParams,
contextPayload: {

View File

@ -365,8 +365,12 @@ export function AgentGenerationWorkspaceNew({
hiddenPrompt: hiddenPromptRef.current || undefined,
agentPresetId:
transportState.selectedAgentPresetId || selectedAgentPresetId || undefined,
selectedChatModel: transportState.selectedModelId,
composerMode: "agent" as const,
selectedChatModel:
transportState.selectedModelId !== "auto"
? transportState.selectedModelId
: selectedAgentPreset?.defaultModelId || transportState.selectedModelId,
composerMode:
selectedAgentPreset?.type === "image" ? ("image" as const) : ("agent" as const),
selectedVisibilityType: "private",
imageParams: transportState.imageParams,
contextPayload: {