mirror of
https://github.com/langgenius/dify.git
synced 2026-05-04 09:28:04 +08:00
Merge commit '9c339239' into sandboxed-agent-rebase
Made-with: Cursor # Conflicts: # api/README.md # api/controllers/console/app/workflow_draft_variable.py # api/core/agent/cot_agent_runner.py # api/core/agent/fc_agent_runner.py # api/core/app/apps/advanced_chat/app_runner.py # api/core/plugin/backwards_invocation/model.py # api/core/prompt/advanced_prompt_transform.py # api/core/workflow/nodes/base/node.py # api/core/workflow/nodes/llm/llm_utils.py # api/core/workflow/nodes/llm/node.py # api/core/workflow/nodes/parameter_extractor/parameter_extractor_node.py # api/core/workflow/nodes/question_classifier/question_classifier_node.py # api/core/workflow/runtime/graph_runtime_state.py # api/extensions/storage/base_storage.py # api/factories/variable_factory.py # api/pyproject.toml # api/services/variable_truncator.py # api/uv.lock # web/app/account/oauth/authorize/page.tsx # web/app/components/app/configuration/config-var/config-modal/field.tsx # web/app/components/base/alert.tsx # web/app/components/base/chat/chat/answer/human-input-content/executed-action.tsx # web/app/components/base/chat/chat/answer/more.tsx # web/app/components/base/chat/chat/answer/operation.tsx # web/app/components/base/chat/chat/answer/workflow-process.tsx # web/app/components/base/chat/chat/citation/index.tsx # web/app/components/base/chat/chat/citation/popup.tsx # web/app/components/base/chat/chat/citation/progress-tooltip.tsx # web/app/components/base/chat/chat/citation/tooltip.tsx # web/app/components/base/chat/chat/question.tsx # web/app/components/base/chat/embedded-chatbot/inputs-form/index.tsx # web/app/components/base/chat/embedded-chatbot/inputs-form/view-form-dropdown.tsx # web/app/components/base/markdown-blocks/form.tsx # web/app/components/base/prompt-editor/plugins/hitl-input-block/component-ui.tsx # web/app/components/base/tag-management/panel.tsx # web/app/components/base/tag-management/trigger.tsx # web/app/components/header/account-setting/index.tsx # web/app/components/header/account-setting/members-page/transfer-ownership-modal/index.tsx # web/app/components/header/account-setting/model-provider-page/provider-added-card/index.tsx # web/app/signin/utils/post-login-redirect.ts # web/eslint-suppressions.json # web/package.json # web/pnpm-lock.yaml
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import * as React from 'react'
|
||||
import { useContext } from 'react'
|
||||
import { FeaturesContext, FeaturesProvider } from './context'
|
||||
import { FeaturesContext, FeaturesProvider } from '../context'
|
||||
|
||||
const TestConsumer = () => {
|
||||
const store = useContext(FeaturesContext)
|
||||
@ -1,8 +1,8 @@
|
||||
import { renderHook } from '@testing-library/react'
|
||||
import * as React from 'react'
|
||||
import { FeaturesContext } from './context'
|
||||
import { useFeatures, useFeaturesStore } from './hooks'
|
||||
import { createFeaturesStore } from './store'
|
||||
import { FeaturesContext } from '../context'
|
||||
import { useFeatures, useFeaturesStore } from '../hooks'
|
||||
import { createFeaturesStore } from '../store'
|
||||
|
||||
describe('useFeatures', () => {
|
||||
it('should return selected state from the store when useFeatures is called with selector', () => {
|
||||
@ -1,5 +1,5 @@
|
||||
import { Resolution, TransferMethod } from '@/types/app'
|
||||
import { createFeaturesStore } from './store'
|
||||
import { createFeaturesStore } from '../store'
|
||||
|
||||
describe('createFeaturesStore', () => {
|
||||
describe('Default State', () => {
|
||||
@ -1,8 +1,8 @@
|
||||
import type { OnFeaturesChange } from '../types'
|
||||
import type { OnFeaturesChange } from '../../types'
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import * as React from 'react'
|
||||
import { FeaturesProvider } from '../context'
|
||||
import Citation from './citation'
|
||||
import { FeaturesProvider } from '../../context'
|
||||
import Citation from '../citation'
|
||||
|
||||
const renderWithProvider = (props: { disabled?: boolean, onChange?: OnFeaturesChange } = {}) => {
|
||||
return render(
|
||||
@ -1,5 +1,5 @@
|
||||
import { fireEvent, render, screen, waitFor } from '@testing-library/react'
|
||||
import DialogWrapper from './dialog-wrapper'
|
||||
import DialogWrapper from '../dialog-wrapper'
|
||||
|
||||
describe('DialogWrapper', () => {
|
||||
beforeEach(() => {
|
||||
@ -1,7 +1,7 @@
|
||||
import type { Features } from '../types'
|
||||
import type { Features } from '../../types'
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import { FeaturesProvider } from '../context'
|
||||
import FeatureBar from './feature-bar'
|
||||
import { FeaturesProvider } from '../../context'
|
||||
import FeatureBar from '../feature-bar'
|
||||
|
||||
const defaultFeatures: Features = {
|
||||
moreLikeThis: { enabled: false },
|
||||
@ -1,6 +1,6 @@
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import * as React from 'react'
|
||||
import FeatureCard from './feature-card'
|
||||
import FeatureCard from '../feature-card'
|
||||
|
||||
describe('FeatureCard', () => {
|
||||
const defaultProps = {
|
||||
@ -1,8 +1,8 @@
|
||||
import type { OnFeaturesChange } from '../types'
|
||||
import type { OnFeaturesChange } from '../../types'
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import * as React from 'react'
|
||||
import { FeaturesProvider } from '../context'
|
||||
import FollowUp from './follow-up'
|
||||
import { FeaturesProvider } from '../../context'
|
||||
import FollowUp from '../follow-up'
|
||||
|
||||
const renderWithProvider = (props: { disabled?: boolean, onChange?: OnFeaturesChange } = {}) => {
|
||||
return render(
|
||||
@ -1,7 +1,7 @@
|
||||
import type { Features } from '../types'
|
||||
import type { Features } from '../../types'
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import { FeaturesProvider } from '../context'
|
||||
import NewFeaturePanel from './index'
|
||||
import { FeaturesProvider } from '../../context'
|
||||
import NewFeaturePanel from '../index'
|
||||
|
||||
vi.mock('next/navigation', () => ({
|
||||
useRouter: () => ({ push: vi.fn() }),
|
||||
@ -1,8 +1,8 @@
|
||||
import type { OnFeaturesChange } from '../types'
|
||||
import type { OnFeaturesChange } from '../../types'
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import * as React from 'react'
|
||||
import { FeaturesProvider } from '../context'
|
||||
import MoreLikeThis from './more-like-this'
|
||||
import { FeaturesProvider } from '../../context'
|
||||
import MoreLikeThis from '../more-like-this'
|
||||
|
||||
const renderWithProvider = (props: { disabled?: boolean, onChange?: OnFeaturesChange } = {}) => {
|
||||
return render(
|
||||
@ -1,8 +1,8 @@
|
||||
import type { OnFeaturesChange } from '../types'
|
||||
import type { OnFeaturesChange } from '../../types'
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import * as React from 'react'
|
||||
import { FeaturesProvider } from '../context'
|
||||
import SpeechToText from './speech-to-text'
|
||||
import { FeaturesProvider } from '../../context'
|
||||
import SpeechToText from '../speech-to-text'
|
||||
|
||||
const renderWithProvider = (props: { disabled?: boolean, onChange?: OnFeaturesChange } = {}) => {
|
||||
return render(
|
||||
@ -1,5 +1,5 @@
|
||||
import { fireEvent, render, screen, waitFor } from '@testing-library/react'
|
||||
import AnnotationCtrlButton from './annotation-ctrl-button'
|
||||
import AnnotationCtrlButton from '../annotation-ctrl-button'
|
||||
|
||||
const mockSetShowAnnotationFullModal = vi.fn()
|
||||
vi.mock('@/context/modal-context', () => ({
|
||||
@ -1,6 +1,6 @@
|
||||
import { fireEvent, render, screen, waitFor } from '@testing-library/react'
|
||||
import Toast from '@/app/components/base/toast'
|
||||
import ConfigParamModal from './config-param-modal'
|
||||
import ConfigParamModal from '../config-param-modal'
|
||||
|
||||
let mockHooksReturn: {
|
||||
modelList: { provider: { provider: string }, models: { model: string }[] }[]
|
||||
@ -1,5 +1,5 @@
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import { Item } from './config-param'
|
||||
import { Item } from '../config-param'
|
||||
|
||||
describe('ConfigParam Item', () => {
|
||||
it('should render title text', () => {
|
||||
@ -1,8 +1,8 @@
|
||||
import type { Features } from '../../types'
|
||||
import type { Features } from '../../../types'
|
||||
import type { OnFeaturesChange } from '@/app/components/base/features/types'
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import { FeaturesProvider } from '../../context'
|
||||
import AnnotationReply from './index'
|
||||
import { FeaturesProvider } from '../../../context'
|
||||
import AnnotationReply from '../index'
|
||||
|
||||
const mockPush = vi.fn()
|
||||
vi.mock('next/navigation', () => ({
|
||||
@ -1,4 +1,4 @@
|
||||
import { PageType } from './type'
|
||||
import { PageType } from '../type'
|
||||
|
||||
describe('PageType', () => {
|
||||
it('should have log and annotation values', () => {
|
||||
@ -1,6 +1,6 @@
|
||||
import type { AnnotationReplyConfig } from '@/models/debug'
|
||||
import { act, renderHook } from '@testing-library/react'
|
||||
import useAnnotationConfig from './use-annotation-config'
|
||||
import useAnnotationConfig from '../use-annotation-config'
|
||||
|
||||
let mockIsAnnotationFull = false
|
||||
vi.mock('@/context/provider-context', () => ({
|
||||
@ -1,5 +1,5 @@
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import ScoreSlider from './index'
|
||||
import ScoreSlider from '../index'
|
||||
|
||||
vi.mock('@/app/components/base/features/new-feature-panel/annotation-reply/score-slider/base-slider', () => ({
|
||||
default: ({ value, onChange, min, max }: { value: number, onChange: (v: number) => void, min: number, max: number }) => (
|
||||
@ -1,5 +1,5 @@
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import Slider from './index'
|
||||
import Slider from '../index'
|
||||
|
||||
describe('BaseSlider', () => {
|
||||
beforeEach(() => {
|
||||
@ -1,8 +1,8 @@
|
||||
import type { Features } from '../../types'
|
||||
import type { Features } from '../../../types'
|
||||
import type { OnFeaturesChange } from '@/app/components/base/features/types'
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import { FeaturesProvider } from '../../context'
|
||||
import ConversationOpener from './index'
|
||||
import { FeaturesProvider } from '../../../context'
|
||||
import ConversationOpener from '../index'
|
||||
|
||||
const mockSetShowOpeningModal = vi.fn()
|
||||
vi.mock('@/context/modal-context', () => ({
|
||||
@ -3,7 +3,7 @@ import type { InputVar } from '@/app/components/workflow/types'
|
||||
import { act, fireEvent, render, screen } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
import { InputVarType } from '@/app/components/workflow/types'
|
||||
import OpeningSettingModal from './modal'
|
||||
import OpeningSettingModal from '../modal'
|
||||
|
||||
const getPromptEditor = () => {
|
||||
const editor = document.querySelector('[data-lexical-editor="true"]')
|
||||
@ -1,8 +1,8 @@
|
||||
import type { Features } from '../../types'
|
||||
import type { Features } from '../../../types'
|
||||
import type { OnFeaturesChange } from '@/app/components/base/features/types'
|
||||
import { fireEvent, render, screen, waitFor } from '@testing-library/react'
|
||||
import { FeaturesProvider } from '../../context'
|
||||
import FileUpload from './index'
|
||||
import { FeaturesProvider } from '../../../context'
|
||||
import FileUpload from '../index'
|
||||
|
||||
vi.mock('@/service/use-common', () => ({
|
||||
useFileUploadConfig: () => ({ data: undefined }),
|
||||
@ -1,10 +1,10 @@
|
||||
import type { Features } from '../../types'
|
||||
import type { Features } from '../../../types'
|
||||
import type { OnFeaturesChange } from '@/app/components/base/features/types'
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
import { TransferMethod } from '@/types/app'
|
||||
import { FeaturesProvider } from '../../context'
|
||||
import SettingContent from './setting-content'
|
||||
import { FeaturesProvider } from '../../../context'
|
||||
import SettingContent from '../setting-content'
|
||||
|
||||
vi.mock('@/app/components/workflow/nodes/_base/components/file-upload-setting', () => ({
|
||||
default: ({ payload, onChange }: { payload: Record<string, unknown>, onChange: (p: Record<string, unknown>) => void }) => (
|
||||
@ -1,8 +1,8 @@
|
||||
import type { Features } from '../../types'
|
||||
import type { Features } from '../../../types'
|
||||
import { fireEvent, render, screen, waitFor } from '@testing-library/react'
|
||||
import { TransferMethod } from '@/types/app'
|
||||
import { FeaturesProvider } from '../../context'
|
||||
import FileUploadSettings from './setting-modal'
|
||||
import { FeaturesProvider } from '../../../context'
|
||||
import FileUploadSettings from '../setting-modal'
|
||||
|
||||
vi.mock('@/service/use-common', () => ({
|
||||
useFileUploadConfig: () => ({ data: undefined }),
|
||||
@ -1,8 +1,8 @@
|
||||
import type { Features } from '../../types'
|
||||
import type { Features } from '../../../types'
|
||||
import type { OnFeaturesChange } from '@/app/components/base/features/types'
|
||||
import { fireEvent, render, screen, waitFor } from '@testing-library/react'
|
||||
import { FeaturesProvider } from '../../context'
|
||||
import ImageUpload from './index'
|
||||
import { FeaturesProvider } from '../../../context'
|
||||
import ImageUpload from '../index'
|
||||
|
||||
vi.mock('@/service/use-common', () => ({
|
||||
useFileUploadConfig: () => ({ data: undefined }),
|
||||
@ -1,7 +1,7 @@
|
||||
import type { I18nText } from '@/i18n-config/language'
|
||||
import type { CodeBasedExtensionForm } from '@/models/common'
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import FormGeneration from './form-generation'
|
||||
import FormGeneration from '../form-generation'
|
||||
|
||||
const i18n = (en: string, zh = en): I18nText =>
|
||||
({ 'en-US': en, 'zh-Hans': zh }) as unknown as I18nText
|
||||
@ -1,8 +1,8 @@
|
||||
import type { Features } from '../../types'
|
||||
import type { Features } from '../../../types'
|
||||
import type { OnFeaturesChange } from '@/app/components/base/features/types'
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import { FeaturesProvider } from '../../context'
|
||||
import Moderation from './index'
|
||||
import { FeaturesProvider } from '../../../context'
|
||||
import Moderation from '../index'
|
||||
|
||||
const mockSetShowModerationSettingModal = vi.fn()
|
||||
vi.mock('@/context/modal-context', () => ({
|
||||
@ -1,6 +1,6 @@
|
||||
import type { ModerationContentConfig } from '@/models/debug'
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import ModerationContent from './moderation-content'
|
||||
import ModerationContent from '../moderation-content'
|
||||
|
||||
const defaultConfig: ModerationContentConfig = {
|
||||
enabled: false,
|
||||
@ -1,6 +1,6 @@
|
||||
import type { ModerationConfig } from '@/models/debug'
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import ModerationSettingModal from './moderation-setting-modal'
|
||||
import ModerationSettingModal from '../moderation-setting-modal'
|
||||
|
||||
const mockNotify = vi.fn()
|
||||
vi.mock('@/app/components/base/toast', () => ({
|
||||
@ -1,9 +1,9 @@
|
||||
import type { Features } from '../../types'
|
||||
import type { Features } from '../../../types'
|
||||
import type { OnFeaturesChange } from '@/app/components/base/features/types'
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import { TtsAutoPlay } from '@/types/app'
|
||||
import { FeaturesProvider } from '../../context'
|
||||
import TextToSpeech from './index'
|
||||
import { FeaturesProvider } from '../../../context'
|
||||
import TextToSpeech from '../index'
|
||||
|
||||
vi.mock('@/i18n-config/language', () => ({
|
||||
languages: [
|
||||
@ -1,10 +1,10 @@
|
||||
import type { Features } from '../../types'
|
||||
import type { Features } from '../../../types'
|
||||
import type { OnFeaturesChange } from '@/app/components/base/features/types'
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
import { TtsAutoPlay } from '@/types/app'
|
||||
import { FeaturesProvider } from '../../context'
|
||||
import ParamConfigContent from './param-config-content'
|
||||
import { FeaturesProvider } from '../../../context'
|
||||
import ParamConfigContent from '../param-config-content'
|
||||
|
||||
let mockLanguages = [
|
||||
{ value: 'en-US', name: 'English', example: 'Hello world' },
|
||||
@ -1,7 +1,7 @@
|
||||
import type { Features } from '../../types'
|
||||
import type { Features } from '../../../types'
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import { FeaturesProvider } from '../../context'
|
||||
import VoiceSettings from './voice-settings'
|
||||
import { FeaturesProvider } from '../../../context'
|
||||
import VoiceSettings from '../voice-settings'
|
||||
|
||||
vi.mock('next/navigation', () => ({
|
||||
usePathname: () => '/app/test-app-id/configuration',
|
||||
Reference in New Issue
Block a user