Skip to content

CanvasAnvil is an open source AI diagram maker and flowchart generator - an infinite-canvas diagram editor and self-hosted drawio alternative that writes editable .drawio files. Text to diagram, then fix nodes, layout and labels in place. Also AI presentations, interior design CAD/BOM, posters and infographics.

837 B
Raw Blame
type RisenPromptSections = {
  role: string;
  instructions?: string;
  input?: string;
  steps?: string;
  endGoal?: string;
  narrowing?: string;
  outputFormat?: string;
};

const renderSection = (title: string, body?: string) => {
  const content = String(body || "").trim();
  if (!content) return "";
  return `# ${title}\n${content}`;
};

export function buildRisenPrompt(sections: RisenPromptSections) {
  return [
    renderSection("R - Role", sections.role),
    renderSection("I - Instructions", sections.instructions),
    renderSection("Input", sections.input),
    renderSection("S - Steps", sections.steps),
    renderSection("E - End Goal", sections.endGoal),
    renderSection("N - Narrowing", sections.narrowing),
    renderSection("Output Format", sections.outputFormat),
  ]
    .filter(Boolean)
    .join("\n\n");
}