UNPKG

@autobe/agent

Version:

AI backend server code generator

41 lines (38 loc) 1.3 kB
import { AutoBeOpenApi } from "@autobe/interface"; import { v7 } from "uuid"; import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant"; import { IAutoBeOrchestrateHistory } from "../../../structures/IAutoBeOrchestrateHistory"; import { AutoBePreliminaryController } from "../../common/AutoBePreliminaryController"; export const transformInterfaceEndpointReviewHistory = (props: { preliminary: AutoBePreliminaryController<"analysisFiles" | "prismaSchemas">; endpoints: AutoBeOpenApi.IEndpoint[]; }): IAutoBeOrchestrateHistory => ({ histories: [ { type: "systemMessage", id: v7(), created_at: new Date().toISOString(), text: AutoBeSystemPromptConstant.INTERFACE_ENDPOINT, }, { id: v7(), type: "systemMessage", text: AutoBeSystemPromptConstant.INTERFACE_ENDPOINT_REVIEW, created_at: new Date().toISOString(), }, ...props.preliminary.getHistories(), { id: v7(), type: "assistantMessage", text: [ "Below are endpoints generated by your request.", "", "```json", JSON.stringify(props.endpoints), "```", ].join("\n"), created_at: new Date().toISOString(), }, ], userMessage: "Review the generated endpoints please", });