Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(routines): show the target model's provider icon in the routines table (#7689)

teo39f3c914b010
diff --git a/apps/web/src/features/routines/components/routine-row.tsx b/apps/web/src/features/routines/components/routine-row.tsx
index f11f026f9c..652779643f 100644
--- a/apps/web/src/features/routines/components/routine-row.tsx
+++ b/apps/web/src/features/routines/components/routine-row.tsx
@@ -1,9 +1,13 @@
+import {
+ modelProvider,
+ ProviderIcon,
+} from '@core/component/AI/component/ProviderIcon';
+import { EntityIcon } from '@core/component/EntityIcon';
import { Layout as EntityLayout } from '@entity/core/Layout';
import { Slot as EntitySlot } from '@entity/core/Slot';
import ClockIcon from '@phosphor/clock-clockwise.svg';
-import RobotIcon from '@phosphor/robot.svg';
import { cn, InlineCheckbox, Layer, Tooltip } from '@ui';
-import type { JSX, ParentProps } from 'solid-js';
+import { type JSX, type ParentProps, Show } from 'solid-js';
import type { RoutineRow } from '../core/types';
/** Shared geometry keeps routine properties aligned with their column headers. */
@@ -90,7 +94,17 @@ export function RoutineListRow(props: {
<EntitySlot role="cell" class="min-w-0 text-xs text-ink-muted">
<Tooltip label={props.row.target} class="min-w-0 max-w-full">
<span class="inline-flex min-w-0 max-w-full items-center gap-1.5">
- <RobotIcon class="size-3.5 shrink-0" />
+ <Show
+ when={modelProvider(props.row.targetModel)}
+ fallback={
+ <EntityIcon targetType="chat" size="xs" class="shrink-0" />
+ }
+ >
+ <ProviderIcon
+ model={props.row.targetModel}
+ class="size-3.5 shrink-0"
+ />
+ </Show>
<span class="truncate">{props.row.target}</span>
</span>
</Tooltip>
diff --git a/apps/web/src/features/routines/components/routines-list.test.tsx b/apps/web/src/features/routines/components/routines-list.test.tsx
index 9b752e5fb9..45cb3070fb 100644
--- a/apps/web/src/features/routines/components/routines-list.test.tsx
+++ b/apps/web/src/features/routines/components/routines-list.test.tsx
@@ -10,7 +10,8 @@ const rows: RoutineRow[] = [
name: 'Morning briefing',
creator: 'You',
createdAt: '',
- target: 'Macro',
+ target: 'Sonnet 5.5',
+ targetModel: 'anthropic/claude-sonnet-5-5',
schedule: 'Weekdays at 9 AM',
status: 'Active',
enabled: true,
@@ -92,6 +93,16 @@ describe('routines list', () => {
expect(props.onToggle).not.toHaveBeenCalled();
expect(props.onOpen).not.toHaveBeenCalled();
});
+ it('marks each target with the provider of the model it runs on', () => {
+ setup();
+ const providerOf = (name: string) =>
+ screen
+ .getByText(name)
+ .parentElement?.querySelector('[data-ai-provider]')
+ ?.getAttribute('data-ai-provider');
+ expect(providerOf('Sonnet 5.5')).toBe('anthropic');
+ expect(providerOf('Finance agent')).toBeUndefined();
+ });
it('opens a blank routine without a templates section', () => {
const props = setup();
fireEvent.click(screen.getByRole('button', { name: 'Create Routine' }));
diff --git a/apps/web/src/features/routines/core/types.ts b/apps/web/src/features/routines/core/types.ts
index aa164c7ae7..73b68e239d 100644
--- a/apps/web/src/features/routines/core/types.ts
+++ b/apps/web/src/features/routines/core/types.ts
@@ -4,6 +4,8 @@ export type RoutineRow = {
creator: string;
createdAt: string;
target: string;
+ /** Model the routine runs on, when the target names or implies one. */
+ targetModel?: string;
schedule: string;
status: 'Active' | 'Paused' | 'Running' | 'Completed';
editable: boolean;
diff --git a/apps/web/src/features/routines/primitives/routines-list.ts b/apps/web/src/features/routines/primitives/routines-list.ts
index 2de7678f73..9f5d3c5942 100644
--- a/apps/web/src/features/routines/primitives/routines-list.ts
+++ b/apps/web/src/features/routines/primitives/routines-list.ts
@@ -9,7 +9,8 @@ import type { RoutineRow } from '../core/types';
export function createRoutineRows(
source: RoutineListSource,
userId: Accessor<string | undefined>,
- targetLabel: (target: RoutineTarget) => string
+ targetLabel: (target: RoutineTarget) => string,
+ targetModel: (target: RoutineTarget) => string | undefined
) {
return createMemo<RoutineRow[]>(() =>
source
@@ -28,6 +29,7 @@ export function createRoutineRows(
creator: 'You',
createdAt: routine.createdAt,
target: draft?.target ? targetLabel(draft.target) : 'Agent',
+ targetModel: draft?.target ? targetModel(draft.target) : undefined,
schedule: draft
? describeSchedule(draft, getDefaultTimezone())
: 'Event triggered',
diff --git a/apps/web/src/features/routines/routines-page.tsx b/apps/web/src/features/routines/routines-page.tsx
index 6eb07e950a..4fd0dc5e1b 100644
--- a/apps/web/src/features/routines/routines-page.tsx
+++ b/apps/web/src/features/routines/routines-page.tsx
@@ -63,6 +63,13 @@ function RoutinesContent() {
?.name ?? 'Agent')
: modelLabel(target.model)
}
+ targetModel={(target) =>
+ target.kind === 'agent'
+ ? (target.modelOverride ??
+ roster.roster().find((agent) => agent.botId === target.agentId)
+ ?.defaultModel)
+ : target.model
+ }
searchRef={(input) => (searchInput = input)}
onCreate={create}
onOpen={(id) => open(id)}
diff --git a/apps/web/src/features/routines/views/routines-list.tsx b/apps/web/src/features/routines/views/routines-list.tsx
index 5a243d95a0..cfbcf9dd60 100644
--- a/apps/web/src/features/routines/views/routines-list.tsx
+++ b/apps/web/src/features/routines/views/routines-list.tsx
@@ -8,11 +8,17 @@ export function RoutinesListView(props: {
source: RoutineListSource;
userId: Accessor<string | undefined>;
targetLabel(target: RoutineTarget): string;
+ targetModel(target: RoutineTarget): string | undefined;
searchRef(input: HTMLInputElement): void;
onCreate(): void;
onOpen(id: string): void;
}) {
- const rows = createRoutineRows(props.source, props.userId, props.targetLabel);
+ const rows = createRoutineRows(
+ props.source,
+ props.userId,
+ props.targetLabel,
+ props.targetModel
+ );
return (
<RoutinesList
searchRef={props.searchRef}