Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

3.3 KB
Raw Blame
// A provider's detail: the shipped SourceDetailPanel, opened from a row of 模型供应商, and its
// 测试 dialog.
import { SourceDetailPanel } from '@/components/settings/models/SourceDetailPanel';
import { SourceTestDialog } from '@/components/settings/models/SourceTestDialog';
import type { TrackSourceMutation } from '@/components/settings/models/mutationSettlement';
import { readyRegion } from '@/components/settings/models/regionRead';
import type { Source } from '@/components/settings/models/types';

import { frames } from '../../frame';
import { baseApi, chatgptPro, claudeMax, hostedTools, relayGpt, tavily, usageApi } from './fixtures';

const pending: TrackSourceMutation = () => new Promise(() => {});
const tools = readyRegion(hostedTools());
const gatewayBackends = new Set(['claude', 'codex', 'opencode', 'vibey'] as const);
const noPending = new Set<never>();

/**
 * The shipped panel at the size the Models page's provider dialog gives it (720 × 624; a tall
 * sheet on a phone). The dialog itself is inline in SettingsModelsPage and opens from page
 * state, so these frames draw the panel without it.
 */
const detail = (source: Source, serviceView = false) => () => (
  <div className="flex h-full flex-col">
    <SourceDetailPanel
      source={source}
      serviceView={serviceView}
      hostedTools={tools}
      hostedPending={noPending}
      onRetryHostedTools={() => {}}
      onClearHostedRefusal={() => {}}
      onSaveSearch={() => {}}
      onSaveFetch={() => {}}
      onRetryService={() => {}}
      onRetryFetch={() => {}}
      onManageSource={() => {}}
      onOpenUsage={() => {}}
      activeBackends={gatewayBackends}
      trackMutation={pending}
      onReauth={() => {}}
      onMutationCommitted={async () => {}}
    />
  </div>
);

const chatgptExpired: Source = { ...chatgptPro, state: { status: 'needs_action', retry_at: null, detail_key: 'models.source.needs_action.oauth_expired' } };

const designFrames = frames([
  {
    name: 'api-key',
    title: '供应商详情 · API Key(ai-relay-gpt)',
    width: 720,
    height: 624,
    status: 'shipped',
    fixtures: { api: baseApi },
    render: detail(relayGpt),
  },
  {
    name: 'subscription',
    title: '供应商详情 · 本机订阅(Claude Max)',
    width: 720,
    height: 624,
    status: 'shipped',
    fixtures: { api: baseApi },
    render: detail(claudeMax),
  },
  {
    name: 'needs-action',
    title: '供应商详情 · 需要重新登录(ChatGPT Pro)',
    width: 720,
    height: 624,
    status: 'shipped',
    fixtures: { api: baseApi },
    render: detail(chatgptExpired),
  },
  {
    name: 'search-service',
    title: '供应商详情 · 搜索服务(Tavily)',
    width: 720,
    height: 624,
    status: 'shipped',
    fixtures: { api: { ...baseApi, ...usageApi() } },
    render: detail(tavily, true),
  },
  {
    name: 'test',
    title: '测试供应商(ai-relay-gpt)',
    width: 1000,
    height: 600,
    status: 'shipped',
    fixtures: { api: baseApi },
    render: () => <SourceTestDialog source={relayGpt} onClose={() => {}} trackMutation={pending} />,
  },
  {
    name: 'phone',
    title: '供应商详情 · 手机',
    width: 390,
    height: 760,
    status: 'shipped',
    fixtures: { api: baseApi },
    render: detail(relayGpt),
  },
]);

export default designFrames;