@autobe/agent
Version:
AI backend server code generator
62 lines (52 loc) • 2.26 kB
text/typescript
import { StringUtil } from "@autobe/utils";
import { v7 } from "uuid";
import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
import { AutoBeState } from "../../../context/AutoBeState";
import { IAutoBeOrchestrateHistory } from "../../../structures/IAutoBeOrchestrateHistory";
import { AutoBePreliminaryController } from "../../common/AutoBePreliminaryController";
export const transformRealizeTransformerPlanHistory = (props: {
state: AutoBeState;
preliminary: AutoBePreliminaryController<
"analysisSections" | "databaseSchemas" | "interfaceSchemas" | "complete"
>;
dtoTypeName: string;
}): IAutoBeOrchestrateHistory => {
return {
histories: [
{
id: v7(),
created_at: new Date().toISOString(),
type: "systemMessage",
text: AutoBeSystemPromptConstant.REALIZE_TRANSFORMER_PLAN,
},
...props.preliminary.getHistories(),
{
id: v7(),
created_at: new Date().toISOString(),
type: "assistantMessage",
text: StringUtil.trim`
I understand the task.
I need to analyze the given DTO type "${props.dtoTypeName}" and determine if it needs a transformer.
**My approach**:
1. Analyze the DTO to determine if it's transformable or not
2. Generate a plan with ONE entry for this DTO
**For transformable DTOs**: Set databaseSchemaName to actual database table name
**For non-transformable DTOs**: Set databaseSchemaName to null
I will return exactly ONE plan entry for the given DTO.
`,
},
],
userMessage: StringUtil.trim`
Analyze the DTO type "${props.dtoTypeName}" and create a transformer plan entry.
**Your task**:
1. Determine if this DTO is transformable (maps to database table) or non-transformable
2. Generate a plan with exactly ONE entry for this DTO
**Remember**:
- Your plan must contain exactly ONE entry for "${props.dtoTypeName}"
- Transformable DTOs: Set databaseSchemaName to actual database table name
- Non-transformable DTOs: Set databaseSchemaName to null
- Do NOT include other DTOs in your plan
Create the plan for this DTO now.
`,
};
};