@autobe/agent
Version:
AI backend server code generator
60 lines (57 loc) • 1.62 kB
text/typescript
import { IAgenticaHistoryJson } from "@agentica/core";
import { v4 } from "uuid";
import { AutoBeSystemPromptConstant } from "../../constants/AutoBeSystemPromptConstant";
import { AutoBeState } from "../../context/AutoBeState";
export const transformPrismaHistories = (
state: AutoBeState,
): Array<
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
> => {
if (state.analyze === null)
return [
{
id: v4(),
created_at: new Date().toISOString(),
type: "systemMessage",
text: [
"Requirement analysis is not yet completed.",
"Don't call any tool function,",
"but say to process the requirement analysis.",
].join(" "),
},
];
return [
{
id: v4(),
created_at: new Date().toISOString(),
type: "systemMessage",
text: AutoBeSystemPromptConstant.PRISMA,
},
{
id: v4(),
created_at: new Date().toISOString(),
type: "assistantMessage",
text: AutoBeSystemPromptConstant.PRISMA_EXAMPLE,
},
{
id: v4(),
created_at: new Date().toISOString(),
type: "assistantMessage",
text: [
"Here is the requirement analysis report.",
"",
"Call the provided tool function to generate Prisma DB schema",
"referencing below requirement analysis report.",
"",
"## User Request",
state.analyze.reason,
"",
`## Requirement Analysis Report`,
"",
"```json",
JSON.stringify(state.analyze.files),
"```",
].join("\n"),
},
];
};