fix: include multimodal agent in chat mode
This commit is contained in:
parent
724609f29c
commit
8329268dea
@ -130,9 +130,13 @@ export async function GET() {
|
||||
agentModel: agentModelWithProvider
|
||||
? {
|
||||
id: agentModelWithProvider.model.id,
|
||||
modelId: agentModelWithProvider.model.modelId,
|
||||
displayName: agentModelWithProvider.model.displayName,
|
||||
avatarUrl: agentModelWithProvider.model.avatarUrl,
|
||||
providerType: agentModelWithProvider.provider.type,
|
||||
supportsVision: agentModelWithProvider.model.supportsVision,
|
||||
supportsImageGen: agentModelWithProvider.model.supportsImageGen,
|
||||
isMultimodal: isAiModelMultimodal(agentModelWithProvider.model),
|
||||
imageGenConfig: agentModelWithProvider.model.imageGenConfig,
|
||||
}
|
||||
: null,
|
||||
|
||||
@ -2411,9 +2411,13 @@ export function CanvasChatPanel({ chatId, initialMessages = [], onClose, onOpenF
|
||||
}>;
|
||||
agentModel?: {
|
||||
id: string;
|
||||
modelId?: string;
|
||||
displayName: string;
|
||||
avatarUrl?: string | null;
|
||||
providerType: string;
|
||||
supportsVision?: boolean;
|
||||
supportsImageGen?: boolean;
|
||||
isMultimodal?: boolean;
|
||||
imageGenConfig?: {
|
||||
maxImages?: number;
|
||||
supportsSize?: boolean;
|
||||
@ -2651,10 +2655,33 @@ export function CanvasChatPanel({ chatId, initialMessages = [], onClose, onOpenF
|
||||
videoToolCapability: null,
|
||||
imageGenConfig: modelsData?.agentModel?.imageGenConfig || undefined,
|
||||
};
|
||||
const multimodalAgentModel = useMemo(() => {
|
||||
if (!modelsData?.agentModel?.id || !modelsData.agentModel.isMultimodal) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
id: modelsData.agentModel.id,
|
||||
modelId: modelsData.agentModel.modelId || modelsData.agentModel.id,
|
||||
displayName: modelsData.agentModel.displayName,
|
||||
avatarUrl: modelsData.agentModel.avatarUrl || null,
|
||||
sortOrder: -998,
|
||||
providerType: modelsData.agentModel.providerType,
|
||||
supportsVision: modelsData.agentModel.supportsVision,
|
||||
supportsImageGen: modelsData.agentModel.supportsImageGen,
|
||||
isMultimodal: true,
|
||||
videoToolCapability: null,
|
||||
imageGenConfig: modelsData.agentModel.imageGenConfig || undefined,
|
||||
};
|
||||
}, [modelsData?.agentModel]);
|
||||
|
||||
// 所有可选模型(Agent模式 + 可视化模型)
|
||||
const allModels = useMemo(() => {
|
||||
const merged = [SMART_AUTO_MODEL, ...visualModels];
|
||||
const merged = [
|
||||
SMART_AUTO_MODEL,
|
||||
...(multimodalAgentModel ? [multimodalAgentModel] : []),
|
||||
...visualModels,
|
||||
];
|
||||
const seen = new Set<string>();
|
||||
return merged.filter((model) => {
|
||||
if (!model?.id || seen.has(model.id)) {
|
||||
@ -2663,7 +2690,7 @@ export function CanvasChatPanel({ chatId, initialMessages = [], onClose, onOpenF
|
||||
seen.add(model.id);
|
||||
return true;
|
||||
});
|
||||
}, [SMART_AUTO_MODEL, visualModels]);
|
||||
}, [SMART_AUTO_MODEL, multimodalAgentModel, visualModels]);
|
||||
const imageOnlyModels = useMemo(
|
||||
() =>
|
||||
visualModels.filter(
|
||||
@ -2676,10 +2703,13 @@ export function CanvasChatPanel({ chatId, initialMessages = [], onClose, onOpenF
|
||||
);
|
||||
const conversationOnlyModels = useMemo(
|
||||
() =>
|
||||
visualModels.filter(
|
||||
(model) => model.isMultimodal && !VIDEO_PROVIDER_TYPES.has(model.providerType)
|
||||
allModels.filter(
|
||||
(model) =>
|
||||
model.id !== "auto" &&
|
||||
model.isMultimodal &&
|
||||
!VIDEO_PROVIDER_TYPES.has(model.providerType)
|
||||
),
|
||||
[visualModels]
|
||||
[allModels]
|
||||
);
|
||||
const videoOnlyModels = useMemo(
|
||||
() => visualModels.filter((model) => VIDEO_PROVIDER_TYPES.has(model.providerType)),
|
||||
@ -3283,10 +3313,9 @@ export function CanvasChatPanel({ chatId, initialMessages = [], onClose, onOpenF
|
||||
message: request.messages.at(-1),
|
||||
selectedChatModel: currentModelIdRef.current,
|
||||
selectedVisibilityType: "private",
|
||||
deepThinkingEnabled:
|
||||
requestIsVideoModel ||
|
||||
requestIsConversationModel ||
|
||||
currentModelIdRef.current === "auto"
|
||||
deepThinkingEnabled: requestIsConversationModel
|
||||
? false
|
||||
: requestIsVideoModel || currentModelIdRef.current === "auto"
|
||||
? undefined
|
||||
: deepThinkingEnabledRef.current,
|
||||
videoParams: requestIsVideoModel ? videoParamsRef.current || undefined : undefined,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user