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