You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by as...@apache.org on 2026/09/22 10:30:38 UTC

(maka) 01/01: fix(ui): drop the model picker option subtitle

This is an automated email from the ASF dual-hosted git repository.

Astro-Han pushed a commit to branch fix/ui-model-picker-subtitle
in repository https://gitbox.apache.org/repos/asf/maka.git

commit e1cd09618317fc09df4d4132ef9071e069cb811f
Author: AstroHan <le...@outlook.com>
AuthorDate: Tue Sep 22 18:30:29 2026 +0800

    fix(ui): drop the model picker option subtitle
    
    Every model choice rendered a second line under its label — the catalog
    description plus a knowledge-cutoff date. The line repeated what the
    label already says, truncated mid-sentence at the popup width, and gave
    nothing the reader could act on, so each option cost a full extra row
    of height for noise.
    
    Stop passing `description` in `buildModelPickerOptions` and
    `wheelOptions`, and delete the now-unused `modelChoiceDescription`
    helper with its `knowledgeCutoff` copy keys. The `locale` extra of
    `buildModelPickerOptions` existed only to feed that helper, so the
    parameter collapses to the optional `renderProviderMark`.
    
    `ChatModelChoice.description` / `knowledgeCutoff` stay on the type for
    the codex app-server executor plugin's own picker, and the
    switch-warning notice keeps its dismiss hint. The wheel picker keeps
    its `description` tooltip field for the plugin.
    
    Generated-by: Maka
---
 packages/ui/src/chat-model-helpers.ts        | 13 -------------
 packages/ui/src/chat-model-switcher.tsx      | 15 ++++++---------
 packages/ui/src/form-interaction-prompt.tsx  |  1 -
 packages/ui/src/model-picker-internals.tsx   | 19 ++++++-------------
 packages/ui/src/model-picker.tsx             |  7 ++-----
 packages/ui/src/shared-ui-copy.ts            |  4 ----
 packages/ui/stories/model-picker.stories.tsx |  1 -
 7 files changed, 14 insertions(+), 46 deletions(-)

diff --git a/packages/ui/src/chat-model-helpers.ts b/packages/ui/src/chat-model-helpers.ts
index 85c3da5e12..fc4509a197 100644
--- a/packages/ui/src/chat-model-helpers.ts
+++ b/packages/ui/src/chat-model-helpers.ts
@@ -48,19 +48,6 @@ import type { UiLocale } from '@maka/core/ui-locale';
 import { getSharedUiCopy } from './shared-ui-copy.js';
 export type { ChatModelChoice } from '@maka/core/chat-model-choice';
 
