From e2c90389a73f407d66682e8ed01414810b50b2f3 Mon Sep 17 00:00:00 2001 From: warren Date: Mon, 23 Dec 2024 23:49:05 +0800 Subject: [PATCH] fix lint --- web/.storybook/main.ts | 2 +- web/.storybook/preview.tsx | 4 +- web/app/account/account-page/index.tsx | 16 ++--- web/app/account/avatar.tsx | 14 ++-- web/app/account/header.tsx | 6 +- web/app/account/layout.tsx | 12 ++-- web/app/activate/activateForm.tsx | 6 +- .../add-annotation-modal/edit-item/index.tsx | 6 +- .../annotation/add-annotation-modal/index.tsx | 13 ++-- .../csv-downloader.tsx | 14 ++-- .../csv-uploader.tsx | 14 ++-- .../batch-add-annotation-modal/index.tsx | 12 ++-- .../edit-annotation-modal/edit-item/index.tsx | 10 +-- .../edit-annotation-modal/index.tsx | 14 ++-- .../app/annotation/empty-element.tsx | 4 +- web/app/components/app/annotation/filter.tsx | 6 +- .../app/annotation/header-opts/index.tsx | 29 ++++---- web/app/components/app/annotation/index.tsx | 37 ++++++---- web/app/components/app/annotation/list.tsx | 8 +-- .../remove-annotation-confirm-modal/index.tsx | 4 +- .../hit-history-no-data.tsx | 6 +- .../view-annotation-modal/index.tsx | 16 ++--- .../app/app-publisher/features-wrapper.tsx | 20 +++--- .../components/app/app-publisher/index.tsx | 30 ++++---- .../publish-with-multiple-model.tsx | 16 ++--- .../app/app-publisher/suggested-action.tsx | 4 +- .../base/feature-panel/index.tsx | 2 +- .../configuration/base/group-name/index.tsx | 2 +- .../base/icons/more-like-this-icon.tsx | 2 +- .../base/icons/remove-icon/index.tsx | 2 +- .../suggested-questions-after-answer-icon.tsx | 2 +- .../base/operation-btn/index.tsx | 6 +- .../base/var-highlight/index.tsx | 2 +- .../warning-mask/cannot-query-dataset.tsx | 4 +- .../base/warning-mask/formatting-changed.tsx | 4 +- .../base/warning-mask/has-not-set-api.tsx | 4 +- .../configuration/base/warning-mask/index.tsx | 2 +- .../config-var/config-modal/field.tsx | 2 +- .../config-var/config-modal/index.tsx | 18 ++--- .../config-var/config-select/index.tsx | 8 +-- .../config-var/config-string/index.tsx | 4 +- .../app/configuration/config-var/index.tsx | 40 +++++------ .../config/agent-setting-button.tsx | 10 +-- .../config/agent/agent-setting/index.tsx | 16 ++--- .../config/agent/agent-setting/item-panel.tsx | 3 +- .../config/agent/agent-tools/index.tsx | 27 ++++--- .../agent-tools/setting-built-in-tool.tsx | 20 +++--- .../config/agent/prompt-editor.tsx | 18 +++-- .../config/assistant-type-picker/index.tsx | 18 ++--- .../config/automatic/automatic-btn.tsx | 6 +- .../config/automatic/get-automatic-res.tsx | 29 ++++---- .../code-generator/get-code-generator-res.tsx | 23 +++--- .../configuration/config/config-document.tsx | 14 ++-- .../config/feature/use-feature.tsx | 2 +- .../app/configuration/config/index.tsx | 12 ++-- .../configuration/debug/chat-user-input.tsx | 8 +-- .../debug-with-multiple-model/chat-item.tsx | 46 +++++------- .../debug-with-multiple-model/context.tsx | 4 +- .../debug-with-multiple-model/debug-item.tsx | 18 ++--- .../debug/debug-with-multiple-model/index.tsx | 29 +++----- .../model-parameter-trigger.tsx | 20 +++--- .../text-generation-item.tsx | 27 ++++--- .../debug/debug-with-single-model/index.tsx | 39 ++++------ .../app/configuration/debug/hooks.tsx | 28 +++----- .../app/configuration/debug/index.tsx | 63 ++++++++-------- .../chat-group/opening-statement/index.tsx | 23 +++--- .../experience-enhance-group/index.tsx | 4 +- .../more-like-this/index.tsx | 8 +-- .../hooks/use-advanced-prompt-config.ts | 23 +++--- .../components/app/configuration/index.tsx | 72 ++++++++++--------- .../toolbox/annotation/config-param.tsx | 18 ++--- .../app/configuration/toolbox/index.tsx | 6 +- .../tools/external-data-tool-modal.tsx | 23 +++--- .../app/configuration/tools/index.tsx | 24 +++---- web/app/components/app/log/filter.tsx | 11 +-- web/app/components/app/log/index.tsx | 21 +++--- web/app/components/app/log/list.tsx | 60 +++++++++------- web/app/components/app/log/model-info.tsx | 12 ++-- web/app/components/app/log/var-panel.tsx | 15 ++-- .../app/overview/apikey-info-panel/index.tsx | 16 ++--- .../apikey-info-panel/progress/index.tsx | 2 +- web/app/components/app/overview/appCard.tsx | 25 +++---- web/app/components/app/overview/appChart.tsx | 27 +++++-- .../app/overview/customize/index.tsx | 12 ++-- .../app/overview/embedded/index.tsx | 12 ++-- .../app/overview/settings/index.tsx | 24 +++---- web/app/components/app/store.ts | 6 +- .../components/app/workflow-log/detail.tsx | 6 +- .../components/app/workflow-log/filter.tsx | 6 +- web/app/components/app/workflow-log/index.tsx | 16 ++--- web/app/components/app/workflow-log/list.tsx | 12 ++-- web/app/init/InitPasswordPopup.tsx | 10 +-- web/app/install/installForm.tsx | 18 ++--- web/app/signin/_header.tsx | 6 +- web/app/signin/check-code/page.tsx | 12 ++-- .../signin/components/mail-and-code-auth.tsx | 14 ++-- .../components/mail-and-password-auth.tsx | 12 ++-- web/app/signin/components/social-auth.tsx | 8 +-- web/app/signin/components/sso-auth.tsx | 14 ++-- web/app/signin/invite-settings/page.tsx | 18 ++--- web/app/signin/normalForm.tsx | 14 ++-- web/app/signin/oneMoreStep.tsx | 14 ++-- web/app/signin/page.tsx | 2 +- web/context/app-context.tsx | 20 +++--- web/context/dataset-detail.ts | 4 +- web/context/datasets-context.tsx | 4 +- web/context/debug-configuration.ts | 55 +++++++------- web/context/event-emitter.tsx | 6 +- web/context/explore-context.ts | 4 +- web/context/external-api-panel-context.tsx | 2 +- .../external-knowledge-api-context.tsx | 8 +-- web/context/i18n.ts | 9 +-- web/context/modal-context.tsx | 32 +++++---- web/context/provider-context.tsx | 27 +++---- web/context/query-client.tsx | 6 +- web/context/workspace-context.tsx | 6 +- web/jest.config.ts | 2 +- web/middleware.ts | 4 +- web/service/annotation.ts | 12 ++-- web/service/apps.ts | 35 +++++++-- web/service/base.ts | 35 ++++----- web/service/billing.ts | 4 +- web/service/common.ts | 67 +++++++++-------- web/service/datasets.ts | 71 +++++++++--------- web/service/debug.ts | 11 +-- web/service/demo/index.tsx | 19 ++++- web/service/explore.ts | 4 +- web/service/log.ts | 44 ++++++------ web/service/refresh-token.ts | 4 +- web/service/share.ts | 45 ++++++++---- web/service/sso.ts | 2 +- web/service/tag.ts | 4 +- web/service/tools.ts | 20 +++--- web/service/use-base.ts | 4 +- web/service/use-workflow.ts | 6 +- web/service/workflow.ts | 11 +-- web/tailwind.config.js | 1 + 137 files changed, 1068 insertions(+), 1053 deletions(-) diff --git a/web/.storybook/main.ts b/web/.storybook/main.ts index 74e95821de5714..0ddfc9884fbd40 100644 --- a/web/.storybook/main.ts +++ b/web/.storybook/main.ts @@ -1,4 +1,4 @@ -import type { StorybookConfig } from '@storybook/nextjs' +import type {StorybookConfig} from '@storybook/nextjs' const config: StorybookConfig = { // stories: ['../stories/**/*.mdx', '../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)'], diff --git a/web/.storybook/preview.tsx b/web/.storybook/preview.tsx index 49cd24e97483b9..9f02795a59e8ba 100644 --- a/web/.storybook/preview.tsx +++ b/web/.storybook/preview.tsx @@ -1,6 +1,6 @@ import React from 'react' -import type { Preview } from '@storybook/react' -import { withThemeByDataAttribute } from '@storybook/addon-themes'; +import type {Preview} from '@storybook/react' +import {withThemeByDataAttribute} from '@storybook/addon-themes'; import I18nServer from '../app/components/i18n-server' import '../app/styles/globals.css' diff --git a/web/app/account/account-page/index.tsx b/web/app/account/account-page/index.tsx index c7af05793f296b..7ca25e9ce6c775 100644 --- a/web/app/account/account-page/index.tsx +++ b/web/app/account/account-page/index.tsx @@ -1,20 +1,20 @@ 'use client' -import { useState } from 'react' -import { useTranslation } from 'react-i18next' +import {useState} from 'react' +import {useTranslation} from 'react-i18next' -import { useContext } from 'use-context-selector' +import {useContext} from 'use-context-selector' import s from './index.module.css' +import type {IItem} from '@/app/components/header/account-setting/collapse' import Collapse from '@/app/components/header/account-setting/collapse' -import type { IItem } from '@/app/components/header/account-setting/collapse' import Modal from '@/app/components/base/modal' import Confirm from '@/app/components/base/confirm' import Button from '@/app/components/base/button' -import { updateUserProfile } from '@/service/common' -import { useAppContext } from '@/context/app-context' -import { ToastContext } from '@/app/components/base/toast' +import {updateUserProfile} from '@/service/common' +import {useAppContext} from '@/context/app-context' +import {ToastContext} from '@/app/components/base/toast' import AppIcon from '@/app/components/base/app-icon' import Avatar from '@/app/components/base/avatar' -import { IS_CE_EDITION } from '@/config' +import {IS_CE_EDITION} from '@/config' import Input from '@/app/components/base/input' const titleClassName = ` diff --git a/web/app/account/avatar.tsx b/web/app/account/avatar.tsx index 8fdecc07bf867b..e4f71571040bf5 100644 --- a/web/app/account/avatar.tsx +++ b/web/app/account/avatar.tsx @@ -1,12 +1,12 @@ 'use client' -import { useTranslation } from 'react-i18next' -import { Fragment } from 'react' -import { useRouter } from 'next/navigation' -import { Menu, Transition } from '@headlessui/react' +import {useTranslation} from 'react-i18next' +import {Fragment} from 'react' +import {useRouter} from 'next/navigation' +import {Menu, Transition} from '@headlessui/react' import Avatar from '@/app/components/base/avatar' -import { logout } from '@/service/common' -import { useAppContext } from '@/context/app-context' -import { LogOut01 } from '@/app/components/base/icons/src/vender/line/general' +import {logout} from '@/service/common' +import {useAppContext} from '@/context/app-context' +import {LogOut01} from '@/app/components/base/icons/src/vender/line/general' export type IAppSelector = { isMobile: boolean diff --git a/web/app/account/header.tsx b/web/app/account/header.tsx index 694533e5ab7cb6..56a10afb133b00 100644 --- a/web/app/account/header.tsx +++ b/web/app/account/header.tsx @@ -1,7 +1,7 @@ 'use client' -import { useTranslation } from 'react-i18next' -import { RiArrowRightUpLine, RiRobot2Line } from '@remixicon/react' -import { useRouter } from 'next/navigation' +import {useTranslation} from 'react-i18next' +import {RiArrowRightUpLine, RiRobot2Line} from '@remixicon/react' +import {useRouter} from 'next/navigation' import Button from '../components/base/button' import Avatar from './avatar' import LogoSite from '@/app/components/base/logo/logo-site' diff --git a/web/app/account/layout.tsx b/web/app/account/layout.tsx index 11a6abeab40782..91c34ca6ced35b 100644 --- a/web/app/account/layout.tsx +++ b/web/app/account/layout.tsx @@ -1,13 +1,13 @@ +import type {ReactNode} from 'react' import React from 'react' -import type { ReactNode } from 'react' import Header from './header' import SwrInitor from '@/app/components/swr-initor' -import { AppContextProvider } from '@/context/app-context' -import GA, { GaType } from '@/app/components/base/ga' +import {AppContextProvider} from '@/context/app-context' +import GA, {GaType} from '@/app/components/base/ga' import HeaderWrapper from '@/app/components/header/header-wrapper' -import { EventEmitterContextProvider } from '@/context/event-emitter' -import { ProviderContextProvider } from '@/context/provider-context' -import { ModalContextProvider } from '@/context/modal-context' +import {EventEmitterContextProvider} from '@/context/event-emitter' +import {ProviderContextProvider} from '@/context/provider-context' +import {ModalContextProvider} from '@/context/modal-context' const Layout = ({ children }: { children: ReactNode }) => { return ( diff --git a/web/app/activate/activateForm.tsx b/web/app/activate/activateForm.tsx index 9a32a76a73c20b..1db2deb85a1e22 100644 --- a/web/app/activate/activateForm.tsx +++ b/web/app/activate/activateForm.tsx @@ -1,11 +1,11 @@ 'use client' -import { useTranslation } from 'react-i18next' +import {useTranslation} from 'react-i18next' import useSWR from 'swr' -import { useRouter, useSearchParams } from 'next/navigation' +import {useRouter, useSearchParams} from 'next/navigation' import cn from '@/utils/classnames' import Button from '@/app/components/base/button' -import { invitationCheck } from '@/service/common' +import {invitationCheck} from '@/service/common' import Loading from '@/app/components/base/loading' const ActivateForm = () => { diff --git a/web/app/components/app/annotation/add-annotation-modal/edit-item/index.tsx b/web/app/components/app/annotation/add-annotation-modal/edit-item/index.tsx index 032e4b83576adf..669f2b5a28871c 100644 --- a/web/app/components/app/annotation/add-annotation-modal/edit-item/index.tsx +++ b/web/app/components/app/annotation/add-annotation-modal/edit-item/index.tsx @@ -1,9 +1,9 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' -import { useTranslation } from 'react-i18next' +import {useTranslation} from 'react-i18next' import Textarea from '@/app/components/base/textarea' -import { Robot, User } from '@/app/components/base/icons/src/public/avatar' +import {Robot, User} from '@/app/components/base/icons/src/public/avatar' export enum EditItemType { Query = 'query', diff --git a/web/app/components/app/annotation/add-annotation-modal/index.tsx b/web/app/components/app/annotation/add-annotation-modal/index.tsx index c6cfb54b23a260..8cbaa6e77bfc0f 100644 --- a/web/app/components/app/annotation/add-annotation-modal/index.tsx +++ b/web/app/components/app/annotation/add-annotation-modal/index.tsx @@ -1,15 +1,16 @@ 'use client' -import type { FC } from 'react' -import React, { useState } from 'react' -import { useTranslation } from 'react-i18next' -import type { AnnotationItemBasic } from '../type' -import EditItem, { EditItemType } from './edit-item' +import type {FC} from 'react' +import React, {useState} from 'react' +import {useTranslation} from 'react-i18next' +import type {AnnotationItemBasic} from '../type' +import EditItem, {EditItemType} from './edit-item' import Checkbox from '@/app/components/base/checkbox' import Drawer from '@/app/components/base/drawer-plus' import Button from '@/app/components/base/button' import Toast from '@/app/components/base/toast' -import { useProviderContext } from '@/context/provider-context' +import {useProviderContext} from '@/context/provider-context' import AnnotationFull from '@/app/components/billing/annotation-full' + type Props = { isShow: boolean onHide: () => void diff --git a/web/app/components/app/annotation/batch-add-annotation-modal/csv-downloader.tsx b/web/app/components/app/annotation/batch-add-annotation-modal/csv-downloader.tsx index d2189b4581c853..4aa1dc4abb6f64 100644 --- a/web/app/components/app/annotation/batch-add-annotation-modal/csv-downloader.tsx +++ b/web/app/components/app/annotation/batch-add-annotation-modal/csv-downloader.tsx @@ -1,14 +1,12 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' -import { - useCSVDownloader, -} from 'react-papaparse' -import { useTranslation } from 'react-i18next' -import { useContext } from 'use-context-selector' -import { Download02 as DownloadIcon } from '@/app/components/base/icons/src/vender/solid/general' +import {useCSVDownloader,} from 'react-papaparse' +import {useTranslation} from 'react-i18next' +import {useContext} from 'use-context-selector' +import {Download02 as DownloadIcon} from '@/app/components/base/icons/src/vender/solid/general' import I18n from '@/context/i18n' -import { LanguagesSupported } from '@/i18n/language' +import {LanguagesSupported} from '@/i18n/language' const CSV_TEMPLATE_QA_EN = [ ['question', 'answer'], diff --git a/web/app/components/app/annotation/batch-add-annotation-modal/csv-uploader.tsx b/web/app/components/app/annotation/batch-add-annotation-modal/csv-uploader.tsx index d37593c784b6bb..42c608cb7425a9 100644 --- a/web/app/components/app/annotation/batch-add-annotation-modal/csv-uploader.tsx +++ b/web/app/components/app/annotation/batch-add-annotation-modal/csv-uploader.tsx @@ -1,12 +1,12 @@ 'use client' -import type { FC } from 'react' -import React, { useEffect, useRef, useState } from 'react' -import { useTranslation } from 'react-i18next' -import { useContext } from 'use-context-selector' -import { RiDeleteBinLine } from '@remixicon/react' +import type {FC} from 'react' +import React, {useEffect, useRef, useState} from 'react' +import {useTranslation} from 'react-i18next' +import {useContext} from 'use-context-selector' +import {RiDeleteBinLine} from '@remixicon/react' import cn from '@/utils/classnames' -import { Csv as CSVIcon } from '@/app/components/base/icons/src/public/files' -import { ToastContext } from '@/app/components/base/toast' +import {Csv as CSVIcon} from '@/app/components/base/icons/src/public/files' +import {ToastContext} from '@/app/components/base/toast' import Button from '@/app/components/base/button' export type Props = { diff --git a/web/app/components/app/annotation/batch-add-annotation-modal/index.tsx b/web/app/components/app/annotation/batch-add-annotation-modal/index.tsx index 9a496a1989da2e..175860ccc38097 100644 --- a/web/app/components/app/annotation/batch-add-annotation-modal/index.tsx +++ b/web/app/components/app/annotation/batch-add-annotation-modal/index.tsx @@ -1,15 +1,15 @@ 'use client' -import type { FC } from 'react' -import React, { useEffect, useState } from 'react' -import { useTranslation } from 'react-i18next' -import { RiCloseLine } from '@remixicon/react' +import type {FC} from 'react' +import React, {useEffect, useState} from 'react' +import {useTranslation} from 'react-i18next' +import {RiCloseLine} from '@remixicon/react' import CSVUploader from './csv-uploader' import CSVDownloader from './csv-downloader' import Button from '@/app/components/base/button' import Modal from '@/app/components/base/modal' import Toast from '@/app/components/base/toast' -import { annotationBatchImport, checkAnnotationBatchImportProgress } from '@/service/annotation' -import { useProviderContext } from '@/context/provider-context' +import {annotationBatchImport, checkAnnotationBatchImportProgress} from '@/service/annotation' +import {useProviderContext} from '@/context/provider-context' import AnnotationFull from '@/app/components/billing/annotation-full' export enum ProcessStatus { diff --git a/web/app/components/app/annotation/edit-annotation-modal/edit-item/index.tsx b/web/app/components/app/annotation/edit-annotation-modal/edit-item/index.tsx index 208da900931016..d8c9d977928a5d 100644 --- a/web/app/components/app/annotation/edit-annotation-modal/edit-item/index.tsx +++ b/web/app/components/app/annotation/edit-annotation-modal/edit-item/index.tsx @@ -1,9 +1,9 @@ 'use client' -import type { FC } from 'react' -import React, { useState } from 'react' -import { useTranslation } from 'react-i18next' -import { RiDeleteBinLine, RiEditFill, RiEditLine } from '@remixicon/react' -import { Robot, User } from '@/app/components/base/icons/src/public/avatar' +import type {FC} from 'react' +import React, {useState} from 'react' +import {useTranslation} from 'react-i18next' +import {RiDeleteBinLine, RiEditFill, RiEditLine} from '@remixicon/react' +import {Robot, User} from '@/app/components/base/icons/src/public/avatar' import Textarea from '@/app/components/base/textarea' import Button from '@/app/components/base/button' import cn from '@/utils/classnames' diff --git a/web/app/components/app/annotation/edit-annotation-modal/index.tsx b/web/app/components/app/annotation/edit-annotation-modal/index.tsx index dc00199e79a9f4..4006e92459ff8f 100644 --- a/web/app/components/app/annotation/edit-annotation-modal/index.tsx +++ b/web/app/components/app/annotation/edit-annotation-modal/index.tsx @@ -1,14 +1,14 @@ 'use client' -import type { FC } from 'react' -import React, { useState } from 'react' -import { useTranslation } from 'react-i18next' -import EditItem, { EditItemType } from './edit-item' +import type {FC} from 'react' +import React, {useState} from 'react' +import {useTranslation} from 'react-i18next' +import EditItem, {EditItemType} from './edit-item' import Drawer from '@/app/components/base/drawer-plus' -import { MessageCheckRemove } from '@/app/components/base/icons/src/vender/line/communication' +import {MessageCheckRemove} from '@/app/components/base/icons/src/vender/line/communication' import Confirm from '@/app/components/base/confirm' -import { addAnnotation, editAnnotation } from '@/service/annotation' +import {addAnnotation, editAnnotation} from '@/service/annotation' import Toast from '@/app/components/base/toast' -import { useProviderContext } from '@/context/provider-context' +import {useProviderContext} from '@/context/provider-context' import AnnotationFull from '@/app/components/billing/annotation-full' import useTimestamp from '@/hooks/use-timestamp' diff --git a/web/app/components/app/annotation/empty-element.tsx b/web/app/components/app/annotation/empty-element.tsx index 9ba31ce11e9e56..93b63c0fac9794 100644 --- a/web/app/components/app/annotation/empty-element.tsx +++ b/web/app/components/app/annotation/empty-element.tsx @@ -1,7 +1,7 @@ 'use client' -import type { FC, SVGProps } from 'react' +import type {FC, SVGProps} from 'react' import React from 'react' -import { useTranslation } from 'react-i18next' +import {useTranslation} from 'react-i18next' const ThreeDotsIcon = ({ className }: SVGProps) => { return diff --git a/web/app/components/app/annotation/filter.tsx b/web/app/components/app/annotation/filter.tsx index d741f6de123980..7595c5321d01a4 100644 --- a/web/app/components/app/annotation/filter.tsx +++ b/web/app/components/app/annotation/filter.tsx @@ -1,10 +1,10 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' -import { useTranslation } from 'react-i18next' +import {useTranslation} from 'react-i18next' import useSWR from 'swr' import Input from '@/app/components/base/input' -import { fetchAnnotationsCount } from '@/service/log' +import {fetchAnnotationsCount} from '@/service/log' export type QueryParam = { keyword?: string diff --git a/web/app/components/app/annotation/header-opts/index.tsx b/web/app/components/app/annotation/header-opts/index.tsx index 649d6501c3cf43..3364accd41d090 100644 --- a/web/app/components/app/annotation/header-opts/index.tsx +++ b/web/app/components/app/annotation/header-opts/index.tsx @@ -1,28 +1,23 @@ 'use client' -import type { FC } from 'react' -import React, { Fragment, useEffect, useState } from 'react' -import { useTranslation } from 'react-i18next' -import { - RiAddLine, - RiMoreFill, -} from '@remixicon/react' -import { useContext } from 'use-context-selector' -import { - useCSVDownloader, -} from 'react-papaparse' -import { Menu, Transition } from '@headlessui/react' +import type {FC} from 'react' +import React, {Fragment, useEffect, useState} from 'react' +import {useTranslation} from 'react-i18next' +import {RiAddLine, RiMoreFill,} from '@remixicon/react' +import {useContext} from 'use-context-selector' +import {useCSVDownloader,} from 'react-papaparse' +import {Menu, Transition} from '@headlessui/react' import Button from '../../../base/button' import AddAnnotationModal from '../add-annotation-modal' -import type { AnnotationItemBasic } from '../type' +import type {AnnotationItemBasic} from '../type' import BatchAddModal from '../batch-add-annotation-modal' import cn from '@/utils/classnames' import CustomPopover from '@/app/components/base/popover' -import { FileDownload02, FilePlus02 } from '@/app/components/base/icons/src/vender/line/files' -import { ChevronRight } from '@/app/components/base/icons/src/vender/line/arrows' +import {FileDownload02, FilePlus02} from '@/app/components/base/icons/src/vender/line/files' +import {ChevronRight} from '@/app/components/base/icons/src/vender/line/arrows' import I18n from '@/context/i18n' -import { fetchExportAnnotationList } from '@/service/annotation' -import { LanguagesSupported } from '@/i18n/language' +import {fetchExportAnnotationList} from '@/service/annotation' +import {LanguagesSupported} from '@/i18n/language' const CSV_HEADER_QA_EN = ['Question', 'Answer'] const CSV_HEADER_QA_CN = ['问题', '答案'] diff --git a/web/app/components/app/annotation/index.tsx b/web/app/components/app/annotation/index.tsx index 132734e651c3b2..58191c0c9e203f 100644 --- a/web/app/components/app/annotation/index.tsx +++ b/web/app/components/app/annotation/index.tsx @@ -1,30 +1,39 @@ 'use client' -import type { FC } from 'react' -import React, { useEffect, useState } from 'react' -import { useTranslation } from 'react-i18next' -import { useDebounce } from 'ahooks' -import { RiEqualizer2Line } from '@remixicon/react' +import type {FC} from 'react' +import React, {useEffect, useState} from 'react' +import {useTranslation} from 'react-i18next' +import {useDebounce} from 'ahooks' +import {RiEqualizer2Line} from '@remixicon/react' import Toast from '../../base/toast' +import type {QueryParam} from './filter' import Filter from './filter' -import type { QueryParam } from './filter' import List from './list' import EmptyElement from './empty-element' import HeaderOpts from './header-opts' -import { AnnotationEnableStatus, type AnnotationItem, type AnnotationItemBasic, JobStatus } from './type' +import {AnnotationEnableStatus, type AnnotationItem, type AnnotationItemBasic, JobStatus} from './type' import ViewAnnotationModal from './view-annotation-modal' -import { MessageFast } from '@/app/components/base/icons/src/vender/solid/communication' +import {MessageFast} from '@/app/components/base/icons/src/vender/solid/communication' import ActionButton from '@/app/components/base/action-button' import Pagination from '@/app/components/base/pagination' import Switch from '@/app/components/base/switch' -import { addAnnotation, delAnnotation, fetchAnnotationConfig as doFetchAnnotationConfig, editAnnotation, fetchAnnotationList, queryAnnotationJobStatus, updateAnnotationScore, updateAnnotationStatus } from '@/service/annotation' +import { + addAnnotation, + delAnnotation, + editAnnotation, + fetchAnnotationConfig as doFetchAnnotationConfig, + fetchAnnotationList, + queryAnnotationJobStatus, + updateAnnotationScore, + updateAnnotationStatus +} from '@/service/annotation' import Loading from '@/app/components/base/loading' -import { APP_PAGE_LIMIT } from '@/config' +import {APP_PAGE_LIMIT} from '@/config' import ConfigParamModal from '@/app/components/base/features/new-feature-panel/annotation-reply/config-param-modal' -import type { AnnotationReplyConfig } from '@/models/debug' -import { sleep } from '@/utils' -import { useProviderContext } from '@/context/provider-context' +import type {AnnotationReplyConfig} from '@/models/debug' +import {sleep} from '@/utils' +import {useProviderContext} from '@/context/provider-context' import AnnotationFullModal from '@/app/components/billing/annotation-full/modal' -import type { App } from '@/types/app' +import type {App} from '@/types/app' import cn from '@/utils/classnames' type Props = { diff --git a/web/app/components/app/annotation/list.tsx b/web/app/components/app/annotation/list.tsx index 39a495085eb52e..402ddedf9ee9f0 100644 --- a/web/app/components/app/annotation/list.tsx +++ b/web/app/components/app/annotation/list.tsx @@ -1,9 +1,9 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' -import { useTranslation } from 'react-i18next' -import { RiDeleteBinLine, RiEditLine } from '@remixicon/react' -import type { AnnotationItem } from './type' +import {useTranslation} from 'react-i18next' +import {RiDeleteBinLine, RiEditLine} from '@remixicon/react' +import type {AnnotationItem} from './type' import RemoveAnnotationConfirmModal from './remove-annotation-confirm-modal' import ActionButton from '@/app/components/base/action-button' import useTimestamp from '@/hooks/use-timestamp' diff --git a/web/app/components/app/annotation/remove-annotation-confirm-modal/index.tsx b/web/app/components/app/annotation/remove-annotation-confirm-modal/index.tsx index a6ade49a7973df..5c346cdcdf36db 100644 --- a/web/app/components/app/annotation/remove-annotation-confirm-modal/index.tsx +++ b/web/app/components/app/annotation/remove-annotation-confirm-modal/index.tsx @@ -1,7 +1,7 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' -import { useTranslation } from 'react-i18next' +import {useTranslation} from 'react-i18next' import Confirm from '@/app/components/base/confirm' type Props = { diff --git a/web/app/components/app/annotation/view-annotation-modal/hit-history-no-data.tsx b/web/app/components/app/annotation/view-annotation-modal/hit-history-no-data.tsx index 6f7c32283a4866..0e79ef0616e089 100644 --- a/web/app/components/app/annotation/view-annotation-modal/hit-history-no-data.tsx +++ b/web/app/components/app/annotation/view-annotation-modal/hit-history-no-data.tsx @@ -1,8 +1,8 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' -import { useTranslation } from 'react-i18next' -import { ClockFastForward } from '@/app/components/base/icons/src/vender/line/time' +import {useTranslation} from 'react-i18next' +import {ClockFastForward} from '@/app/components/base/icons/src/vender/line/time' const HitHistoryNoData: FC = () => { const { t } = useTranslation() diff --git a/web/app/components/app/annotation/view-annotation-modal/index.tsx b/web/app/components/app/annotation/view-annotation-modal/index.tsx index 83a64b980f68b7..4e8085955cfd16 100644 --- a/web/app/components/app/annotation/view-annotation-modal/index.tsx +++ b/web/app/components/app/annotation/view-annotation-modal/index.tsx @@ -1,18 +1,18 @@ 'use client' -import type { FC } from 'react' -import React, { useEffect, useState } from 'react' -import { useTranslation } from 'react-i18next' -import EditItem, { EditItemType } from '../edit-annotation-modal/edit-item' -import type { AnnotationItem, HitHistoryItem } from '../type' +import type {FC} from 'react' +import React, {useEffect, useState} from 'react' +import {useTranslation} from 'react-i18next' +import EditItem, {EditItemType} from '../edit-annotation-modal/edit-item' +import type {AnnotationItem, HitHistoryItem} from '../type' import HitHistoryNoData from './hit-history-no-data' import Badge from '@/app/components/base/badge' import Drawer from '@/app/components/base/drawer-plus' import Pagination from '@/app/components/base/pagination' -import { MessageCheckRemove } from '@/app/components/base/icons/src/vender/line/communication' +import {MessageCheckRemove} from '@/app/components/base/icons/src/vender/line/communication' import Confirm from '@/app/components/base/confirm' import TabSlider from '@/app/components/base/tab-slider-plain' -import { fetchHitHistoryList } from '@/service/annotation' -import { APP_PAGE_LIMIT } from '@/config' +import {fetchHitHistoryList} from '@/service/annotation' +import {APP_PAGE_LIMIT} from '@/config' import useTimestamp from '@/hooks/use-timestamp' import cn from '@/utils/classnames' diff --git a/web/app/components/app/app-publisher/features-wrapper.tsx b/web/app/components/app/app-publisher/features-wrapper.tsx index dadd112135b344..27af0c090abcee 100644 --- a/web/app/components/app/app-publisher/features-wrapper.tsx +++ b/web/app/components/app/app-publisher/features-wrapper.tsx @@ -1,15 +1,15 @@ -import React, { useCallback, useState } from 'react' -import { useTranslation } from 'react-i18next' +import React, {useCallback, useState} from 'react' +import {useTranslation} from 'react-i18next' import produce from 'immer' -import type { AppPublisherProps } from '@/app/components/app/app-publisher' -import Confirm from '@/app/components/base/confirm' +import type {AppPublisherProps} from '@/app/components/app/app-publisher' import AppPublisher from '@/app/components/app/app-publisher' -import { useFeatures, useFeaturesStore } from '@/app/components/base/features/hooks' -import type { ModelAndParameter } from '@/app/components/app/configuration/debug/types' -import type { FileUpload } from '@/app/components/base/features/types' -import { Resolution } from '@/types/app' -import { FILE_EXTS } from '@/app/components/base/prompt-editor/constants' -import { SupportUploadFileTypes } from '@/app/components/workflow/types' +import Confirm from '@/app/components/base/confirm' +import {useFeatures, useFeaturesStore} from '@/app/components/base/features/hooks' +import type {ModelAndParameter} from '@/app/components/app/configuration/debug/types' +import type {FileUpload} from '@/app/components/base/features/types' +import {Resolution} from '@/types/app' +import {FILE_EXTS} from '@/app/components/base/prompt-editor/constants' +import {SupportUploadFileTypes} from '@/app/components/workflow/types' type Props = Omit & { onPublish?: (modelAndParameter?: ModelAndParameter, features?: any) => Promise | any diff --git a/web/app/components/app/app-publisher/index.tsx b/web/app/components/app/app-publisher/index.tsx index 3ba35a73369d37..7122e1bca6b776 100644 --- a/web/app/components/app/app-publisher/index.tsx +++ b/web/app/components/app/app-publisher/index.tsx @@ -1,13 +1,9 @@ -import { - memo, - useCallback, - useState, -} from 'react' -import { useTranslation } from 'react-i18next' +import {memo, useCallback, useState,} from 'react' +import {useTranslation} from 'react-i18next' import dayjs from 'dayjs' -import { RiArrowDownSLine, RiPlanetLine } from '@remixicon/react' +import {RiArrowDownSLine, RiPlanetLine} from '@remixicon/react' import Toast from '../../base/toast' -import type { ModelAndParameter } from '../configuration/debug/types' +import type {ModelAndParameter} from '../configuration/debug/types' import SuggestedAction from './suggested-action' import PublishWithMultipleModel from './publish-with-multiple-model' import Button from '@/app/components/base/button' @@ -16,17 +12,17 @@ import { PortalToFollowElemContent, PortalToFollowElemTrigger, } from '@/app/components/base/portal-to-follow-elem' -import { fetchInstalledAppList } from '@/service/explore' +import {fetchInstalledAppList} from '@/service/explore' import EmbeddedModal from '@/app/components/app/overview/embedded' -import { useStore as useAppStore } from '@/app/components/app/store' -import { useGetLanguage } from '@/context/i18n' -import { PlayCircle } from '@/app/components/base/icons/src/vender/line/mediaAndDevices' -import { CodeBrowser } from '@/app/components/base/icons/src/vender/line/development' -import { LeftIndent02 } from '@/app/components/base/icons/src/vender/line/editor' -import { FileText } from '@/app/components/base/icons/src/vender/line/files' +import {useStore as useAppStore} from '@/app/components/app/store' +import {useGetLanguage} from '@/context/i18n' +import {PlayCircle} from '@/app/components/base/icons/src/vender/line/mediaAndDevices' +import {CodeBrowser} from '@/app/components/base/icons/src/vender/line/development' +import {LeftIndent02} from '@/app/components/base/icons/src/vender/line/editor' +import {FileText} from '@/app/components/base/icons/src/vender/line/files' import WorkflowToolConfigureButton from '@/app/components/tools/workflow-tool/configure-button' -import type { InputVar } from '@/app/components/workflow/types' -import { appDefaultIconBackground } from '@/config' +import type {InputVar} from '@/app/components/workflow/types' +import {appDefaultIconBackground} from '@/config' export type AppPublisherProps = { disabled?: boolean diff --git a/web/app/components/app/app-publisher/publish-with-multiple-model.tsx b/web/app/components/app/app-publisher/publish-with-multiple-model.tsx index 6d96faeaa54191..f9a8ec394bcb4e 100644 --- a/web/app/components/app/app-publisher/publish-with-multiple-model.tsx +++ b/web/app/components/app/app-publisher/publish-with-multiple-model.tsx @@ -1,8 +1,8 @@ -import type { FC } from 'react' -import { useState } from 'react' -import { useTranslation } from 'react-i18next' -import { RiArrowDownSLine } from '@remixicon/react' -import type { ModelAndParameter } from '../configuration/debug/types' +import type {FC} from 'react' +import {useState} from 'react' +import {useTranslation} from 'react-i18next' +import {RiArrowDownSLine} from '@remixicon/react' +import type {ModelAndParameter} from '../configuration/debug/types' import ModelIcon from '../../header/account-setting/model-provider-page/model-icon' import Button from '@/app/components/base/button' import { @@ -10,9 +10,9 @@ import { PortalToFollowElemContent, PortalToFollowElemTrigger, } from '@/app/components/base/portal-to-follow-elem' -import { useProviderContext } from '@/context/provider-context' -import type { Model, ModelItem } from '@/app/components/header/account-setting/model-provider-page/declarations' -import { useLanguage } from '@/app/components/header/account-setting/model-provider-page/hooks' +import {useProviderContext} from '@/context/provider-context' +import type {Model, ModelItem} from '@/app/components/header/account-setting/model-provider-page/declarations' +import {useLanguage} from '@/app/components/header/account-setting/model-provider-page/hooks' type PublishWithMultipleModelProps = { multipleModelConfigs: ModelAndParameter[] diff --git a/web/app/components/app/app-publisher/suggested-action.tsx b/web/app/components/app/app-publisher/suggested-action.tsx index a371eafde0fc94..2c631968281cf4 100644 --- a/web/app/components/app/app-publisher/suggested-action.tsx +++ b/web/app/components/app/app-publisher/suggested-action.tsx @@ -1,6 +1,6 @@ -import type { HTMLProps, PropsWithChildren } from 'react' +import type {HTMLProps, PropsWithChildren} from 'react' import classNames from '@/utils/classnames' -import { ArrowUpRight } from '@/app/components/base/icons/src/vender/line/arrows' +import {ArrowUpRight} from '@/app/components/base/icons/src/vender/line/arrows' export type SuggestedActionProps = PropsWithChildren & { icon?: React.ReactNode diff --git a/web/app/components/app/configuration/base/feature-panel/index.tsx b/web/app/components/app/configuration/base/feature-panel/index.tsx index 9c4adbdd2de2eb..bb43719ee31874 100644 --- a/web/app/components/app/configuration/base/feature-panel/index.tsx +++ b/web/app/components/app/configuration/base/feature-panel/index.tsx @@ -1,5 +1,5 @@ 'use client' -import type { FC, ReactNode } from 'react' +import type {FC, ReactNode} from 'react' import React from 'react' import cn from '@/utils/classnames' diff --git a/web/app/components/app/configuration/base/group-name/index.tsx b/web/app/components/app/configuration/base/group-name/index.tsx index 51fe09021b9afa..3813d1418a5503 100644 --- a/web/app/components/app/configuration/base/group-name/index.tsx +++ b/web/app/components/app/configuration/base/group-name/index.tsx @@ -1,5 +1,5 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' export type IGroupNameProps = { diff --git a/web/app/components/app/configuration/base/icons/more-like-this-icon.tsx b/web/app/components/app/configuration/base/icons/more-like-this-icon.tsx index 74c808eb39be60..57c5c9b1622563 100644 --- a/web/app/components/app/configuration/base/icons/more-like-this-icon.tsx +++ b/web/app/components/app/configuration/base/icons/more-like-this-icon.tsx @@ -1,5 +1,5 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' const MoreLikeThisIcon: FC = () => { diff --git a/web/app/components/app/configuration/base/icons/remove-icon/index.tsx b/web/app/components/app/configuration/base/icons/remove-icon/index.tsx index e07a462d496de0..c28bfb0fd7fb20 100644 --- a/web/app/components/app/configuration/base/icons/remove-icon/index.tsx +++ b/web/app/components/app/configuration/base/icons/remove-icon/index.tsx @@ -1,5 +1,5 @@ 'use client' -import React, { useState } from 'react' +import React, {useState} from 'react' import cn from '@/utils/classnames' type IRemoveIconProps = { diff --git a/web/app/components/app/configuration/base/icons/suggested-questions-after-answer-icon.tsx b/web/app/components/app/configuration/base/icons/suggested-questions-after-answer-icon.tsx index cabc2e4d737391..0c0b6c97578648 100644 --- a/web/app/components/app/configuration/base/icons/suggested-questions-after-answer-icon.tsx +++ b/web/app/components/app/configuration/base/icons/suggested-questions-after-answer-icon.tsx @@ -1,5 +1,5 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' const SuggestedQuestionsAfterAnswerIcon: FC = () => { diff --git a/web/app/components/app/configuration/base/operation-btn/index.tsx b/web/app/components/app/configuration/base/operation-btn/index.tsx index e9ffd14257ab3a..5fb59d9946f907 100644 --- a/web/app/components/app/configuration/base/operation-btn/index.tsx +++ b/web/app/components/app/configuration/base/operation-btn/index.tsx @@ -1,8 +1,8 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' -import { useTranslation } from 'react-i18next' -import { PlusIcon } from '@heroicons/react/20/solid' +import {useTranslation} from 'react-i18next' +import {PlusIcon} from '@heroicons/react/20/solid' import cn from '@/utils/classnames' export type IOperationBtnProps = { diff --git a/web/app/components/app/configuration/base/var-highlight/index.tsx b/web/app/components/app/configuration/base/var-highlight/index.tsx index 3dd6c14902fbb8..4d63145deffd62 100644 --- a/web/app/components/app/configuration/base/var-highlight/index.tsx +++ b/web/app/components/app/configuration/base/var-highlight/index.tsx @@ -1,5 +1,5 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' import s from './style.module.css' diff --git a/web/app/components/app/configuration/base/warning-mask/cannot-query-dataset.tsx b/web/app/components/app/configuration/base/warning-mask/cannot-query-dataset.tsx index 52756189a10432..98c680a377a913 100644 --- a/web/app/components/app/configuration/base/warning-mask/cannot-query-dataset.tsx +++ b/web/app/components/app/configuration/base/warning-mask/cannot-query-dataset.tsx @@ -1,7 +1,7 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' -import { useTranslation } from 'react-i18next' +import {useTranslation} from 'react-i18next' import WarningMask from '.' import Button from '@/app/components/base/button' diff --git a/web/app/components/app/configuration/base/warning-mask/formatting-changed.tsx b/web/app/components/app/configuration/base/warning-mask/formatting-changed.tsx index 35c2283d154c38..5f48244410e493 100644 --- a/web/app/components/app/configuration/base/warning-mask/formatting-changed.tsx +++ b/web/app/components/app/configuration/base/warning-mask/formatting-changed.tsx @@ -1,7 +1,7 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' -import { useTranslation } from 'react-i18next' +import {useTranslation} from 'react-i18next' import WarningMask from '.' import Button from '@/app/components/base/button' diff --git a/web/app/components/app/configuration/base/warning-mask/has-not-set-api.tsx b/web/app/components/app/configuration/base/warning-mask/has-not-set-api.tsx index d83f9d920f9f03..6f4206aee19af1 100644 --- a/web/app/components/app/configuration/base/warning-mask/has-not-set-api.tsx +++ b/web/app/components/app/configuration/base/warning-mask/has-not-set-api.tsx @@ -1,7 +1,7 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' -import { useTranslation } from 'react-i18next' +import {useTranslation} from 'react-i18next' import WarningMask from '.' import Button from '@/app/components/base/button' diff --git a/web/app/components/app/configuration/base/warning-mask/index.tsx b/web/app/components/app/configuration/base/warning-mask/index.tsx index 03df4f16dfbf0e..3761b55198ad01 100644 --- a/web/app/components/app/configuration/base/warning-mask/index.tsx +++ b/web/app/components/app/configuration/base/warning-mask/index.tsx @@ -1,5 +1,5 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' import s from './style.module.css' diff --git a/web/app/components/app/configuration/config-var/config-modal/field.tsx b/web/app/components/app/configuration/config-var/config-modal/field.tsx index 5052f988d75df2..e0b1549a5f0d91 100644 --- a/web/app/components/app/configuration/config-var/config-modal/field.tsx +++ b/web/app/components/app/configuration/config-var/config-modal/field.tsx @@ -1,5 +1,5 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' import cn from '@/utils/classnames' diff --git a/web/app/components/app/configuration/config-var/config-modal/index.tsx b/web/app/components/app/configuration/config-var/config-modal/index.tsx index 85e241a203b99c..f8c1b145b13b20 100644 --- a/web/app/components/app/configuration/config-var/config-modal/index.tsx +++ b/web/app/components/app/configuration/config-var/config-modal/index.tsx @@ -1,8 +1,8 @@ 'use client' -import type { FC } from 'react' -import React, { useCallback, useEffect, useRef, useState } from 'react' -import { useTranslation } from 'react-i18next' -import { useContext } from 'use-context-selector' +import type {FC} from 'react' +import React, {useCallback, useEffect, useRef, useState} from 'react' +import {useTranslation} from 'react-i18next' +import {useContext} from 'use-context-selector' import produce from 'immer' import ModalFoot from '../modal-foot' import ConfigSelect from '../config-select' @@ -11,15 +11,15 @@ import SelectTypeItem from '../select-type-item' import Field from './field' import Input from '@/app/components/base/input' import Toast from '@/app/components/base/toast' -import { checkKeys, getNewVarInWorkflow } from '@/utils/var' +import {checkKeys, getNewVarInWorkflow} from '@/utils/var' import ConfigContext from '@/context/debug-configuration' -import type { InputVar, MoreInfo, UploadFileSetting } from '@/app/components/workflow/types' +import type {InputVar, MoreInfo, UploadFileSetting} from '@/app/components/workflow/types' +import {ChangeType, InputVarType, SupportUploadFileTypes} from '@/app/components/workflow/types' import Modal from '@/app/components/base/modal' -import { ChangeType, InputVarType, SupportUploadFileTypes } from '@/app/components/workflow/types' import FileUploadSetting from '@/app/components/workflow/nodes/_base/components/file-upload-setting' import Checkbox from '@/app/components/base/checkbox' -import { DEFAULT_FILE_UPLOAD_SETTING } from '@/app/components/workflow/constants' -import { DEFAULT_VALUE_MAX_LEN } from '@/config' +import {DEFAULT_FILE_UPLOAD_SETTING} from '@/app/components/workflow/constants' +import {DEFAULT_VALUE_MAX_LEN} from '@/config' const TEXT_MAX_LENGTH = 256 diff --git a/web/app/components/app/configuration/config-var/config-select/index.tsx b/web/app/components/app/configuration/config-var/config-select/index.tsx index 449cb8b12feeef..95c4e496a220a2 100644 --- a/web/app/components/app/configuration/config-var/config-select/index.tsx +++ b/web/app/components/app/configuration/config-var/config-select/index.tsx @@ -1,9 +1,9 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' -import { useTranslation } from 'react-i18next' -import { PlusIcon } from '@heroicons/react/24/outline' -import { ReactSortable } from 'react-sortablejs' +import {useTranslation} from 'react-i18next' +import {PlusIcon} from '@heroicons/react/24/outline' +import {ReactSortable} from 'react-sortablejs' import RemoveIcon from '../../base/icons/remove-icon' import s from './style.module.css' diff --git a/web/app/components/app/configuration/config-var/config-string/index.tsx b/web/app/components/app/configuration/config-var/config-string/index.tsx index 719ad8ee1313ec..d9fbffbcd31b1e 100644 --- a/web/app/components/app/configuration/config-var/config-string/index.tsx +++ b/web/app/components/app/configuration/config-var/config-string/index.tsx @@ -1,6 +1,6 @@ 'use client' -import type { FC } from 'react' -import React, { useEffect } from 'react' +import type {FC} from 'react' +import React, {useEffect} from 'react' import Input from '@/app/components/base/input' export type IConfigStringProps = { diff --git a/web/app/components/app/configuration/config-var/index.tsx b/web/app/components/app/configuration/config-var/index.tsx index 67bc37385e187f..d11e2f947292eb 100644 --- a/web/app/components/app/configuration/config-var/index.tsx +++ b/web/app/components/app/configuration/config-var/index.tsx @@ -1,36 +1,34 @@ 'use client' -import type { FC } from 'react' -import React, { useState } from 'react' -import { useTranslation } from 'react-i18next' -import { useBoolean } from 'ahooks' -import type { Timeout } from 'ahooks/lib/useRequest/src/types' -import { useContext } from 'use-context-selector' +import type {FC} from 'react' +import React, {useState} from 'react' +import {useTranslation} from 'react-i18next' +import {useBoolean} from 'ahooks' +import type {Timeout} from 'ahooks/lib/useRequest/src/types' +import {useContext} from 'use-context-selector' import produce from 'immer' -import { - RiDeleteBinLine, -} from '@remixicon/react' +import {RiDeleteBinLine,} from '@remixicon/react' import Panel from '../base/feature-panel' import EditModal from './config-modal' +import type {IInputTypeIconProps} from './input-type-icon' import IconTypeIcon from './input-type-icon' -import type { IInputTypeIconProps } from './input-type-icon' import s from './style.module.css' import SelectVarType from './select-var-type' -import { BracketsX as VarIcon } from '@/app/components/base/icons/src/vender/line/development' +import {BracketsX as VarIcon} from '@/app/components/base/icons/src/vender/line/development' import Tooltip from '@/app/components/base/tooltip' -import type { PromptVariable } from '@/models/debug' -import { DEFAULT_VALUE_MAX_LEN, getMaxVarNameLength } from '@/config' -import { checkKeys, getNewVar } from '@/utils/var' +import type {PromptVariable} from '@/models/debug' +import {DEFAULT_VALUE_MAX_LEN, getMaxVarNameLength} from '@/config' +import {checkKeys, getNewVar} from '@/utils/var' import Switch from '@/app/components/base/switch' import Toast from '@/app/components/base/toast' -import { Settings01 } from '@/app/components/base/icons/src/vender/line/general' +import {Settings01} from '@/app/components/base/icons/src/vender/line/general' import Confirm from '@/app/components/base/confirm' import ConfigContext from '@/context/debug-configuration' -import { AppType } from '@/types/app' -import type { ExternalDataTool } from '@/models/common' -import { useModalContext } from '@/context/modal-context' -import { useEventEmitterContextContext } from '@/context/event-emitter' -import type { InputVar } from '@/app/components/workflow/types' -import { InputVarType } from '@/app/components/workflow/types' +import {AppType} from '@/types/app' +import type {ExternalDataTool} from '@/models/common' +import {useModalContext} from '@/context/modal-context' +import {useEventEmitterContextContext} from '@/context/event-emitter' +import type {InputVar} from '@/app/components/workflow/types' +import {InputVarType} from '@/app/components/workflow/types' export const ADD_EXTERNAL_DATA_TOOL = 'ADD_EXTERNAL_DATA_TOOL' diff --git a/web/app/components/app/configuration/config/agent-setting-button.tsx b/web/app/components/app/configuration/config/agent-setting-button.tsx index f50f77837e98e2..fe27ff7f2e94a4 100644 --- a/web/app/components/app/configuration/config/agent-setting-button.tsx +++ b/web/app/components/app/configuration/config/agent-setting-button.tsx @@ -1,11 +1,11 @@ 'use client' -import type { FC } from 'react' -import React, { useState } from 'react' -import { useTranslation } from 'react-i18next' +import type {FC} from 'react' +import React, {useState} from 'react' +import {useTranslation} from 'react-i18next' import AgentSetting from './agent/agent-setting' import Button from '@/app/components/base/button' -import { Settings01 } from '@/app/components/base/icons/src/vender/line/general' -import type { AgentConfig } from '@/models/debug' +import {Settings01} from '@/app/components/base/icons/src/vender/line/general' +import type {AgentConfig} from '@/models/debug' type Props = { isFunctionCall: boolean diff --git a/web/app/components/app/configuration/config/agent/agent-setting/index.tsx b/web/app/components/app/configuration/config/agent/agent-setting/index.tsx index 959336457fc2ae..4ba9059b7b4ced 100644 --- a/web/app/components/app/configuration/config/agent/agent-setting/index.tsx +++ b/web/app/components/app/configuration/config/agent/agent-setting/index.tsx @@ -1,15 +1,15 @@ 'use client' -import type { FC } from 'react' -import React, { useState } from 'react' -import { useTranslation } from 'react-i18next' -import { RiCloseLine } from '@remixicon/react' +import type {FC} from 'react' +import React, {useState} from 'react' +import {useTranslation} from 'react-i18next' +import {RiCloseLine} from '@remixicon/react' import ItemPanel from './item-panel' import Button from '@/app/components/base/button' -import { CuteRobot } from '@/app/components/base/icons/src/vender/solid/communication' -import { Unblur } from '@/app/components/base/icons/src/vender/solid/education' +import {CuteRobot} from '@/app/components/base/icons/src/vender/solid/communication' +import {Unblur} from '@/app/components/base/icons/src/vender/solid/education' import Slider from '@/app/components/base/slider' -import type { AgentConfig } from '@/models/debug' -import { DEFAULT_AGENT_PROMPT } from '@/config' +import type {AgentConfig} from '@/models/debug' +import {DEFAULT_AGENT_PROMPT} from '@/config' type Props = { isChatModel: boolean diff --git a/web/app/components/app/configuration/config/agent/agent-setting/item-panel.tsx b/web/app/components/app/configuration/config/agent/agent-setting/item-panel.tsx index 99c2478b0647ed..392e53c6d297ce 100644 --- a/web/app/components/app/configuration/config/agent/agent-setting/item-panel.tsx +++ b/web/app/components/app/configuration/config/agent/agent-setting/item-panel.tsx @@ -1,8 +1,9 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' import cn from '@/utils/classnames' import Tooltip from '@/app/components/base/tooltip' + type Props = { className?: string icon: JSX.Element diff --git a/web/app/components/app/configuration/config/agent/agent-tools/index.tsx b/web/app/components/app/configuration/config/agent/agent-tools/index.tsx index 52e5d5d906d0bd..8d90d40706aeb8 100644 --- a/web/app/components/app/configuration/config/agent/agent-tools/index.tsx +++ b/web/app/components/app/configuration/config/agent/agent-tools/index.tsx @@ -1,28 +1,25 @@ 'use client' -import type { FC } from 'react' -import React, { useState } from 'react' -import { useTranslation } from 'react-i18next' -import { useContext } from 'use-context-selector' +import type {FC} from 'react' +import React, {useState} from 'react' +import {useTranslation} from 'react-i18next' +import {useContext} from 'use-context-selector' import produce from 'immer' -import { - RiDeleteBinLine, - RiHammerFill, -} from '@remixicon/react' -import { useFormattingChangedDispatcher } from '../../../debug/hooks' +import {RiDeleteBinLine, RiHammerFill,} from '@remixicon/react' +import {useFormattingChangedDispatcher} from '../../../debug/hooks' import SettingBuiltInTool from './setting-built-in-tool' import cn from '@/utils/classnames' import Panel from '@/app/components/app/configuration/base/feature-panel' -import { InfoCircle } from '@/app/components/base/icons/src/vender/line/general' +import {InfoCircle} from '@/app/components/base/icons/src/vender/line/general' import OperationBtn from '@/app/components/app/configuration/base/operation-btn' import AppIcon from '@/app/components/base/app-icon' import Switch from '@/app/components/base/switch' import ConfigContext from '@/context/debug-configuration' -import type { AgentTool } from '@/types/app' -import { type Collection, CollectionType } from '@/app/components/tools/types' -import { MAX_TOOLS_NUM } from '@/config' -import { AlertTriangle } from '@/app/components/base/icons/src/vender/solid/alertsAndFeedback' +import type {AgentTool} from '@/types/app' +import {type Collection, CollectionType} from '@/app/components/tools/types' +import {MAX_TOOLS_NUM} from '@/config' +import {AlertTriangle} from '@/app/components/base/icons/src/vender/solid/alertsAndFeedback' import Tooltip from '@/app/components/base/tooltip' -import { DefaultToolIcon } from '@/app/components/base/icons/src/public/other' +import {DefaultToolIcon} from '@/app/components/base/icons/src/public/other' import AddToolModal from '@/app/components/tools/add-tool-modal' type AgentToolWithMoreInfo = AgentTool & { icon: any; collection?: Collection } | null diff --git a/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx b/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx index 69e18e3136d8fd..adccf33f6ff509 100644 --- a/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx +++ b/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx @@ -1,20 +1,20 @@ 'use client' -import type { FC } from 'react' -import React, { useEffect, useState } from 'react' -import { useTranslation } from 'react-i18next' -import { useContext } from 'use-context-selector' +import type {FC} from 'react' +import React, {useEffect, useState} from 'react' +import {useTranslation} from 'react-i18next' +import {useContext} from 'use-context-selector' import cn from '@/utils/classnames' import Drawer from '@/app/components/base/drawer-plus' import Form from '@/app/components/header/account-setting/model-provider-page/model-modal/Form' -import { addDefaultValue, toolParametersToFormSchemas } from '@/app/components/tools/utils/to-form-schema' -import type { Collection, Tool } from '@/app/components/tools/types' -import { CollectionType } from '@/app/components/tools/types' -import { fetchBuiltInToolList, fetchCustomToolList, fetchModelToolList, fetchWorkflowToolList } from '@/service/tools' +import {addDefaultValue, toolParametersToFormSchemas} from '@/app/components/tools/utils/to-form-schema' +import type {Collection, Tool} from '@/app/components/tools/types' +import {CollectionType} from '@/app/components/tools/types' +import {fetchBuiltInToolList, fetchCustomToolList, fetchModelToolList, fetchWorkflowToolList} from '@/service/tools' import I18n from '@/context/i18n' import Button from '@/app/components/base/button' import Loading from '@/app/components/base/loading' -import { DiagonalDividingLine } from '@/app/components/base/icons/src/public/common' -import { getLanguage } from '@/i18n/language' +import {DiagonalDividingLine} from '@/app/components/base/icons/src/public/common' +import {getLanguage} from '@/i18n/language' import AppIcon from '@/app/components/base/app-icon' type Props = { diff --git a/web/app/components/app/configuration/config/agent/prompt-editor.tsx b/web/app/components/app/configuration/config/agent/prompt-editor.tsx index 1532c96fb61d69..4f37f90d11358f 100644 --- a/web/app/components/app/configuration/config/agent/prompt-editor.tsx +++ b/web/app/components/app/configuration/config/agent/prompt-editor.tsx @@ -1,21 +1,19 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' import copy from 'copy-to-clipboard' -import { useContext } from 'use-context-selector' -import { useTranslation } from 'react-i18next' +import {useContext} from 'use-context-selector' +import {useTranslation} from 'react-i18next' import cn from '@/utils/classnames' -import { - Clipboard, - ClipboardCheck, -} from '@/app/components/base/icons/src/vender/line/files' +import {Clipboard, ClipboardCheck,} from '@/app/components/base/icons/src/vender/line/files' import PromptEditor from '@/app/components/base/prompt-editor' -import type { ExternalDataTool } from '@/models/common' +import type {ExternalDataTool} from '@/models/common' import ConfigContext from '@/context/debug-configuration' -import { useModalContext } from '@/context/modal-context' -import { useToastContext } from '@/app/components/base/toast' +import {useModalContext} from '@/context/modal-context' +import {useToastContext} from '@/app/components/base/toast' import s from '@/app/components/app/configuration/config-prompt/style.module.css' + type Props = { className?: string type: 'first-prompt' | 'next-iteration' diff --git a/web/app/components/app/configuration/config/assistant-type-picker/index.tsx b/web/app/components/app/configuration/config/assistant-type-picker/index.tsx index 336d736e3b411b..f719a4725b69a1 100644 --- a/web/app/components/app/configuration/config/assistant-type-picker/index.tsx +++ b/web/app/components/app/configuration/config/assistant-type-picker/index.tsx @@ -1,8 +1,8 @@ 'use client' -import type { FC } from 'react' -import React, { useState } from 'react' -import { useTranslation } from 'react-i18next' -import { RiArrowDownSLine } from '@remixicon/react' +import type {FC} from 'react' +import React, {useState} from 'react' +import {useTranslation} from 'react-i18next' +import {RiArrowDownSLine} from '@remixicon/react' import AgentSetting from '../agent/agent-setting' import cn from '@/utils/classnames' import { @@ -10,12 +10,12 @@ import { PortalToFollowElemContent, PortalToFollowElemTrigger, } from '@/app/components/base/portal-to-follow-elem' -import { BubbleText } from '@/app/components/base/icons/src/vender/solid/education' +import {BubbleText} from '@/app/components/base/icons/src/vender/solid/education' import Radio from '@/app/components/base/radio/ui' -import { CuteRobot } from '@/app/components/base/icons/src/vender/solid/communication' -import { Settings04 } from '@/app/components/base/icons/src/vender/line/general' -import { ArrowUpRight } from '@/app/components/base/icons/src/vender/line/arrows' -import type { AgentConfig } from '@/models/debug' +import {CuteRobot} from '@/app/components/base/icons/src/vender/solid/communication' +import {Settings04} from '@/app/components/base/icons/src/vender/line/general' +import {ArrowUpRight} from '@/app/components/base/icons/src/vender/line/arrows' +import type {AgentConfig} from '@/models/debug' type Props = { value: string diff --git a/web/app/components/app/configuration/config/automatic/automatic-btn.tsx b/web/app/components/app/configuration/config/automatic/automatic-btn.tsx index f70976082d92b9..4f92425fb31be8 100644 --- a/web/app/components/app/configuration/config/automatic/automatic-btn.tsx +++ b/web/app/components/app/configuration/config/automatic/automatic-btn.tsx @@ -1,8 +1,8 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' -import { useTranslation } from 'react-i18next' -import { Generator } from '@/app/components/base/icons/src/vender/other' +import {useTranslation} from 'react-i18next' +import {Generator} from '@/app/components/base/icons/src/vender/other' export type IAutomaticBtnProps = { onClick: () => void diff --git a/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx b/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx index 0a20f4b376c2d4..0548826b9290cb 100644 --- a/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx +++ b/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx @@ -1,8 +1,8 @@ 'use client' -import type { FC } from 'react' -import React, { useCallback } from 'react' -import { useTranslation } from 'react-i18next' -import { useBoolean } from 'ahooks' +import type {FC} from 'react' +import React, {useCallback} from 'react' +import {useTranslation} from 'react-i18next' +import {useBoolean} from 'ahooks' import { RiDatabase2Line, RiFileExcel2Line, @@ -20,23 +20,24 @@ import Modal from '@/app/components/base/modal' import Button from '@/app/components/base/button' import Textarea from '@/app/components/base/textarea' import Toast from '@/app/components/base/toast' -import { generateRule } from '@/service/debug' +// type +import type {AutomaticRes} from '@/service/debug' +import {generateRule} from '@/service/debug' import ConfigPrompt from '@/app/components/app/configuration/config-prompt' -import type { Model } from '@/types/app' -import { AppType } from '@/types/app' +import type {Model} from '@/types/app' +import {AppType} from '@/types/app' import ConfigVar from '@/app/components/app/configuration/config-var' import GroupName from '@/app/components/app/configuration/base/group-name' import Loading from '@/app/components/base/loading' import Confirm from '@/app/components/base/confirm' -import { LoveMessage } from '@/app/components/base/icons/src/vender/features' - -// type -import type { AutomaticRes } from '@/service/debug' -import { Generator } from '@/app/components/base/icons/src/vender/other' +import {LoveMessage} from '@/app/components/base/icons/src/vender/features' +import {Generator} from '@/app/components/base/icons/src/vender/other' import ModelIcon from '@/app/components/header/account-setting/model-provider-page/model-icon' import ModelName from '@/app/components/header/account-setting/model-provider-page/model-name' -import { ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' -import { useModelListAndDefaultModelAndCurrentProviderAndModel } from '@/app/components/header/account-setting/model-provider-page/hooks' +import {ModelTypeEnum} from '@/app/components/header/account-setting/model-provider-page/declarations' +import { + useModelListAndDefaultModelAndCurrentProviderAndModel +} from '@/app/components/header/account-setting/model-provider-page/hooks' export type IGetAutomaticResProps = { mode: AppType diff --git a/web/app/components/app/configuration/config/code-generator/get-code-generator-res.tsx b/web/app/components/app/configuration/config/code-generator/get-code-generator-res.tsx index 85c522ca0ffefd..98590a640248e2 100644 --- a/web/app/components/app/configuration/config/code-generator/get-code-generator-res.tsx +++ b/web/app/components/app/configuration/config/code-generator/get-code-generator-res.tsx @@ -1,24 +1,27 @@ -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' import cn from 'classnames' import useBoolean from 'ahooks/lib/useBoolean' -import { useTranslation } from 'react-i18next' +import {useTranslation} from 'react-i18next' import ConfigPrompt from '../../config-prompt' -import { languageMap } from '../../../../workflow/nodes/_base/components/editor/code-editor/index' -import { generateRuleCode } from '@/service/debug' -import type { CodeGenRes } from '@/service/debug' -import { type AppType, type Model, ModelModeType } from '@/types/app' +import {languageMap} from '../../../../workflow/nodes/_base/components/editor/code-editor/index' +import type {CodeGenRes} from '@/service/debug' +import {generateRuleCode} from '@/service/debug' +import {type AppType, type Model, ModelModeType} from '@/types/app' import Modal from '@/app/components/base/modal' import Button from '@/app/components/base/button' -import { Generator } from '@/app/components/base/icons/src/vender/other' +import {Generator} from '@/app/components/base/icons/src/vender/other' import Toast from '@/app/components/base/toast' import Loading from '@/app/components/base/loading' import Confirm from '@/app/components/base/confirm' -import type { CodeLanguage } from '@/app/components/workflow/nodes/code/types' -import { useModelListAndDefaultModelAndCurrentProviderAndModel } from '@/app/components/header/account-setting/model-provider-page/hooks' -import { ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' +import type {CodeLanguage} from '@/app/components/workflow/nodes/code/types' +import { + useModelListAndDefaultModelAndCurrentProviderAndModel +} from '@/app/components/header/account-setting/model-provider-page/hooks' +import {ModelTypeEnum} from '@/app/components/header/account-setting/model-provider-page/declarations' import ModelIcon from '@/app/components/header/account-setting/model-provider-page/model-icon' import ModelName from '@/app/components/header/account-setting/model-provider-page/model-name' + export type IGetCodeGeneratorResProps = { mode: AppType isShow: boolean diff --git a/web/app/components/app/configuration/config/config-document.tsx b/web/app/components/app/configuration/config/config-document.tsx index 1ac6da0dd8b29d..637491a1a4095b 100644 --- a/web/app/components/app/configuration/config/config-document.tsx +++ b/web/app/components/app/configuration/config/config-document.tsx @@ -1,15 +1,15 @@ 'use client' -import type { FC } from 'react' -import React, { useCallback } from 'react' -import { useTranslation } from 'react-i18next' +import type {FC} from 'react' +import React, {useCallback} from 'react' +import {useTranslation} from 'react-i18next' import produce from 'immer' -import { useContext } from 'use-context-selector' +import {useContext} from 'use-context-selector' -import { Document } from '@/app/components/base/icons/src/vender/features' +import {Document} from '@/app/components/base/icons/src/vender/features' import Tooltip from '@/app/components/base/tooltip' import ConfigContext from '@/context/debug-configuration' -import { SupportUploadFileTypes } from '@/app/components/workflow/types' -import { useFeatures, useFeaturesStore } from '@/app/components/base/features/hooks' +import {SupportUploadFileTypes} from '@/app/components/workflow/types' +import {useFeatures, useFeaturesStore} from '@/app/components/base/features/hooks' import Switch from '@/app/components/base/switch' const ConfigDocument: FC = () => { diff --git a/web/app/components/app/configuration/config/feature/use-feature.tsx b/web/app/components/app/configuration/config/feature/use-feature.tsx index acc08dd4a42888..41808518124ca7 100644 --- a/web/app/components/app/configuration/config/feature/use-feature.tsx +++ b/web/app/components/app/configuration/config/feature/use-feature.tsx @@ -1,4 +1,4 @@ -import React, { useEffect } from 'react' +import React, {useEffect} from 'react' function useFeature({ introduction, diff --git a/web/app/components/app/configuration/config/index.tsx b/web/app/components/app/configuration/config/index.tsx index 39fdd502ef6c64..d33254c96f9536 100644 --- a/web/app/components/app/configuration/config/index.tsx +++ b/web/app/components/app/configuration/config/index.tsx @@ -1,9 +1,9 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' -import { useContext } from 'use-context-selector' +import {useContext} from 'use-context-selector' import produce from 'immer' -import { useFormattingChangedDispatcher } from '../debug/hooks' +import {useFormattingChangedDispatcher} from '../debug/hooks' import DatasetConfig from '../dataset-config' import HistoryPanel from '../config-prompt/conversation-history/history-panel' import ConfigVision from '../config-vision' @@ -12,9 +12,9 @@ import AgentTools from './agent/agent-tools' import ConfigContext from '@/context/debug-configuration' import ConfigPrompt from '@/app/components/app/configuration/config-prompt' import ConfigVar from '@/app/components/app/configuration/config-var' -import { type ModelConfig, type PromptVariable } from '@/models/debug' -import type { AppType } from '@/types/app' -import { ModelModeType } from '@/types/app' +import {type ModelConfig, type PromptVariable} from '@/models/debug' +import type {AppType} from '@/types/app' +import {ModelModeType} from '@/types/app' const Config: FC = () => { const { diff --git a/web/app/components/app/configuration/debug/chat-user-input.tsx b/web/app/components/app/configuration/debug/chat-user-input.tsx index cda41917e3f5f6..8c272fb9c16351 100644 --- a/web/app/components/app/configuration/debug/chat-user-input.tsx +++ b/web/app/components/app/configuration/debug/chat-user-input.tsx @@ -1,12 +1,12 @@ import React from 'react' -import { useTranslation } from 'react-i18next' -import { useContext } from 'use-context-selector' +import {useTranslation} from 'react-i18next' +import {useContext} from 'use-context-selector' import ConfigContext from '@/context/debug-configuration' import Input from '@/app/components/base/input' import Select from '@/app/components/base/select' import Textarea from '@/app/components/base/textarea' -import { DEFAULT_VALUE_MAX_LEN } from '@/config' -import type { Inputs } from '@/models/debug' +import {DEFAULT_VALUE_MAX_LEN} from '@/config' +import type {Inputs} from '@/models/debug' import cn from '@/utils/classnames' type Props = { diff --git a/web/app/components/app/configuration/debug/debug-with-multiple-model/chat-item.tsx b/web/app/components/app/configuration/debug/debug-with-multiple-model/chat-item.tsx index 1144c323d1ae77..e794d19f16bc85 100644 --- a/web/app/components/app/configuration/debug/debug-with-multiple-model/chat-item.tsx +++ b/web/app/components/app/configuration/debug/debug-with-multiple-model/chat-item.tsx @@ -1,35 +1,21 @@ -import type { FC } from 'react' -import { - memo, - useCallback, - useMemo, -} from 'react' -import type { ModelAndParameter } from '../types' -import { - APP_CHAT_WITH_MULTIPLE_MODEL, - APP_CHAT_WITH_MULTIPLE_MODEL_RESTART, -} from '../types' -import { - useConfigFromDebugContext, - useFormattingChangedSubscription, -} from '../hooks' +import type {FC} from 'react' +import {memo, useCallback, useMemo,} from 'react' +import type {ModelAndParameter} from '../types' +import {APP_CHAT_WITH_MULTIPLE_MODEL, APP_CHAT_WITH_MULTIPLE_MODEL_RESTART,} from '../types' +import {useConfigFromDebugContext, useFormattingChangedSubscription,} from '../hooks' import Chat from '@/app/components/base/chat/chat' -import { useChat } from '@/app/components/base/chat/chat/hooks' -import { useDebugConfigurationContext } from '@/context/debug-configuration' -import type { ChatConfig, OnSend } from '@/app/components/base/chat/types' -import { useEventEmitterContextContext } from '@/context/event-emitter' -import { useProviderContext } from '@/context/provider-context' -import { - fetchConversationMessages, - fetchSuggestedQuestions, - stopChatMessageResponding, -} from '@/service/debug' +import {useChat} from '@/app/components/base/chat/chat/hooks' +import {useDebugConfigurationContext} from '@/context/debug-configuration' +import type {ChatConfig, OnSend} from '@/app/components/base/chat/types' +import {useEventEmitterContextContext} from '@/context/event-emitter' +import {useProviderContext} from '@/context/provider-context' +import {fetchConversationMessages, fetchSuggestedQuestions, stopChatMessageResponding,} from '@/service/debug' import Avatar from '@/app/components/base/avatar' -import { useAppContext } from '@/context/app-context' -import { ModelFeatureEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' -import { useFeatures } from '@/app/components/base/features/hooks' -import type { InputForm } from '@/app/components/base/chat/chat/type' -import { getLastAnswer } from '@/app/components/base/chat/utils' +import {useAppContext} from '@/context/app-context' +import {ModelFeatureEnum} from '@/app/components/header/account-setting/model-provider-page/declarations' +import {useFeatures} from '@/app/components/base/features/hooks' +import type {InputForm} from '@/app/components/base/chat/chat/type' +import {getLastAnswer} from '@/app/components/base/chat/utils' type ChatItemProps = { modelAndParameter: ModelAndParameter diff --git a/web/app/components/app/configuration/debug/debug-with-multiple-model/context.tsx b/web/app/components/app/configuration/debug/debug-with-multiple-model/context.tsx index d95faf7ae92428..f2836f3e76fdb5 100644 --- a/web/app/components/app/configuration/debug/debug-with-multiple-model/context.tsx +++ b/web/app/components/app/configuration/debug/debug-with-multiple-model/context.tsx @@ -1,7 +1,7 @@ 'use client' -import { createContext, useContext } from 'use-context-selector' -import type { ModelAndParameter } from '../types' +import {createContext, useContext} from 'use-context-selector' +import type {ModelAndParameter} from '../types' export type DebugWithMultipleModelContextType = { multipleModelConfigs: ModelAndParameter[] diff --git a/web/app/components/app/configuration/debug/debug-with-multiple-model/debug-item.tsx b/web/app/components/app/configuration/debug/debug-with-multiple-model/debug-item.tsx index 9f6da8a0988cfb..d0a75603f748e0 100644 --- a/web/app/components/app/configuration/debug/debug-with-multiple-model/debug-item.tsx +++ b/web/app/components/app/configuration/debug/debug-with-multiple-model/debug-item.tsx @@ -1,16 +1,16 @@ -import type { CSSProperties, FC } from 'react' -import { useTranslation } from 'react-i18next' -import { memo } from 'react' -import type { ModelAndParameter } from '../types' +import type {CSSProperties, FC} from 'react' +import {memo} from 'react' +import {useTranslation} from 'react-i18next' +import type {ModelAndParameter} from '../types' import ModelParameterTrigger from './model-parameter-trigger' import ChatItem from './chat-item' import TextGenerationItem from './text-generation-item' -import { useDebugWithMultipleModelContext } from './context' -import { useDebugConfigurationContext } from '@/context/debug-configuration' +import {useDebugWithMultipleModelContext} from './context' +import {useDebugConfigurationContext} from '@/context/debug-configuration' +import type {Item} from '@/app/components/base/dropdown' import Dropdown from '@/app/components/base/dropdown' -import type { Item } from '@/app/components/base/dropdown' -import { useProviderContext } from '@/context/provider-context' -import { ModelStatusEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' +import {useProviderContext} from '@/context/provider-context' +import {ModelStatusEnum} from '@/app/components/header/account-setting/model-provider-page/declarations' type DebugItemProps = { modelAndParameter: ModelAndParameter diff --git a/web/app/components/app/configuration/debug/debug-with-multiple-model/index.tsx b/web/app/components/app/configuration/debug/debug-with-multiple-model/index.tsx index d5662cb49cbc11..6e3a37b18754c6 100644 --- a/web/app/components/app/configuration/debug/debug-with-multiple-model/index.tsx +++ b/web/app/components/app/configuration/debug/debug-with-multiple-model/index.tsx @@ -1,23 +1,16 @@ -import type { FC } from 'react' -import { - memo, - useCallback, - useMemo, -} from 'react' -import { APP_CHAT_WITH_MULTIPLE_MODEL } from '../types' +import type {FC} from 'react' +import {memo, useCallback, useMemo,} from 'react' +import {APP_CHAT_WITH_MULTIPLE_MODEL} from '../types' import DebugItem from './debug-item' -import { - DebugWithMultipleModelContextProvider, - useDebugWithMultipleModelContext, -} from './context' -import type { DebugWithMultipleModelContextType } from './context' -import { useEventEmitterContextContext } from '@/context/event-emitter' +import type {DebugWithMultipleModelContextType} from './context' +import {DebugWithMultipleModelContextProvider, useDebugWithMultipleModelContext,} from './context' +import {useEventEmitterContextContext} from '@/context/event-emitter' import ChatInputArea from '@/app/components/base/chat/chat/chat-input-area' -import { useDebugConfigurationContext } from '@/context/debug-configuration' -import { useFeatures } from '@/app/components/base/features/hooks' -import { useStore as useAppStore } from '@/app/components/app/store' -import type { FileEntity } from '@/app/components/base/file-uploader/types' -import type { InputForm } from '@/app/components/base/chat/chat/type' +import {useDebugConfigurationContext} from '@/context/debug-configuration' +import {useFeatures} from '@/app/components/base/features/hooks' +import {useStore as useAppStore} from '@/app/components/app/store' +import type {FileEntity} from '@/app/components/base/file-uploader/types' +import type {InputForm} from '@/app/components/base/chat/chat/type' const DebugWithMultipleModel = () => { const { diff --git a/web/app/components/app/configuration/debug/debug-with-multiple-model/model-parameter-trigger.tsx b/web/app/components/app/configuration/debug/debug-with-multiple-model/model-parameter-trigger.tsx index 155ebe21ca6ebe..dde30afe8bbf1c 100644 --- a/web/app/components/app/configuration/debug/debug-with-multiple-model/model-parameter-trigger.tsx +++ b/web/app/components/app/configuration/debug/debug-with-multiple-model/model-parameter-trigger.tsx @@ -1,9 +1,9 @@ -import type { FC } from 'react' -import { memo } from 'react' -import { useTranslation } from 'react-i18next' -import { RiArrowDownSLine } from '@remixicon/react' -import type { ModelAndParameter } from '../types' -import { useDebugWithMultipleModelContext } from './context' +import type {FC} from 'react' +import {memo} from 'react' +import {useTranslation} from 'react-i18next' +import {RiArrowDownSLine} from '@remixicon/react' +import type {ModelAndParameter} from '../types' +import {useDebugWithMultipleModelContext} from './context' import ModelParameterModal from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal' import ModelIcon from '@/app/components/header/account-setting/model-provider-page/model-icon' import ModelName from '@/app/components/header/account-setting/model-provider-page/model-name' @@ -11,11 +11,11 @@ import { MODEL_STATUS_TEXT, ModelStatusEnum, } from '@/app/components/header/account-setting/model-provider-page/declarations' -import { useDebugConfigurationContext } from '@/context/debug-configuration' -import { CubeOutline } from '@/app/components/base/icons/src/vender/line/shapes' +import {useDebugConfigurationContext} from '@/context/debug-configuration' +import {CubeOutline} from '@/app/components/base/icons/src/vender/line/shapes' import Tooltip from '@/app/components/base/tooltip' -import { AlertTriangle } from '@/app/components/base/icons/src/vender/line/alertsAndFeedback' -import { useLanguage } from '@/app/components/header/account-setting/model-provider-page/hooks' +import {AlertTriangle} from '@/app/components/base/icons/src/vender/line/alertsAndFeedback' +import {useLanguage} from '@/app/components/header/account-setting/model-provider-page/hooks' type ModelParameterTriggerProps = { modelAndParameter: ModelAndParameter diff --git a/web/app/components/app/configuration/debug/debug-with-multiple-model/text-generation-item.tsx b/web/app/components/app/configuration/debug/debug-with-multiple-model/text-generation-item.tsx index 57c8f83f3f58db..4430f8749e08dc 100644 --- a/web/app/components/app/configuration/debug/debug-with-multiple-model/text-generation-item.tsx +++ b/web/app/components/app/configuration/debug/debug-with-multiple-model/text-generation-item.tsx @@ -1,19 +1,16 @@ -import type { FC } from 'react' -import { memo } from 'react' -import type { ModelAndParameter } from '../types' -import { APP_CHAT_WITH_MULTIPLE_MODEL } from '../types' -import type { - OnSend, - TextGenerationConfig, -} from '@/app/components/base/text-generation/types' -import { useTextGeneration } from '@/app/components/base/text-generation/hooks' +import type {FC} from 'react' +import {memo} from 'react' +import type {ModelAndParameter} from '../types' +import {APP_CHAT_WITH_MULTIPLE_MODEL} from '../types' +import type {OnSend, TextGenerationConfig,} from '@/app/components/base/text-generation/types' +import {useTextGeneration} from '@/app/components/base/text-generation/hooks' import TextGeneration from '@/app/components/app/text-generate/item' -import { useDebugConfigurationContext } from '@/context/debug-configuration' -import { promptVariablesToUserInputsForm } from '@/utils/model-config' -import { TransferMethod } from '@/app/components/base/chat/types' -import { useEventEmitterContextContext } from '@/context/event-emitter' -import { useProviderContext } from '@/context/provider-context' -import { useFeatures } from '@/app/components/base/features/hooks' +import {useDebugConfigurationContext} from '@/context/debug-configuration' +import {promptVariablesToUserInputsForm} from '@/utils/model-config' +import {TransferMethod} from '@/app/components/base/chat/types' +import {useEventEmitterContextContext} from '@/context/event-emitter' +import {useProviderContext} from '@/context/provider-context' +import {useFeatures} from '@/app/components/base/features/hooks' type TextGenerationItemProps = { modelAndParameter: ModelAndParameter diff --git a/web/app/components/app/configuration/debug/debug-with-single-model/index.tsx b/web/app/components/app/configuration/debug/debug-with-single-model/index.tsx index 2cbfe91f169d4b..1e0b666191f904 100644 --- a/web/app/components/app/configuration/debug/debug-with-single-model/index.tsx +++ b/web/app/components/app/configuration/debug/debug-with-single-model/index.tsx @@ -1,31 +1,18 @@ -import { - forwardRef, - memo, - useCallback, - useImperativeHandle, - useMemo, -} from 'react' -import { - useConfigFromDebugContext, - useFormattingChangedSubscription, -} from '../hooks' +import {forwardRef, memo, useCallback, useImperativeHandle, useMemo,} from 'react' +import {useConfigFromDebugContext, useFormattingChangedSubscription,} from '../hooks' import Chat from '@/app/components/base/chat/chat' -import { useChat } from '@/app/components/base/chat/chat/hooks' -import { useDebugConfigurationContext } from '@/context/debug-configuration' -import type { ChatConfig, ChatItem, OnSend } from '@/app/components/base/chat/types' -import { useProviderContext } from '@/context/provider-context' -import { - fetchConversationMessages, - fetchSuggestedQuestions, - stopChatMessageResponding, -} from '@/service/debug' +import {useChat} from '@/app/components/base/chat/chat/hooks' +import {useDebugConfigurationContext} from '@/context/debug-configuration' +import type {ChatConfig, ChatItem, OnSend} from '@/app/components/base/chat/types' +import {useProviderContext} from '@/context/provider-context' +import {fetchConversationMessages, fetchSuggestedQuestions, stopChatMessageResponding,} from '@/service/debug' import Avatar from '@/app/components/base/avatar' -import { useAppContext } from '@/context/app-context' -import { ModelFeatureEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' -import { useStore as useAppStore } from '@/app/components/app/store' -import { useFeatures } from '@/app/components/base/features/hooks' -import { getLastAnswer } from '@/app/components/base/chat/utils' -import type { InputForm } from '@/app/components/base/chat/chat/type' +import {useAppContext} from '@/context/app-context' +import {ModelFeatureEnum} from '@/app/components/header/account-setting/model-provider-page/declarations' +import {useStore as useAppStore} from '@/app/components/app/store' +import {useFeatures} from '@/app/components/base/features/hooks' +import {getLastAnswer} from '@/app/components/base/chat/utils' +import type {InputForm} from '@/app/components/base/chat/chat/type' type DebugWithSingleModelProps = { checkCanSend?: () => boolean diff --git a/web/app/components/app/configuration/debug/hooks.tsx b/web/app/components/app/configuration/debug/hooks.tsx index 12022e706a64ab..2ba380ec08962f 100644 --- a/web/app/components/app/configuration/debug/hooks.tsx +++ b/web/app/components/app/configuration/debug/hooks.tsx @@ -1,23 +1,11 @@ -import { - useCallback, - useRef, - useState, -} from 'react' -import type { - DebugWithSingleOrMultipleModelConfigs, - ModelAndParameter, -} from './types' -import { ORCHESTRATE_CHANGED } from './types' -import type { - ChatConfig, - ChatItem, -} from '@/app/components/base/chat/types' -import { - AgentStrategy, -} from '@/types/app' -import { promptVariablesToUserInputsForm } from '@/utils/model-config' -import { useDebugConfigurationContext } from '@/context/debug-configuration' -import { useEventEmitterContextContext } from '@/context/event-emitter' +import {useCallback, useRef, useState,} from 'react' +import type {DebugWithSingleOrMultipleModelConfigs, ModelAndParameter,} from './types' +import {ORCHESTRATE_CHANGED} from './types' +import type {ChatConfig, ChatItem,} from '@/app/components/base/chat/types' +import {AgentStrategy,} from '@/types/app' +import {promptVariablesToUserInputsForm} from '@/utils/model-config' +import {useDebugConfigurationContext} from '@/context/debug-configuration' +import {useEventEmitterContextContext} from '@/context/event-emitter' export const useDebugWithSingleOrMultipleModel = (appId: string) => { const localeDebugWithSingleOrMultipleModelConfigs = localStorage.getItem('app-debug-with-single-or-multiple-models') diff --git a/web/app/components/app/configuration/debug/index.tsx b/web/app/components/app/configuration/debug/index.tsx index 480bd782aec752..94ee4967ce0eeb 100644 --- a/web/app/components/app/configuration/debug/index.tsx +++ b/web/app/components/app/configuration/debug/index.tsx @@ -1,52 +1,47 @@ 'use client' -import type { FC } from 'react' -import { useTranslation } from 'react-i18next' -import React, { useCallback, useEffect, useRef, useState } from 'react' -import produce, { setAutoFreeze } from 'immer' -import { useBoolean } from 'ahooks' -import { - RiAddLine, - RiEqualizer2Line, - RiSparklingFill, -} from '@remixicon/react' -import { useContext } from 'use-context-selector' -import { useShallow } from 'zustand/react/shallow' +import type {FC} from 'react' +import React, {useCallback, useEffect, useRef, useState} from 'react' +import {useTranslation} from 'react-i18next' +import produce, {setAutoFreeze} from 'immer' +import {useBoolean} from 'ahooks' +import {RiAddLine, RiEqualizer2Line, RiSparklingFill,} from '@remixicon/react' +import {useContext} from 'use-context-selector' +import {useShallow} from 'zustand/react/shallow' import HasNotSetAPIKEY from '../base/warning-mask/has-not-set-api' import FormattingChanged from '../base/warning-mask/formatting-changed' import GroupName from '../base/group-name' import CannotQueryDataset from '../base/warning-mask/cannot-query-dataset' import DebugWithMultipleModel from './debug-with-multiple-model' +import type {DebugWithSingleModelRefType} from './debug-with-single-model' import DebugWithSingleModel from './debug-with-single-model' -import type { DebugWithSingleModelRefType } from './debug-with-single-model' -import type { ModelAndParameter } from './types' -import { - APP_CHAT_WITH_MULTIPLE_MODEL, - APP_CHAT_WITH_MULTIPLE_MODEL_RESTART, -} from './types' -import { AppType, ModelModeType, TransferMethod } from '@/types/app' +import type {ModelAndParameter} from './types' +import {APP_CHAT_WITH_MULTIPLE_MODEL, APP_CHAT_WITH_MULTIPLE_MODEL_RESTART,} from './types' +import type {ModelConfig as BackendModelConfig, VisionFile, VisionSettings} from '@/types/app' +import {AppType, ModelModeType, TransferMethod} from '@/types/app' import ChatUserInput from '@/app/components/app/configuration/debug/chat-user-input' import PromptValuePanel from '@/app/components/app/configuration/prompt-value-panel' import ConfigContext from '@/context/debug-configuration' -import { ToastContext } from '@/app/components/base/toast' -import { sendCompletionMessage } from '@/service/debug' +import {ToastContext} from '@/app/components/base/toast' +import {sendCompletionMessage} from '@/service/debug' import Button from '@/app/components/base/button' -import { RefreshCcw01 } from '@/app/components/base/icons/src/vender/line/arrows' +import {RefreshCcw01} from '@/app/components/base/icons/src/vender/line/arrows' import TooltipPlus from '@/app/components/base/tooltip' -import ActionButton, { ActionButtonState } from '@/app/components/base/action-button' -import type { ModelConfig as BackendModelConfig, VisionFile, VisionSettings } from '@/types/app' -import { promptVariablesToUserInputsForm } from '@/utils/model-config' +import ActionButton, {ActionButtonState} from '@/app/components/base/action-button' +import {promptVariablesToUserInputsForm} from '@/utils/model-config' import TextGeneration from '@/app/components/app/text-generate/item' -import { IS_CE_EDITION } from '@/config' -import type { Inputs } from '@/models/debug' -import { useDefaultModel } from '@/app/components/header/account-setting/model-provider-page/hooks' -import { ModelFeatureEnum, ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' -import type { ModelParameterModalProps } from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal' -import { useEventEmitterContextContext } from '@/context/event-emitter' -import { useProviderContext } from '@/context/provider-context' +import {IS_CE_EDITION} from '@/config' +import type {Inputs} from '@/models/debug' +import {useDefaultModel} from '@/app/components/header/account-setting/model-provider-page/hooks' +import {ModelFeatureEnum, ModelTypeEnum} from '@/app/components/header/account-setting/model-provider-page/declarations' +import type { + ModelParameterModalProps +} from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal' +import {useEventEmitterContextContext} from '@/context/event-emitter' +import {useProviderContext} from '@/context/provider-context' import AgentLogModal from '@/app/components/base/agent-log-modal' import PromptLogModal from '@/app/components/base/prompt-log-modal' -import { useStore as useAppStore } from '@/app/components/app/store' -import { useFeatures, useFeaturesStore } from '@/app/components/base/features/hooks' +import {useStore as useAppStore} from '@/app/components/app/store' +import {useFeatures, useFeaturesStore} from '@/app/components/base/features/hooks' type IDebug = { isAPIKeySet: boolean diff --git a/web/app/components/app/configuration/features/chat-group/opening-statement/index.tsx b/web/app/components/app/configuration/features/chat-group/opening-statement/index.tsx index 6d16660e81b65b..3e5c6776e2936e 100644 --- a/web/app/components/app/configuration/features/chat-group/opening-statement/index.tsx +++ b/web/app/components/app/configuration/features/chat-group/opening-statement/index.tsx @@ -1,25 +1,22 @@ /* eslint-disable multiline-ternary */ 'use client' -import type { FC } from 'react' -import React, { useEffect, useRef, useState } from 'react' -import { - RiAddLine, - RiDeleteBinLine, -} from '@remixicon/react' -import { useContext } from 'use-context-selector' +import type {FC} from 'react' +import React, {useEffect, useRef, useState} from 'react' +import {RiAddLine, RiDeleteBinLine,} from '@remixicon/react' +import {useContext} from 'use-context-selector' import produce from 'immer' -import { useTranslation } from 'react-i18next' -import { useBoolean } from 'ahooks' -import { ReactSortable } from 'react-sortablejs' +import {useTranslation} from 'react-i18next' +import {useBoolean} from 'ahooks' +import {ReactSortable} from 'react-sortablejs' import cn from '@/utils/classnames' import ConfigContext from '@/context/debug-configuration' import Panel from '@/app/components/app/configuration/base/feature-panel' import Button from '@/app/components/base/button' import OperationBtn from '@/app/components/app/configuration/base/operation-btn' -import { getInputKeys } from '@/app/components/base/block-input' +import {getInputKeys} from '@/app/components/base/block-input' import ConfirmAddVar from '@/app/components/app/configuration/config-prompt/confirm-add-var' -import { getNewVar } from '@/utils/var' -import { varHighlightHTML } from '@/app/components/app/configuration/base/var-highlight' +import {getNewVar} from '@/utils/var' +import {varHighlightHTML} from '@/app/components/app/configuration/base/var-highlight' import Toast from '@/app/components/base/toast' const MAX_QUESTION_NUM = 10 diff --git a/web/app/components/app/configuration/features/experience-enhance-group/index.tsx b/web/app/components/app/configuration/features/experience-enhance-group/index.tsx index 4a629a6b0e4995..44cc6bc9839650 100644 --- a/web/app/components/app/configuration/features/experience-enhance-group/index.tsx +++ b/web/app/components/app/configuration/features/experience-enhance-group/index.tsx @@ -1,7 +1,7 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' -import { useTranslation } from 'react-i18next' +import {useTranslation} from 'react-i18next' import GroupName from '../../base/group-name' import TextToSpeech from '../chat-group/text-to-speech' import MoreLikeThis from './more-like-this' diff --git a/web/app/components/app/configuration/features/experience-enhance-group/more-like-this/index.tsx b/web/app/components/app/configuration/features/experience-enhance-group/more-like-this/index.tsx index f63ed1c25a9e87..416a4d5adf5aa5 100644 --- a/web/app/components/app/configuration/features/experience-enhance-group/more-like-this/index.tsx +++ b/web/app/components/app/configuration/features/experience-enhance-group/more-like-this/index.tsx @@ -1,9 +1,9 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' -import { useTranslation } from 'react-i18next' -import { XMarkIcon } from '@heroicons/react/24/outline' -import { useLocalStorageState } from 'ahooks' +import {useTranslation} from 'react-i18next' +import {XMarkIcon} from '@heroicons/react/24/outline' +import {useLocalStorageState} from 'ahooks' import MoreLikeThisIcon from '../../../base/icons/more-like-this-icon' import Panel from '@/app/components/app/configuration/base/feature-panel' diff --git a/web/app/components/app/configuration/hooks/use-advanced-prompt-config.ts b/web/app/components/app/configuration/hooks/use-advanced-prompt-config.ts index 193ac87dd0c918..4e109185e098aa 100644 --- a/web/app/components/app/configuration/hooks/use-advanced-prompt-config.ts +++ b/web/app/components/app/configuration/hooks/use-advanced-prompt-config.ts @@ -1,13 +1,18 @@ -import { useState } from 'react' -import { clone } from 'lodash-es' +import {useState} from 'react' +import {clone} from 'lodash-es' import produce from 'immer' -import type { ChatPromptConfig, CompletionPromptConfig, ConversationHistoriesRole, PromptItem } from '@/models/debug' -import { PromptMode } from '@/models/debug' -import { ModelModeType } from '@/types/app' -import { DEFAULT_CHAT_PROMPT_CONFIG, DEFAULT_COMPLETION_PROMPT_CONFIG } from '@/config' -import { PRE_PROMPT_PLACEHOLDER_TEXT, checkHasContextBlock, checkHasHistoryBlock, checkHasQueryBlock } from '@/app/components/base/prompt-editor/constants' -import { fetchPromptTemplate } from '@/service/debug' -import type { FormValue } from '@/app/components/header/account-setting/model-provider-page/declarations' +import type {ChatPromptConfig, CompletionPromptConfig, ConversationHistoriesRole, PromptItem} from '@/models/debug' +import {PromptMode} from '@/models/debug' +import {ModelModeType} from '@/types/app' +import {DEFAULT_CHAT_PROMPT_CONFIG, DEFAULT_COMPLETION_PROMPT_CONFIG} from '@/config' +import { + checkHasContextBlock, + checkHasHistoryBlock, + checkHasQueryBlock, + PRE_PROMPT_PLACEHOLDER_TEXT +} from '@/app/components/base/prompt-editor/constants' +import {fetchPromptTemplate} from '@/service/debug' +import type {FormValue} from '@/app/components/header/account-setting/model-provider-page/declarations' type Param = { appMode: string diff --git a/web/app/components/app/configuration/index.tsx b/web/app/components/app/configuration/index.tsx index d3719a7696f753..7766061d7930bb 100644 --- a/web/app/components/app/configuration/index.tsx +++ b/web/app/components/app/configuration/index.tsx @@ -1,15 +1,15 @@ 'use client' -import type { FC } from 'react' -import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react' +import type {FC} from 'react' +import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react' import useSWR from 'swr' -import { useTranslation } from 'react-i18next' -import { useContext } from 'use-context-selector' -import { usePathname } from 'next/navigation' +import {useTranslation} from 'react-i18next' +import {useContext} from 'use-context-selector' +import {usePathname} from 'next/navigation' import produce from 'immer' -import { useBoolean, useGetState } from 'ahooks' -import { clone, isEqual } from 'lodash-es' -import { CodeBracketIcon } from '@heroicons/react/20/solid' -import { useShallow } from 'zustand/react/shallow' +import {useBoolean, useGetState} from 'ahooks' +import {clone, isEqual} from 'lodash-es' +import {CodeBracketIcon} from '@heroicons/react/20/solid' +import {useShallow} from 'zustand/react/shallow' import AgentSettingButton from '@/app/components/app/configuration/config/agent-setting-button' import useAdvancedPromptConfig from '@/app/components/app/configuration/hooks/use-advanced-prompt-config' import EditHistoryModal from '@/app/components/app/configuration/config-prompt/conversation-history/edit-modal' @@ -17,7 +17,7 @@ import { useDebugWithSingleOrMultipleModel, useFormattingChangedDispatcher, } from '@/app/components/app/configuration/debug/hooks' -import type { ModelAndParameter } from '@/app/components/app/configuration/debug/types' +import type {ModelAndParameter} from '@/app/components/app/configuration/debug/types' import Button from '@/app/components/base/button' import Loading from '@/app/components/base/loading' import AppPublisher from '@/app/components/app/app-publisher/features-wrapper' @@ -32,45 +32,51 @@ import type { PromptVariable, TextToSpeechConfig, } from '@/models/debug' -import type { ExternalDataTool } from '@/models/common' -import type { DataSet } from '@/models/datasets' -import type { ModelConfig as BackendModelConfig, VisionSettings } from '@/types/app' +import {PromptMode} from '@/models/debug' +import type {ExternalDataTool} from '@/models/common' +import type {DataSet} from '@/models/datasets' +import type {ModelConfig as BackendModelConfig, VisionSettings} from '@/types/app' +import {AgentStrategy, AppType, ModelModeType, Resolution, RETRIEVE_TYPE, TransferMethod} from '@/types/app' import ConfigContext from '@/context/debug-configuration' import Config from '@/app/components/app/configuration/config' import Debug from '@/app/components/app/configuration/debug' import Confirm from '@/app/components/base/confirm' -import { ModelFeatureEnum, ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' -import { ToastContext } from '@/app/components/base/toast' -import { fetchAppDetail, updateAppModelConfig } from '@/service/apps' -import { promptVariablesToUserInputsForm, userInputsFormToPromptVariables } from '@/utils/model-config' -import { fetchDatasets } from '@/service/datasets' -import { useProviderContext } from '@/context/provider-context' -import { AgentStrategy, AppType, ModelModeType, RETRIEVE_TYPE, Resolution, TransferMethod } from '@/types/app' -import { PromptMode } from '@/models/debug' -import { ANNOTATION_DEFAULT, DATASET_DEFAULT, DEFAULT_AGENT_SETTING, DEFAULT_CHAT_PROMPT_CONFIG, DEFAULT_COMPLETION_PROMPT_CONFIG } from '@/config' +import type {FormValue} from '@/app/components/header/account-setting/model-provider-page/declarations' +import {ModelFeatureEnum, ModelTypeEnum} from '@/app/components/header/account-setting/model-provider-page/declarations' +import {ToastContext} from '@/app/components/base/toast' +import {fetchAppDetail, updateAppModelConfig} from '@/service/apps' +import {promptVariablesToUserInputsForm, userInputsFormToPromptVariables} from '@/utils/model-config' +import {fetchDatasets} from '@/service/datasets' +import {useProviderContext} from '@/context/provider-context' +import { + ANNOTATION_DEFAULT, + DATASET_DEFAULT, + DEFAULT_AGENT_SETTING, + DEFAULT_CHAT_PROMPT_CONFIG, + DEFAULT_COMPLETION_PROMPT_CONFIG +} from '@/config' import SelectDataSet from '@/app/components/app/configuration/dataset-config/select-dataset' -import { useModalContext } from '@/context/modal-context' -import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints' +import {useModalContext} from '@/context/modal-context' +import useBreakpoints, {MediaType} from '@/hooks/use-breakpoints' import Drawer from '@/app/components/base/drawer' import ModelParameterModal from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal' -import type { FormValue } from '@/app/components/header/account-setting/model-provider-page/declarations' import { useModelListAndDefaultModelAndCurrentProviderAndModel, useTextGenerationCurrentProviderAndModelAndModelList, } from '@/app/components/header/account-setting/model-provider-page/hooks' -import { fetchCollectionList } from '@/service/tools' -import { type Collection } from '@/app/components/tools/types' -import { useStore as useAppStore } from '@/app/components/app/store' +import {fetchCollectionList} from '@/service/tools' +import {type Collection} from '@/app/components/tools/types' +import {useStore as useAppStore} from '@/app/components/app/store' import { getMultipleRetrievalConfig, getSelectedDatasetsMode, } from '@/app/components/workflow/nodes/knowledge-retrieval/utils' -import { FeaturesProvider } from '@/app/components/base/features' -import type { Features as FeaturesData, FileUpload } from '@/app/components/base/features/types' -import { FILE_EXTS } from '@/app/components/base/prompt-editor/constants' -import { SupportUploadFileTypes } from '@/app/components/workflow/types' +import {FeaturesProvider} from '@/app/components/base/features' +import type {Features as FeaturesData, FileUpload} from '@/app/components/base/features/types' +import {FILE_EXTS} from '@/app/components/base/prompt-editor/constants' +import {SupportUploadFileTypes} from '@/app/components/workflow/types' import NewFeaturePanel from '@/app/components/base/features/new-feature-panel' -import { fetchFileUploadConfig } from '@/service/common' +import {fetchFileUploadConfig} from '@/service/common' type PublishConfig = { modelConfig: ModelConfig diff --git a/web/app/components/app/configuration/toolbox/annotation/config-param.tsx b/web/app/components/app/configuration/toolbox/annotation/config-param.tsx index e418a76c344ccd..8a88f8679d14c4 100644 --- a/web/app/components/app/configuration/toolbox/annotation/config-param.tsx +++ b/web/app/components/app/configuration/toolbox/annotation/config-param.tsx @@ -1,18 +1,18 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' -import { useTranslation } from 'react-i18next' -import { useContext } from 'use-context-selector' -import { usePathname, useRouter } from 'next/navigation' +import {useTranslation} from 'react-i18next' +import {useContext} from 'use-context-selector' +import {usePathname, useRouter} from 'next/navigation' import ConfigParamModal from './config-param-modal' import Panel from '@/app/components/app/configuration/base/feature-panel' -import { MessageFast } from '@/app/components/base/icons/src/vender/solid/communication' +import {MessageFast} from '@/app/components/base/icons/src/vender/solid/communication' import Tooltip from '@/app/components/base/tooltip' -import { LinkExternal02, Settings04 } from '@/app/components/base/icons/src/vender/line/general' +import {LinkExternal02, Settings04} from '@/app/components/base/icons/src/vender/line/general' import ConfigContext from '@/context/debug-configuration' -import type { EmbeddingModelConfig } from '@/app/components/app/annotation/type' -import { fetchAnnotationConfig, updateAnnotationScore } from '@/service/annotation' -import type { AnnotationReplyConfig as AnnotationReplyConfigType } from '@/models/debug' +import type {EmbeddingModelConfig} from '@/app/components/app/annotation/type' +import {fetchAnnotationConfig, updateAnnotationScore} from '@/service/annotation' +import type {AnnotationReplyConfig as AnnotationReplyConfigType} from '@/models/debug' type Props = { onEmbeddingChange: (embeddingModel: EmbeddingModelConfig) => void diff --git a/web/app/components/app/configuration/toolbox/index.tsx b/web/app/components/app/configuration/toolbox/index.tsx index 00ea301a42d8a5..e5b600afec1093 100644 --- a/web/app/components/app/configuration/toolbox/index.tsx +++ b/web/app/components/app/configuration/toolbox/index.tsx @@ -1,12 +1,12 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' -import { useTranslation } from 'react-i18next' +import {useTranslation} from 'react-i18next' import GroupName from '../base/group-name' import Moderation from './moderation' import Annotation from './annotation/config-param' -import type { EmbeddingModelConfig } from '@/app/components/app/annotation/type' +import type {EmbeddingModelConfig} from '@/app/components/app/annotation/type' export type ToolboxProps = { showModerationSettings: boolean diff --git a/web/app/components/app/configuration/tools/external-data-tool-modal.tsx b/web/app/components/app/configuration/tools/external-data-tool-modal.tsx index eefdd4514ceb40..d718492aae69db 100644 --- a/web/app/components/app/configuration/tools/external-data-tool-modal.tsx +++ b/web/app/components/app/configuration/tools/external-data-tool-modal.tsx @@ -1,23 +1,20 @@ -import type { FC } from 'react' -import { useState } from 'react' +import type {FC} from 'react' +import {useState} from 'react' import useSWR from 'swr' -import { useContext } from 'use-context-selector' -import { useTranslation } from 'react-i18next' +import {useContext} from 'use-context-selector' +import {useTranslation} from 'react-i18next' import FormGeneration from '@/app/components/base/features/new-feature-panel/moderation/form-generation' import Modal from '@/app/components/base/modal' import Button from '@/app/components/base/button' import EmojiPicker from '@/app/components/base/emoji-picker' import ApiBasedExtensionSelector from '@/app/components/header/account-setting/api-based-extension-page/selector' -import { BookOpen01 } from '@/app/components/base/icons/src/vender/line/education' -import { fetchCodeBasedExtensionList } from '@/service/common' -import { SimpleSelect } from '@/app/components/base/select' +import {BookOpen01} from '@/app/components/base/icons/src/vender/line/education' +import {fetchCodeBasedExtensionList} from '@/service/common' +import {SimpleSelect} from '@/app/components/base/select' import I18n from '@/context/i18n' -import { LanguagesSupported } from '@/i18n/language' -import type { - CodeBasedExtensionItem, - ExternalDataTool, -} from '@/models/common' -import { useToastContext } from '@/app/components/base/toast' +import {LanguagesSupported} from '@/i18n/language' +import type {CodeBasedExtensionItem, ExternalDataTool,} from '@/models/common' +import {useToastContext} from '@/app/components/base/toast' import AppIcon from '@/app/components/base/app-icon' const systemTypes = ['api'] diff --git a/web/app/components/app/configuration/tools/index.tsx b/web/app/components/app/configuration/tools/index.tsx index 03525d7232d3c7..c4de45ce57a158 100644 --- a/web/app/components/app/configuration/tools/index.tsx +++ b/web/app/components/app/configuration/tools/index.tsx @@ -1,24 +1,18 @@ // abandoned -import { useState } from 'react' -import { useTranslation } from 'react-i18next' +import {useState} from 'react' +import {useTranslation} from 'react-i18next' import copy from 'copy-to-clipboard' -import { useContext } from 'use-context-selector' -import { - RiAddLine, - RiArrowDownSLine, - RiDeleteBinLine, -} from '@remixicon/react' +import {useContext} from 'use-context-selector' +import {RiAddLine, RiArrowDownSLine, RiDeleteBinLine,} from '@remixicon/react' import ConfigContext from '@/context/debug-configuration' import Switch from '@/app/components/base/switch' import Tooltip from '@/app/components/base/tooltip' -import { Tool03 } from '@/app/components/base/icons/src/vender/solid/general' -import { - Settings01, -} from '@/app/components/base/icons/src/vender/line/general' -import { useModalContext } from '@/context/modal-context' -import type { ExternalDataTool } from '@/models/common' +import {Tool03} from '@/app/components/base/icons/src/vender/solid/general' +import {Settings01,} from '@/app/components/base/icons/src/vender/line/general' +import {useModalContext} from '@/context/modal-context' +import type {ExternalDataTool} from '@/models/common' import AppIcon from '@/app/components/base/app-icon' -import { useToastContext } from '@/app/components/base/toast' +import {useToastContext} from '@/app/components/base/toast' const Tools = () => { const { t } = useTranslation() diff --git a/web/app/components/app/log/filter.tsx b/web/app/components/app/log/filter.tsx index 787b7405c1aa5d..799df9b74ac429 100644 --- a/web/app/components/app/log/filter.tsx +++ b/web/app/components/app/log/filter.tsx @@ -1,16 +1,17 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' -import { useTranslation } from 'react-i18next' +import {useTranslation} from 'react-i18next' import useSWR from 'swr' import dayjs from 'dayjs' -import { RiCalendarLine } from '@remixicon/react' +import {RiCalendarLine} from '@remixicon/react' import quarterOfYear from 'dayjs/plugin/quarterOfYear' -import type { QueryParam } from './index' +import type {QueryParam} from './index' import Chip from '@/app/components/base/chip' import Input from '@/app/components/base/input' import Sort from '@/app/components/base/sort' -import { fetchAnnotationsCount } from '@/service/log' +import {fetchAnnotationsCount} from '@/service/log' + dayjs.extend(quarterOfYear) const today = dayjs() diff --git a/web/app/components/app/log/index.tsx b/web/app/components/app/log/index.tsx index 592233facd8397..0d61eb84df81c3 100644 --- a/web/app/components/app/log/index.tsx +++ b/web/app/components/app/log/index.tsx @@ -1,20 +1,21 @@ 'use client' -import type { FC, SVGProps } from 'react' -import React, { useState } from 'react' +import type {FC, SVGProps} from 'react' +import React, {useState} from 'react' import useSWR from 'swr' import Link from 'next/link' -import { usePathname } from 'next/navigation' -import { useDebounce } from 'ahooks' -import { omit } from 'lodash-es' +import {usePathname} from 'next/navigation' +import {useDebounce} from 'ahooks' +import {omit} from 'lodash-es' import dayjs from 'dayjs' -import { Trans, useTranslation } from 'react-i18next' +import {Trans, useTranslation} from 'react-i18next' import List from './list' -import Filter, { TIME_PERIOD_MAPPING } from './filter' +import Filter, {TIME_PERIOD_MAPPING} from './filter' import Pagination from '@/app/components/base/pagination' import Loading from '@/app/components/base/loading' -import { fetchChatConversations, fetchCompletionConversations } from '@/service/log' -import { APP_PAGE_LIMIT } from '@/config' -import type { App, AppMode } from '@/types/app' +import {fetchChatConversations, fetchCompletionConversations} from '@/service/log' +import {APP_PAGE_LIMIT} from '@/config' +import type {App, AppMode} from '@/types/app' + export type ILogsProps = { appDetail: App } diff --git a/web/app/components/app/log/list.tsx b/web/app/components/app/log/list.tsx index 383aeb1492c769..fcd90bb38d9597 100644 --- a/web/app/components/app/log/list.tsx +++ b/web/app/components/app/log/list.tsx @@ -1,45 +1,57 @@ 'use client' -import type { FC } from 'react' -import React, { useCallback, useEffect, useRef, useState } from 'react' +import type {FC} from 'react' +import React, {useCallback, useEffect, useRef, useState} from 'react' import useSWR from 'swr' -import { - HandThumbDownIcon, - HandThumbUpIcon, -} from '@heroicons/react/24/outline' -import { RiCloseLine, RiEditFill } from '@remixicon/react' -import { get } from 'lodash-es' +import {HandThumbDownIcon, HandThumbUpIcon,} from '@heroicons/react/24/outline' +import {RiCloseLine, RiEditFill} from '@remixicon/react' +import {get} from 'lodash-es' import InfiniteScroll from 'react-infinite-scroll-component' import dayjs from 'dayjs' import utc from 'dayjs/plugin/utc' import timezone from 'dayjs/plugin/timezone' -import { createContext, useContext } from 'use-context-selector' -import { useShallow } from 'zustand/react/shallow' -import { useTranslation } from 'react-i18next' -import type { ChatItemInTree } from '../../base/chat/types' +import {createContext, useContext} from 'use-context-selector' +import {useShallow} from 'zustand/react/shallow' +import {useTranslation} from 'react-i18next' +import type {ChatItemInTree} from '../../base/chat/types' import Indicator from '../../header/indicator' import VarPanel from './var-panel' -import type { FeedbackFunc, FeedbackType, IChatItem, SubmitAnnotationFunc } from '@/app/components/base/chat/chat/type' -import type { Annotation, ChatConversationGeneralDetail, ChatConversationsResponse, ChatMessage, ChatMessagesRequest, CompletionConversationGeneralDetail, CompletionConversationsResponse, LogAnnotation } from '@/models/log' -import type { App } from '@/types/app' +import type {FeedbackFunc, FeedbackType, IChatItem, SubmitAnnotationFunc} from '@/app/components/base/chat/chat/type' +import type { + Annotation, + ChatConversationGeneralDetail, + ChatConversationsResponse, + ChatMessage, + ChatMessagesRequest, + CompletionConversationGeneralDetail, + CompletionConversationsResponse, + LogAnnotation +} from '@/models/log' +import type {App} from '@/types/app' import ActionButton from '@/app/components/base/action-button' import Loading from '@/app/components/base/loading' import Drawer from '@/app/components/base/drawer' import Chat from '@/app/components/base/chat/chat' -import { ToastContext } from '@/app/components/base/toast' -import { fetchChatConversationDetail, fetchChatMessages, fetchCompletionConversationDetail, updateLogMessageAnnotations, updateLogMessageFeedbacks } from '@/service/log' +import {ToastContext} from '@/app/components/base/toast' +import { + fetchChatConversationDetail, + fetchChatMessages, + fetchCompletionConversationDetail, + updateLogMessageAnnotations, + updateLogMessageFeedbacks +} from '@/service/log' import ModelInfo from '@/app/components/app/log/model-info' -import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints' +import useBreakpoints, {MediaType} from '@/hooks/use-breakpoints' import TextGeneration from '@/app/components/app/text-generate/item' -import { addFileInfos, sortAgentSorts } from '@/app/components/tools/utils' +import {addFileInfos, sortAgentSorts} from '@/app/components/tools/utils' import MessageLogModal from '@/app/components/base/message-log-modal' import PromptLogModal from '@/app/components/base/prompt-log-modal' -import { useStore as useAppStore } from '@/app/components/app/store' -import { useAppContext } from '@/context/app-context' +import {useStore as useAppStore} from '@/app/components/app/store' +import {useAppContext} from '@/context/app-context' import useTimestamp from '@/hooks/use-timestamp' import Tooltip from '@/app/components/base/tooltip' -import { CopyIcon } from '@/app/components/base/copy-icon' -import { buildChatItemTree, getThreadMessages } from '@/app/components/base/chat/utils' -import { getProcessedFilesFromResponse } from '@/app/components/base/file-uploader/utils' +import {CopyIcon} from '@/app/components/base/copy-icon' +import {buildChatItemTree, getThreadMessages} from '@/app/components/base/chat/utils' +import {getProcessedFilesFromResponse} from '@/app/components/base/file-uploader/utils' import cn from '@/utils/classnames' dayjs.extend(utc) diff --git a/web/app/components/app/log/model-info.tsx b/web/app/components/app/log/model-info.tsx index b0fb0ec757c551..4740a369d43b4c 100644 --- a/web/app/components/app/log/model-info.tsx +++ b/web/app/components/app/log/model-info.tsx @@ -1,10 +1,8 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' -import { useTranslation } from 'react-i18next' -import { - RiInformation2Line, -} from '@remixicon/react' +import {useTranslation} from 'react-i18next' +import {RiInformation2Line,} from '@remixicon/react' import ModelIcon from '@/app/components/header/account-setting/model-provider-page/model-icon' import ModelName from '@/app/components/header/account-setting/model-provider-page/model-name' import { @@ -12,7 +10,9 @@ import { PortalToFollowElemContent, PortalToFollowElemTrigger, } from '@/app/components/base/portal-to-follow-elem' -import { useTextGenerationCurrentProviderAndModelAndModelList } from '@/app/components/header/account-setting/model-provider-page/hooks' +import { + useTextGenerationCurrentProviderAndModelAndModelList +} from '@/app/components/header/account-setting/model-provider-page/hooks' import cn from '@/utils/classnames' const PARAM_MAP = { diff --git a/web/app/components/app/log/var-panel.tsx b/web/app/components/app/log/var-panel.tsx index 3ae4bfb5c63a58..bb9970e952e6cf 100644 --- a/web/app/components/app/log/var-panel.tsx +++ b/web/app/components/app/log/var-panel.tsx @@ -1,13 +1,10 @@ 'use client' -import { useBoolean } from 'ahooks' -import type { FC } from 'react' -import React, { useState } from 'react' -import { useTranslation } from 'react-i18next' -import { - RiArrowDownSLine, - RiArrowRightSLine, -} from '@remixicon/react' -import { Variable02 } from '@/app/components/base/icons/src/vender/solid/development' +import {useBoolean} from 'ahooks' +import type {FC} from 'react' +import React, {useState} from 'react' +import {useTranslation} from 'react-i18next' +import {RiArrowDownSLine, RiArrowRightSLine,} from '@remixicon/react' +import {Variable02} from '@/app/components/base/icons/src/vender/solid/development' import ImagePreview from '@/app/components/base/image-uploader/image-preview' import cn from '@/utils/classnames' diff --git a/web/app/components/app/overview/apikey-info-panel/index.tsx b/web/app/components/app/overview/apikey-info-panel/index.tsx index 661a88e82361a3..85f9140319ff01 100644 --- a/web/app/components/app/overview/apikey-info-panel/index.tsx +++ b/web/app/components/app/overview/apikey-info-panel/index.tsx @@ -1,14 +1,14 @@ 'use client' -import type { FC } from 'react' -import React, { useState } from 'react' -import { useTranslation } from 'react-i18next' -import { RiCloseLine } from '@remixicon/react' +import type {FC} from 'react' +import React, {useState} from 'react' +import {useTranslation} from 'react-i18next' +import {RiCloseLine} from '@remixicon/react' import cn from '@/utils/classnames' import Button from '@/app/components/base/button' -import { LinkExternal02 } from '@/app/components/base/icons/src/vender/line/general' -import { IS_CE_EDITION } from '@/config' -import { useProviderContext } from '@/context/provider-context' -import { useModalContext } from '@/context/modal-context' +import {LinkExternal02} from '@/app/components/base/icons/src/vender/line/general' +import {IS_CE_EDITION} from '@/config' +import {useProviderContext} from '@/context/provider-context' +import {useModalContext} from '@/context/modal-context' const APIKeyInfoPanel: FC = () => { const isCloud = !IS_CE_EDITION diff --git a/web/app/components/app/overview/apikey-info-panel/progress/index.tsx b/web/app/components/app/overview/apikey-info-panel/progress/index.tsx index 3a4accbb43179c..2787bad32346be 100644 --- a/web/app/components/app/overview/apikey-info-panel/progress/index.tsx +++ b/web/app/components/app/overview/apikey-info-panel/progress/index.tsx @@ -1,5 +1,5 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' import s from './style.module.css' import cn from '@/utils/classnames' diff --git a/web/app/components/app/overview/appCard.tsx b/web/app/components/app/overview/appCard.tsx index f9f5c1fbfff03a..755a60d581d9e1 100644 --- a/web/app/components/app/overview/appCard.tsx +++ b/web/app/components/app/overview/appCard.tsx @@ -1,22 +1,17 @@ 'use client' -import type { HTMLProps } from 'react' -import React, { useMemo, useState } from 'react' -import { - Cog8ToothIcon, - DocumentTextIcon, - PaintBrushIcon, - RocketLaunchIcon, -} from '@heroicons/react/24/outline' -import { usePathname, useRouter } from 'next/navigation' -import { useTranslation } from 'react-i18next' +import type {HTMLProps} from 'react' +import React, {useMemo, useState} from 'react' +import {Cog8ToothIcon, DocumentTextIcon, PaintBrushIcon, RocketLaunchIcon,} from '@heroicons/react/24/outline' +import {usePathname, useRouter} from 'next/navigation' +import {useTranslation} from 'react-i18next' +import type {ConfigParams} from './settings' import SettingsModal from './settings' import EmbeddedModal from './embedded' import CustomizeModal from './customize' import style from './style.module.css' -import type { ConfigParams } from './settings' import Tooltip from '@/app/components/base/tooltip' import AppBasic from '@/app/components/app-sidebar/basic' -import { asyncRunSafe, randomString } from '@/utils' +import {asyncRunSafe, randomString} from '@/utils' import Button from '@/app/components/base/button' import Tag from '@/app/components/base/tag' import Switch from '@/app/components/base/switch' @@ -25,9 +20,9 @@ import CopyFeedback from '@/app/components/base/copy-feedback' import Confirm from '@/app/components/base/confirm' import ShareQRCode from '@/app/components/base/qrcode' import SecretKeyButton from '@/app/components/develop/secret-key/secret-key-button' -import type { AppDetailResponse } from '@/models/app' -import { useAppContext } from '@/context/app-context' -import type { AppSSO } from '@/types/app' +import type {AppDetailResponse} from '@/models/app' +import {useAppContext} from '@/context/app-context' +import type {AppSSO} from '@/types/app' export type IAppCardProps = { className?: string diff --git a/web/app/components/app/overview/appChart.tsx b/web/app/components/app/overview/appChart.tsx index e0788bcda3bed6..69e26554639788 100644 --- a/web/app/components/app/overview/appChart.tsx +++ b/web/app/components/app/overview/appChart.tsx @@ -1,17 +1,30 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' import ReactECharts from 'echarts-for-react' -import type { EChartsOption } from 'echarts' +import type {EChartsOption} from 'echarts' import useSWR from 'swr' import dayjs from 'dayjs' -import { get } from 'lodash-es' -import { useTranslation } from 'react-i18next' -import { formatNumber } from '@/utils/format' +import {get} from 'lodash-es' +import {useTranslation} from 'react-i18next' +import {formatNumber} from '@/utils/format' import Basic from '@/app/components/app-sidebar/basic' import Loading from '@/app/components/base/loading' -import type { AppDailyConversationsResponse, AppDailyEndUsersResponse, AppDailyMessagesResponse, AppTokenCostsResponse } from '@/models/app' -import { getAppDailyConversations, getAppDailyEndUsers, getAppDailyMessages, getAppStatistics, getAppTokenCosts, getWorkflowDailyConversations } from '@/service/apps' +import type { + AppDailyConversationsResponse, + AppDailyEndUsersResponse, + AppDailyMessagesResponse, + AppTokenCostsResponse +} from '@/models/app' +import { + getAppDailyConversations, + getAppDailyEndUsers, + getAppDailyMessages, + getAppStatistics, + getAppTokenCosts, + getWorkflowDailyConversations +} from '@/service/apps' + const valueFormatter = (v: string | number) => v const COLOR_TYPE_MAP = { diff --git a/web/app/components/app/overview/customize/index.tsx b/web/app/components/app/overview/customize/index.tsx index d53aa00a6ffd8a..eac245cf926184 100644 --- a/web/app/components/app/overview/customize/index.tsx +++ b/web/app/components/app/overview/customize/index.tsx @@ -1,15 +1,15 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' -import { ArrowTopRightOnSquareIcon } from '@heroicons/react/24/outline' -import { useTranslation } from 'react-i18next' -import { useContext } from 'use-context-selector' -import type { AppMode } from '@/types/app' +import {ArrowTopRightOnSquareIcon} from '@heroicons/react/24/outline' +import {useTranslation} from 'react-i18next' +import {useContext} from 'use-context-selector' +import type {AppMode} from '@/types/app' import I18n from '@/context/i18n' import Button from '@/app/components/base/button' import Modal from '@/app/components/base/modal' import Tag from '@/app/components/base/tag' -import { LanguagesSupported } from '@/i18n/language' +import {LanguagesSupported} from '@/i18n/language' type IShareLinkProps = { isShow: boolean diff --git a/web/app/components/app/overview/embedded/index.tsx b/web/app/components/app/overview/embedded/index.tsx index b71a3c3fdf9d28..47c14135e7ce83 100644 --- a/web/app/components/app/overview/embedded/index.tsx +++ b/web/app/components/app/overview/embedded/index.tsx @@ -1,15 +1,15 @@ -import React, { useEffect, useState } from 'react' -import { useTranslation } from 'react-i18next' +import React, {useEffect, useState} from 'react' +import {useTranslation} from 'react-i18next' import copy from 'copy-to-clipboard' import style from './style.module.css' import cn from '@/utils/classnames' import Modal from '@/app/components/base/modal' import copyStyle from '@/app/components/base/copy-btn/style.module.css' import Tooltip from '@/app/components/base/tooltip' -import { useAppContext } from '@/context/app-context' -import { IS_CE_EDITION } from '@/config' -import type { SiteInfo } from '@/models/share' -import { useThemeContext } from '@/app/components/base/chat/embedded-chatbot/theme/theme-context' +import {useAppContext} from '@/context/app-context' +import {IS_CE_EDITION} from '@/config' +import type {SiteInfo} from '@/models/share' +import {useThemeContext} from '@/app/components/base/chat/embedded-chatbot/theme/theme-context' type Props = { siteInfo?: SiteInfo diff --git a/web/app/components/app/overview/settings/index.tsx b/web/app/components/app/overview/settings/index.tsx index e7cc4148efb099..a8ad05cb22936f 100644 --- a/web/app/components/app/overview/settings/index.tsx +++ b/web/app/components/app/overview/settings/index.tsx @@ -1,10 +1,10 @@ 'use client' -import type { FC } from 'react' -import React, { useEffect, useState } from 'react' -import { ChevronRightIcon } from '@heroicons/react/20/solid' +import type {FC} from 'react' +import React, {useEffect, useState} from 'react' +import {ChevronRightIcon} from '@heroicons/react/20/solid' import Link from 'next/link' -import { Trans, useTranslation } from 'react-i18next' -import { useContextSelector } from 'use-context-selector' +import {Trans, useTranslation} from 'react-i18next' +import {useContextSelector} from 'use-context-selector' import s from './style.module.css' import Modal from '@/app/components/base/modal' import Button from '@/app/components/base/button' @@ -12,14 +12,14 @@ import Input from '@/app/components/base/input' import Textarea from '@/app/components/base/textarea' import AppIcon from '@/app/components/base/app-icon' import Switch from '@/app/components/base/switch' -import { SimpleSelect } from '@/app/components/base/select' -import type { AppDetailResponse } from '@/models/app' -import type { AppIconType, AppSSO, Language } from '@/types/app' -import { useToastContext } from '@/app/components/base/toast' -import { languages } from '@/i18n/language' +import {SimpleSelect} from '@/app/components/base/select' +import type {AppDetailResponse} from '@/models/app' +import type {AppIconType, AppSSO, Language} from '@/types/app' +import {useToastContext} from '@/app/components/base/toast' +import {languages} from '@/i18n/language' import Tooltip from '@/app/components/base/tooltip' -import AppContext, { useAppContext } from '@/context/app-context' -import type { AppIconSelection } from '@/app/components/base/app-icon-picker' +import AppContext, {useAppContext} from '@/context/app-context' +import type {AppIconSelection} from '@/app/components/base/app-icon-picker' import AppIconPicker from '@/app/components/base/app-icon-picker' export type ISettingsModalProps = { diff --git a/web/app/components/app/store.ts b/web/app/components/app/store.ts index 5f02f92f0d47f7..15be4ca96bdb11 100644 --- a/web/app/components/app/store.ts +++ b/web/app/components/app/store.ts @@ -1,6 +1,6 @@ -import { create } from 'zustand' -import type { App, AppSSO } from '@/types/app' -import type { IChatItem } from '@/app/components/base/chat/chat/type' +import {create} from 'zustand' +import type {App, AppSSO} from '@/types/app' +import type {IChatItem} from '@/app/components/base/chat/chat/type' type State = { appDetail?: App & Partial diff --git a/web/app/components/app/workflow-log/detail.tsx b/web/app/components/app/workflow-log/detail.tsx index 2ee9f83c54a8b6..1e2e1d4440bb06 100644 --- a/web/app/components/app/workflow-log/detail.tsx +++ b/web/app/components/app/workflow-log/detail.tsx @@ -1,7 +1,7 @@ 'use client' -import type { FC } from 'react' -import { useTranslation } from 'react-i18next' -import { RiCloseLine } from '@remixicon/react' +import type {FC} from 'react' +import {useTranslation} from 'react-i18next' +import {RiCloseLine} from '@remixicon/react' import Run from '@/app/components/workflow/run' type ILogDetail = { diff --git a/web/app/components/app/workflow-log/filter.tsx b/web/app/components/app/workflow-log/filter.tsx index 466e9b8fda9a21..2d796564d08a97 100644 --- a/web/app/components/app/workflow-log/filter.tsx +++ b/web/app/components/app/workflow-log/filter.tsx @@ -1,8 +1,8 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' -import { useTranslation } from 'react-i18next' -import type { QueryParam } from './index' +import {useTranslation} from 'react-i18next' +import type {QueryParam} from './index' import Chip from '@/app/components/base/chip' import Input from '@/app/components/base/input' diff --git a/web/app/components/app/workflow-log/index.tsx b/web/app/components/app/workflow-log/index.tsx index 453f2cd75adcc8..de41db7d81cf70 100644 --- a/web/app/components/app/workflow-log/index.tsx +++ b/web/app/components/app/workflow-log/index.tsx @@ -1,18 +1,18 @@ 'use client' -import type { FC, SVGProps } from 'react' -import React, { useState } from 'react' +import type {FC, SVGProps} from 'react' +import React, {useState} from 'react' import useSWR from 'swr' -import { usePathname } from 'next/navigation' -import { useDebounce } from 'ahooks' -import { Trans, useTranslation } from 'react-i18next' +import {usePathname} from 'next/navigation' +import {useDebounce} from 'ahooks' +import {Trans, useTranslation} from 'react-i18next' import Link from 'next/link' import List from './list' import Filter from './filter' import Pagination from '@/app/components/base/pagination' import Loading from '@/app/components/base/loading' -import { fetchWorkflowLogs } from '@/service/log' -import { APP_PAGE_LIMIT } from '@/config' -import type { App, AppMode } from '@/types/app' +import {fetchWorkflowLogs} from '@/service/log' +import {APP_PAGE_LIMIT} from '@/config' +import type {App, AppMode} from '@/types/app' export type ILogsProps = { appDetail: App diff --git a/web/app/components/app/workflow-log/list.tsx b/web/app/components/app/workflow-log/list.tsx index 41db9b5d466822..ac3b4d9b0eec43 100644 --- a/web/app/components/app/workflow-log/list.tsx +++ b/web/app/components/app/workflow-log/list.tsx @@ -1,14 +1,14 @@ 'use client' -import type { FC } from 'react' -import React, { useState } from 'react' -import { useTranslation } from 'react-i18next' +import type {FC} from 'react' +import React, {useState} from 'react' +import {useTranslation} from 'react-i18next' import DetailPanel from './detail' -import type { WorkflowAppLogDetail, WorkflowLogsResponse } from '@/models/log' -import type { App } from '@/types/app' +import type {WorkflowAppLogDetail, WorkflowLogsResponse} from '@/models/log' +import type {App} from '@/types/app' import Loading from '@/app/components/base/loading' import Drawer from '@/app/components/base/drawer' import Indicator from '@/app/components/header/indicator' -import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints' +import useBreakpoints, {MediaType} from '@/hooks/use-breakpoints' import useTimestamp from '@/hooks/use-timestamp' import cn from '@/utils/classnames' diff --git a/web/app/init/InitPasswordPopup.tsx b/web/app/init/InitPasswordPopup.tsx index cbf25f43b23450..408a0dd2233f5c 100644 --- a/web/app/init/InitPasswordPopup.tsx +++ b/web/app/init/InitPasswordPopup.tsx @@ -1,12 +1,12 @@ 'use client' -import { useEffect, useState } from 'react' -import { useTranslation } from 'react-i18next' -import { useRouter } from 'next/navigation' +import {useEffect, useState} from 'react' +import {useTranslation} from 'react-i18next' +import {useRouter} from 'next/navigation' import Toast from '../components/base/toast' import Loading from '../components/base/loading' import Button from '@/app/components/base/button' -import { fetchInitValidateStatus, initValidate } from '@/service/common' -import type { InitValidateStatusResponse } from '@/models/common' +import {fetchInitValidateStatus, initValidate} from '@/service/common' +import type {InitValidateStatusResponse} from '@/models/common' const InitPasswordPopup = () => { const [password, setPassword] = useState('') diff --git a/web/app/install/installForm.tsx b/web/app/install/installForm.tsx index abf377e389b465..248ca59c9a9a8c 100644 --- a/web/app/install/installForm.tsx +++ b/web/app/install/installForm.tsx @@ -1,20 +1,20 @@ 'use client' -import React, { useEffect } from 'react' -import { useTranslation } from 'react-i18next' +import React, {useEffect} from 'react' +import {useTranslation} from 'react-i18next' import Link from 'next/link' -import { useRouter } from 'next/navigation' +import {useRouter} from 'next/navigation' -import type { SubmitHandler } from 'react-hook-form' -import { useForm } from 'react-hook-form' -import { z } from 'zod' -import { zodResolver } from '@hookform/resolvers/zod' +import type {SubmitHandler} from 'react-hook-form' +import {useForm} from 'react-hook-form' +import {z} from 'zod' +import {zodResolver} from '@hookform/resolvers/zod' import Loading from '../components/base/loading' import classNames from '@/utils/classnames' import Button from '@/app/components/base/button' -import { fetchInitValidateStatus, fetchSetupStatus, setup } from '@/service/common' -import type { InitValidateStatusResponse, SetupStatusResponse } from '@/models/common' +import {fetchInitValidateStatus, fetchSetupStatus, setup} from '@/service/common' +import type {InitValidateStatusResponse, SetupStatusResponse} from '@/models/common' const validPassword = /^(?=.*[a-zA-Z])(?=.*\d).{8,}$/ diff --git a/web/app/signin/_header.tsx b/web/app/signin/_header.tsx index a9479a3fe43a1c..617510d429c5f2 100644 --- a/web/app/signin/_header.tsx +++ b/web/app/signin/_header.tsx @@ -1,9 +1,9 @@ 'use client' import React from 'react' -import { useContext } from 'use-context-selector' +import {useContext} from 'use-context-selector' import Select from '@/app/components/base/select/locale' -import { languages } from '@/i18n/language' -import { type Locale } from '@/i18n' +import {languages} from '@/i18n/language' +import {type Locale} from '@/i18n' import I18n from '@/context/i18n' import LogoSite from '@/app/components/base/logo/logo-site' diff --git a/web/app/signin/check-code/page.tsx b/web/app/signin/check-code/page.tsx index 4767308f72d865..7ee7f3c9907747 100644 --- a/web/app/signin/check-code/page.tsx +++ b/web/app/signin/check-code/page.tsx @@ -1,14 +1,14 @@ 'use client' -import { RiArrowLeftLine, RiMailSendFill } from '@remixicon/react' -import { useTranslation } from 'react-i18next' -import { useState } from 'react' -import { useRouter, useSearchParams } from 'next/navigation' -import { useContext } from 'use-context-selector' +import {RiArrowLeftLine, RiMailSendFill} from '@remixicon/react' +import {useTranslation} from 'react-i18next' +import {useState} from 'react' +import {useRouter, useSearchParams} from 'next/navigation' +import {useContext} from 'use-context-selector' import Countdown from '@/app/components/signin/countdown' import Button from '@/app/components/base/button' import Input from '@/app/components/base/input' import Toast from '@/app/components/base/toast' -import { emailLoginWithCode, sendEMailLoginCode } from '@/service/common' +import {emailLoginWithCode, sendEMailLoginCode} from '@/service/common' import I18NContext from '@/context/i18n' export default function CheckCode() { diff --git a/web/app/signin/components/mail-and-code-auth.tsx b/web/app/signin/components/mail-and-code-auth.tsx index 7225b094d42e89..5d9aa455a661bb 100644 --- a/web/app/signin/components/mail-and-code-auth.tsx +++ b/web/app/signin/components/mail-and-code-auth.tsx @@ -1,13 +1,13 @@ -import { useState } from 'react' -import { useTranslation } from 'react-i18next' -import { useRouter, useSearchParams } from 'next/navigation' -import { useContext } from 'use-context-selector' +import {useState} from 'react' +import {useTranslation} from 'react-i18next' +import {useRouter, useSearchParams} from 'next/navigation' +import {useContext} from 'use-context-selector' import Input from '@/app/components/base/input' import Button from '@/app/components/base/button' -import { emailRegex } from '@/config' +import {emailRegex} from '@/config' import Toast from '@/app/components/base/toast' -import { sendEMailLoginCode } from '@/service/common' -import { COUNT_DOWN_KEY, COUNT_DOWN_TIME_MS } from '@/app/components/signin/countdown' +import {sendEMailLoginCode} from '@/service/common' +import {COUNT_DOWN_KEY, COUNT_DOWN_TIME_MS} from '@/app/components/signin/countdown' import I18NContext from '@/context/i18n' type MailAndCodeAuthProps = { diff --git a/web/app/signin/components/mail-and-password-auth.tsx b/web/app/signin/components/mail-and-password-auth.tsx index 97f8bd1becc6d7..17f90b97dee2c6 100644 --- a/web/app/signin/components/mail-and-password-auth.tsx +++ b/web/app/signin/components/mail-and-password-auth.tsx @@ -1,12 +1,12 @@ import Link from 'next/link' -import { useState } from 'react' -import { useTranslation } from 'react-i18next' -import { useRouter, useSearchParams } from 'next/navigation' -import { useContext } from 'use-context-selector' +import {useState} from 'react' +import {useTranslation} from 'react-i18next' +import {useRouter, useSearchParams} from 'next/navigation' +import {useContext} from 'use-context-selector' import Button from '@/app/components/base/button' import Toast from '@/app/components/base/toast' -import { emailRegex } from '@/config' -import { login } from '@/service/common' +import {emailRegex} from '@/config' +import {login} from '@/service/common' import Input from '@/app/components/base/input' import I18NContext from '@/context/i18n' diff --git a/web/app/signin/components/social-auth.tsx b/web/app/signin/components/social-auth.tsx index 39d7ceaa406a13..9e7c2761dd6ceb 100644 --- a/web/app/signin/components/social-auth.tsx +++ b/web/app/signin/components/social-auth.tsx @@ -1,10 +1,10 @@ -import { useTranslation } from 'react-i18next' -import { useSearchParams } from 'next/navigation' +import {useTranslation} from 'react-i18next' +import {useSearchParams} from 'next/navigation' import style from '../page.module.css' import Button from '@/app/components/base/button' -import { apiPrefix } from '@/config' +import {apiPrefix} from '@/config' import classNames from '@/utils/classnames' -import { getPurifyHref } from '@/utils' +import {getPurifyHref} from '@/utils' type SocialAuthProps = { disabled?: boolean diff --git a/web/app/signin/components/sso-auth.tsx b/web/app/signin/components/sso-auth.tsx index fb303b93e2859b..797b61fc2f7631 100644 --- a/web/app/signin/components/sso-auth.tsx +++ b/web/app/signin/components/sso-auth.tsx @@ -1,13 +1,13 @@ 'use client' -import { useRouter, useSearchParams } from 'next/navigation' -import type { FC } from 'react' -import { useState } from 'react' -import { useTranslation } from 'react-i18next' -import { Lock01 } from '@/app/components/base/icons/src/vender/solid/security' +import {useRouter, useSearchParams} from 'next/navigation' +import type {FC} from 'react' +import {useState} from 'react' +import {useTranslation} from 'react-i18next' +import {Lock01} from '@/app/components/base/icons/src/vender/solid/security' import Toast from '@/app/components/base/toast' -import { getUserOAuth2SSOUrl, getUserOIDCSSOUrl, getUserSAMLSSOUrl } from '@/service/sso' +import {getUserOAuth2SSOUrl, getUserOIDCSSOUrl, getUserSAMLSSOUrl} from '@/service/sso' import Button from '@/app/components/base/button' -import { SSOProtocol } from '@/types/feature' +import {SSOProtocol} from '@/types/feature' type SSOAuthProps = { protocol: SSOProtocol | '' diff --git a/web/app/signin/invite-settings/page.tsx b/web/app/signin/invite-settings/page.tsx index 2138399ec3a3ee..706ec889639f4f 100644 --- a/web/app/signin/invite-settings/page.tsx +++ b/web/app/signin/invite-settings/page.tsx @@ -1,18 +1,18 @@ 'use client' -import { useTranslation } from 'react-i18next' -import { useCallback, useState } from 'react' +import {useTranslation} from 'react-i18next' +import {useCallback, useState} from 'react' import Link from 'next/link' -import { useContext } from 'use-context-selector' -import { useRouter, useSearchParams } from 'next/navigation' +import {useContext} from 'use-context-selector' +import {useRouter, useSearchParams} from 'next/navigation' import useSWR from 'swr' -import { RiAccountCircleLine } from '@remixicon/react' +import {RiAccountCircleLine} from '@remixicon/react' import Input from '@/app/components/base/input' -import { SimpleSelect } from '@/app/components/base/select' +import {SimpleSelect} from '@/app/components/base/select' import Button from '@/app/components/base/button' -import { timezones } from '@/utils/timezone' -import { LanguagesSupported, languages } from '@/i18n/language' +import {timezones} from '@/utils/timezone' +import {languages, LanguagesSupported} from '@/i18n/language' import I18n from '@/context/i18n' -import { activateMember, invitationCheck } from '@/service/common' +import {activateMember, invitationCheck} from '@/service/common' import Loading from '@/app/components/base/loading' import Toast from '@/app/components/base/toast' diff --git a/web/app/signin/normalForm.tsx b/web/app/signin/normalForm.tsx index 1911fa35c615df..ddc57816a3b0f5 100644 --- a/web/app/signin/normalForm.tsx +++ b/web/app/signin/normalForm.tsx @@ -1,18 +1,18 @@ -import React, { useCallback, useEffect, useState } from 'react' -import { useTranslation } from 'react-i18next' +import React, {useCallback, useEffect, useState} from 'react' +import {useTranslation} from 'react-i18next' import Link from 'next/link' -import { useRouter, useSearchParams } from 'next/navigation' -import { RiContractLine, RiDoorLockLine, RiErrorWarningFill } from '@remixicon/react' +import {useRouter, useSearchParams} from 'next/navigation' +import {RiContractLine, RiDoorLockLine, RiErrorWarningFill} from '@remixicon/react' import Loading from '../components/base/loading' import MailAndCodeAuth from './components/mail-and-code-auth' import MailAndPasswordAuth from './components/mail-and-password-auth' import SocialAuth from './components/social-auth' import SSOAuth from './components/sso-auth' import cn from '@/utils/classnames' -import { getSystemFeatures, invitationCheck } from '@/service/common' -import { LicenseStatus, defaultSystemFeatures } from '@/types/feature' +import {getSystemFeatures, invitationCheck} from '@/service/common' +import {defaultSystemFeatures, LicenseStatus} from '@/types/feature' import Toast from '@/app/components/base/toast' -import { IS_CE_EDITION } from '@/config' +import {IS_CE_EDITION} from '@/config' const NormalForm = () => { const { t } = useTranslation() diff --git a/web/app/signin/oneMoreStep.tsx b/web/app/signin/oneMoreStep.tsx index 8554b364c0e893..67c1b961c5218e 100644 --- a/web/app/signin/oneMoreStep.tsx +++ b/web/app/signin/oneMoreStep.tsx @@ -1,16 +1,16 @@ 'use client' -import React, { useEffect, useReducer } from 'react' -import { useTranslation } from 'react-i18next' +import React, {useEffect, useReducer} from 'react' +import {useTranslation} from 'react-i18next' import Link from 'next/link' import useSWR from 'swr' -import { useRouter, useSearchParams } from 'next/navigation' +import {useRouter, useSearchParams} from 'next/navigation' import Input from '../components/base/input' import Button from '@/app/components/base/button' import Tooltip from '@/app/components/base/tooltip' -import { SimpleSelect } from '@/app/components/base/select' -import { timezones } from '@/utils/timezone' -import { LanguagesSupported, languages } from '@/i18n/language' -import { oneMoreStep } from '@/service/common' +import {SimpleSelect} from '@/app/components/base/select' +import {timezones} from '@/utils/timezone' +import {languages, LanguagesSupported} from '@/i18n/language' +import {oneMoreStep} from '@/service/common' import Toast from '@/app/components/base/toast' type IState = { diff --git a/web/app/signin/page.tsx b/web/app/signin/page.tsx index f2ef17c48726ef..0c4d04a6fce5bb 100644 --- a/web/app/signin/page.tsx +++ b/web/app/signin/page.tsx @@ -1,5 +1,5 @@ 'use client' -import { useSearchParams } from 'next/navigation' +import {useSearchParams} from 'next/navigation' import OneMoreStep from './oneMoreStep' import NormalForm from './normalForm' diff --git a/web/context/app-context.tsx b/web/context/app-context.tsx index 7addfb83d45c66..67856ae6879042 100644 --- a/web/context/app-context.tsx +++ b/web/context/app-context.tsx @@ -1,18 +1,18 @@ 'use client' -import { createRef, useCallback, useEffect, useMemo, useRef, useState } from 'react' +import type {FC, ReactNode} from 'react' +import {createRef, useCallback, useEffect, useMemo, useRef, useState} from 'react' import useSWR from 'swr' -import { createContext, useContext, useContextSelector } from 'use-context-selector' -import type { FC, ReactNode } from 'react' -import { fetchAppList } from '@/service/apps' +import {createContext, useContext, useContextSelector} from 'use-context-selector' +import {fetchAppList} from '@/service/apps' import Loading from '@/app/components/base/loading' -import { fetchCurrentWorkspace, fetchLanggeniusVersion, fetchUserProfile, getSystemFeatures } from '@/service/common' -import type { App } from '@/types/app' -import { Theme } from '@/types/app' -import type { ICurrentWorkspace, LangGeniusVersionResponse, UserProfileResponse } from '@/models/common' +import {fetchCurrentWorkspace, fetchLanggeniusVersion, fetchUserProfile, getSystemFeatures} from '@/service/common' +import type {App} from '@/types/app' +import {Theme} from '@/types/app' +import type {ICurrentWorkspace, LangGeniusVersionResponse, UserProfileResponse} from '@/models/common' import MaintenanceNotice from '@/app/components/header/maintenance-notice' -import type { SystemFeatures } from '@/types/feature' -import { defaultSystemFeatures } from '@/types/feature' +import type {SystemFeatures} from '@/types/feature' +import {defaultSystemFeatures} from '@/types/feature' export type AppContextValue = { theme: Theme diff --git a/web/context/dataset-detail.ts b/web/context/dataset-detail.ts index de046ce7a064eb..05569234d58f03 100644 --- a/web/context/dataset-detail.ts +++ b/web/context/dataset-detail.ts @@ -1,5 +1,5 @@ -import { createContext, useContext } from 'use-context-selector' -import type { DataSet } from '@/models/datasets' +import {createContext, useContext} from 'use-context-selector' +import type {DataSet} from '@/models/datasets' const DatasetDetailContext = createContext<{ indexingTechnique?: string; dataset?: DataSet; mutateDatasetRes?: () => void }>({}) diff --git a/web/context/datasets-context.tsx b/web/context/datasets-context.tsx index ba708233beb18b..e95a20015381c7 100644 --- a/web/context/datasets-context.tsx +++ b/web/context/datasets-context.tsx @@ -1,7 +1,7 @@ 'use client' -import { createContext, useContext } from 'use-context-selector' -import type { DataSet } from '@/models/datasets' +import {createContext, useContext} from 'use-context-selector' +import type {DataSet} from '@/models/datasets' export type DatasetsContextValue = { datasets: DataSet[] diff --git a/web/context/debug-configuration.ts b/web/context/debug-configuration.ts index 61508278d01e7b..f8a427c546fcb2 100644 --- a/web/context/debug-configuration.ts +++ b/web/context/debug-configuration.ts @@ -1,30 +1,35 @@ -import { createContext, useContext } from 'use-context-selector' -import { PromptMode } from '@/models/debug' +import {createContext, useContext} from 'use-context-selector' import type { - AnnotationReplyConfig, - BlockStatus, - ChatPromptConfig, - CitationConfig, - CompletionPromptConfig, - ConversationHistoriesRole, - DatasetConfigs, - Inputs, - ModelConfig, - ModerationConfig, - MoreLikeThisConfig, - PromptConfig, - PromptItem, - SpeechToTextConfig, - SuggestedQuestionsAfterAnswerConfig, - TextToSpeechConfig, + AnnotationReplyConfig, + BlockStatus, + ChatPromptConfig, + CitationConfig, + CompletionPromptConfig, + ConversationHistoriesRole, + DatasetConfigs, + Inputs, + ModelConfig, + ModerationConfig, + MoreLikeThisConfig, + PromptConfig, + PromptItem, + SpeechToTextConfig, + SuggestedQuestionsAfterAnswerConfig, + TextToSpeechConfig, } from '@/models/debug' -import type { ExternalDataTool } from '@/models/common' -import type { DataSet } from '@/models/datasets' -import type { VisionSettings } from '@/types/app' -import { ModelModeType, RETRIEVE_TYPE, Resolution, TransferMethod } from '@/types/app' -import { ANNOTATION_DEFAULT, DEFAULT_AGENT_SETTING, DEFAULT_CHAT_PROMPT_CONFIG, DEFAULT_COMPLETION_PROMPT_CONFIG } from '@/config' -import type { FormValue } from '@/app/components/header/account-setting/model-provider-page/declarations' -import type { Collection } from '@/app/components/tools/types' +import {PromptMode} from '@/models/debug' +import type {ExternalDataTool} from '@/models/common' +import type {DataSet} from '@/models/datasets' +import type {VisionSettings} from '@/types/app' +import {ModelModeType, Resolution, RETRIEVE_TYPE, TransferMethod} from '@/types/app' +import { + ANNOTATION_DEFAULT, + DEFAULT_AGENT_SETTING, + DEFAULT_CHAT_PROMPT_CONFIG, + DEFAULT_COMPLETION_PROMPT_CONFIG +} from '@/config' +import type {FormValue} from '@/app/components/header/account-setting/model-provider-page/declarations' +import type {Collection} from '@/app/components/tools/types' type IDebugConfiguration = { appId: string diff --git a/web/context/event-emitter.tsx b/web/context/event-emitter.tsx index d31e32e8aa1024..8327a8b68edac8 100644 --- a/web/context/event-emitter.tsx +++ b/web/context/event-emitter.tsx @@ -1,8 +1,8 @@ 'use client' -import { createContext, useContext } from 'use-context-selector' -import { useEventEmitter } from 'ahooks' -import type { EventEmitter } from 'ahooks/lib/useEventEmitter' +import {createContext, useContext} from 'use-context-selector' +import {useEventEmitter} from 'ahooks' +import type {EventEmitter} from 'ahooks/lib/useEventEmitter' const EventEmitterContext = createContext<{ eventEmitter: EventEmitter | null }>({ eventEmitter: null, diff --git a/web/context/explore-context.ts b/web/context/explore-context.ts index 796b6a5bfbbb24..23e2251d635dfe 100644 --- a/web/context/explore-context.ts +++ b/web/context/explore-context.ts @@ -1,5 +1,5 @@ -import { createContext } from 'use-context-selector' -import type { InstalledApp } from '@/models/explore' +import {createContext} from 'use-context-selector' +import type {InstalledApp} from '@/models/explore' type IExplore = { controlUpdateInstalledApps: number diff --git a/web/context/external-api-panel-context.tsx b/web/context/external-api-panel-context.tsx index 05ae5c45c1baad..88fca3bb4f0426 100644 --- a/web/context/external-api-panel-context.tsx +++ b/web/context/external-api-panel-context.tsx @@ -1,6 +1,6 @@ 'use client' -import React, { createContext, useContext, useState } from 'react' +import React, {createContext, useContext, useState} from 'react' type ExternalApiPanelContextType = { showExternalApiPanel: boolean diff --git a/web/context/external-knowledge-api-context.tsx b/web/context/external-knowledge-api-context.tsx index 5f2d2ff3937b1c..76e93b52d223a0 100644 --- a/web/context/external-knowledge-api-context.tsx +++ b/web/context/external-knowledge-api-context.tsx @@ -1,10 +1,10 @@ 'use client' -import { createContext, useContext, useMemo } from 'react' -import type { FC, ReactNode } from 'react' +import type {FC, ReactNode} from 'react' +import {createContext, useContext, useMemo} from 'react' import useSWR from 'swr' -import type { ExternalAPIItem, ExternalAPIListResponse } from '@/models/datasets' -import { fetchExternalAPIList } from '@/service/datasets' +import type {ExternalAPIItem, ExternalAPIListResponse} from '@/models/datasets' +import {fetchExternalAPIList} from '@/service/datasets' type ExternalKnowledgeApiContextType = { externalKnowledgeApiList: ExternalAPIItem[] diff --git a/web/context/i18n.ts b/web/context/i18n.ts index be41730b071eb6..ce58a72a43a0da 100644 --- a/web/context/i18n.ts +++ b/web/context/i18n.ts @@ -1,9 +1,6 @@ -import { - createContext, - useContext, -} from 'use-context-selector' -import type { Locale } from '@/i18n' -import { getLanguage } from '@/i18n/language' +import {createContext, useContext,} from 'use-context-selector' +import type {Locale} from '@/i18n' +import {getLanguage} from '@/i18n/language' type II18NContext = { locale: Locale diff --git a/web/context/modal-context.tsx b/web/context/modal-context.tsx index 2dfc08cf883c5b..df37ae1734e072 100644 --- a/web/context/modal-context.tsx +++ b/web/context/modal-context.tsx @@ -1,12 +1,13 @@ 'use client' -import type { Dispatch, SetStateAction } from 'react' -import { useCallback, useState } from 'react' -import { createContext, useContext, useContextSelector } from 'use-context-selector' -import { useRouter, useSearchParams } from 'next/navigation' +import type {Dispatch, SetStateAction} from 'react' +import {useCallback, useState} from 'react' +import {createContext, useContext, useContextSelector} from 'use-context-selector' +import {useRouter, useSearchParams} from 'next/navigation' import AccountSetting from '@/app/components/header/account-setting' import ApiBasedExtensionModal from '@/app/components/header/account-setting/api-based-extension-page/modal' -import ModerationSettingModal from '@/app/components/base/features/new-feature-panel/moderation/moderation-setting-modal' +import ModerationSettingModal + from '@/app/components/base/features/new-feature-panel/moderation/moderation-setting-modal' import ExternalDataToolModal from '@/app/components/app/configuration/tools/external-data-tool-modal' import AnnotationFullModal from '@/app/components/billing/annotation-full/modal' import ModelModal from '@/app/components/header/account-setting/model-provider-page/model-modal' @@ -19,18 +20,19 @@ import type { } from '@/app/components/header/account-setting/model-provider-page/declarations' import Pricing from '@/app/components/billing/pricing' -import type { ModerationConfig, PromptVariable } from '@/models/debug' +import type {ModerationConfig, PromptVariable} from '@/models/debug' +import type {ApiBasedExtension, ExternalDataTool,} from '@/models/common' +import type {CreateExternalAPIReq} from '@/app/components/datasets/external-api/declarations' +import ModelLoadBalancingEntryModal + from '@/app/components/header/account-setting/model-provider-page/model-modal/model-load-balancing-entry-modal' import type { - ApiBasedExtension, - ExternalDataTool, -} from '@/models/common' -import type { CreateExternalAPIReq } from '@/app/components/datasets/external-api/declarations' -import ModelLoadBalancingEntryModal from '@/app/components/header/account-setting/model-provider-page/model-modal/model-load-balancing-entry-modal' -import type { ModelLoadBalancingModalProps } from '@/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-modal' -import ModelLoadBalancingModal from '@/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-modal' + ModelLoadBalancingModalProps +} from '@/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-modal' +import ModelLoadBalancingModal + from '@/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-modal' import OpeningSettingModal from '@/app/components/base/features/new-feature-panel/conversation-opener/modal' -import type { OpeningStatement } from '@/app/components/base/features/types' -import type { InputVar } from '@/app/components/workflow/types' +import type {OpeningStatement} from '@/app/components/base/features/types' +import type {InputVar} from '@/app/components/workflow/types' export type ModalState = { payload: T diff --git a/web/context/provider-context.tsx b/web/context/provider-context.tsx index 75747ba79c95cf..f0fc079a755134 100644 --- a/web/context/provider-context.tsx +++ b/web/context/provider-context.tsx @@ -1,23 +1,16 @@ 'use client' -import { createContext, useContext, useContextSelector } from 'use-context-selector' +import {createContext, useContext, useContextSelector} from 'use-context-selector' import useSWR from 'swr' -import { useEffect, useState } from 'react' -import { - fetchModelList, - fetchModelProviders, - fetchSupportRetrievalMethods, -} from '@/service/common' -import { - ModelStatusEnum, - ModelTypeEnum, -} from '@/app/components/header/account-setting/model-provider-page/declarations' -import type { Model, ModelProvider } from '@/app/components/header/account-setting/model-provider-page/declarations' -import type { RETRIEVE_METHOD } from '@/types/app' -import { Plan, type UsagePlanInfo } from '@/app/components/billing/type' -import { fetchCurrentPlanInfo } from '@/service/billing' -import { parseCurrentPlan } from '@/app/components/billing/utils' -import { defaultPlan } from '@/app/components/billing/config' +import {useEffect, useState} from 'react' +import {fetchModelList, fetchModelProviders, fetchSupportRetrievalMethods,} from '@/service/common' +import type {Model, ModelProvider} from '@/app/components/header/account-setting/model-provider-page/declarations' +import {ModelStatusEnum, ModelTypeEnum,} from '@/app/components/header/account-setting/model-provider-page/declarations' +import type {RETRIEVE_METHOD} from '@/types/app' +import {Plan, type UsagePlanInfo} from '@/app/components/billing/type' +import {fetchCurrentPlanInfo} from '@/service/billing' +import {parseCurrentPlan} from '@/app/components/billing/utils' +import {defaultPlan} from '@/app/components/billing/config' type ProviderContextState = { modelProviders: ModelProvider[] diff --git a/web/context/query-client.tsx b/web/context/query-client.tsx index f85930515c66ad..9d9d4c7d008959 100644 --- a/web/context/query-client.tsx +++ b/web/context/query-client.tsx @@ -1,8 +1,8 @@ 'use client' -import type { FC, PropsWithChildren } from 'react' -import { QueryClient, QueryClientProvider } from '@tanstack/react-query' -import { ReactQueryDevtools } from '@tanstack/react-query-devtools' +import type {FC, PropsWithChildren} from 'react' +import {QueryClient, QueryClientProvider} from '@tanstack/react-query' +import {ReactQueryDevtools} from '@tanstack/react-query-devtools' const STALE_TIME = 1000 * 60 * 30 // 30 minutes diff --git a/web/context/workspace-context.tsx b/web/context/workspace-context.tsx index 9350a959b413d8..681b66cb17be4c 100644 --- a/web/context/workspace-context.tsx +++ b/web/context/workspace-context.tsx @@ -1,9 +1,9 @@ 'use client' -import { createContext, useContext } from 'use-context-selector' +import {createContext, useContext} from 'use-context-selector' import useSWR from 'swr' -import { fetchWorkspaces } from '@/service/common' -import type { IWorkspace } from '@/models/common' +import {fetchWorkspaces} from '@/service/common' +import type {IWorkspace} from '@/models/common' export type WorkspacesContextValue = { workspaces: IWorkspace[] diff --git a/web/jest.config.ts b/web/jest.config.ts index 232f90252d9d8d..af0a3b1a38e481 100644 --- a/web/jest.config.ts +++ b/web/jest.config.ts @@ -3,7 +3,7 @@ * https://jestjs.io/docs/configuration */ -import type { Config } from 'jest' +import type {Config} from 'jest' import nextJest from 'next/jest.js' // https://nextjs.org/docs/app/building-your-application/testing/jest diff --git a/web/middleware.ts b/web/middleware.ts index e0f8f3782f78d5..7c16492737777a 100644 --- a/web/middleware.ts +++ b/web/middleware.ts @@ -1,5 +1,5 @@ -import type { NextRequest } from 'next/server' -import { NextResponse } from 'next/server' +import type {NextRequest} from 'next/server' +import {NextResponse} from 'next/server' const NECESSARY_DOMAIN = '*.sentry.io http://localhost:* http://127.0.0.1:* https://analytics.google.com googletagmanager.com *.googletagmanager.com https://www.google-analytics.com https://api.github.com' diff --git a/web/service/annotation.ts b/web/service/annotation.ts index 5096a4f58a3f27..362b442154c373 100644 --- a/web/service/annotation.ts +++ b/web/service/annotation.ts @@ -1,7 +1,11 @@ -import type { Fetcher } from 'swr' -import { del, get, post } from './base' -import type { AnnotationEnableStatus, AnnotationItemBasic, EmbeddingModelConfig } from '@/app/components/app/annotation/type' -import { ANNOTATION_DEFAULT } from '@/config' +import type {Fetcher} from 'swr' +import {del, get, post} from './base' +import type { + AnnotationEnableStatus, + AnnotationItemBasic, + EmbeddingModelConfig +} from '@/app/components/app/annotation/type' +import {ANNOTATION_DEFAULT} from '@/config' export const fetchAnnotationConfig = (appId: string) => { return get(`apps/${appId}/annotation-setting`) diff --git a/web/service/apps.ts b/web/service/apps.ts index 3f7ec7b54818e8..b3d3fda76a13f9 100644 --- a/web/service/apps.ts +++ b/web/service/apps.ts @@ -1,9 +1,32 @@ -import type { Fetcher } from 'swr' -import { del, get, patch, post, put } from './base' -import type { ApiKeysListResponse, AppDailyConversationsResponse, AppDailyEndUsersResponse, AppDailyMessagesResponse, AppDetailResponse, AppListResponse, AppSSOResponse, AppStatisticsResponse, AppTemplatesResponse, AppTokenCostsResponse, AppVoicesListResponse, CreateApiKeyResponse, DSLImportMode, DSLImportResponse, GenerationIntroductionResponse, TracingConfig, TracingStatus, UpdateAppModelConfigResponse, UpdateAppSiteCodeResponse, UpdateOpenAIKeyResponse, ValidateOpenAIKeyResponse, WorkflowDailyConversationsResponse } from '@/models/app' -import type { CommonResponse } from '@/models/common' -import type { AppIconType, AppMode, ModelConfig } from '@/types/app' -import type { TracingProvider } from '@/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/type' +import type {Fetcher} from 'swr' +import {del, get, patch, post, put} from './base' +import type { + ApiKeysListResponse, + AppDailyConversationsResponse, + AppDailyEndUsersResponse, + AppDailyMessagesResponse, + AppDetailResponse, + AppListResponse, + AppSSOResponse, + AppStatisticsResponse, + AppTemplatesResponse, + AppTokenCostsResponse, + AppVoicesListResponse, + CreateApiKeyResponse, + DSLImportMode, + DSLImportResponse, + GenerationIntroductionResponse, + TracingConfig, + TracingStatus, + UpdateAppModelConfigResponse, + UpdateAppSiteCodeResponse, + UpdateOpenAIKeyResponse, + ValidateOpenAIKeyResponse, + WorkflowDailyConversationsResponse +} from '@/models/app' +import type {CommonResponse} from '@/models/common' +import type {AppIconType, AppMode, ModelConfig} from '@/types/app' +import type {TracingProvider} from '@/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/type' export const fetchAppList: Fetcher }> = ({ url, params }) => { return get(url, { params }) diff --git a/web/service/base.ts b/web/service/base.ts index 22b1a43ad18359..3074e3e773f8bb 100644 --- a/web/service/base.ts +++ b/web/service/base.ts @@ -1,23 +1,24 @@ -import { refreshAccessTokenOrRelogin } from './refresh-token' -import { API_PREFIX, IS_CE_EDITION, PUBLIC_API_PREFIX } from '@/config' +import {refreshAccessTokenOrRelogin} from './refresh-token' +import {API_PREFIX, IS_CE_EDITION, PUBLIC_API_PREFIX} from '@/config' import Toast from '@/app/components/base/toast' -import type { AnnotationReply, MessageEnd, MessageReplace, ThoughtItem } from '@/app/components/base/chat/chat/type' -import type { VisionFile } from '@/types/app' +import type {AnnotationReply, MessageEnd, MessageReplace, ThoughtItem} from '@/app/components/base/chat/chat/type' +import type {VisionFile} from '@/types/app' import type { - IterationFinishedResponse, - IterationNextResponse, - IterationStartedResponse, - NodeFinishedResponse, - NodeStartedResponse, - ParallelBranchFinishedResponse, - ParallelBranchStartedResponse, - TextChunkResponse, - TextReplaceResponse, - WorkflowFinishedResponse, - WorkflowStartedResponse, + IterationFinishedResponse, + IterationNextResponse, + IterationStartedResponse, + NodeFinishedResponse, + NodeStartedResponse, + ParallelBranchFinishedResponse, + ParallelBranchStartedResponse, + TextChunkResponse, + TextReplaceResponse, + WorkflowFinishedResponse, + WorkflowStartedResponse, } from '@/types/workflow' -import { removeAccessToken } from '@/app/components/share/utils' -import { asyncRunSafe } from '@/utils' +import {removeAccessToken} from '@/app/components/share/utils' +import {asyncRunSafe} from '@/utils' + const TIME_OUT = 100000 const ContentType = { diff --git a/web/service/billing.ts b/web/service/billing.ts index 7dfe5ac0a7c521..27b0b48b26a351 100644 --- a/web/service/billing.ts +++ b/web/service/billing.ts @@ -1,5 +1,5 @@ -import { get } from './base' -import type { CurrentPlanInfoBackend, SubscriptionUrlsBackend } from '@/app/components/billing/type' +import {get} from './base' +import type {CurrentPlanInfoBackend, SubscriptionUrlsBackend} from '@/app/components/billing/type' export const fetchCurrentPlanInfo = () => { return get('/features') diff --git a/web/service/common.ts b/web/service/common.ts index 81b96aa97c4615..a2dc9772150bb6 100644 --- a/web/service/common.ts +++ b/web/service/common.ts @@ -1,42 +1,39 @@ -import type { Fetcher } from 'swr' -import { del, get, patch, post, put } from './base' +import type {Fetcher} from 'swr' +import {del, get, patch, post, put} from './base' import type { - AccountIntegrate, - ApiBasedExtension, - CodeBasedExtension, - CommonResponse, - DataSourceNotion, - FileUploadConfigResponse, - ICurrentWorkspace, - IWorkspace, - InitValidateStatusResponse, - InvitationResponse, - LangGeniusVersionResponse, - Member, - ModerateResponse, - OauthResponse, - PluginProvider, - Provider, - ProviderAnthropicToken, - ProviderAzureToken, - SetupStatusResponse, - UserProfileOriginResponse, + AccountIntegrate, + ApiBasedExtension, + CodeBasedExtension, + CommonResponse, + DataSourceNotion, + FileUploadConfigResponse, + ICurrentWorkspace, + InitValidateStatusResponse, + InvitationResponse, + IWorkspace, + LangGeniusVersionResponse, + Member, + ModerateResponse, + OauthResponse, + PluginProvider, + Provider, + ProviderAnthropicToken, + ProviderAzureToken, + SetupStatusResponse, + UserProfileOriginResponse, } from '@/models/common' +import type {UpdateOpenAIKeyResponse, ValidateOpenAIKeyResponse,} from '@/models/app' import type { - UpdateOpenAIKeyResponse, - ValidateOpenAIKeyResponse, -} from '@/models/app' -import type { - DefaultModelResponse, - Model, - ModelItem, - ModelLoadBalancingConfig, - ModelParameterRule, - ModelProvider, - ModelTypeEnum, + DefaultModelResponse, + Model, + ModelItem, + ModelLoadBalancingConfig, + ModelParameterRule, + ModelProvider, + ModelTypeEnum, } from '@/app/components/header/account-setting/model-provider-page/declarations' -import type { RETRIEVE_METHOD } from '@/types/app' -import type { SystemFeatures } from '@/types/feature' +import type {RETRIEVE_METHOD} from '@/types/app' +import type {SystemFeatures} from '@/types/feature' type LoginSuccess = { result: 'success' diff --git a/web/service/datasets.ts b/web/service/datasets.ts index 90411efd4e19f9..7d4c66c50bd900 100644 --- a/web/service/datasets.ts +++ b/web/service/datasets.ts @@ -1,43 +1,40 @@ -import type { Fetcher } from 'swr' +import type {Fetcher} from 'swr' import qs from 'qs' -import { del, get, patch, post, put } from './base' +import {del, get, patch, post, put} from './base' import type { - CreateDocumentReq, - DataSet, - DataSetListResponse, - DocumentDetailResponse, - DocumentListResponse, - ErrorDocsResponse, - ExternalAPIDeleteResponse, - ExternalAPIItem, - ExternalAPIListResponse, - ExternalAPIUsage, - ExternalKnowledgeBaseHitTestingResponse, - ExternalKnowledgeItem, - FileIndexingEstimateResponse, - HitTestingRecordsResponse, - HitTestingResponse, - IndexingEstimateParams, - IndexingEstimateResponse, - IndexingStatusBatchResponse, - IndexingStatusResponse, - ProcessRuleResponse, - RelatedAppResponse, - SegmentDetailModel, - SegmentUpdater, - SegmentsQuery, - SegmentsResponse, - createDocumentResponse, + CreateDocumentReq, + createDocumentResponse, + DataSet, + DataSetListResponse, + DocumentDetailResponse, + DocumentListResponse, + ErrorDocsResponse, + ExternalAPIDeleteResponse, + ExternalAPIItem, + ExternalAPIListResponse, + ExternalAPIUsage, + ExternalKnowledgeBaseHitTestingResponse, + ExternalKnowledgeItem, + FileIndexingEstimateResponse, + HitTestingRecordsResponse, + HitTestingResponse, + IndexingEstimateParams, + IndexingEstimateResponse, + IndexingStatusBatchResponse, + IndexingStatusResponse, + ProcessRuleResponse, + RelatedAppResponse, + SegmentDetailModel, + SegmentsQuery, + SegmentsResponse, + SegmentUpdater, } from '@/models/datasets' -import type { CreateKnowledgeBaseReq } from '@/app/components/datasets/external-knowledge-base/create/declarations' -import type { CreateExternalAPIReq } from '@/app/components/datasets/external-api/declarations' -import type { CommonResponse, DataSourceNotionWorkspace } from '@/models/common' -import { DataSourceProvider } from '@/models/common' -import type { - ApiKeysListResponse, - CreateApiKeyResponse, -} from '@/models/app' -import type { RetrievalConfig } from '@/types/app' +import type {CreateKnowledgeBaseReq} from '@/app/components/datasets/external-knowledge-base/create/declarations' +import type {CreateExternalAPIReq} from '@/app/components/datasets/external-api/declarations' +import type {CommonResponse, DataSourceNotionWorkspace} from '@/models/common' +import {DataSourceProvider} from '@/models/common' +import type {ApiKeysListResponse, CreateApiKeyResponse,} from '@/models/app' +import type {RetrievalConfig} from '@/types/app' // apis for documents in a dataset diff --git a/web/service/debug.ts b/web/service/debug.ts index 3770c4d398d186..ff4b0e1e4b9718 100644 --- a/web/service/debug.ts +++ b/web/service/debug.ts @@ -1,8 +1,9 @@ -import { get, post, ssePost } from './base' -import type { IOnCompleted, IOnData, IOnError, IOnFile, IOnMessageEnd, IOnMessageReplace, IOnThought } from './base' -import type { ChatPromptConfig, CompletionPromptConfig } from '@/models/debug' -import type { ModelModeType } from '@/types/app' -import type { ModelParameterRule } from '@/app/components/header/account-setting/model-provider-page/declarations' +import type {IOnCompleted, IOnData, IOnError, IOnFile, IOnMessageEnd, IOnMessageReplace, IOnThought} from './base' +import {get, post, ssePost} from './base' +import type {ChatPromptConfig, CompletionPromptConfig} from '@/models/debug' +import type {ModelModeType} from '@/types/app' +import type {ModelParameterRule} from '@/app/components/header/account-setting/model-provider-page/declarations' + export type AutomaticRes = { prompt: string variables: string[] diff --git a/web/service/demo/index.tsx b/web/service/demo/index.tsx index 50889770bda6f9..413600065f13cc 100644 --- a/web/service/demo/index.tsx +++ b/web/service/demo/index.tsx @@ -1,9 +1,22 @@ 'use client' -import type { FC } from 'react' +import type {FC} from 'react' import React from 'react' -import useSWR, { useSWRConfig } from 'swr' -import { createApp, fetchAppDetail, fetchAppList, getAppDailyConversations, getAppDailyEndUsers, updateAppApiStatus, updateAppModelConfig, updateAppRateLimit, updateAppSiteAccessToken, updateAppSiteConfig, updateAppSiteStatus } from '../apps' +import useSWR, {useSWRConfig} from 'swr' +import { + createApp, + fetchAppDetail, + fetchAppList, + getAppDailyConversations, + getAppDailyEndUsers, + updateAppApiStatus, + updateAppModelConfig, + updateAppRateLimit, + updateAppSiteAccessToken, + updateAppSiteConfig, + updateAppSiteStatus +} from '../apps' import Loading from '@/app/components/base/loading' + const Service: FC = () => { const { data: appList, error: appListError } = useSWR({ url: '/apps', params: { page: 1 } }, fetchAppList) const { data: firstApp, error: appDetailError } = useSWR({ url: '/apps', id: '1' }, fetchAppDetail) diff --git a/web/service/explore.ts b/web/service/explore.ts index e9e17416d1c1b3..d3bfbde647fba4 100644 --- a/web/service/explore.ts +++ b/web/service/explore.ts @@ -1,5 +1,5 @@ -import { del, get, patch, post } from './base' -import type { App, AppCategory } from '@/models/explore' +import {del, get, patch, post} from './base' +import type {App, AppCategory} from '@/models/explore' export const fetchAppList = () => { return get<{ diff --git a/web/service/log.ts b/web/service/log.ts index ec22785e40d470..5af884572a9476 100644 --- a/web/service/log.ts +++ b/web/service/log.ts @@ -1,27 +1,27 @@ -import type { Fetcher } from 'swr' -import { get, post } from './base' +import type {Fetcher} from 'swr' +import {get, post} from './base' import type { - AgentLogDetailRequest, - AgentLogDetailResponse, - AnnotationsCountResponse, - ChatConversationFullDetailResponse, - ChatConversationsRequest, - ChatConversationsResponse, - ChatMessagesRequest, - ChatMessagesResponse, - CompletionConversationFullDetailResponse, - CompletionConversationsRequest, - CompletionConversationsResponse, - ConversationListResponse, - LogMessageAnnotationsRequest, - LogMessageAnnotationsResponse, - LogMessageFeedbacksRequest, - LogMessageFeedbacksResponse, - WorkflowLogsRequest, - WorkflowLogsResponse, - WorkflowRunDetailResponse, + AgentLogDetailRequest, + AgentLogDetailResponse, + AnnotationsCountResponse, + ChatConversationFullDetailResponse, + ChatConversationsRequest, + ChatConversationsResponse, + ChatMessagesRequest, + ChatMessagesResponse, + CompletionConversationFullDetailResponse, + CompletionConversationsRequest, + CompletionConversationsResponse, + ConversationListResponse, + LogMessageAnnotationsRequest, + LogMessageAnnotationsResponse, + LogMessageFeedbacksRequest, + LogMessageFeedbacksResponse, + WorkflowLogsRequest, + WorkflowLogsResponse, + WorkflowRunDetailResponse, } from '@/models/log' -import type { NodeTracingListResponse } from '@/types/workflow' +import type {NodeTracingListResponse} from '@/types/workflow' export const fetchConversationList: Fetcher }> = ({ appId, params }) => { return get(`/console/api/apps/${appId}/messages`, params) diff --git a/web/service/refresh-token.ts b/web/service/refresh-token.ts index b193779629e26e..72402dfc6a0df1 100644 --- a/web/service/refresh-token.ts +++ b/web/service/refresh-token.ts @@ -1,5 +1,5 @@ -import { apiPrefix } from '@/config' -import { fetchWithRetry } from '@/utils' +import {apiPrefix} from '@/config' +import {fetchWithRetry} from '@/utils' const LOCAL_STORAGE_KEY = 'is_other_tab_refreshing' diff --git a/web/service/share.ts b/web/service/share.ts index 0e46e30d01fec7..31b68ef8c36e38 100644 --- a/web/service/share.ts +++ b/web/service/share.ts @@ -1,17 +1,38 @@ -import type { IOnCompleted, IOnData, IOnError, IOnFile, IOnIterationFinished, IOnIterationNext, IOnIterationStarted, IOnMessageEnd, IOnMessageReplace, IOnNodeFinished, IOnNodeStarted, IOnTTSChunk, IOnTTSEnd, IOnTextChunk, IOnTextReplace, IOnThought, IOnWorkflowFinished, IOnWorkflowStarted } from './base' +import type { + IOnCompleted, + IOnData, + IOnError, + IOnFile, + IOnIterationFinished, + IOnIterationNext, + IOnIterationStarted, + IOnMessageEnd, + IOnMessageReplace, + IOnNodeFinished, + IOnNodeStarted, + IOnTextChunk, + IOnTextReplace, + IOnThought, + IOnTTSChunk, + IOnTTSEnd, + IOnWorkflowFinished, + IOnWorkflowStarted +} from './base' import { - del as consoleDel, get as consoleGet, patch as consolePatch, post as consolePost, - delPublic as del, getPublic as get, patchPublic as patch, postPublic as post, ssePost, + del as consoleDel, + delPublic as del, + get as consoleGet, + getPublic as get, + patch as consolePatch, + patchPublic as patch, + post as consolePost, + postPublic as post, + ssePost, } from './base' -import type { FeedbackType } from '@/app/components/base/chat/chat/type' -import type { - AppConversationData, - AppData, - AppMeta, - ConversationItem, -} from '@/models/share' -import type { ChatConfig } from '@/app/components/base/chat/types' -import type { SystemFeatures } from '@/types/feature' +import type {FeedbackType} from '@/app/components/base/chat/chat/type' +import type {AppConversationData, AppData, AppMeta, ConversationItem,} from '@/models/share' +import type {ChatConfig} from '@/app/components/base/chat/types' +import type {SystemFeatures} from '@/types/feature' function getAction(action: 'get' | 'post' | 'del' | 'patch', isInstalledApp: boolean) { switch (action) { diff --git a/web/service/sso.ts b/web/service/sso.ts index eb22799ba5d4bc..b5b7ad18e0d831 100644 --- a/web/service/sso.ts +++ b/web/service/sso.ts @@ -1,4 +1,4 @@ -import { get } from './base' +import {get} from './base' export const getUserSAMLSSOUrl = (invite_token?: string) => { const url = invite_token ? `/enterprise/sso/saml/login?invite_token=${invite_token}` : '/enterprise/sso/saml/login' diff --git a/web/service/tag.ts b/web/service/tag.ts index 99cfe07342cd50..777252656f0f98 100644 --- a/web/service/tag.ts +++ b/web/service/tag.ts @@ -1,5 +1,5 @@ -import { del, get, patch, post } from './base' -import type { Tag } from '@/app/components/base/tag-management/constant' +import {del, get, patch, post} from './base' +import type {Tag} from '@/app/components/base/tag-management/constant' export const fetchTagList = (type: string) => { return get('/tags', { params: { type } }) diff --git a/web/service/tools.ts b/web/service/tools.ts index 90221edec23dc5..7233f3522eef94 100644 --- a/web/service/tools.ts +++ b/web/service/tools.ts @@ -1,15 +1,15 @@ -import { get, post } from './base' +import {get, post} from './base' import type { - Collection, - CustomCollectionBackend, - CustomParamSchema, - Tool, - ToolCredential, - WorkflowToolProviderRequest, - WorkflowToolProviderResponse, + Collection, + CustomCollectionBackend, + CustomParamSchema, + Tool, + ToolCredential, + WorkflowToolProviderRequest, + WorkflowToolProviderResponse, } from '@/app/components/tools/types' -import type { ToolWithProvider } from '@/app/components/workflow/types' -import type { Label } from '@/app/components/tools/labels/constant' +import type {ToolWithProvider} from '@/app/components/workflow/types' +import type {Label} from '@/app/components/tools/labels/constant' export const fetchCollectionList = () => { return get('/workspaces/current/tool-providers') diff --git a/web/service/use-base.ts b/web/service/use-base.ts index 5eeca22668161a..23fecc2fd0f7f4 100644 --- a/web/service/use-base.ts +++ b/web/service/use-base.ts @@ -1,6 +1,4 @@ -import { - useQueryClient, -} from '@tanstack/react-query' +import {useQueryClient,} from '@tanstack/react-query' export const useInvalid = (key: string[]) => { const queryClient = useQueryClient() diff --git a/web/service/use-workflow.ts b/web/service/use-workflow.ts index 948a114b042f84..7a4cb7afe11216 100644 --- a/web/service/use-workflow.ts +++ b/web/service/use-workflow.ts @@ -1,6 +1,6 @@ -import { useQuery } from '@tanstack/react-query' -import { get } from './base' -import type { WorkflowConfigResponse } from '@/types/workflow' +import {useQuery} from '@tanstack/react-query' +import {get} from './base' +import type {WorkflowConfigResponse} from '@/types/workflow' const NAME_SPACE = 'workflow' diff --git a/web/service/workflow.ts b/web/service/workflow.ts index 10b5eac7cc5f29..35df411e52b804 100644 --- a/web/service/workflow.ts +++ b/web/service/workflow.ts @@ -1,14 +1,15 @@ -import type { Fetcher } from 'swr' -import { get, post } from './base' -import type { CommonResponse } from '@/models/common' +import type {Fetcher} from 'swr' +import {get, post} from './base' +import type {CommonResponse} from '@/models/common' import { ChatRunHistoryResponse, - ConversationVariableResponse, FetchWorkflowDraftPageResponse, + ConversationVariableResponse, + FetchWorkflowDraftPageResponse, FetchWorkflowDraftResponse, NodesDefaultConfigsResponse, WorkflowRunHistoryResponse, } from '@/types/workflow' -import type { BlockEnum } from '@/app/components/workflow/types' +import type {BlockEnum} from '@/app/components/workflow/types' export const fetchWorkflowDraft = (url: string) => { return get(url, {}, { silent: true }) as Promise diff --git a/web/tailwind.config.js b/web/tailwind.config.js index b4e2263167f1cc..11b207d1d0d772 100644 --- a/web/tailwind.config.js +++ b/web/tailwind.config.js @@ -1,5 +1,6 @@ /** @type {import('tailwindcss').Config} */ import tailwindThemeVarDefine from './themes/tailwind-theme-var-define' + module.exports = { content: [ './app/**/*.{js,ts,jsx,tsx}',