mirror of
https://github.com/langgenius/dify.git
synced 2026-04-05 10:53:06 +08:00
chore: add more stories (#27142)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
4
web/.storybook/__mocks__/context-block.tsx
Normal file
4
web/.storybook/__mocks__/context-block.tsx
Normal file
@@ -0,0 +1,4 @@
|
||||
// Mock for context-block plugin to avoid circular dependency in Storybook
|
||||
export const ContextBlockNode = null
|
||||
export const ContextBlockReplacementBlock = null
|
||||
export default null
|
||||
4
web/.storybook/__mocks__/history-block.tsx
Normal file
4
web/.storybook/__mocks__/history-block.tsx
Normal file
@@ -0,0 +1,4 @@
|
||||
// Mock for history-block plugin to avoid circular dependency in Storybook
|
||||
export const HistoryBlockNode = null
|
||||
export const HistoryBlockReplacementBlock = null
|
||||
export default null
|
||||
4
web/.storybook/__mocks__/query-block.tsx
Normal file
4
web/.storybook/__mocks__/query-block.tsx
Normal file
@@ -0,0 +1,4 @@
|
||||
// Mock for query-block plugin to avoid circular dependency in Storybook
|
||||
export const QueryBlockNode = null
|
||||
export const QueryBlockReplacementBlock = null
|
||||
export default null
|
||||
@@ -1,4 +1,9 @@
|
||||
import type { StorybookConfig } from '@storybook/nextjs'
|
||||
import path from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url)
|
||||
const __dirname = path.dirname(__filename)
|
||||
|
||||
const config: StorybookConfig = {
|
||||
stories: ['../app/components/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
|
||||
@@ -25,5 +30,17 @@ const config: StorybookConfig = {
|
||||
docs: {
|
||||
defaultName: 'Documentation',
|
||||
},
|
||||
webpackFinal: async (config) => {
|
||||
// Add alias to mock problematic modules with circular dependencies
|
||||
config.resolve = config.resolve || {}
|
||||
config.resolve.alias = {
|
||||
...config.resolve.alias,
|
||||
// Mock the plugin index files to avoid circular dependencies
|
||||
[path.resolve(__dirname, '../app/components/base/prompt-editor/plugins/context-block/index.tsx')]: path.resolve(__dirname, '__mocks__/context-block.tsx'),
|
||||
[path.resolve(__dirname, '../app/components/base/prompt-editor/plugins/history-block/index.tsx')]: path.resolve(__dirname, '__mocks__/history-block.tsx'),
|
||||
[path.resolve(__dirname, '../app/components/base/prompt-editor/plugins/query-block/index.tsx')]: path.resolve(__dirname, '__mocks__/query-block.tsx'),
|
||||
}
|
||||
return config
|
||||
},
|
||||
}
|
||||
export default config
|
||||
|
||||
Reference in New Issue
Block a user