Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions frontend/src/adk/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,11 @@ export interface DeployAgentkitResult {
agentName: string;
runtimeId?: string;
consoleUrl?: string;
feishuChannel?: {
enabled: boolean;
transport: string;
runtimeId?: string;
};
}

/** One live progress frame streamed during a deployment. */
Expand All @@ -375,12 +380,28 @@ export async function deployAgentkitProject(
name: string,
files: { path: string; content: string }[],
config: { region: string; projectName: string },
opts?: { author?: string; onStage?: (s: DeployStage) => void },
opts?: {
author?: string;
onStage?: (s: DeployStage) => void;
im?: {
feishu?: {
enabled: boolean;
};
};
envs?: { key: string; value: string }[];
},
): Promise<DeployAgentkitResult> {
const res = await apiFetch("/web/deploy-agentkit", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ name, files, config, author: opts?.author ?? "" }),
body: JSON.stringify({
name,
files,
config,
author: opts?.author ?? "",
im: opts?.im,
envs: opts?.envs,
}),
});
if (!res.ok) {
const t = await res.text().catch(() => "");
Expand Down Expand Up @@ -411,6 +432,7 @@ export async function deployAgentkitProject(
agentName: final.agentName,
runtimeId: final.runtimeId,
consoleUrl: final.consoleUrl,
feishuChannel: final.feishuChannel,
};
}

Expand Down Expand Up @@ -605,4 +627,3 @@ export async function getRuntimeDetail(
}
return res.json();
}

43 changes: 40 additions & 3 deletions frontend/src/create/CustomCreate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ type StepId =
| "memory"
| "knowledge"
| "tracing"
| "deploy"
| "subagents"
| "review";

Expand All @@ -102,6 +103,7 @@ const STEPS: StepMeta[] = [
{ id: "memory", label: "记忆", hint: "短期 / 长期", icon: Layers },
{ id: "knowledge", label: "知识库", hint: "外部知识检索", icon: Database },
{ id: "tracing", label: "观测", hint: "Tracing 与 A2UI", icon: Eye },
{ id: "deploy", label: "部署配置", hint: "飞书等运行入口", icon: Rocket },
{ id: "subagents", label: "子 Agent", hint: "嵌套协作", icon: Boxes },
{ id: "review", label: "完成", hint: "预览并创建", icon: Rocket },
];
Expand Down Expand Up @@ -922,6 +924,11 @@ export function CustomCreate({ onBack, onCreate, onAgentAdded, initialDraft, aut
// Auto-enable tracing when at least one exporter is chosen.
patch({ tracingExporters: next, tracing: next.length > 0 ? true : node.tracing });
};
const patchDeployment = (p: Partial<NonNullable<AgentDraft["deployment"]>>) =>
setDraft((d) => ({
...d,
deployment: { ...(d.deployment ?? { feishuEnabled: false }), ...p },
}));

// Detail-pane branching is driven by the SELECTED node's type.
const orchestrator = isOrchestratorType(node.agentType);
Expand Down Expand Up @@ -951,6 +958,7 @@ export function CustomCreate({ onBack, onCreate, onAgentAdded, initialDraft, aut
memory: node.memory.shortTerm || node.memory.longTerm,
knowledge: node.knowledgebase,
tracing: node.tracing || node.enableA2ui,
deploy: true,
subagents: (node.subAgents?.length ?? 0) > 0,
review: canFinish,
}),
Expand All @@ -963,7 +971,16 @@ export function CustomCreate({ onBack, onCreate, onAgentAdded, initialDraft, aut
const navStepIds: StepId[] =
orchestrator || a2a
? ["basic"]
: ["basic", "model", "tools", "skills", "memory", "knowledge", "tracing"];
: [
"basic",
"model",
"tools",
"skills",
"memory",
"knowledge",
"tracing",
...(safePath.length === 0 ? (["deploy"] as StepId[]) : []),
];
const navSteps = STEPS.filter((s) => navStepIds.includes(s.id));
const activeIndex = navSteps.findIndex((s) => s.id === activeId);

Expand Down Expand Up @@ -1077,12 +1094,13 @@ export function CustomCreate({ onBack, onCreate, onAgentAdded, initialDraft, aut
const handleDeploy = async (
proj: AgentProject,
onStage?: (s: DeployStage) => void,
options?: Parameters<typeof deployAgentkitProject>[3],
) => {
return deployAgentkitProject(
proj.name,
proj.files,
{ region: "cn-beijing", projectName: "default" },
{ author, onStage },
{ ...options, author, onStage },
);
};

Expand Down Expand Up @@ -1114,7 +1132,13 @@ export function CustomCreate({ onBack, onCreate, onAgentAdded, initialDraft, aut
</button>
</div>
<div className="cw-preview-body">
<ProjectPreview project={project} onChange={setProject} onDeploy={handleDeploy} onAgentAdded={onAgentAdded} />
<ProjectPreview
project={project}
onChange={setProject}
onDeploy={handleDeploy}
onAgentAdded={onAgentAdded}
feishuEnabled={!!draft.deployment?.feishuEnabled}
/>
</div>
</div>
);
Expand Down Expand Up @@ -1512,6 +1536,19 @@ export function CustomCreate({ onBack, onCreate, onAgentAdded, initialDraft, aut
/>
</div>
</Section>
{safePath.length === 0 && (
<Section meta={metaOf("deploy")}>
<div className="cw-form cw-toggle-stack">
<Toggle
checked={!!draft.deployment?.feishuEnabled}
onChange={(v) => patchDeployment({ feishuEnabled: v })}
title="连接飞书"
desc="部署后可通过飞书消息触发当前 Agent。"
icon={Globe}
/>
</div>
</Section>
)}
</>
)}
</div>
Expand Down
20 changes: 15 additions & 5 deletions frontend/src/create/IntelligentCreate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useEffect, useRef, useState } from "react";
import { motion, AnimatePresence } from "motion/react";
import { Send, Sparkles, Bot, FolderTree, AlertCircle, Loader2 } from "lucide-react";
import { createSession, runSSE, getAgentInfo, deployAgentkitProject } from "../adk/client";
import type { DeployStage } from "../adk/client";
import { applyEvent, emptyAcc, type Acc } from "../blocks";
import { Markdown } from "../ui/Markdown";
import { ProjectPreview } from "../ui/ProjectPreview";
Expand Down Expand Up @@ -204,11 +205,20 @@ export function IntelligentCreate({ userId, onBack, onCreate, onAgentAdded }: In
return { project: parseProject(finalText), finalText };
}

const handleDeploy = async (proj: AgentProject) => {
return deployAgentkitProject(proj.name, proj.files, {
region: "cn-beijing",
projectName: "default",
});
const handleDeploy = async (
proj: AgentProject,
onStage?: (s: DeployStage) => void,
options?: Parameters<typeof deployAgentkitProject>[3],
) => {
return deployAgentkitProject(
proj.name,
proj.files,
{
region: "cn-beijing",
projectName: "default",
},
{ ...options, onStage },
);
};

const send = async () => {
Expand Down
Loading
Loading