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。

1.5 KB
Raw Blame
import { Button } from '@/components/ui/button';
import type { MakerVendor } from '@/lib/ccAgent.types';
import type { BotModelRoute } from '../../../shared/botModelChain';
import { BotModelChainEditor } from './BotModelChainEditor';
import { useBotTranslation } from './botPronounContext';

/** A purpose-specific override using the same complete-route picker as the primary model. */
export function BotTaskModelEditor({ value, inheritedRoute, onChange, disabled, hiddenVendors, deviceId, inheritanceHint }: {
  value: BotModelRoute | null;
  inheritedRoute?: BotModelRoute;
  inheritanceHint?: string;
  onChange(value: BotModelRoute | null): void;
  disabled?: boolean;
  hiddenVendors?: MakerVendor[];
  deviceId?: string;
}) {
  const { t } = useBotTranslation();
  const route = value ?? inheritedRoute;
  return <div className="mt-4 min-w-0 border-t border-[var(--border-default)] pt-4" data-testid="bot-task-model-controls">
    <BotModelChainEditor label={t('bots.model.task')} value={route ? [route] : []}
      allowFallbacks={false} disabled={disabled} hiddenVendors={hiddenVendors} deviceId={deviceId}
      onChange={routes => { if (routes[0]) onChange(routes[0]); }} />
    {value ? <Button variant="secondary" tone="quiet" size="sm" compact disabled={disabled}
      onClick={() => onChange(null)}>{t('bots.model.inheritPrimary')}</Button>
      : <p className="mt-1 text-12 leading-5 text-[var(--text-secondary)]">{inheritanceHint ?? t('bots.model.inheritingPrimary')}</p>}
  </div>;
}