-export function modelChoiceDescription(
-  choice: Pick<ChatModelChoice, 'description' | 'knowledgeCutoff'>,
-  locale: UiLocale,
-): string | undefined {
-  const description = choice.description?.trim();
-  const knowledge = choice.knowledgeCutoff?.trim();
-  const copy = getSharedUiCopy(locale).modelPicker;
-  const parts = [description, knowledge ? copy.knowledgeCutoff(knowledge) : undefined].filter(
-    (value): value is string => Boolean(value),
-  );
-  return parts.length > 0 ? parts.join(' · ') : undefined;
-}
-
 export interface ModelMenuGroup {
   connectionSlug: string;
   /** Provider of this group, so the menu can render its brand mark on the heading. */
diff --git a/packages/ui/src/chat-model-switcher.tsx b/packages/ui/src/chat-model-switcher.tsx
index e53651932c..a1691df291 100644
--- a/packages/ui/src/chat-model-switcher.tsx
+++ b/packages/ui/src/chat-model-switcher.tsx
@@ -39,7 +39,6 @@ import { ICON_SIZE, AlertTriangle, Settings, X } from './icons.js';
 import {
   type ChatModelChoice,
   exactModelChoiceValue,
-  modelChoiceDescription,
   modelMenuGroups,
   type ModelMenuGroup,
 } from './chat-model-helpers.js';
@@ -71,14 +70,12 @@ const exactChoiceValue = (choice: ChatModelChoice) =>
 
 function wheelOptions(
   groups: readonly ModelMenuGroup[],
-  locale: Parameters<typeof modelChoiceDescription>[1],
 ): ModelWheelOption[] {
   return groups.flatMap((group) =>
     group.choices.map((choice) => ({
       value: exactChoiceValue(choice),
       label: choice.label,
       heading: group.heading,
-      description: modelChoiceDescription(choice, locale),
     })),
   );
 }
@@ -217,7 +214,7 @@ export function ChatModelSwitcher(props: {
         ? { value: currentValue, label: displayLabel, providerType: props.currentProviderType, disabled: true }
         : undefined,
       exactChoiceValue,
-      { locale, renderProviderMark: props.renderProviderMark },
+      props.renderProviderMark,
     );
     // A regular option, not a disabled one: activating it is the dismissal,
     // so a click, Enter on the highlight, and a screen reader's activate all
@@ -233,7 +230,7 @@ export function ChatModelSwitcher(props: {
     return list;
   }, [grouped, currentKnownChoice, currentValue, props.hideUnavailableCurrentOption,
       noticeShown, displayLabel, props.currentProviderType, copy.switchWarning,
-      copy.switchWarningDismiss, locale, props.renderProviderMark]);
+      copy.switchWarningDismiss, props.renderProviderMark]);
   const renderOption = useCallback((option: SelectorOptionData) => (
     option.value === SWITCH_WARNING_VALUE
       ? (
@@ -300,7 +297,7 @@ export function ChatModelSwitcher(props: {
   }, [props.presentation]);
   useEffect(() => setWheelOpen(false), [props.activeSession.id]);
   if (props.presentation === 'wheel') {
-    const wheelList = wheelOptions(grouped, locale);
+    const wheelList = wheelOptions(grouped);
     if (!currentKnownChoice && currentValue && !props.hideUnavailableCurrentOption) {
       wheelList.unshift({ value: currentValue, label: displayLabel, disabled: true });
     }
@@ -399,10 +396,10 @@ export function NewChatModelPicker(props: {
         ? { label: props.label, value: currentValue, providerType: props.currentProviderType, disabled: true }
         : undefined,
       exactChoiceValue,
-      { locale, renderProviderMark: props.renderProviderMark },
+      props.renderProviderMark,
     ),
     [grouped, currentKnownChoice, currentValue, props.label, props.currentProviderType,
-      locale, props.renderProviderMark],
+      props.renderProviderMark],
   );
   // The only producer is synchronous state (pending new-chat model), so the
   // pick shows through `currentValue` on the same render — no pending state.
@@ -417,7 +414,7 @@ export function NewChatModelPicker(props: {
     }));
   };
   if (props.presentation === 'wheel') {
-    const wheelList = wheelOptions(grouped, locale);
+    const wheelList = wheelOptions(grouped);
     if (!currentKnownChoice && currentValue) {
       wheelList.unshift({ value: currentValue, label: props.label, disabled: true });
     }
diff --git a/packages/ui/src/form-interaction-prompt.tsx b/packages/ui/src/form-interaction-prompt.tsx
index e9d3b39f8c..1bb45f8e18 100644
--- a/packages/ui/src/form-interaction-prompt.tsx
+++ b/packages/ui/src/form-interaction-prompt.tsx
@@ -231,7 +231,6 @@ function modelPickerOptions(
     modelMenuGroups([...choices], locale),
     undefined,
     (choice) => exactModelChoiceValue(choice.connectionId, choice.connectionSlug, choice.model),
-    { locale },
   );
 }
 
diff --git a/packages/ui/src/model-picker-internals.tsx b/packages/ui/src/model-picker-internals.tsx
index 5e6acf1bb6..886669b1b4 100644
--- a/packages/ui/src/model-picker-internals.tsx
+++ b/packages/ui/src/model-picker-internals.tsx
@@ -25,10 +25,8 @@ import {
   type SelectorSection,
 } from '@astryxdesign/core/Selector';
 import type { ProviderType } from '@maka/core/llm-connections';
-import type { UiLocale } from '@maka/core/ui-locale';
 import {
   type ModelMenuGroup,
-  modelChoiceDescription,
 } from './chat-model-helpers.js';
 
 export interface ModelPickerLeadingOption {
@@ -54,10 +52,9 @@ export function providerMarkIcon(
 
 /**
  * Shapes Maka's provider catalog into Astryx Selector's public option model:
- * each option carries its provider mark as `icon` and the catalog line as
- * `description`, so Selector's default row and trigger rendering need no
- * product markup. Search, flattening, keyboard navigation, selection, and
- * empty results remain entirely inside Selector.
+ * each option carries its provider mark as `icon`, so Selector's default row
+ * and trigger rendering need no product markup. Search, flattening, keyboard
+ * navigation, selection, and empty results remain entirely inside Selector.
  *
  * `toValue` is `modelChoiceValue` for the settings catalog (slug-scoped) and
  * `exactModelChoiceValue` for the session switcher (connection-id-scoped).
@@ -66,10 +63,7 @@ export function buildModelPickerOptions(
   groups: readonly ModelMenuGroup[],
   leadingOption: ModelPickerLeadingOption | undefined,
   toValue: ModelChoiceValueFn,
-  extras: {
-    locale: UiLocale;
-    renderProviderMark?(type: ProviderType): ReactNode;
-  },
+  renderProviderMark?: (type: ProviderType) => ReactNode,
 ): SelectorOptionType[] {
   const sections: SelectorSection[] = groups.map((group) => ({
     type: 'section',
@@ -77,8 +71,7 @@ export function buildModelPickerOptions(
     options: group.choices.map((choice) => ({
       value: toValue(choice),
       label: choice.label,
-      icon: providerMarkIcon(group.providerType, extras.renderProviderMark),
-      description: modelChoiceDescription(choice, extras.locale),
+      icon: providerMarkIcon(group.providerType, renderProviderMark),
     })),
   }));
 
@@ -87,7 +80,7 @@ export function buildModelPickerOptions(
   const option: SelectorOptionData = {
     value: leadingOption.value,
     label: leadingOption.label,
-    icon: providerMarkIcon(leadingOption.providerType, extras.renderProviderMark),
+    icon: providerMarkIcon(leadingOption.providerType, renderProviderMark),
     disabled: leadingOption.disabled,
   };
   return sections.length > 0 ? [option, { type: 'divider' }, ...sections] : [option];
diff --git a/packages/ui/src/model-picker.tsx b/packages/ui/src/model-picker.tsx
index 3bdb287010..04b44e5312 100644
--- a/packages/ui/src/model-picker.tsx
+++ b/packages/ui/src/model-picker.tsx
@@ -66,11 +66,8 @@ export function ModelPicker(props: ModelPickerProps) {
 
   const options = useMemo(
     () =>
-      buildModelPickerOptions(props.groups, props.leadingOption, slugScopedValue, {
-        locale,
-        renderProviderMark: props.renderProviderMark,
-      }),
-    [props.groups, props.leadingOption, locale, props.renderProviderMark],
+      buildModelPickerOptions(props.groups, props.leadingOption, slugScopedValue, props.renderProviderMark),
+    [props.groups, props.leadingOption, props.renderProviderMark],
   );
 
   // Reflect the pick immediately and hold it until the caller's write settles,
diff --git a/packages/ui/src/shared-ui-copy.ts b/packages/ui/src/shared-ui-copy.ts
index cc6fc00034..2a0bc8aa68 100644
--- a/packages/ui/src/shared-ui-copy.ts
+++ b/packages/ui/src/shared-ui-copy.ts
@@ -63,7 +63,6 @@ export interface SharedUiCopy {
   };
   modelPicker: {
     searchPlaceholder: string;
-    knowledgeCutoff: (date: string) => string;
   };
   moduleHubs: {
     extensions: {
@@ -159,7 +158,6 @@ const SHARED_UI_COPY = {
     },
     modelPicker: {
       searchPlaceholder: '搜索模型…',
-      knowledgeCutoff: (date) => `知识截止:${date}`,
     },
     moduleHubs: {
       extensions: {
@@ -238,7 +236,6 @@ const SHARED_UI_COPY = {
     },
     modelPicker: {
       searchPlaceholder: '搜尋模型…',
-      knowledgeCutoff: (date) => `知識截止:${date}`,
     },
     moduleHubs: {
       extensions: {
@@ -317,7 +314,6 @@ const SHARED_UI_COPY = {
     },
     modelPicker: {
       searchPlaceholder: 'Search models…',
-      knowledgeCutoff: (date) => `Knowledge cutoff: ${date}`,
     },
     moduleHubs: {
       extensions: {
diff --git a/packages/ui/stories/model-picker.stories.tsx b/packages/ui/stories/model-picker.stories.tsx
index c3336d9ba0..559fd61bd5 100644
--- a/packages/ui/stories/model-picker.stories.tsx
+++ b/packages/ui/stories/model-picker.stories.tsx
@@ -26,7 +26,6 @@ import type { SessionSummary } from '@maka/core/session';
 import { ChatModelSwitcher, ModelChipStatic, NewChatModelPicker, ThinkingLevelSelector } from '../src/chat-model-switcher.js';
 import {
   exactModelChoiceValue,
-  modelChoiceDescription,
   modelChoiceValue,
   modelMenuGroups,
   type ChatModelChoice,


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org