fix: sync model max image count config to frontend controls
This commit is contained in:
parent
84fe9175b5
commit
2f8ff5fd12
@ -39,6 +39,7 @@ export async function GET() {
|
|||||||
isSubModel: model.isSubModel,
|
isSubModel: model.isSubModel,
|
||||||
parentModelId: model.parentModelId,
|
parentModelId: model.parentModelId,
|
||||||
capabilities: model.capabilities, // 🆕 返回子模型的能力配置
|
capabilities: model.capabilities, // 🆕 返回子模型的能力配置
|
||||||
|
imageGenConfig: model.imageGenConfig,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const resolvedDefaultModelId =
|
const resolvedDefaultModelId =
|
||||||
|
|||||||
@ -1302,6 +1302,14 @@ export function CanvasChatPanel({ chatId, initialMessages = [], onClose, onOpenF
|
|||||||
supportsVision?: boolean;
|
supportsVision?: boolean;
|
||||||
supportsImageGen?: boolean;
|
supportsImageGen?: boolean;
|
||||||
capabilities?: string[] | null;
|
capabilities?: string[] | null;
|
||||||
|
imageGenConfig?: {
|
||||||
|
maxImages?: number;
|
||||||
|
supportsSize?: boolean;
|
||||||
|
supportsPromptExtend?: boolean;
|
||||||
|
supportsNegativePrompt?: boolean;
|
||||||
|
supportsWatermark?: boolean;
|
||||||
|
supportsSeed?: boolean;
|
||||||
|
} | null;
|
||||||
}>;
|
}>;
|
||||||
agentModel?: {
|
agentModel?: {
|
||||||
id: string;
|
id: string;
|
||||||
@ -5362,6 +5370,7 @@ export function CanvasChatPanel({ chatId, initialMessages = [], onClose, onOpenF
|
|||||||
onParamsChange={handleImageParamsChange}
|
onParamsChange={handleImageParamsChange}
|
||||||
inline={true}
|
inline={true}
|
||||||
providerType={currentModel?.providerType}
|
providerType={currentModel?.providerType}
|
||||||
|
imageGenConfig={currentModel?.imageGenConfig || undefined}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -369,6 +369,14 @@ export function Chat({
|
|||||||
providerType: string;
|
providerType: string;
|
||||||
supportsVision?: boolean;
|
supportsVision?: boolean;
|
||||||
supportsImageGen?: boolean;
|
supportsImageGen?: boolean;
|
||||||
|
imageGenConfig?: {
|
||||||
|
maxImages?: number;
|
||||||
|
supportsSize?: boolean;
|
||||||
|
supportsPromptExtend?: boolean;
|
||||||
|
supportsNegativePrompt?: boolean;
|
||||||
|
supportsWatermark?: boolean;
|
||||||
|
supportsSeed?: boolean;
|
||||||
|
} | null;
|
||||||
}>;
|
}>;
|
||||||
}>("/api/models", fetcher);
|
}>("/api/models", fetcher);
|
||||||
|
|
||||||
@ -1914,6 +1922,7 @@ export function Chat({
|
|||||||
imageParams={imageParams}
|
imageParams={imageParams}
|
||||||
onImageParamsChange={handleImageParamsChange}
|
onImageParamsChange={handleImageParamsChange}
|
||||||
imageProviderType={currentModel?.providerType}
|
imageProviderType={currentModel?.providerType}
|
||||||
|
imageGenConfig={currentModel?.imageGenConfig || undefined}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -96,6 +96,14 @@ type ModelOption = {
|
|||||||
avatarUrl?: string | null;
|
avatarUrl?: string | null;
|
||||||
providerType: string;
|
providerType: string;
|
||||||
supportsImageGen?: boolean;
|
supportsImageGen?: boolean;
|
||||||
|
imageGenConfig?: {
|
||||||
|
maxImages?: number;
|
||||||
|
supportsSize?: boolean;
|
||||||
|
supportsPromptExtend?: boolean;
|
||||||
|
supportsNegativePrompt?: boolean;
|
||||||
|
supportsWatermark?: boolean;
|
||||||
|
supportsSeed?: boolean;
|
||||||
|
} | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
type NavLink = {
|
type NavLink = {
|
||||||
@ -1704,6 +1712,7 @@ export function LovartHome({
|
|||||||
onParamsChange={handleImageParamsChange}
|
onParamsChange={handleImageParamsChange}
|
||||||
inline
|
inline
|
||||||
providerType={triggerComposerModel?.providerType}
|
providerType={triggerComposerModel?.providerType}
|
||||||
|
imageGenConfig={triggerComposerModel?.imageGenConfig || undefined}
|
||||||
hideImageCount
|
hideImageCount
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -17,6 +17,14 @@ type DynamicModel = {
|
|||||||
isSubModel?: boolean; // 🆕 是否为子模型
|
isSubModel?: boolean; // 🆕 是否为子模型
|
||||||
parentModelId?: string | null; // 🆕 父模型ID
|
parentModelId?: string | null; // 🆕 父模型ID
|
||||||
capabilities?: any; // 🆕 模型能力配置
|
capabilities?: any; // 🆕 模型能力配置
|
||||||
|
imageGenConfig?: {
|
||||||
|
maxImages?: number;
|
||||||
|
supportsSize?: boolean;
|
||||||
|
supportsPromptExtend?: boolean;
|
||||||
|
supportsNegativePrompt?: boolean;
|
||||||
|
supportsWatermark?: boolean;
|
||||||
|
supportsSeed?: boolean;
|
||||||
|
} | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetcher = (url: string) => fetch(url).then((res) => res.json());
|
const fetcher = (url: string) => fetch(url).then((res) => res.json());
|
||||||
@ -93,6 +101,7 @@ function PureMultimodalInput({
|
|||||||
imageParams,
|
imageParams,
|
||||||
onImageParamsChange,
|
onImageParamsChange,
|
||||||
imageProviderType,
|
imageProviderType,
|
||||||
|
imageGenConfig,
|
||||||
}: {
|
}: {
|
||||||
chatId: string;
|
chatId: string;
|
||||||
input: string;
|
input: string;
|
||||||
@ -119,6 +128,14 @@ function PureMultimodalInput({
|
|||||||
imageParams?: ImageGenerationParams | null;
|
imageParams?: ImageGenerationParams | null;
|
||||||
onImageParamsChange?: (params: ImageGenerationParams) => void;
|
onImageParamsChange?: (params: ImageGenerationParams) => void;
|
||||||
imageProviderType?: string; // 🆕 图片模型提供商类型
|
imageProviderType?: string; // 🆕 图片模型提供商类型
|
||||||
|
imageGenConfig?: {
|
||||||
|
maxImages?: number;
|
||||||
|
supportsSize?: boolean;
|
||||||
|
supportsPromptExtend?: boolean;
|
||||||
|
supportsNegativePrompt?: boolean;
|
||||||
|
supportsWatermark?: boolean;
|
||||||
|
supportsSeed?: boolean;
|
||||||
|
} | null;
|
||||||
}) {
|
}) {
|
||||||
// 🔍 调试日志:检查图片模型相关props
|
// 🔍 调试日志:检查图片模型相关props
|
||||||
console.log('[MultimodalInput] Render - isImageModel:', isImageModel);
|
console.log('[MultimodalInput] Render - isImageModel:', isImageModel);
|
||||||
@ -1051,6 +1068,7 @@ function PureMultimodalInput({
|
|||||||
onParamsChange={onImageParamsChange}
|
onParamsChange={onImageParamsChange}
|
||||||
inline={true}
|
inline={true}
|
||||||
providerType={imageProviderType}
|
providerType={imageProviderType}
|
||||||
|
imageGenConfig={imageGenConfig || undefined}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
@ -1108,6 +1126,9 @@ export const MultimodalInput = memo(
|
|||||||
if (!equal(prevProps.imageParams, nextProps.imageParams)) {
|
if (!equal(prevProps.imageParams, nextProps.imageParams)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (!equal(prevProps.imageGenConfig, nextProps.imageGenConfig)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user