fix(chat): keep mode switch selection without auto rollback
This commit is contained in:
parent
eec91f3c6f
commit
0d9824cb81
@ -116,14 +116,10 @@ async function NewChatPage() {
|
||||
const cookieModel = initialModelId
|
||||
? visibleModels.find(({ model }) => model.id === initialModelId)
|
||||
: undefined;
|
||||
const cookieIsVideoModel = Boolean(
|
||||
cookieModel && VIDEO_PROVIDER_TYPES.has(cookieModel.provider.type)
|
||||
);
|
||||
|
||||
if (
|
||||
!initialModelId ||
|
||||
!cookieModel ||
|
||||
(cookieIsVideoModel && Boolean(nanoBananaModel))
|
||||
!cookieModel
|
||||
) {
|
||||
if (nanoBananaModel) {
|
||||
initialModelId = nanoBananaModel.model.id;
|
||||
|
||||
@ -1529,8 +1529,13 @@ function PureModelSelectorCompact({
|
||||
useEffect(() => {
|
||||
if (displayModels.length === 0) return;
|
||||
|
||||
const currentExists = displayModels.some((m) => m.id === selectedModelId);
|
||||
if (currentExists) return;
|
||||
const currentExistsInDisplay = displayModels.some((m) => m.id === selectedModelId);
|
||||
if (currentExistsInDisplay) return;
|
||||
|
||||
const currentExistsInAll = allModels.some((m) => m.id === selectedModelId);
|
||||
if (currentExistsInAll) {
|
||||
return;
|
||||
}
|
||||
|
||||
const fallbackImageModel =
|
||||
modeFilteredModels.find((model) => isNanoBananaProModel(model)) ||
|
||||
@ -1546,7 +1551,7 @@ function PureModelSelectorCompact({
|
||||
startTransition(() => {
|
||||
saveChatModelAsCookie(fallbackModelId);
|
||||
});
|
||||
}, [canShowAutoModel, displayModels, modeFilteredModels, onModelChange, selectedModelId]);
|
||||
}, [allModels, canShowAutoModel, displayModels, modeFilteredModels, onModelChange, selectedModelId]);
|
||||
|
||||
// 自动选择模型的逻辑 - 必须在所有条件 return 之前定义
|
||||
const selectBestModel = useCallback(() => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user