From bc29cf40b035ae4b3ed158ff8d0d50e8ea652a71 Mon Sep 17 00:00:00 2001 From: tylerslaton Date: Fri, 18 Oct 2024 10:23:35 -0400 Subject: [PATCH] feat: add random initial names for agents Signed-off-by: tylerslaton --- ui/admin/app/lib/service/nameGenerator.ts | 104 ++++++++++++++++++++ ui/admin/app/routes/_auth.agents._index.tsx | 5 +- 2 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 ui/admin/app/lib/service/nameGenerator.ts diff --git a/ui/admin/app/lib/service/nameGenerator.ts b/ui/admin/app/lib/service/nameGenerator.ts new file mode 100644 index 000000000..a0525b947 --- /dev/null +++ b/ui/admin/app/lib/service/nameGenerator.ts @@ -0,0 +1,104 @@ +const adjectives = [ + "Smart", + "Clever", + "Intelligent", + "Adaptive", + "Intuitive", + "Helpful", + "Efficient", + "Responsive", + "Quick", + "Analytical", + "Logical", + "Creative", + "Innovative", + "Insightful", + "Proactive", + "Versatile", + "Agile", + "Brilliant", + "Capable", + "Diligent", + "Eloquent", + "Focused", + "Graceful", + "Harmonious", + "Imaginative", + "Judicious", + "Knowledgeable", + "Luminous", + "Meticulous", + "Nimble", + "Observant", + "Perceptive", + "Qualified", + "Reliable", + "Skillful", + "Thorough", + "Unstoppable", + "Vigilant", + "Wise", + "Expert", + "Yielding", + "Zealous", + "Astute", + "Balanced", + "Competent", + "Dynamic", +]; + +const nouns = [ + "Assistant", + "Copilot", + "Helper", + "Companion", + "Aide", + "Collaborator", + "Partner", + "Advisor", + "Guide", + "Sidekick", + "Ally", + "Supporter", + "Mentor", + "Coach", + "Facilitator", + "Buddy", + "Agent", + "Beacon", + "Counselor", + "Dynamo", + "Enhancer", + "Friend", + "Genius", + "Hotshot", + "Innovator", + "Juggler", + "Keeper", + "Luminary", + "Mastermind", + "Navigator", + "Optimizer", + "Pathfinder", + "Quartermaster", + "Resolver", + "Sage", + "Trailblazer", + "Utility", + "Virtuoso", + "Whiz", + "Savant", + "Yoda", + "Zealot", + "Ace", + "Brainiac", + "Catalyst", + "Dynamo", +]; + +export function generateRandomName(): string { + const randomAdjective = + adjectives[Math.floor(Math.random() * adjectives.length)]; + const randomNoun = nouns[Math.floor(Math.random() * nouns.length)]; + return `${randomAdjective} ${randomNoun}`; +} diff --git a/ui/admin/app/routes/_auth.agents._index.tsx b/ui/admin/app/routes/_auth.agents._index.tsx index ec75f545d..372aebd2c 100644 --- a/ui/admin/app/routes/_auth.agents._index.tsx +++ b/ui/admin/app/routes/_auth.agents._index.tsx @@ -9,6 +9,7 @@ import useSWR from "swr"; import { Agent } from "~/lib/model/agents"; import { AgentService } from "~/lib/service/api/agentService"; import { ThreadsService } from "~/lib/service/api/threadsService"; +import { generateRandomName } from "~/lib/service/nameGenerator"; import { timeSince } from "~/lib/utils"; import { TypographyP } from "~/components/Typography"; @@ -64,7 +65,9 @@ export default function Threads() { className="justify-start" onClick={() => { AgentService.createAgent({ - agent: {} as Agent, + agent: { + name: generateRandomName(), + } as Agent, }).then((agent) => { navigate( $path("/agents/:agent", {