Skip to content

Commit

Permalink
enhance: turn up the heat in the agent/workflow name generation (#679)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanhopperlowe authored Nov 26, 2024
1 parent e4c4807 commit 9b47349
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions ui/admin/app/lib/service/nameGenerator.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { faker } from "@faker-js/faker";

export function generateRandomName(): string {
// faker doesn't have a "capitalized word" function, so we need to do it manually :(
const rawAdjective = faker.word.adjective();
const rawAnimal = faker.animal.type();
const adjective =
rawAdjective.charAt(0).toUpperCase() + rawAdjective.slice(1);
const animal = rawAnimal.charAt(0).toUpperCase() + rawAnimal.slice(1);
const uppercaseFirst = (word: string) =>
word.charAt(0).toUpperCase() + word.slice(1);

return `${adjective} ${animal}`;
export function generateRandomName(): string {
return [faker.word.adjective(), faker.word.noun()]
.map(uppercaseFirst)
.join(" ");
}

0 comments on commit 9b47349

Please sign in to comment.