fix(settings): 多模态总开关打开即在 AI 服务与模型展示 Omni 视图
管线模式切换器位于 OmniChannelSection(挂在 kind=all 的 ProvidersSection 内), 而新版 ServicesTab 只有 pipelineMode=multimodal 时才生成 omni 视图——总开关 打开后没有任何入口切换模式,配置区域因此消失(回归)。 availableServiceViews 改为按「总开关」「生效模式」两个条件生成视图: 开关打开即出现 omni 视图(内含传统/多模态切换器),切到多模态模式后才 按既有语义隐藏传统 llm/asr 页。
This commit is contained in:
1 parent
7e2e48b5dd
commit
2c760b490f
3 files changed
+35
-8
No files matched your search
@@ -85,7 +85,7 @@ assert.deepEqual(
|
||||
);
|
||||
console.log('settings navigation tests passed');
|
||||
|
||||
const omniViews = availableServiceViews(true, true);
|
||||
const omniViews = availableServiceViews(true, true, true);
|
||||
assert.deepEqual(
|
||||
omniViews,
|
||||
['omni', 'models', 'connections'],
|
||||
@@ -101,12 +101,28 @@ assert.equal(
|
||||
'models',
|
||||
'pipeline changes do not redirect a user managing local models',
|
||||
);
|
||||
const phoneViews = availableServiceViews(false, false);
|
||||
const enabledTraditionalViews = availableServiceViews(true, false, true);
|
||||
assert.deepEqual(
|
||||
enabledTraditionalViews,
|
||||
['omni', 'llm', 'asr', 'models', 'connections'],
|
||||
'enabling the experiment must surface the Omni view while traditional pages remain',
|
||||
);
|
||||
assert.equal(
|
||||
resolveServiceView('omni', enabledTraditionalViews),
|
||||
'omni',
|
||||
'the Omni view hosts the pipeline mode switcher',
|
||||
);
|
||||
const phoneViews = availableServiceViews(false, false, false);
|
||||
assert.equal(
|
||||
phoneViews.includes('models'),
|
||||
false,
|
||||
'unsupported local model management is not exposed',
|
||||
);
|
||||
assert.equal(
|
||||
phoneViews.includes('omni'),
|
||||
false,
|
||||
'a disabled multimodal pipeline hides the Omni view',
|
||||
);
|
||||
assert.equal(
|
||||
resolveServiceView('models', phoneViews),
|
||||
'llm',
|
||||
@@ -117,3 +133,4 @@ assert.equal(
|
||||
'llm',
|
||||
'leaving Omni returns to a traditional service',
|
||||
);
|
||||
console.log('settings service view tests passed');
|
||||
@@ -62,10 +62,20 @@ export function searchSettingsSections<T extends SearchableSettingsSection>(
|
||||
|
||||
export type ServiceViewId = 'llm' | 'asr' | 'omni' | 'models' | 'connections';
|
||||
|
||||
export function availableServiceViews(multimodal: boolean, localModels: boolean): ServiceViewId[] {
|
||||
/**
|
||||
* 多模态总开关(multimodalPipelineEnabled)打开即展示 omni 视图——
|
||||
* 管线模式(传统 / 多模态)的切换器就在该视图里,否则开关打开后没有任何入口
|
||||
* 进入多模态配置。只有真正切到多模态模式后才隐藏传统 llm/asr 页。
|
||||
*/
|
||||
export function availableServiceViews(
|
||||
multimodalPipelineEnabled: boolean,
|
||||
multimodalMode: boolean,
|
||||
localModels: boolean,
|
||||
): ServiceViewId[] {
|
||||
return [
|
||||
...(multimodal ? ['omni' as const] : ['llm' as const, 'asr' as const]),
|
||||
...(localModels ? ['models' as const] : []),
|
||||
...(multimodalPipelineEnabled ? (['omni'] as const) : []),
|
||||
...(!multimodalMode ? (['llm', 'asr'] as const) : []),
|
||||
...(localModels ? (['models'] as const) : []),
|
||||
'connections',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -87,10 +87,10 @@ export function ServicesTab() {
|
||||
const { prefs } = useHotkeySettings();
|
||||
const platformCaps = usePlatformCaps();
|
||||
const showLocalModel = platformCaps?.supportsLocalAsr === true;
|
||||
const multimodal =
|
||||
prefs?.multimodalPipelineEnabled === true && prefs.pipelineMode === 'multimodal';
|
||||
const multimodalEnabled = prefs?.multimodalPipelineEnabled === true;
|
||||
const multimodal = multimodalEnabled && prefs.pipelineMode === 'multimodal';
|
||||
const [view, setView] = useState<ServiceViewId>('llm');
|
||||
const views = availableServiceViews(multimodal, showLocalModel);
|
||||
const views = availableServiceViews(multimodalEnabled, multimodal, showLocalModel);
|
||||
const selectedView = resolveServiceView(view, views);
|
||||
const contentRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
|
||||
Reference in new issue
Block a user