Skip to content

Commit

Permalink
Merge pull request #240 from toyamarinyon/new-graph-id-on-copy
Browse files Browse the repository at this point in the history
feat(agent): Add unique graph ID generation for agent copies
  • Loading branch information
toyamarinyon authored Dec 16, 2024
2 parents c9dab35 + 989ca92 commit acf8b15
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/dev/copy-agent/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { putGraph } from "../../(playground)/p/[agentId]/canary/actions";
import {
buildFileFolderPath,
createFileId,
createGraphId,
pathJoin,
pathnameToFilename,
} from "../../(playground)/p/[agentId]/canary/lib/utils";
Expand Down Expand Up @@ -101,7 +102,8 @@ export async function copyAgentAction(
} as Node;
}),
);
const { url } = await putGraph({ ...graph, nodes: newNodes });
const newGraphId = createGraphId();
const { url } = await putGraph({ ...graph, id: newGraphId, nodes: newNodes });
const newAgentId = `agnt_${createId()}` as AgentId;
const newAgent = await db.insert(agents).values({
id: newAgentId,
Expand Down

0 comments on commit acf8b15

Please sign in to comment.