Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

Merge main and preserve scheduler model device labels

Yuewei-LLf200844bb5b3
diff --cc apps/desktop/src/renderer/features/scheduler/components/ScheduleChips.tsx
index 630cff3031,edd145beec..234f261b2c
--- a/apps/desktop/src/renderer/features/scheduler/components/ScheduleChips.tsx
+++ b/apps/desktop/src/renderer/features/scheduler/components/ScheduleChips.tsx
@@@ -16,9 -17,14 +17,10 @@@ import { useDetectCwd } from '@/hooks/u
import { useAgentCapabilities, type ModelDescriptor } from '@/hooks/useAgentCapabilities';
import { useProviders } from '@/hooks/useProviders';
import { useDeviceProviders } from '@/hooks/useDeviceProviders';
+ import { useModelRouteDevices } from '@/hooks/useModelRouteDevices';
-import { agentDeviceModelMemoryAccessors } from '@/state/agentDeviceModelMemory';
import { RemoteSourceMark } from '@/components/icons/RemoteSourceMark';
-import {
- ModelIconMark,
- ModelSelectorContent,
- type RemoteAgentSelectorOptions,
-} from '@/components/new-chat/ModelSelector';
+import { ModelIconMark } from '@/components/new-chat/ModelSelector';
+import { ModelRouteSelectorContent } from '@/components/new-chat/ModelRouteSelector';
import { useModelDiscoveryPending } from '@/components/new-chat/useModelDiscoveryPending';
import {
effectiveSourceIdForModel,
@@@ -1116,14 -1132,31 +1118,22 @@@ export function ModelEffortChip(
},
[disabled, discovery],
);
- const pickerAgents = useModelPickerAgents(agentKind, agentDeviceId);
- const caps = useAgentCapabilities(agentKind, agentDeviceId ?? undefined);
+ const pickerAgents = useModelPickerAgents(agentKind, agentDeviceId || undefined);
+ const caps = useAgentCapabilities(agentKind, agentDeviceId || undefined);
// 触发器(trigger)展示用:仍按 openai-codex/ 与 codex/ 折扣模型的 XD 网关来源可见性过滤,算出当前
// 选中模型名。下拉内容本体改用聊天的 ModelSelectorContent(它内部按来源/api-key 自行
- // 过滤 + 分组),这里只为 trigger 文案保留最小化 model 解析。Agent 在另一台电脑时读那台的目录。
+ // 过滤 + 分组),这里只为 trigger 文案保留最小化 model 解析。
const localProviders = useProviders();
- const deviceProviders = useDeviceProviders(agentDeviceId ?? undefined);
- const { providers, loading: providersLoading } = agentDeviceId ? deviceProviders : localProviders;
- // 其他电脑与分享来的供应商:与普通任务同一份候选(useModelRouteDevices)。locked 只留
- // 当前所在的那一处,绑定任务的运行位置跟随任务本身。
+ const remoteProviders = useDeviceProviders(agentDeviceId || undefined);
+ const { providers, loading: providersLoading } = agentDeviceId ? remoteProviders : localProviders;
++ // 触发器的位置说明与统一选择器使用相同候选,沿用设备名称的统一回退规则。
+ const routeDevices = useModelRouteDevices({
- controlledDeviceId: remoteLocation === 'none' ? undefined : null,
++ controlledDeviceId: null,
+ leadAgentDeviceId: agentDeviceId,
+ });
- const remoteAgent = useMemo<RemoteAgentSelectorOptions | undefined>(() => {
- const devices = remoteLocation === 'locked'
- ? routeDevices.devices?.filter((device) => device.deviceId === agentDeviceId)
- : routeDevices.devices;
- return devices && devices.length > 0
- ? { devices, selectedDeviceId: agentDeviceId, deviceModelMemory: agentDeviceModelMemoryAccessors }
- : undefined;
- }, [agentDeviceId, remoteLocation, routeDevices.devices]);
+ const agentDeviceName = agentDeviceId
- ? (deviceDisplayName(agentDeviceId, undefined, routeDevices.devices ?? []))
++ ? deviceDisplayName(agentDeviceId, undefined, routeDevices.devices ?? [])
+ : null;
const xdConnected = providers.some((p) => p.id === 'xd' && p.connected);
const availableModels = caps.capabilities?.availableModels;
const models = useMemo(
@@@ -1189,17 -1224,26 +1199,22 @@@
name={activeProvider?.name}
routing={activeProvider?.routing}
logoKind={activeProvider?.logoKind}
- colorClass={agentDeviceId ? 'text-current' : ''}
+ colorClass=""
withMargin={false}
/>
- ) : null;
- // Agent 在另一台电脑:与聊天 trigger 一样在来源标上叠信号波纹,悬停说出是哪台。
+ ) : undefined;
+
+ const agentDeviceTitle = agentDeviceName
+ ? t('newChat.modelSelector.trigger.agentDevice', { device: agentDeviceName })
+ : null;
+
return (
<Popover open={open} onOpenChange={handleOpenChange}>
<PopoverTrigger asChild>
<ChipButton
- icon={
- !isFollowingSession && activeMark
- ? agentDeviceId ? <RemoteSourceMark>{activeMark}</RemoteSourceMark> : activeMark
- : undefined
- }
- title={agentDeviceTitle ? `${display} · ${agentDeviceTitle}` : undefined}
+ icon={agentDeviceId && modelIcon ? <RemoteSourceMark>{modelIcon}</RemoteSourceMark> : modelIcon}
label={display}
++ title={agentDeviceTitle ? `${display} · ${agentDeviceTitle}` : undefined}
active={open}
disabled={disabled}
className="[&>span:last-of-type]:min-w-[106px] max-w-[240px] px-2"