diff --git a/apps/mobile/src/features/models/strings.ts b/apps/mobile/src/features/models/strings.ts
index 65b06f92db..19b1409255 100644
--- a/apps/mobile/src/features/models/strings.ts
+++ b/apps/mobile/src/features/models/strings.ts
@@ -90,10 +90,6 @@ export const en = {
botHint: 'The main model chats. Task models do delegated work. Only this Bot changes.',
presetHint: 'Bots already using this preset keep their settings until you apply it again.',
orchestrator: 'Main model',
- assignment: 'Assignment default model',
- allowed: 'Allowed Assignment models',
- allowedHint:
- 'Models the Orchestrator can pick for delegated work. Change the default before removing it.',
effort: 'Reasoning effort',
providerDefault: 'Provider default',
effortDefault: 'Default',
@@ -113,20 +109,6 @@ export const en = {
groups: 'Routing Groups',
groupFront: (model: string) => `Next available: ${model}`,
groupCurrent: (model: string) => `Current: ${model}`,
- groupNotesHint:
- 'Tell the Orchestrator when to use each Routing Group. Saved when you leave the field.',
- groupNote: (name: string) => `Note for ${name}`,
- allowedEfforts: 'Assignment reasoning levels',
- allowedEffortsHint:
- 'Levels the Orchestrator may choose when it starts an Assignment on each allowed model.',
- allowedEffortModelHint: (name: string) =>
- `Levels the Orchestrator may choose for ${name}. Keep at least one.`,
- allowedEffortGroupHint: (name: string) =>
- `Levels the Orchestrator may choose for ${name}. Turn all off to allow any shared level.`,
- effortsAny: 'Any level',
- effortRangeDefault: (level: string) => `default ${level}`,
- effortDefaultLevel: 'Default level',
- effortLocked: 'Used by the Assignment default',
presets: 'Presets',
presetRoutes: (main: string, side: string) => `Main: ${main} · Assignments: ${side}`,
presetInherited: 'Default',
@@ -294,9 +276,6 @@ export const zh: typeof en = {
botHint: '主模型负责对话,副模型执行委派任务。只影响此 Bot。',
presetHint: '已使用此预设的 Bot 保持原设置,重新应用后才更新。',
orchestrator: '主模型',
- assignment: '默认副模型',
- allowed: '可选的副模型',
- allowedHint: '主模型可选这些副模型执行委派任务。移除默认副模型前先换一个默认。',
effort: '推理强度',
providerDefault: '服务商默认',
effortDefault: '默认',
@@ -316,17 +295,6 @@ export const zh: typeof en = {
groups: '路由组',
groupFront: (model: string) => `下一个可用:${model}`,
groupCurrent: (model: string) => `当前:${model}`,
- groupNotesHint: '告诉主模型什么时候用这个路由组。离开输入框时保存。',
- groupNote: (name: string) => `${name} 的备注`,
- allowedEfforts: '副模型推理强度',
- allowedEffortsHint: '主模型创建委派任务时,可为每个副模型选择的推理强度。',
- allowedEffortModelHint: (name: string) => `主模型给 ${name} 可选的强度,至少保留一个。`,
- allowedEffortGroupHint: (name: string) =>
- `主模型给 ${name} 可选的强度。全部关闭则可选任意共有强度。`,
- effortsAny: '任意强度',
- effortRangeDefault: (level: string) => `默认 ${level}`,
- effortDefaultLevel: '默认强度',
- effortLocked: '默认副模型正在使用',
presets: '预设',
presetRoutes: (main: string, side: string) => `主:${main} · 副:${side}`,
presetInherited: '跟随默认',
diff --git a/apps/mobile/src/ui/chat/allowed-efforts.tsx b/apps/mobile/src/ui/chat/allowed-efforts.tsx
deleted file mode 100644
index 654ae7d0ae..0000000000
--- a/apps/mobile/src/ui/chat/allowed-efforts.tsx
+++ /dev/null
@@ -1,196 +0,0 @@
-import type { ReactElement } from 'react';
-import { ScrollView, View } from 'react-native';
-
-import { sameModel } from '@botharness/host-client/bot-settings';
-import { modelCatalogGroupEfforts } from '@botharness/host-client/model-catalog';
-import {
- assignmentEffortRange,
- modelRoutes,
- type AssignmentEffortTarget,
- type ModelSettingsState,
-} from '@botharness/host-client/model-settings';
-import { space } from '../design/tokens';
-import { SettingsGroupItem, SettingsRow, SettingsSection } from '../primitives/settings-row';
-import { useStrings } from '../strings';
-import { EffortBar } from './model-effort';
-import { PickerLink } from './model-route-label';
-import { effortChoices, routeLabel } from './model-route-text';
-import { SHEET_GROUP, SheetNote } from './sheet';
-
-export interface AllowedEffortItem {
- key: string;
- target: AssignmentEffortTarget;
- name: string;
- choices: { value: string; label: string }[];
-}
-
-export function allowedEffortItems(value: ModelSettingsState): AllowedEffortItem[] {
- const routes = modelRoutes(value);
- const models = routes.assignmentModels.map((option): AllowedEffortItem => ({
- key: `model:${option.provider}/${option.model}`,
- target: { kind: 'model', provider: option.provider, model: option.model },
- name: routeLabel(value, option),
- choices: effortChoices(value.models.find((entry) => sameModel(entry, option))),
- }));
- const groups = (routes.groups.assignmentGroups ?? []).flatMap((id): AllowedEffortItem[] => {
- const group = value.groups?.find((entry) => entry.id === id);
- if (group === undefined) return [];
- return [
- {
- key: `group:${id}`,
- target: { kind: 'group', id },
- name: group.name,
- choices: modelCatalogGroupEfforts(group, value.models).map((effort) => ({
- value: effort.id,
- label: effort.name,
- })),
- },
- ];
- });
- return [...models, ...groups].filter((item) => item.choices.length > 0);
-}
-
-export function allowedEffortItem(
- value: ModelSettingsState,
- target: AssignmentEffortTarget,
-): AllowedEffortItem | undefined {
- return allowedEffortItems(value).find((item) =>
- item.target.kind === 'group'
- ? target.kind === 'group' && item.target.id === target.id
- : item.target.kind === 'model' && target.kind === 'model' && sameModel(item.target, target),
- );
-}
-
-function useRangeLabel() {
- const t = useStrings();
- return (value: ModelSettingsState, item: AllowedEffortItem) => {
- const range = assignmentEffortRange(value, item.target);
- if (range === undefined) return '';
- const label = (id: string) => item.choices.find((choice) => choice.value === id)?.label ?? id;
- const allowed = item.choices.filter((choice) => range.allowed.includes(choice.value));
- const any = range.allowed.length === 0 || allowed.length === item.choices.length;
- const shown = any
- ? t.modelSettings.effortsAny
- : allowed.map((choice) => choice.label).join(', ');
- const fallback = range.allowed.length === 0 && range.defaultEffort === '';
- return allowed.length === 1 || fallback
- ? shown
- : `${shown} · ${t.modelSettings.effortRangeDefault(label(range.defaultEffort))}`;
- };
-}
-
-export function AllowedEffortLinks({
- value,
- onOpen,
-}: {
- value: ModelSettingsState;
- onOpen: ((target: AssignmentEffortTarget) => void) | undefined;
-}) {
- const t = useStrings();
- const rangeLabel = useRangeLabel();
- const items = allowedEffortItems(value);
- if (items.length === 0) return null;
- return (
-
- {t.modelSettings.allowedEffortsHint}
-
-
- {items.map((item) => (
- onOpen(item.target)}
- />
- ))}
-
-
-
- );
-}
-
-export function AllowedEffortPage({
- value,
- target,
- busy,
- header,
- onSave,
-}: {
- value: ModelSettingsState;
- target: AssignmentEffortTarget;
- busy: boolean;
- header: ReactElement | null;
- onSave(allowed: string[], defaultEffort: string): void;
-}) {
- const t = useStrings();
- const item = allowedEffortItem(value, target);
- const range = assignmentEffortRange(value, target);
- if (item === undefined || range === undefined)
- return (
-
- {header}
- {t.modelSettings.noResults}
-
- );
- const group = target.kind === 'group';
- const any = group && range.allowed.length === 0;
- const checked = (id: string) => any || range.allowed.includes(id);
- const allowed = item.choices.filter((choice) => checked(choice.value));
- const toggle = (id: string, on: boolean) => {
- const next = item.choices
- .map((choice) => choice.value)
- .filter((candidate) => (candidate === id ? on : checked(candidate)));
- if (next.length === 0 && !group) return;
- onSave(next, range.defaultEffort);
- };
- return (
-
- {header}
-
- {group
- ? t.modelSettings.allowedEffortGroupHint(item.name)
- : t.modelSettings.allowedEffortModelHint(item.name)}
-
-
- {item.choices.map((choice, index) => {
- const locked =
- range.locked === choice.value ||
- (!group && allowed.length === 1 && checked(choice.value));
- return (
-
- toggle(choice.value, on),
- }}
- />
-
- );
- })}
-
- {range.locked === undefined && allowed.length > 1 && !any ? (
- onSave(range.allowed, effort)}
- />
- ) : null}
-
- );
-}
diff --git a/apps/mobile/src/ui/chat/group-notes.tsx b/apps/mobile/src/ui/chat/group-notes.tsx
deleted file mode 100644
index c48d15a59b..0000000000
--- a/apps/mobile/src/ui/chat/group-notes.tsx
+++ /dev/null
@@ -1,81 +0,0 @@
-import { useState } from 'react';
-import { View } from 'react-native';
-
-import type { AssignmentGroupOption } from '@botharness/host-client/bot-settings';
-import type { ModelCatalogGroup } from '@botharness/host-client/model-catalog';
-import { ASSIGNMENT_GROUP_NOTE_MAX } from '@botharness/host-client/model-settings';
-import { space } from '../design/tokens';
-import { TextField } from '../primitives/text-field';
-import { useStrings } from '../strings';
-import { SheetNote } from './sheet';
-
-function GroupNoteField({
- testID,
- label,
- saved,
- disabled,
- onSave,
-}: {
- testID: string;
- label: string;
- saved: string;
- disabled: boolean;
- onSave: (note: string) => void;
-}) {
- const [draft, setDraft] = useState(saved);
- const commit = () => {
- if (draft.trim() !== saved.trim()) onSave(draft);
- };
- return (
-
- );
-}
-
-export function GroupNotes({
- listed,
- groups,
- options,
- busy,
- onSave,
-}: {
- listed: readonly string[];
- groups: readonly ModelCatalogGroup[];
- options: readonly AssignmentGroupOption[];
- busy: boolean;
- onSave: (groupId: string, note: string) => void;
-}) {
- const t = useStrings();
- if (listed.length === 0) return null;
- return (
-
- {t.modelSettings.groupNotesHint}
-
- {listed.map((id) => {
- const name = groups.find((group) => group.id === id)?.name ?? id;
- const saved = options.find((option) => option.group === id)?.note ?? '';
- return (
- onSave(id, note)}
- />
- );
- })}
-
-
- );
-}
diff --git a/apps/mobile/src/ui/chat/model-picker-row.tsx b/apps/mobile/src/ui/chat/model-picker-row.tsx
index 76afbb51e4..5674c06700 100644
--- a/apps/mobile/src/ui/chat/model-picker-row.tsx
+++ b/apps/mobile/src/ui/chat/model-picker-row.tsx
@@ -150,7 +150,6 @@ export function ModelGroupPickerRow({
groups,
usable,
showCount,
- note,
...actions
}: RowActions & {
group: ModelCatalogGroup;
@@ -161,7 +160,6 @@ export function ModelGroupPickerRow({
groups: readonly ModelCatalogGroup[];
usable: boolean;
showCount: boolean;
- note?: string | undefined;
}) {
const t = useStrings();
const theme = useDesignTheme();
@@ -196,7 +194,6 @@ export function ModelGroupPickerRow({
executed === undefined ? current : t.modelSettings.groupCurrent(executed.name),
executed?.external ? t.routingGroup.externalEngine : undefined,
...members,
- note,
]
.filter(Boolean)
.join(', ')}
@@ -221,7 +218,6 @@ export function ModelGroupPickerRow({
: restful === undefined
? frontLabel
: restingLabel(restful),
- ...(note === undefined ? [] : [note]),
].join(' · ')}
tone={usable ? 'fg' : 'muted'}
/>
diff --git a/apps/mobile/src/ui/chat/model-route-text.ts b/apps/mobile/src/ui/chat/model-route-text.ts
index a187768039..98d516dfb6 100644
--- a/apps/mobile/src/ui/chat/model-route-text.ts
+++ b/apps/mobile/src/ui/chat/model-route-text.ts
@@ -5,7 +5,6 @@ import {
type ModelCatalogEntry,
type ModelCatalogGroup,
} from '@botharness/host-client/model-catalog';
-import type { ModelPlanGroups } from '@botharness/host-client/model-plans';
import type { ModelSettingsState } from '@botharness/host-client/model-settings';
import { t } from '../strings';
import { modelEntryLabel } from './composer-labels';
@@ -61,14 +60,6 @@ export function groupEffortLabel(
return groupEffortChoices(value, group).find((item) => item.value === effort)?.label ?? effort;
}
-export function groupEffortOf(groups: ModelPlanGroups, assignment: boolean): string {
- return assignment
- ? (groups.assignmentGroupOptions?.find(
- (option) => option.group === groups.assignmentDefaultGroupId,
- )?.defaultEffort ?? '')
- : (groups.orchestratorGroupEffort ?? '');
-}
-
export function keptGroupEffort(
value: ModelSettingsState,
group: ModelCatalogGroup,
diff --git a/apps/mobile/src/ui/chat/model-settings-route.tsx b/apps/mobile/src/ui/chat/model-settings-route.tsx
index 0364a3780a..e5a708c2c5 100644
--- a/apps/mobile/src/ui/chat/model-settings-route.tsx
+++ b/apps/mobile/src/ui/chat/model-settings-route.tsx
@@ -3,7 +3,6 @@ import { useLocalSearchParams } from 'expo-router';
import {
modelScopeKey,
type AssignmentEffortTarget,
- type ModelField,
type ModelScope,
} from '@botharness/host-client/model-settings';
import { useHostSession } from '../../host/host-session';
@@ -46,50 +45,39 @@ export function ModelSettingsScreen({
: kind === 'preset' || (pick && id !== '')
? { kind: 'preset', id }
: { kind: 'global' };
- const picker: ModelField | undefined = pick
- ? [
- 'assignment',
- 'allowed',
- 'allowed-effort',
- 'orchestrator-effort',
- 'assignment-effort',
- ].includes(field)
- ? (field as ModelField)
- : 'orchestrator'
- : undefined;
- const effortTarget: AssignmentEffortTarget | undefined =
- group !== ''
- ? { kind: 'group', id: group }
- : provider !== '' && model !== ''
- ? { kind: 'model', provider, model }
- : undefined;
if (client === undefined) return {t.unreachable};
- if (pick && (field === 'sub-add' || field === 'sub-effort'))
+ if (pick && (field === 'sub-add' || field === 'sub-effort')) {
+ const target: AssignmentEffortTarget | undefined =
+ engine === 'codex' || engine === 'claude'
+ ? {
+ kind: 'engine',
+ engine,
+ ...(account === '' ? {} : { accountId: account }),
+ ...(model === '' ? {} : { model }),
+ }
+ : group !== ''
+ ? { kind: 'group', id: group }
+ : provider !== '' && model !== ''
+ ? { kind: 'model', provider, model }
+ : undefined;
return (
);
+ }
+ const picker =
+ pick && (field === 'orchestrator' || field === 'orchestrator-effort') ? field : undefined;
return (
);
}
diff --git a/apps/mobile/src/ui/chat/model-settings-screen.tsx b/apps/mobile/src/ui/chat/model-settings-screen.tsx
index a178577ba2..853749b5d9 100644
--- a/apps/mobile/src/ui/chat/model-settings-screen.tsx
+++ b/apps/mobile/src/ui/chat/model-settings-screen.tsx
@@ -28,14 +28,8 @@ import {
modelSettingsResource,
saveModelPreset,
searchModels,
- setAssignmentEfforts,
- setAssignmentGroupNote,
setModelGroup,
setModelRoute,
- toggleAssignmentGroup,
- toggleAssignmentModel,
- type AssignmentEffortTarget,
- type ModelField,
type ModelScope,
type ModelSettingsState,
} from '@botharness/host-client/model-settings';
@@ -45,14 +39,11 @@ import { space } from '../design/tokens';
import { Chip } from '../primitives/chip';
import { FavoriteButton } from '../primitives/favorite-button';
import { modelFamilyKey, restingNotice } from './composer-labels';
-import { AllowedEffortLinks, AllowedEffortPage } from './allowed-efforts';
-import { GroupNotes } from './group-notes';
import { CurrentEngineModel, PickerLink, RouteIcon } from './model-route-label';
import { EffortBar, GroupEffortBar, GroupEffortLink, GroupEfforts } from './model-effort';
import {
effortChoices,
groupEffortChoices,
- groupEffortOf,
keptEffort,
keptGroupEffort,
presetDetail,
@@ -173,12 +164,10 @@ export function ModelsView({
client,
scope,
picker,
- effortTarget,
}: {
client: HostClient;
scope: ModelScope;
- picker?: ModelField | undefined;
- effortTarget?: AssignmentEffortTarget | undefined;
+ picker?: 'orchestrator' | 'orchestrator-effort' | undefined;
}) {
const t = useStrings();
const router = useRouter();
@@ -197,22 +186,16 @@ export function ModelsView({
const [name, setName] = useState();
const [saved, setSaved] = useState(false);
const value = models.value;
- const openPicker = (field: ModelField, target?: AssignmentEffortTarget) => {
- const extra =
- target === undefined || target.kind === 'engine'
- ? {}
- : target.kind === 'group'
- ? { group: target.id }
- : { provider: target.provider, model: target.model };
+ const openPicker = (field: 'orchestrator' | 'orchestrator-effort' | 'sub-add') => {
if (scope.kind === 'bot')
router.push({
pathname: '/bot/[slug]/model-picker',
- params: { slug: scope.slug, field, ...extra },
+ params: { slug: scope.slug, field },
});
else
router.push({
pathname: '/settings/model-picker',
- params: { field, ...extra, ...(scope.kind === 'preset' ? { id: scope.id } : {}) },
+ params: { field, ...(scope.kind === 'preset' ? { id: scope.id } : {}) },
});
};
const openChoice = (choice: SubChoice) => {
@@ -223,19 +206,15 @@ export function ModelsView({
router.push({ pathname: '/settings/model-sub-choice', params: { id: scope.id, key } });
};
const title =
- picker === 'allowed'
- ? t.modelSettings.allowed
- : picker?.endsWith('-effort')
- ? t.modelSettings.effort
- : picker === 'assignment'
- ? t.modelSettings.assignment
- : picker === 'orchestrator'
- ? scope.kind === 'global'
- ? t.modelSettings.global
- : t.modelSettings.orchestrator
- : scope.kind === 'preset'
- ? (value?.preset?.name ?? t.modelPresets)
- : t.modelSettings.title;
+ picker === 'orchestrator-effort'
+ ? t.modelSettings.effort
+ : picker === 'orchestrator'
+ ? scope.kind === 'global'
+ ? t.modelSettings.global
+ : t.modelSettings.orchestrator
+ : scope.kind === 'preset'
+ ? (value?.preset?.name ?? t.modelPresets)
+ : t.modelSettings.title;
const frame = (body: ReactNode) => (
@@ -252,6 +231,7 @@ export function ModelsView({
),
);
const routes = modelRoutes(value);
+ const groupEffort = routes.groups.orchestratorGroupEffort ?? '';
const banner =
models.error === undefined ? null : (
@@ -263,13 +243,11 @@ export function ModelsView({
);
if (picker !== undefined) {
- const assignment = picker.startsWith('assignment');
- const current = assignment ? routes.assignmentDefault : routes.orchestrator;
+ const current = routes.orchestrator;
const currentEntry = value.models.find((entry) => sameModel(entry, current));
const choose = (route: ModelRoute, stay = false) => {
models.run(
- () =>
- setModelRoute(client, scope, value, assignment ? 'assignment' : 'orchestrator', route),
+ () => setModelRoute(client, scope, value, 'orchestrator', route),
() => {
if (stay) return;
Keyboard.dismiss();
@@ -277,12 +255,9 @@ export function ModelsView({
},
);
};
- const fieldGroupId = assignment
- ? routes.groups.assignmentDefaultGroupId
- : scope.kind === 'global'
- ? value.defaultGroupId
- : routes.groups.orchestratorGroupId;
- const effortGroup = value.groups?.find((group) => group.id === fieldGroupId);
+ const fieldGroupId =
+ scope.kind === 'global' ? value.defaultGroupId : routes.groups.orchestratorGroupId;
+ const currentGroup = value.groups?.find((group) => group.id === fieldGroupId);
const chooseEffort = (effort: string) =>
current === undefined
? undefined
@@ -291,11 +266,9 @@ export function ModelsView({
model: current.model,
...(effort === '' ? {} : { reasoningEffort: effort }),
});
- const field = assignment ? 'assignment' : 'orchestrator';
- const groupEffort = groupEffortOf(routes.groups, assignment);
const pickGroup = (group: ModelCatalogGroup, effort: string, stay: boolean) =>
models.run(
- () => setModelGroup(client, scope, value, group.id, field, effort),
+ () => setModelGroup(client, scope, value, group.id, 'orchestrator', effort),
() => {
if (stay) return;
Keyboard.dismiss();
@@ -319,32 +292,14 @@ export function ModelsView({
onChange={(effort) => pickGroup(group, effort, true)}
/>
);
- if (picker === 'allowed-effort')
+ if (picker === 'orchestrator-effort')
return frame(
- effortTarget === undefined ? (
- {t.modelSettings.noResults}
- ) : (
-
- models.run(() =>
- setAssignmentEfforts(client, scope, value, effortTarget, allowed, effort),
- )
- }
- />
- ),
- );
- if (picker.endsWith('-effort'))
- return frame(
- effortGroup !== undefined && groupEffortChoices(value, effortGroup).length === 0 ? (
-
+ currentGroup !== undefined && groupEffortChoices(value, currentGroup).length === 0 ? (
+
) : (
{banner}
- {effortBar(effortGroup)}
+ {effortBar(currentGroup)}
),
);
@@ -355,10 +310,7 @@ export function ModelsView({
name: entry.modelName,
})),
);
- const groups = picker === 'orchestrator' || scope.kind !== 'global' ? (value.groups ?? []) : [];
- const listedGroups = routes.groups.assignmentGroups ?? [];
- const currentGroup =
- picker === 'allowed' ? undefined : groups.find((group) => group.id === fieldGroupId);
+ const groups = value.groups ?? [];
const starredKeys = new Set(models.favorites.map(modelChoiceKey));
const rowKey = (row: PickerRow) =>
row.kind === 'preset'
@@ -382,9 +334,7 @@ export function ModelsView({
};
});
const presetRows: PickerRow[] =
- picker === 'orchestrator' && scope.kind === 'bot'
- ? value.presets.map((preset) => ({ kind: 'preset', preset }))
- : [];
+ scope.kind === 'bot' ? value.presets.map((preset) => ({ kind: 'preset', preset })) : [];
const presetPart = (groupId: string | undefined, route: ModelRoute | undefined) => {
const group = value.groups?.find((entry) => entry.id === groupId);
if (group !== undefined) return group.name;
@@ -396,7 +346,7 @@ export function ModelsView({
value.models.filter(starredModel).length +
groupRows.filter(starredRow).length +
presetRows.filter(starredRow).length;
- const showFavorites = !picker.endsWith('-effort') && favoriteCount > 0;
+ const showFavorites = favoriteCount > 0;
const filter =
family === FAVORITES || (family === undefined && showFavorites)
? showFavorites
@@ -440,17 +390,12 @@ export function ModelsView({
? row.kind === 'group'
: row.kind === 'model' && modelFamilyKey(row.entry) === shownFamily),
);
- const entries =
+ const rows =
shownFamily === FAVORITES
? found
: [...found.filter(listedRow), ...found.filter((row) => !listedRow(row))];
- const lastGroup = entries.findLastIndex((row) => row.kind === 'group');
- const rows: (PickerRow | { kind: 'notes' })[] =
- picker === 'allowed' && listedGroups.length > 0 && lastGroup >= 0
- ? [...entries.slice(0, lastGroup + 1), { kind: 'notes' }, ...entries.slice(lastGroup + 1)]
- : entries;
- const first = (index: number) => index === 0 || rows[index - 1]?.kind === 'notes';
- const last = (index: number) => index === rows.length - 1 || rows[index + 1]?.kind === 'notes';
+ const first = (index: number) => index === 0;
+ const last = (index: number) => index === rows.length - 1;
const star = (row: PickerRow, on: boolean) => {
if (family === undefined) setFamily(shownFamily);
setHeld(
@@ -542,30 +487,16 @@ export function ModelsView({
(row.kind === 'notes' ? 'group-notes' : rowKey(row))}
+ keyExtractor={rowKey}
keyboardShouldPersistTaps="handled"
keyboardDismissMode="on-drag"
ListHeaderComponent={
- picker === 'allowed' ? (
- {t.modelSettings.allowedHint}
- ) : picker === 'orchestrator' && scope.kind === 'bot' && currentGroup === undefined ? (
+ scope.kind === 'bot' && currentGroup === undefined ? (
) : undefined
}
ListEmptyComponent={{t.modelSettings.noResults}}
renderItem={({ item: row, index }) => {
- if (row.kind === 'notes')
- return (
-
- models.run(() => setAssignmentGroupNote(client, scope, value, id, note))
- }
- />
- );
if (row.kind === 'preset') {
const { preset } = row;
const selected = value.plan?.sourcePresetId === preset.id;
@@ -618,15 +549,7 @@ export function ModelsView({
}
if (row.kind === 'group') {
const { group, front } = row;
- const selected =
- picker === 'allowed'
- ? listedGroups.includes(group.id)
- : currentGroup?.id === group.id;
- const required =
- picker === 'allowed' && routes.groups.assignmentDefaultGroupId === group.id;
- const note = routes.groups.assignmentGroupOptions?.find(
- (option) => option.group === group.id,
- )?.note;
+ const selected = currentGroup?.id === group.id;
const usable =
group.restingUntil === undefined &&
group.routes.some(
@@ -640,16 +563,13 @@ export function ModelsView({
group={group}
front={front}
currentTarget={
- scope.kind === 'bot' && picker === 'orchestrator' && selected
- ? value.currentTarget
- : undefined
+ scope.kind === 'bot' && selected ? value.currentTarget : undefined
}
models={value.models}
engines={value.engines}
- groups={value.groups ?? []}
+ groups={groups}
usable={usable}
- showCount={picker !== 'orchestrator'}
- note={picker === 'allowed' ? note : undefined}
+ showCount={false}
testID={`model-group-${group.id}`}
selected={selected}
control={selected ? { kind: 'check' } : undefined}
@@ -667,46 +587,32 @@ export function ModelsView({
/>
}
onPress={
- models.busy || required || (selected && picker !== 'allowed')
+ models.busy || selected
? undefined
- : picker === 'allowed' && selected
- ? () =>
- models.run(() =>
- toggleAssignmentGroup(client, scope, value, group.id),
- )
- : restingNotice(group.name, group) !== undefined
- ? () => setRestNotice(restingNotice(group.name, group))
- : !usable
- ? undefined
- : picker === 'allowed'
- ? () =>
- models.run(() =>
- toggleAssignmentGroup(client, scope, value, group.id),
- )
- : () =>
- pickGroup(
- group,
- keptGroupEffort(
- value,
- group,
- currentGroup === undefined
- ? (current?.reasoningEffort ?? '')
- : groupEffort,
- ),
- groupEffortChoices(value, group).length > 0,
- )
+ : restingNotice(group.name, group) !== undefined
+ ? () => setRestNotice(restingNotice(group.name, group))
+ : !usable
+ ? undefined
+ : () =>
+ pickGroup(
+ group,
+ keptGroupEffort(
+ value,
+ group,
+ currentGroup === undefined
+ ? (current?.reasoningEffort ?? '')
+ : groupEffort,
+ ),
+ groupEffortChoices(value, group).length > 0,
+ )
}
/>
);
}
const item = row.entry;
- const selected =
- picker === 'allowed'
- ? routes.assignmentModels.some((option) => sameModel(option, item))
- : currentGroup === undefined && sameModel(item, current);
+ const selected = currentGroup === undefined && sameModel(item, current);
const usable = item.credential === undefined && item.restingUntil === undefined;
- const required = picker === 'allowed' && sameModel(item, routes.assignmentDefault);
const isFavorite = starredRow(row);
return (
@@ -728,27 +634,22 @@ export function ModelsView({
/>
}
onPress={
- models.busy || required
+ models.busy
? undefined
- : restingNotice(item.modelName, item) !== undefined &&
- !(picker === 'allowed' && selected)
+ : restingNotice(item.modelName, item) !== undefined
? () => setRestNotice(restingNotice(item.modelName, item))
- : !usable && !(picker === 'allowed' && selected)
+ : !usable
? undefined
: () => {
- if (picker === 'allowed')
- models.run(() => toggleAssignmentModel(client, scope, value, item));
- else {
- const reasoningEffort = keptEffort(item, current);
- choose(
- {
- provider: item.provider,
- model: item.model,
- ...(reasoningEffort === '' ? {} : { reasoningEffort }),
- },
- effortChoices(item).length > 0,
- );
- }
+ const reasoningEffort = keptEffort(item, current);
+ choose(
+ {
+ provider: item.provider,
+ model: item.model,
+ ...(reasoningEffort === '' ? {} : { reasoningEffort }),
+ },
+ effortChoices(item).length > 0,
+ );
}
}
/>
@@ -756,7 +657,7 @@ export function ModelsView({
);
}}
/>
- {picker === 'allowed' ? null : effortBar(currentGroup)}
+ {effortBar(currentGroup)}
>,
);
}
@@ -774,15 +675,6 @@ export function ModelsView({
scope.kind === 'preset'
? groupName(routes.groups.orchestratorGroupId)
: currentModel(value).group;
- const assignmentGroup = groupName(routes.groups.assignmentDefaultGroupId);
- const assignmentCatalogGroup = value.groups?.find(
- (group) => group.id === routes.groups.assignmentDefaultGroupId,
- );
- const assignmentShown =
- assignmentCatalogGroup === undefined ||
- assignmentCatalogGroup.routes.some((route) => sameModel(route, routes.assignmentDefault))
- ? routes.assignmentDefault
- : modelCatalogGroupFront(assignmentCatalogGroup, value.models);
const form = (
@@ -825,7 +717,7 @@ export function ModelsView({
groupId={
scope.kind === 'global' ? value.defaultGroupId : routes.groups.orchestratorGroupId
}
- effort={groupEffortOf(routes.groups, false)}
+ effort={groupEffort}
onPress={models.busy ? undefined : () => openPicker('orchestrator-effort')}
/>
)}
diff --git a/apps/mobile/test/model-route-text.test.ts b/apps/mobile/test/model-route-text.test.ts
index 78d5242b42..1d5d84a118 100644
--- a/apps/mobile/test/model-route-text.test.ts
+++ b/apps/mobile/test/model-route-text.test.ts
@@ -5,7 +5,6 @@ import {
effortChoices,
groupEffortChoices,
groupEffortLabel,
- groupEffortOf,
keptEffort,
keptGroupEffort,
routeEffortLabel,
@@ -101,17 +100,5 @@ describe('phone model rows', () => {
expect(keptGroupEffort(value, daily, 'max')).toBe('max');
expect(keptGroupEffort(value, daily, 'low')).toBe('');
expect(groupEffortChoices(value, { ...daily, routes: [glm] })).toEqual([]);
- expect(
- groupEffortOf({ orchestratorGroupId: 'daily', orchestratorGroupEffort: 'max' }, false),
- ).toBe('max');
- expect(
- groupEffortOf(
- {
- assignmentDefaultGroupId: 'daily',
- assignmentGroupOptions: [{ group: 'daily', defaultEffort: 'high' }],
- },
- true,
- ),
- ).toBe('high');
});
});
diff --git a/apps/mobile/test/model-settings-route.test.tsx b/apps/mobile/test/model-settings-route.test.tsx
new file mode 100644
index 0000000000..ad3d2c992e
--- /dev/null
+++ b/apps/mobile/test/model-settings-route.test.tsx
@@ -0,0 +1,42 @@
+import { renderToStaticMarkup } from 'react-dom/server';
+import { describe, expect, it, vi } from 'vitest';
+import { modelScopeKey } from '@botharness/host-client/model-settings';
+
+import type { ModelsView } from '../src/ui/chat/model-settings-screen';
+import type { SubChoicePicker } from '../src/ui/chat/sub-choice-picker';
+import BotModelPickerScreen from '../app/bot/[slug]/model-picker';
+import GlobalModelPickerScreen from '../app/settings/model-picker';
+
+const { params } = vi.hoisted(() => ({ params: vi.fn() }));
+vi.mock('expo-router', () => ({ useLocalSearchParams: params }));
+vi.mock('../src/host/host-session', () => ({
+ useHostSession: () => ({ client: {}, saved: { hostId: 'test-host' } }),
+}));
+vi.mock('../src/ui/chat/sheet', () => ({ SheetNote: () => null }));
+vi.mock('../src/ui/chat/model-settings-screen', () => ({
+ ModelsView: ({ picker, scope }: Parameters[0]) => (
+ {picker ?? `${modelScopeKey(scope)} editor`}
+ ),
+}));
+vi.mock('../src/ui/chat/sub-choice-picker', () => ({
+ SubChoicePicker: ({ field }: Parameters[0]) => {field}
,
+}));
+
+describe('mobile model picker routes', () => {
+ it.each(['assignment', 'allowed', 'allowed-effort', 'assignment-effort'])(
+ 'opens the editor from a legacy %s link',
+ (field) => {
+ params.mockReturnValue({ field, id: 'fast', slug: 'qa', group: 'daily' });
+ expect(renderToStaticMarkup()).toBe('bot:qa editor
');
+ expect(renderToStaticMarkup()).toBe('preset:fast editor
');
+ },
+ );
+
+ it.each(['orchestrator', 'orchestrator-effort', 'sub-add', 'sub-effort'])(
+ 'still opens the %s picker',
+ (field) => {
+ params.mockReturnValue({ field, slug: 'qa' });
+ expect(renderToStaticMarkup()).toBe(`${field}
`);
+ },
+ );
+});
diff --git a/apps/mobile/test/model-settings.test.ts b/apps/mobile/test/model-settings.test.ts
index b5d02e3d07..0587cc5ba4 100644
--- a/apps/mobile/test/model-settings.test.ts
+++ b/apps/mobile/test/model-settings.test.ts
@@ -4,14 +4,11 @@ import { currentModel, loadBotModel, loadGlobalModel } from '@botharness/host-cl
import { createHostClient } from '@botharness/host-client/client';
import { modelChoiceKey } from '@botharness/host-client/model-catalog';
import {
- assignmentEffortRange,
inheritModel,
modelRoutes,
modelSettingsResource,
saveModelPreset,
searchModels,
- setAssignmentEfforts,
- setAssignmentGroupNote,
setModelGroup,
setModelRoute,
toggleAssignmentGroup,
@@ -347,16 +344,6 @@ describe('native Model Plans and Presets', () => {
await expect(toggleAssignmentGroup(client, scope, current(), 'side')).rejects.toThrow(
'ASSIGNMENT_DEFAULT_REQUIRED',
);
- await setAssignmentGroupNote(client, scope, current(), 'daily', ' Quick checks ');
- expect(fake.calls.at(-1)?.args).toMatchObject({
- assignmentGroups: ['side', 'daily'],
- assignmentGroupOptions: [{ group: 'daily', note: 'Quick checks' }],
- });
- await setAssignmentGroupNote(client, scope, current(), 'daily', '');
- expect(fake.calls.at(-1)?.args).toMatchObject({ assignmentGroupOptions: [] });
- await expect(
- setAssignmentGroupNote(client, scope, { ...current(), groups: [] }, 'other', 'x'),
- ).rejects.toThrow('MODEL_UNAVAILABLE');
await setModelRoute(client, scope, current(), 'assignment', flash);
expect(fake.calls.at(-1)?.args).toMatchObject({
orchestratorGroupId: 'daily',
@@ -368,60 +355,6 @@ describe('native Model Plans and Presets', () => {
expect(fake.calls.at(-1)?.args).toMatchObject({ orchestrator: pro, orchestratorGroupId: null });
});
- it('narrows the reasoning levels of an allowed model or Routing Group (#4497)', async () => {
- const { fake, client } = setup();
- const daily = { id: 'daily', name: 'Daily', revision: 1, routes: [pro] };
- const scope = { kind: 'bot' as const, slug: 'qa' };
- fake.methods.set('modelPlanSet', () => ({ plan }));
- const proOption = { ...pro, allowedEfforts: ['', 'high'], defaultEffort: '' };
- const current: ModelSettingsState = {
- ...state,
- groups: [daily],
- plan: {
- ...plan,
- assignmentModels: [...allowed, proOption],
- assignmentGroups: ['daily'],
- assignmentGroupOptions: [{ group: 'daily', note: 'Hard work' }],
- },
- };
- const proTarget = { kind: 'model' as const, ...pro };
- expect(assignmentEffortRange(current, proTarget)).toEqual({
- allowed: ['', 'high'],
- defaultEffort: '',
- });
- await setAssignmentEfforts(client, scope, current, proTarget, ['high'], '');
- expect(fake.calls.at(-1)?.args).toMatchObject({
- assignmentModels: [allowed[0], { ...pro, allowedEfforts: ['high'], defaultEffort: 'high' }],
- });
- await expect(setAssignmentEfforts(client, scope, current, proTarget, [], '')).rejects.toThrow(
- 'EFFORT_REQUIRED',
- );
- const flashTarget = { kind: 'model' as const, ...flash };
- expect(assignmentEffortRange(current, flashTarget)?.locked).toBe('');
- await expect(
- setAssignmentEfforts(client, scope, current, flashTarget, ['high'], 'high'),
- ).rejects.toThrow('ASSIGNMENT_DEFAULT_REQUIRED');
- await setAssignmentEfforts(client, scope, current, flashTarget, ['', 'high'], 'high');
- expect(fake.calls.at(-1)?.args).toMatchObject({
- assignmentModels: [{ ...allowed[0], defaultEffort: '' }, proOption],
- });
- const dailyTarget = { kind: 'group' as const, id: 'daily' };
- expect(assignmentEffortRange(current, dailyTarget)).toEqual({ allowed: [], defaultEffort: '' });
- await setAssignmentEfforts(client, scope, current, dailyTarget, ['high'], '');
- expect(fake.calls.at(-1)?.args).toMatchObject({
- assignmentGroupOptions: [
- { group: 'daily', note: 'Hard work', allowedEfforts: ['high'], defaultEffort: 'high' },
- ],
- });
- await setAssignmentEfforts(client, scope, current, dailyTarget, [], '');
- expect(fake.calls.at(-1)?.args).toMatchObject({
- assignmentGroupOptions: [{ group: 'daily', note: 'Hard work' }],
- });
- await expect(
- setAssignmentEfforts(client, scope, current, { kind: 'group', id: 'other' }, [], ''),
- ).rejects.toThrow('MODEL_UNAVAILABLE');
- });
-
it('keeps open Assignments, starts a group on a ready model, and copies the default group into a new Preset (#4501)', async () => {
const { fake, client } = setup();
const daily = { id: 'daily', name: 'Daily', revision: 1, routes: [flash, pro] };
diff --git a/changes/4860-legacy-task-picker-links.md b/changes/4860-legacy-task-picker-links.md
new file mode 100644
index 0000000000..7b20e89329
--- /dev/null
+++ b/changes/4860-legacy-task-picker-links.md
@@ -0,0 +1,11 @@
+---
+section: Fixed
+---
+
+## en
+
+- Old mobile Task model picker links now open the Bot or preset editor and preserve the saved list. ([#4860](https://github.com/BotHarness/DeepSeekBot/issues/4860))
+
+## zh
+
+- 打开旧版移动端副模型选择链接时,会进入对应的 Bot 或预设编辑页,并保留已保存的副模型列表。([#4860](https://github.com/BotHarness/DeepSeekBot/issues/4860))
diff --git a/packages/host-client/src/model-settings.ts b/packages/host-client/src/model-settings.ts
index fc783f49c9..d4d08e978f 100644
--- a/packages/host-client/src/model-settings.ts
+++ b/packages/host-client/src/model-settings.ts
@@ -56,21 +56,10 @@ import {
type SubSelection,
} from './preset-sub';
-export const ASSIGNMENT_GROUP_NOTE_MAX = 500;
-
export type ModelScope =
| { kind: 'global' }
| { kind: 'bot'; slug: string }
| { kind: 'preset'; id: string };
-export type ModelField =
- | 'orchestrator'
- | 'assignment'
- | 'allowed'
- | 'allowed-effort'
- | 'orchestrator-effort'
- | 'assignment-effort'
- | 'sub-add'
- | 'sub-effort';
export type ModelSettingsState = BotModel & { preset?: ModelPreset };
export function modelScopeKey(scope: ModelScope): string {
@@ -692,39 +681,6 @@ export async function toggleAssignmentGroup(
recordFeature('model:plan_update', { via: 'assignments' });
}
-export async function setAssignmentGroupNote(
- client: ModelSettingsClient,
- scope: ModelScope,
- state: ModelSettingsState,
- groupId: string,
- note: string,
-): Promise {
- const routes = modelRoutes(state);
- if (!(routes.groups.assignmentGroups ?? []).includes(groupId))
- throw new HostAnswerInvalid('MODEL_UNAVAILABLE');
- const text = note.trim();
- if (text.length > ASSIGNMENT_GROUP_NOTE_MAX) throw new HostAnswerInvalid('NOTE_TOO_LONG');
- const options = routes.groups.assignmentGroupOptions ?? [];
- const { note: _note, ...kept } = options.find((option) => option.group === groupId) ?? {
- group: groupId,
- };
- const next: AssignmentGroupOption = text === '' ? kept : { ...kept, note: text };
- const keep = next.allowedEfforts !== undefined || next.note !== undefined;
- await writePlan(client, scope, state, {
- orchestrator: requireRoute(routes.orchestrator),
- assignmentDefault: requireRoute(routes.assignmentDefault),
- assignmentModels: routes.assignmentModels,
- groups: {
- ...routes.groups,
- assignmentGroupOptions: [
- ...options.filter((option) => option.group !== groupId),
- ...(keep ? [next] : []),
- ],
- },
- });
- recordFeature('model:plan_update', { via: 'assignments' });
-}
-
export type AssignmentEffortTarget =
| Extract
| { kind: 'group'; id: string };
@@ -773,88 +729,6 @@ export function subEffortOptions(
}
}
-export function assignmentEffortRange(
- state: ModelSettingsState,
- target: AssignmentEffortTarget,
-): { allowed: string[]; defaultEffort: string; locked?: string } | undefined {
- if (target.kind === 'engine') return undefined;
- const routes = modelRoutes(state);
- if (target.kind === 'model') {
- const option = routes.assignmentModels.find((item) => sameModel(item, target));
- if (option === undefined) return undefined;
- const fixed =
- routes.groups.assignmentDefaultGroupId === undefined &&
- routes.assignmentDefault !== undefined &&
- sameModel(routes.assignmentDefault, target);
- return {
- allowed: [...option.allowedEfforts],
- defaultEffort: option.defaultEffort,
- ...(fixed ? { locked: routes.assignmentDefault?.reasoningEffort ?? '' } : {}),
- };
- }
- if (!(routes.groups.assignmentGroups ?? []).includes(target.id)) return undefined;
- const option = routes.groups.assignmentGroupOptions?.find((item) => item.group === target.id);
- const fixed =
- routes.groups.assignmentDefaultGroupId === target.id && (option?.defaultEffort ?? '') !== '';
- return {
- allowed: [...(option?.allowedEfforts ?? [])],
- defaultEffort: option?.defaultEffort ?? '',
- ...(fixed ? { locked: option?.defaultEffort ?? '' } : {}),
- };
-}
-
-function groupEffortRange(
- options: readonly AssignmentGroupOption[],
- groupId: string,
- efforts: string[],
- chosen: string,
-): AssignmentGroupOption[] {
- const current = options.find((option) => option.group === groupId) ?? { group: groupId };
- const { allowedEfforts: _efforts, defaultEffort: _default, ...kept } = current;
- const next: AssignmentGroupOption =
- efforts.length === 0 ? kept : { ...kept, allowedEfforts: efforts, defaultEffort: chosen };
- const keep = next.allowedEfforts !== undefined || next.note !== undefined;
- return [...options.filter((option) => option.group !== groupId), ...(keep ? [next] : [])];
-}
-
-export async function setAssignmentEfforts(
- client: ModelSettingsClient,
- scope: ModelScope,
- state: ModelSettingsState,
- target: AssignmentEffortTarget,
- allowed: readonly string[],
- defaultEffort: string,
-): Promise {
- const range = assignmentEffortRange(state, target);
- if (range === undefined) throw new HostAnswerInvalid('MODEL_UNAVAILABLE');
- const efforts = [...new Set(allowed)];
- if (range.locked !== undefined && !efforts.includes(range.locked))
- throw new HostAnswerInvalid('ASSIGNMENT_DEFAULT_REQUIRED');
- if (target.kind === 'model' && efforts.length === 0)
- throw new HostAnswerInvalid('EFFORT_REQUIRED');
- const chosen =
- range.locked ?? (efforts.includes(defaultEffort) ? defaultEffort : (efforts[0] ?? ''));
- const routes = modelRoutes(state);
- const assignmentModels =
- target.kind === 'model'
- ? routes.assignmentModels.map((option) =>
- sameModel(option, target)
- ? { ...option, allowedEfforts: efforts, defaultEffort: chosen }
- : option,
- )
- : routes.assignmentModels;
- const options = routes.groups.assignmentGroupOptions ?? [];
- const assignmentGroupOptions =
- target.kind === 'group' ? groupEffortRange(options, target.id, efforts, chosen) : options;
- await writePlan(client, scope, state, {
- orchestrator: requireRoute(routes.orchestrator),
- assignmentDefault: requireRoute(routes.assignmentDefault),
- assignmentModels,
- groups: { ...routes.groups, assignmentGroupOptions },
- });
- recordFeature('model:plan_update', { via: 'assignments' });
-}
-
export async function inheritModel(
client: ModelSettingsClient,
slug: string,