Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

1.2 KB
Raw Blame
import type { Meta, StoryObj } from '@storybook/nextjs-vite'
import { TooltipProvider } from '@langgenius/dify-ui/tooltip'
import { MermaidDiagram } from '.'

const meta = {
  title: 'Base/Data Display/MermaidDiagram',
  component: MermaidDiagram,
  args: {
    source:
      'flowchart LR\n A[用户输入] --> B{知识检索}\n B --> C[生成回答]\n B --> D[调用工具]\n D --> C',
  },
  decorators: [
    (Story) => (
      <div className="w-full max-w-3xl">
        <TooltipProvider delay={300} closeDelay={200}>
          <Story />
        </TooltipProvider>
      </div>
    ),
  ],
  parameters: { layout: 'padded' },
} satisfies Meta<typeof MermaidDiagram>

export default meta
type Story = StoryObj<typeof meta>

export const Flowchart: Story = {}
export const Narrow: Story = {
  decorators: [
    (Story) => (
      <div className="w-80">
        <Story />
      </div>
    ),
  ],
}
export const Sequence: Story = {
  args: {
    source:
      'sequenceDiagram\n participant User\n participant Agent\n participant Knowledge\n User->>Agent: Ask a question\n Agent->>Knowledge: Retrieve context\n Knowledge-->>Agent: Relevant documents\n Agent-->>User: Answer with citations',
  },
}
export const Invalid: Story = { args: { source: 'flowchart TD\n A[' } }