💻 源码
export type StepType = 'thought' | 'action' | 'observation' | 'answer' | 'plain' | 'input'

export interface ReActStep {
  id: string
  type: StepType
  title: string
  content: string
  round: number
  meta?: Record<string, string>
}

export interface ReActRound {
  round: number
  thought?: ReActStep
  action?: ReActStep
  observation?: ReActStep
}

export interface ChatMessage {
  role: 'system' | 'user' | 'assistant' | 'tool'
  content: string
  tool_calls?: ToolCall[]
  tool_call_id?: string
  name?: string
}

export interface ToolCall {
  id: string
  type: 'function'
  function: {
    name: string
    arguments: string
  }
}

export interface ToolDefinition {
  type: 'function'
  function: {
    name: string
    description: string
    parameters: {
      type: 'object'
      properties: Record<string, { type: string; description: string }>
      required: string[]
    }
  }
}

export interface RunResult {
  steps: ReActStep[]
  rounds: ReActRound[]
  finalAnswer: string
  toolCallCount: number
  messages: ChatMessage[]
}

export interface PlainRunResult {
  steps: ReActStep[]
  finalAnswer: string
}

export interface DemoQuestion {
  id: string
  text: string
  hint: string
  needsTool: boolean
}