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。

873 B
Raw Blame
export type LearnDesktopCommandFeedback =
  | { kind: 'toast'; level: 'warning' | 'error'; i18nKey: string }
  | { kind: 'insert-card'; runId: string };

export function resolveLearnDesktopCommandFeedback(payload: {
  error?: string;
  learnRunId?: string;
}): LearnDesktopCommandFeedback | null {
  switch (payload.error) {
    case 'learn-usage':
      return { kind: 'toast', level: 'warning', i18nKey: 'learn.toast.usage' };
    case 'learn-busy':
      return { kind: 'toast', level: 'warning', i18nKey: 'learn.toast.busy' };
    case 'learn-failed':
      return { kind: 'toast', level: 'error', i18nKey: 'learn.toast.failed' };
    case 'remote-unsupported':
      return { kind: 'toast', level: 'warning', i18nKey: 'commands.toast.remoteUnsupported' };
    default:
      return payload.learnRunId ? { kind: 'insert-card', runId: payload.learnRunId } : null;
  }
}