Skip to content

feat: 代码生成 API — 供协作空间调用 #22

Closed

Description

@dahai80

需求来源

fusion-cowork V1.0 协作空间中,成员可能需要 AI 生成脚本/代码片段,作为工作流节点或独立执行。

需求描述

提供 REST API 供 fusion-cowork 调用 fusion-code 的代码生成能力。

期望接口

POST /api/code/generate
Content-Type: application/json

{
  "prompt": "string",          // 代码生成需求描述
  "language": "string",        // python/bash/javascript/swift
  "context": "string|null",    // 可选上下文(空间对话片段)
  "max_tokens": int
}

Response 200:
{
  "code": "string",            // 生成的代码
  "language": "string",
  "explanation": "string",     // 代码说明
  "tokens_used": int
}

使用场景

  1. 协作空间成员在对话中请求生成 Python 脚本
  2. 工作流编排中自动生成节点代码
  3. SpaceAgent 调用代码生成工具

优先级

P2 — M8+ 里程碑增强项

关联

  • fusion-cowork 增强方案: ~/fusion/architecture/fusion-cowork-enhance.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions