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。

2.0 KB
Raw Blame
import { useState } from 'react';
import { mountPage } from '../../ui-page/harness';
import { UserMessage } from '../../../src/renderer/components/chat/UserMessage';
import { AssistantMessage } from '../../../src/renderer/components/chat/AssistantMessage';
import { MessageReadAloudContext } from '../../../src/renderer/components/chat/MessageReadAloudContext';

function CompanionReply() {
  const [reading, setReading] = useState(false);
  return <MessageReadAloudContext.Provider value={{
    sessionId: 'shared-task', available: true, disabled: false,
    messageId: reading ? 'reply-2' : null, phase: reading ? 'playing' : 'idle',
    canRead: () => true, toggle: () => setReading(value => !value),
  }}>
    <AssistantMessage workingDir="/project" currentSessionId="shared-task" messageClientId="reply-2"
      content="先收好桌面上的文件,再把常用物品放回顺手的位置。整理完成后,记得留出一块空白的工作区域。"
      agentKind="cc" simplifiedBotConversation showActionBar />
  </MessageReadAloudContext.Provider>;
}

void mountPage({
  route: '/cc-agent/shared-task',
  host: { maker: { getCapabilities: async () => ({ availableModels: [], hasFastMode: false, effortLevels: [], permissionModes: [], fork: { supported: true }, rewind: { supported: false } }) } },
  render: (ctx) => ctx.case.startsWith('companion')
    ? <div className="p-4" data-ui-page-subject><CompanionReply /></div>
    : <div className="p-8 space-y-10" data-ui-page-subject>
    <UserMessage workingDir="/project" content="技术上能想办法实现吗?" sessionId="shared-task" messageClientId="user-2" agentKind="cc" remoteHostId={ctx.case === 'ssh' ? 'ssh-host' : undefined} />
    <AssistantMessage workingDir="/project" content="可以。分叉后会保留历史上下文,继续使用原来那台电脑上的共享模型。" currentSessionId="shared-task" messageClientId="reply-2" agentKind="cc" remoteHostId={ctx.case === 'ssh' ? 'ssh-host' : undefined} showActionBar />
  </div>,
});