diff --git a/api/controllers/console/app/annotation.py b/api/controllers/console/app/annotation.py index 24f1020c18..fcd8ed1882 100644 --- a/api/controllers/console/app/annotation.py +++ b/api/controllers/console/app/annotation.py @@ -89,7 +89,7 @@ class AnnotationReplyActionStatusApi(Resource): app_annotation_job_key = "{}_app_annotation_job_{}".format(action, str(job_id)) cache_result = redis_client.get(app_annotation_job_key) if cache_result is None: - raise ValueError("The job is not exist.") + raise ValueError("The job does not exist.") job_status = cache_result.decode() error_msg = "" @@ -226,7 +226,7 @@ class AnnotationBatchImportStatusApi(Resource): indexing_cache_key = "app_annotation_batch_import_{}".format(str(job_id)) cache_result = redis_client.get(indexing_cache_key) if cache_result is None: - raise ValueError("The job is not exist.") + raise ValueError("The job does not exist.") job_status = cache_result.decode() error_msg = "" if job_status == "error": diff --git a/api/controllers/console/datasets/datasets_segments.py b/api/controllers/console/datasets/datasets_segments.py index 1b38d0776a..696aaa94db 100644 --- a/api/controllers/console/datasets/datasets_segments.py +++ b/api/controllers/console/datasets/datasets_segments.py @@ -398,7 +398,7 @@ class DatasetDocumentSegmentBatchImportApi(Resource): indexing_cache_key = "segment_batch_import_{}".format(job_id) cache_result = redis_client.get(indexing_cache_key) if cache_result is None: - raise ValueError("The job is not exist.") + raise ValueError("The job does not exist.") return {"job_id": job_id, "job_status": cache_result.decode()}, 200 diff --git a/api/controllers/console/workspace/plugin.py b/api/controllers/console/workspace/plugin.py index 302bc30905..e9c1884c60 100644 --- a/api/controllers/console/workspace/plugin.py +++ b/api/controllers/console/workspace/plugin.py @@ -249,6 +249,31 @@ class PluginInstallFromMarketplaceApi(Resource): return jsonable_encoder(response) +class PluginFetchMarketplacePkgApi(Resource): + @setup_required + @login_required + @account_initialization_required + @plugin_permission_required(install_required=True) + def get(self): + tenant_id = current_user.current_tenant_id + + parser = reqparse.RequestParser() + parser.add_argument("plugin_unique_identifier", type=str, required=True, location="args") + args = parser.parse_args() + + try: + return jsonable_encoder( + { + "manifest": PluginService.fetch_marketplace_pkg( + tenant_id, + args["plugin_unique_identifier"], + ) + } + ) + except PluginDaemonClientSideError as e: + raise ValueError(e) + + class PluginFetchManifestApi(Resource): @setup_required @login_required @@ -488,6 +513,7 @@ api.add_resource(PluginDeleteInstallTaskApi, "/workspaces/current/plugin/tasks/< api.add_resource(PluginDeleteAllInstallTaskItemsApi, "/workspaces/current/plugin/tasks/delete_all") api.add_resource(PluginDeleteInstallTaskItemApi, "/workspaces/current/plugin/tasks//delete/") api.add_resource(PluginUninstallApi, "/workspaces/current/plugin/uninstall") +api.add_resource(PluginFetchMarketplacePkgApi, "/workspaces/current/plugin/marketplace/pkg") api.add_resource(PluginChangePermissionApi, "/workspaces/current/plugin/permission/change") api.add_resource(PluginFetchPermissionApi, "/workspaces/current/plugin/permission/fetch") diff --git a/api/controllers/service_api/dataset/dataset.py b/api/controllers/service_api/dataset/dataset.py index 8d470b8991..f087243a25 100644 --- a/api/controllers/service_api/dataset/dataset.py +++ b/api/controllers/service_api/dataset/dataset.py @@ -13,6 +13,7 @@ from fields.dataset_fields import dataset_detail_fields from libs.login import current_user from models.dataset import Dataset, DatasetPermissionEnum from services.dataset_service import DatasetPermissionService, DatasetService +from services.entities.knowledge_entities.knowledge_entities import RetrievalModel def _validate_name(name): @@ -120,8 +121,11 @@ class DatasetListApi(DatasetApiResource): nullable=True, required=False, ) - args = parser.parse_args() + parser.add_argument("retrieval_model", type=dict, required=False, nullable=True, location="json") + parser.add_argument("embedding_model", type=str, required=False, nullable=True, location="json") + parser.add_argument("embedding_model_provider", type=str, required=False, nullable=True, location="json") + args = parser.parse_args() try: dataset = DatasetService.create_empty_dataset( tenant_id=tenant_id, @@ -133,6 +137,9 @@ class DatasetListApi(DatasetApiResource): provider=args["provider"], external_knowledge_api_id=args["external_knowledge_api_id"], external_knowledge_id=args["external_knowledge_id"], + embedding_model_provider=args["embedding_model_provider"], + embedding_model_name=args["embedding_model"], + retrieval_model=RetrievalModel(**args["retrieval_model"]), ) except services.errors.dataset.DatasetNameDuplicateError: raise DatasetNameDuplicateError() diff --git a/api/controllers/service_api/dataset/document.py b/api/controllers/service_api/dataset/document.py index 4cc92847fe..eec6afc9ef 100644 --- a/api/controllers/service_api/dataset/document.py +++ b/api/controllers/service_api/dataset/document.py @@ -49,7 +49,9 @@ class DocumentAddByTextApi(DatasetApiResource): parser.add_argument( "indexing_technique", type=str, choices=Dataset.INDEXING_TECHNIQUE_LIST, nullable=False, location="json" ) - parser.add_argument("retrieval_model", type=dict, required=False, nullable=False, location="json") + parser.add_argument("retrieval_model", type=dict, required=False, nullable=True, location="json") + parser.add_argument("embedding_model", type=str, required=False, nullable=True, location="json") + parser.add_argument("embedding_model_provider", type=str, required=False, nullable=True, location="json") args = parser.parse_args() dataset_id = str(dataset_id) @@ -57,7 +59,7 @@ class DocumentAddByTextApi(DatasetApiResource): dataset = db.session.query(Dataset).filter(Dataset.tenant_id == tenant_id, Dataset.id == dataset_id).first() if not dataset: - raise ValueError("Dataset is not exist.") + raise ValueError("Dataset does not exist.") if not dataset.indexing_technique and not args["indexing_technique"]: raise ValueError("indexing_technique is required.") @@ -114,7 +116,7 @@ class DocumentUpdateByTextApi(DatasetApiResource): dataset = db.session.query(Dataset).filter(Dataset.tenant_id == tenant_id, Dataset.id == dataset_id).first() if not dataset: - raise ValueError("Dataset is not exist.") + raise ValueError("Dataset does not exist.") # indexing_technique is already set in dataset since this is an update args["indexing_technique"] = dataset.indexing_technique @@ -172,7 +174,7 @@ class DocumentAddByFileApi(DatasetApiResource): dataset = db.session.query(Dataset).filter(Dataset.tenant_id == tenant_id, Dataset.id == dataset_id).first() if not dataset: - raise ValueError("Dataset is not exist.") + raise ValueError("Dataset does not exist.") if not dataset.indexing_technique and not args.get("indexing_technique"): raise ValueError("indexing_technique is required.") @@ -239,7 +241,7 @@ class DocumentUpdateByFileApi(DatasetApiResource): dataset = db.session.query(Dataset).filter(Dataset.tenant_id == tenant_id, Dataset.id == dataset_id).first() if not dataset: - raise ValueError("Dataset is not exist.") + raise ValueError("Dataset does not exist.") # indexing_technique is already set in dataset since this is an update args["indexing_technique"] = dataset.indexing_technique @@ -303,7 +305,7 @@ class DocumentDeleteApi(DatasetApiResource): dataset = db.session.query(Dataset).filter(Dataset.tenant_id == tenant_id, Dataset.id == dataset_id).first() if not dataset: - raise ValueError("Dataset is not exist.") + raise ValueError("Dataset does not exist.") document = DocumentService.get_document(dataset.id, document_id) diff --git a/api/core/app/apps/message_based_app_generator.py b/api/core/app/apps/message_based_app_generator.py index 64ec6ac0c4..b1f527c0f2 100644 --- a/api/core/app/apps/message_based_app_generator.py +++ b/api/core/app/apps/message_based_app_generator.py @@ -153,6 +153,7 @@ class MessageBasedAppGenerator(BaseAppGenerator): query = application_generate_entity.query or "New conversation" else: query = next(iter(application_generate_entity.inputs.values()), "New conversation") + query = query or "New conversation" conversation_name = (query[:20] + "…") if len(query) > 20 else query if not conversation: diff --git a/api/core/ops/ops_trace_manager.py b/api/core/ops/ops_trace_manager.py index f388225cc4..6fc02393fe 100644 --- a/api/core/ops/ops_trace_manager.py +++ b/api/core/ops/ops_trace_manager.py @@ -453,7 +453,7 @@ class TraceTask: "version": workflow_run_version, "total_tokens": total_tokens, "file_list": file_list, - "triggered_form": workflow_run.triggered_from, + "triggered_from": workflow_run.triggered_from, "user_id": user_id, } diff --git a/api/core/plugin/entities/plugin.py b/api/core/plugin/entities/plugin.py index 421c16093d..07ed94380a 100644 --- a/api/core/plugin/entities/plugin.py +++ b/api/core/plugin/entities/plugin.py @@ -70,6 +70,9 @@ class PluginDeclaration(BaseModel): models: Optional[list[str]] = Field(default_factory=list) endpoints: Optional[list[str]] = Field(default_factory=list) + class Meta(BaseModel): + minimum_dify_version: Optional[str] = Field(default=None, pattern=r"^\d{1,4}(\.\d{1,4}){1,3}(-\w{1,16})?$") + version: str = Field(..., pattern=r"^\d{1,4}(\.\d{1,4}){1,3}(-\w{1,16})?$") author: Optional[str] = Field(..., pattern=r"^[a-zA-Z0-9_-]{1,64}$") name: str = Field(..., pattern=r"^[a-z0-9_-]{1,128}$") @@ -86,6 +89,7 @@ class PluginDeclaration(BaseModel): model: Optional[ProviderEntity] = None endpoint: Optional[EndpointProviderDeclaration] = None agent_strategy: Optional[AgentStrategyProviderEntity] = None + meta: Meta @model_validator(mode="before") @classmethod diff --git a/api/core/rag/datasource/vdb/qdrant/qdrant_vector.py b/api/core/rag/datasource/vdb/qdrant/qdrant_vector.py index 4efd90667a..1e040f415e 100644 --- a/api/core/rag/datasource/vdb/qdrant/qdrant_vector.py +++ b/api/core/rag/datasource/vdb/qdrant/qdrant_vector.py @@ -444,7 +444,7 @@ class QdrantVectorFactory(AbstractVectorFactory): if dataset_collection_binding: collection_name = dataset_collection_binding.collection_name else: - raise ValueError("Dataset Collection Bindings is not exist!") + raise ValueError("Dataset Collection Bindings does not exist!") else: if dataset.index_struct_dict: class_prefix: str = dataset.index_struct_dict["vector_store"]["class_prefix"] diff --git a/api/core/workflow/nodes/parameter_extractor/parameter_extractor_node.py b/api/core/workflow/nodes/parameter_extractor/parameter_extractor_node.py index be43639fc0..8db1e432fc 100644 --- a/api/core/workflow/nodes/parameter_extractor/parameter_extractor_node.py +++ b/api/core/workflow/nodes/parameter_extractor/parameter_extractor_node.py @@ -186,6 +186,8 @@ class ParameterExtractorNode(LLMNode): "usage": None, "function": {} if not prompt_message_tools else jsonable_encoder(prompt_message_tools[0]), "tool_call": None, + "model_provider": model_config.provider, + "model_name": model_config.model, } try: diff --git a/api/core/workflow/nodes/question_classifier/question_classifier_node.py b/api/core/workflow/nodes/question_classifier/question_classifier_node.py index 0ec44eefac..b4f34a3bef 100644 --- a/api/core/workflow/nodes/question_classifier/question_classifier_node.py +++ b/api/core/workflow/nodes/question_classifier/question_classifier_node.py @@ -130,6 +130,8 @@ class QuestionClassifierNode(LLMNode): ), "usage": jsonable_encoder(usage), "finish_reason": finish_reason, + "model_provider": model_config.provider, + "model_name": model_config.model, } outputs = {"class_name": category_name, "class_id": category_id} diff --git a/api/extensions/ext_logging.py b/api/extensions/ext_logging.py index bf9b492a50..422ec87765 100644 --- a/api/extensions/ext_logging.py +++ b/api/extensions/ext_logging.py @@ -36,6 +36,8 @@ def init_app(app: DifyApp): handlers=log_handlers, force=True, ) + # Disable propagation for noisy loggers to avoid duplicate logs + logging.getLogger("sqlalchemy.engine").propagate = False log_tz = dify_config.LOG_TZ if log_tz: from datetime import datetime diff --git a/api/services/dataset_service.py b/api/services/dataset_service.py index b019cf6b63..0301c8a584 100644 --- a/api/services/dataset_service.py +++ b/api/services/dataset_service.py @@ -169,6 +169,9 @@ class DatasetService: provider: str = "vendor", external_knowledge_api_id: Optional[str] = None, external_knowledge_id: Optional[str] = None, + embedding_model_provider: Optional[str] = None, + embedding_model_name: Optional[str] = None, + retrieval_model: Optional[RetrievalModel] = None, ): # check if dataset name already exists if Dataset.query.filter_by(name=name, tenant_id=tenant_id).first(): @@ -176,9 +179,30 @@ class DatasetService: embedding_model = None if indexing_technique == "high_quality": model_manager = ModelManager() - embedding_model = model_manager.get_default_model_instance( - tenant_id=tenant_id, model_type=ModelType.TEXT_EMBEDDING - ) + if embedding_model_provider and embedding_model_name: + # check if embedding model setting is valid + DatasetService.check_embedding_model_setting(tenant_id, embedding_model_provider, embedding_model_name) + embedding_model = model_manager.get_model_instance( + tenant_id=tenant_id, + provider=embedding_model_provider, + model_type=ModelType.TEXT_EMBEDDING, + model=embedding_model_name, + ) + else: + embedding_model = model_manager.get_default_model_instance( + tenant_id=tenant_id, model_type=ModelType.TEXT_EMBEDDING + ) + if retrieval_model and retrieval_model.reranking_model: + if ( + retrieval_model.reranking_model.reranking_provider_name + and retrieval_model.reranking_model.reranking_model_name + ): + # check if reranking model setting is valid + DatasetService.check_embedding_model_setting( + tenant_id, + retrieval_model.reranking_model.reranking_provider_name, + retrieval_model.reranking_model.reranking_model_name, + ) dataset = Dataset(name=name, indexing_technique=indexing_technique) # dataset = Dataset(name=name, provider=provider, config=config) dataset.description = description @@ -187,6 +211,7 @@ class DatasetService: dataset.tenant_id = tenant_id dataset.embedding_model_provider = embedding_model.provider if embedding_model else None dataset.embedding_model = embedding_model.model if embedding_model else None + dataset.retrieval_model = retrieval_model.model_dump() if retrieval_model else None dataset.permission = permission or DatasetPermissionEnum.ONLY_ME dataset.provider = provider db.session.add(dataset) @@ -923,11 +948,11 @@ class DocumentService: "score_threshold_enabled": False, } - dataset.retrieval_model = ( - knowledge_config.retrieval_model.model_dump() - if knowledge_config.retrieval_model - else default_retrieval_model - ) # type: ignore + dataset.retrieval_model = ( + knowledge_config.retrieval_model.model_dump() + if knowledge_config.retrieval_model + else default_retrieval_model + ) # type: ignore documents = [] if knowledge_config.original_document_id: diff --git a/api/services/plugin/plugin_service.py b/api/services/plugin/plugin_service.py index 25d192410f..96a07d36b9 100644 --- a/api/services/plugin/plugin_service.py +++ b/api/services/plugin/plugin_service.py @@ -309,6 +309,22 @@ class PluginService: ], ) + @staticmethod + def fetch_marketplace_pkg( + tenant_id: str, plugin_unique_identifier: str, verify_signature: bool = False + ) -> PluginDeclaration: + """ + Fetch marketplace package + """ + manager = PluginInstallationManager() + try: + declaration = manager.fetch_plugin_manifest(tenant_id, plugin_unique_identifier) + except Exception: + pkg = download_plugin_pkg(plugin_unique_identifier) + declaration = manager.upload_pkg(tenant_id, pkg, verify_signature).manifest + + return declaration + @staticmethod def install_from_marketplace_pkg( tenant_id: str, plugin_unique_identifiers: Sequence[str], verify_signature: bool = False diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/config-popup.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/config-popup.tsx index 20bf2137c2..eb23da2ae0 100644 --- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/config-popup.tsx +++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/config-popup.tsx @@ -124,7 +124,7 @@ const ConfigPopup: FC = ({ ) const configuredProviderPanel = () => { - const configuredPanels: any[] = [] + const configuredPanels: JSX.Element[] = [] if (langSmithConfig) configuredPanels.push(langSmithPanel) @@ -139,7 +139,7 @@ const ConfigPopup: FC = ({ } const moreProviderPanel = () => { - const notConfiguredPanels: any[] = [] + const notConfiguredPanels: JSX.Element[] = [] if (!langSmithConfig) notConfiguredPanels.push(langSmithPanel) diff --git a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/api/page.tsx b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/api/page.tsx index f1b20dd8d8..167520ca7b 100644 --- a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/api/page.tsx +++ b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/api/page.tsx @@ -1,8 +1,6 @@ import React from 'react' -type Props = {} - -const page = (props: Props) => { +const page = () => { return (
dataset detail api
) diff --git a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout-main.tsx b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout-main.tsx index ef19b6d92e..078c7ebd8c 100644 --- a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout-main.tsx +++ b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout-main.tsx @@ -1,22 +1,22 @@ 'use client' -import type { FC, SVGProps } from 'react' +import type { FC } from 'react' import React, { useEffect, useMemo } from 'react' import { usePathname } from 'next/navigation' import useSWR from 'swr' import { useTranslation } from 'react-i18next' import { useBoolean } from 'ahooks' import { - Cog8ToothIcon, - DocumentTextIcon, + RiEqualizer2Fill, + RiEqualizer2Line, + RiFileTextFill, + RiFileTextLine, + RiFocus2Fill, + RiFocus2Line, +} from '@remixicon/react' +import { PaperClipIcon, } from '@heroicons/react/24/outline' -import { - Cog8ToothIcon as Cog8ToothSolidIcon, - // CommandLineIcon as CommandLineSolidIcon, - DocumentTextIcon as DocumentTextSolidIcon, -} from '@heroicons/react/24/solid' import { RiApps2AddLine, RiBookOpenLine, RiInformation2Line } from '@remixicon/react' -import s from './style.module.css' import classNames from '@/utils/classnames' import { fetchDatasetDetail, fetchDatasetRelatedApps } from '@/service/datasets' import type { RelatedAppResponse } from '@/models/datasets' @@ -37,27 +37,6 @@ export type IAppDetailLayoutProps = { params: { datasetId: string } } -const TargetIcon = ({ className }: SVGProps) => { - return - - - - - - - - - -} - -const TargetSolidIcon = ({ className }: SVGProps) => { - return - - - - -} - type IExtraInfoProps = { isMobile: boolean relatedApps?: RelatedAppResponse @@ -98,9 +77,9 @@ const ExtraInfo = ({ isMobile, relatedApps, expand }: IExtraInfoProps) => { )} - {isMobile &&
+ {isMobile &&
{relatedAppsTotal || '--'} - +
} )} @@ -164,17 +143,16 @@ const DatasetDetailLayout: FC = (props) => { const navigation = useMemo(() => { const baseNavigation = [ - { name: t('common.datasetMenus.hitTesting'), href: `/datasets/${datasetId}/hitTesting`, icon: TargetIcon, selectedIcon: TargetSolidIcon }, - // { name: 'api & webhook', href: `/datasets/${datasetId}/api`, icon: CommandLineIcon, selectedIcon: CommandLineSolidIcon }, - { name: t('common.datasetMenus.settings'), href: `/datasets/${datasetId}/settings`, icon: Cog8ToothIcon, selectedIcon: Cog8ToothSolidIcon }, + { name: t('common.datasetMenus.hitTesting'), href: `/datasets/${datasetId}/hitTesting`, icon: RiFocus2Line, selectedIcon: RiFocus2Fill }, + { name: t('common.datasetMenus.settings'), href: `/datasets/${datasetId}/settings`, icon: RiEqualizer2Line, selectedIcon: RiEqualizer2Fill }, ] if (datasetRes?.provider !== 'external') { baseNavigation.unshift({ name: t('common.datasetMenus.documents'), href: `/datasets/${datasetId}/documents`, - icon: DocumentTextIcon, - selectedIcon: DocumentTextSolidIcon, + icon: RiFileTextLine, + selectedIcon: RiFileTextFill, }) } return baseNavigation diff --git a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/style.module.css b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/style.module.css deleted file mode 100644 index 516b124809..0000000000 --- a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/style.module.css +++ /dev/null @@ -1,9 +0,0 @@ -.statusPoint { - @apply flex justify-center items-center absolute -right-0.5 -bottom-0.5 w-2.5 h-2.5 bg-white rounded; -} -.subTitle { - @apply uppercase text-xs text-gray-500 font-medium px-3 pb-2 pt-4; -} -.emptyIconDiv { - @apply h-7 w-7 bg-gray-50 border border-[#EAECF5] inline-flex justify-center items-center rounded-lg; -} diff --git a/web/app/(commonLayout)/datasets/DatasetCard.tsx b/web/app/(commonLayout)/datasets/DatasetCard.tsx index 9cafa341f2..e0012b4956 100644 --- a/web/app/(commonLayout)/datasets/DatasetCard.tsx +++ b/web/app/(commonLayout)/datasets/DatasetCard.tsx @@ -61,7 +61,7 @@ const DatasetCard = ({ if (onSuccess) onSuccess() } - catch (e: any) { + catch { } setShowConfirmDelete(false) }, [dataset.id, notify, onSuccess, t]) diff --git a/web/app/(commonLayout)/datasets/template/template.en.mdx b/web/app/(commonLayout)/datasets/template/template.en.mdx index 4faf26058e..357b66a96f 100644 --- a/web/app/(commonLayout)/datasets/template/template.en.mdx +++ b/web/app/(commonLayout)/datasets/template/template.en.mdx @@ -37,7 +37,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi This API is based on an existing knowledge and creates a new document through text based on this knowledge. - ### Params + ### Path Knowledge ID @@ -175,7 +175,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi This API is based on an existing knowledge and creates a new document through a file based on this knowledge. - ### Params + ### Path Knowledge ID @@ -314,6 +314,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi Index technique (optional) + If this is not set, embedding_model, embedding_provider_name and retrieval_model will be set to null - high_quality High quality - economy Economy @@ -334,6 +335,26 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi External knowledge ID (optional) + + Embedding model name (optional) + + + Embedding model provider name (optional) + + + Retrieval model (optional) + - search_method (string) Search method + - hybrid_search Hybrid search + - semantic_search Semantic search + - full_text_search Full-text search + - reranking_enable (bool) Whether to enable reranking + - reranking_model (object) Rerank model configuration + - reranking_provider_name (string) Rerank model provider + - reranking_model_name (string) Rerank model name + - top_k (int) Number of results to return + - score_threshold_enabled (bool) Whether to enable score threshold + - score_threshold (float) Score threshold + @@ -461,7 +482,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### Query + ### Path Knowledge Base ID @@ -542,7 +563,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### Query + ### Path Knowledge Base ID @@ -650,7 +671,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### Params + ### Path Knowledge ID @@ -689,7 +710,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi This API is based on an existing knowledge and updates the document through text based on this knowledge. - ### Params + ### Path Knowledge ID @@ -791,7 +812,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi This API is based on an existing knowledge, and updates documents through files based on this knowledge - ### Params + ### Path Knowledge ID @@ -888,7 +909,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### Params + ### Path Knowledge ID @@ -943,7 +964,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### Params + ### Path Knowledge ID @@ -985,7 +1006,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### Params + ### Path Knowledge ID @@ -1060,7 +1081,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### Params + ### Path Knowledge ID @@ -1252,10 +1273,10 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi title="Request" tag="DELETE" label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}" - targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/segments/{segment_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'`} + targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'`} > ```bash {{ title: 'cURL' }} - curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/segments/{segment_id}' \ + curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \ --header 'Authorization: Bearer {api_key}' \ --header 'Content-Type: application/json' ``` @@ -1369,7 +1390,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### Params + ### Path Knowledge ID @@ -1440,7 +1461,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### Params + ### Path Knowledge ID @@ -1517,7 +1538,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### Params + ### Path Knowledge ID @@ -1565,7 +1586,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### Params + ### Path Knowledge ID @@ -1834,7 +1855,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### Params + ### Path Knowledge ID @@ -1881,7 +1902,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### Params + ### Path Knowledge ID @@ -1930,7 +1951,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### Params + ### Path Knowledge ID @@ -1963,7 +1984,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### Params + ### Path Knowledge ID @@ -1996,7 +2017,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### Params + ### Path Knowledge ID @@ -2281,4 +2302,4 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi -
\ No newline at end of file +
diff --git a/web/app/(commonLayout)/datasets/template/template.ja.mdx b/web/app/(commonLayout)/datasets/template/template.ja.mdx index a5e560df8c..6691d902a8 100644 --- a/web/app/(commonLayout)/datasets/template/template.ja.mdx +++ b/web/app/(commonLayout)/datasets/template/template.ja.mdx @@ -37,7 +37,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi この API は既存のナレッジに基づいており、このナレッジを基にテキストを使用して新しいドキュメントを作成します。 - ### パラメータ + ### パス ナレッジ ID @@ -175,7 +175,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi この API は既存のナレッジに基づいており、このナレッジを基にファイルを使用して新しいドキュメントを作成します。 - ### パラメータ + ### パス ナレッジ ID @@ -334,6 +334,26 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi 外部ナレッジ ID (オプション) + + 埋め込みモデル名(任意) + + + 埋め込みモデルのプロバイダ名(任意) + + + 検索モデル(任意) + - search_method (文字列) 検索方法 + - hybrid_search ハイブリッド検索 + - semantic_search セマンティック検索 + - full_text_search 全文検索 + - reranking_enable (ブール値) リランキングを有効にするかどうか + - reranking_model (オブジェクト) リランクモデルの設定 + - reranking_provider_name (文字列) リランクモデルのプロバイダ + - reranking_model_name (文字列) リランクモデル名 + - top_k (整数) 返される結果の数 + - score_threshold_enabled (ブール値) スコア閾値を有効にするかどうか + - score_threshold (浮動小数点数) スコア閾値 + @@ -500,7 +520,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi この API は既存のナレッジに基づいており、このナレッジを基にテキストを使用してドキュメントを更新します。 - ### パラメータ + ### パス ナレッジ ID @@ -602,7 +622,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi この API は既存のナレッジに基づいており、このナレッジを基にファイルを使用してドキュメントを更新します。 - ### パラメータ + ### パス ナレッジ ID @@ -754,7 +774,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### パラメータ + ### パス ナレッジ ID @@ -796,7 +816,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### パラメータ + ### パス ナレッジ ID @@ -871,7 +891,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### パラメータ + ### パス ナレッジ ID @@ -1063,10 +1083,10 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi title="リクエスト" tag="DELETE" label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}" - targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/segments/{segment_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'`} + targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'`} > ```bash {{ title: 'cURL' }} - curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/segments/{segment_id}' \ + curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \ --header 'Authorization: Bearer {api_key}' \ --header 'Content-Type: application/json' ``` @@ -1180,7 +1200,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### パラメータ + ### パス ナレッジ ID @@ -1251,7 +1271,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### パラメータ + ### パス ナレッジ ID @@ -1328,7 +1348,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### パラメータ + ### パス ナレッジ ID @@ -1376,7 +1396,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### パラメータ + ### パス ナレッジ ID @@ -1645,7 +1665,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### パラメータ + ### パス ナレッジ ID @@ -1692,7 +1712,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### パラメータ + ### パス ナレッジ ID @@ -1741,7 +1761,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### パラメータ + ### パス ナレッジ ID @@ -1774,7 +1794,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### パラメータ + ### パス ナレッジ ID @@ -1807,7 +1827,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### パラメータ + ### パス ナレッジ ID @@ -1848,7 +1868,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### パラメータ + ### パス ナレッジ ID diff --git a/web/app/(commonLayout)/datasets/template/template.zh.mdx b/web/app/(commonLayout)/datasets/template/template.zh.mdx index 8ff82ca1fb..fb8f728b61 100644 --- a/web/app/(commonLayout)/datasets/template/template.zh.mdx +++ b/web/app/(commonLayout)/datasets/template/template.zh.mdx @@ -335,6 +335,26 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi 外部知识库 ID(选填) + + Embedding 模型名称 + + + Embedding 模型供应商 + + + 检索模式 + - search_method (string) 检索方法 + - hybrid_search 混合检索 + - semantic_search 语义检索 + - full_text_search 全文检索 + - reranking_enable (bool) 是否开启rerank + - reranking_model (object) Rerank 模型配置 + - reranking_provider_name (string) Rerank 模型的提供商 + - reranking_model_name (string) Rerank 模型的名称 + - top_k (int) 召回条数 + - score_threshold_enabled (bool)是否开启召回分数限制 + - score_threshold (float) 召回分数限制 + @@ -462,7 +482,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### Query + ### Path 知识库 ID @@ -543,11 +563,15 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### Query + ### Path 知识库 ID + + + ### Request Body + 索引模式(选填,建议填写) - high_quality 高质量 @@ -1917,7 +1941,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### Params + ### Path 知识库 ID @@ -1966,7 +1990,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### Params + ### Path 知识库 ID @@ -1999,7 +2023,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### Params + ### Path 知识库 ID @@ -2032,7 +2056,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### Params + ### Path 知识库 ID @@ -2073,7 +2097,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi /> - ### Query + ### Path 知识库 ID diff --git a/web/app/components/app-sidebar/app-info.tsx b/web/app/components/app-sidebar/app-info.tsx index 93f749a565..18a9ac8bc8 100644 --- a/web/app/components/app-sidebar/app-info.tsx +++ b/web/app/components/app-sidebar/app-info.tsx @@ -85,7 +85,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => { setAppDetail(app) mutateApps() } - catch (e) { + catch { notify({ type: 'error', message: t('app.editFailed') }) } }, [appDetail, mutateApps, notify, setAppDetail, t]) @@ -112,7 +112,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => { onPlanInfoChanged() getRedirection(true, newApp, replace) } - catch (e) { + catch { notify({ type: 'error', message: t('app.newApp.appCreateFailed') }) } } @@ -131,7 +131,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => { a.download = `${appDetail.name}.yml` a.click() } - catch (e) { + catch { notify({ type: 'error', message: t('app.exportFailed') }) } } @@ -152,7 +152,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => { } setSecretEnvList(list) } - catch (e) { + catch { notify({ type: 'error', message: t('app.exportFailed') }) } } @@ -175,7 +175,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => { }) } setShowConfirmDelete(false) - }, [appDetail, mutateApps, notify, onPlanInfoChanged, replace, t]) + }, [appDetail, mutateApps, notify, onPlanInfoChanged, replace, setAppDetail, t]) const { isCurrentWorkspaceEditor } = useAppContext() diff --git a/web/app/components/app-sidebar/index.tsx b/web/app/components/app-sidebar/index.tsx index 67ede51101..3276a1c0a7 100644 --- a/web/app/components/app-sidebar/index.tsx +++ b/web/app/components/app-sidebar/index.tsx @@ -1,7 +1,6 @@ import React, { useEffect } from 'react' import { useShallow } from 'zustand/react/shallow' -import { RiLayoutRight2Line } from '@remixicon/react' -import { LayoutRight2LineMod } from '../base/icons/src/public/knowledge' +import { RiLayoutLeft2Line, RiLayoutRight2Line } from '@remixicon/react' import NavLink from './navLink' import type { NavIcon } from './navLink' import AppBasic from './basic' @@ -108,13 +107,13 @@ const AppDetailNav = ({ title, desc, isExternal, icon, icon_background, navigati `} >
handleToggle(appSidebarExpand)} > { expand ? - : + : }
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 fb16df0d85..274a57adf1 100644 --- a/web/app/components/app/annotation/add-annotation-modal/index.tsx +++ b/web/app/components/app/annotation/add-annotation-modal/index.tsx @@ -56,7 +56,7 @@ const AddAnnotationModal: FC = ({ try { await onAdd(payload) } - catch (e) { + catch { } setIsSaving(false) diff --git a/web/app/components/app/annotation/index.tsx b/web/app/components/app/annotation/index.tsx index d50ccde54d..f010f5f8b1 100644 --- a/web/app/components/app/annotation/index.tsx +++ b/web/app/components/app/annotation/index.tsx @@ -90,7 +90,7 @@ const Annotation: FC = ({ setList(data as AnnotationItem[]) setTotal(total) } - catch (e) { + catch { } setIsLoading(false) 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 3e558bffb9..08904d23d4 100644 --- a/web/app/components/app/annotation/view-annotation-modal/index.tsx +++ b/web/app/components/app/annotation/view-annotation-modal/index.tsx @@ -55,7 +55,7 @@ const ViewAnnotationModal: FC = ({ setHitHistoryList(data as HitHistoryItem[]) setTotal(total) } - catch (e) { + catch { } } diff --git a/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx b/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx index 90d440aba5..3268c1dc76 100644 --- a/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx +++ b/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx @@ -241,7 +241,8 @@ const Prompt: FC = ({ selectable: !hasSetBlockStatus.query, }} onChange={(value) => { - handleChange?.(value, []) + if (handleChange) + handleChange(value, []) }} onBlur={() => { handleChange(promptTemplate, getVars(promptTemplate)) 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 b638a2ebdf..4b773c01ba 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 @@ -73,7 +73,7 @@ const AgentTools: FC = () => { formattingChangedDispatcher() } - const handleToolAuthSetting = (value: any) => { + const handleToolAuthSetting = (value: AgentToolWithMoreInfo) => { const newModelConfig = produce(modelConfig, (draft) => { const tool = (draft.agentConfig.tools).find((item: any) => item.provider_id === value?.collection?.id && item.tool_name === value?.tool_name) if (tool) @@ -121,7 +121,7 @@ const AgentTools: FC = () => { } headerRight={
-
{tools.filter((item: any) => !!item.enabled).length}/{tools.length} {t('appDebug.agent.tools.enabled')}
+
{tools.filter(item => !!item.enabled).length}/{tools.length} {t('appDebug.agent.tools.enabled')}
{tools.length < MAX_TOOLS_NUM && ( <>
@@ -273,7 +273,7 @@ const AgentTools: FC = () => { {isShowSettingTool && ( { type: 'success', message: t('common.api.actionSuccess'), }) - handleToolAuthSetting(currentTool as any) + handleToolAuthSetting(currentTool) setShowSettingAuth(false) }} /> 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 b63b7c75b8..75183ab5a7 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 @@ -56,8 +56,8 @@ const SettingBuiltInTool: FC = ({ const [tools, setTools] = useState([]) const currTool = tools.find(tool => tool.name === toolName) const formSchemas = currTool ? toolParametersToFormSchemas(currTool.parameters) : [] - const infoSchemas = formSchemas.filter((item: any) => item.form === 'llm') - const settingSchemas = formSchemas.filter((item: any) => item.form !== 'llm') + const infoSchemas = formSchemas.filter(item => item.form === 'llm') + const settingSchemas = formSchemas.filter(item => item.form !== 'llm') const hasSetting = settingSchemas.length > 0 const [tempSetting, setTempSetting] = useState(setting) const [currType, setCurrType] = useState('info') @@ -88,7 +88,7 @@ const SettingBuiltInTool: FC = ({ setTempSetting(addDefaultValue(setting, formSchemas)) } } - catch (e) { } + catch { } setIsLoading(false) })() }, [collection?.name, collection?.id, collection?.type]) @@ -99,7 +99,7 @@ const SettingBuiltInTool: FC = ({ const isValid = (() => { let valid = true - settingSchemas.forEach((item: any) => { + settingSchemas.forEach((item) => { if (item.required && !tempSetting[item.name]) valid = false }) @@ -120,7 +120,7 @@ const SettingBuiltInTool: FC = ({
{infoSchemas.length > 0 && (
- {infoSchemas.map((item: any, index) => ( + {infoSchemas.map((item, index) => (
{item.label[language]}
@@ -147,7 +147,7 @@ const SettingBuiltInTool: FC = ({
= ({ provider={model?.provider} completionParams={model?.completion_params} modelId={model?.name} - setModel={onSingleRetrievalModelChange as any} - onCompletionParamsChange={onSingleRetrievalModelParamsChange as any} + setModel={onSingleRetrievalModelChange} + onCompletionParamsChange={onSingleRetrievalModelParamsChange} hideDebugWithMultipleModel debugWithMultipleModel={false} /> diff --git a/web/app/components/app/configuration/dataset-config/settings-modal/index.tsx b/web/app/components/app/configuration/dataset-config/settings-modal/index.tsx index 05290a32cc..90885dacc8 100644 --- a/web/app/components/app/configuration/dataset-config/settings-modal/index.tsx +++ b/web/app/components/app/configuration/dataset-config/settings-modal/index.tsx @@ -150,7 +150,7 @@ const SettingsModal: FC = ({ retrieval_model_dict: retrievalConfig, }) } - catch (e) { + catch { notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') }) } finally { 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 e74dff4099..17d04acdc7 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 @@ -8,6 +8,7 @@ import ModelParameterModal from '@/app/components/header/account-setting/model-p 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 { + type FormValue, MODEL_STATUS_TEXT, ModelStatusEnum, } from '@/app/components/header/account-setting/model-provider-page/declarations' @@ -45,7 +46,7 @@ const ModelParameterTrigger: FC = ({ } onMultipleModelConfigsChange(true, newModelConfigs) } - const handleParamsChange = (params: any) => { + const handleParamsChange = (params: FormValue) => { const newModelConfigs = [...multipleModelConfigs] newModelConfigs[index] = { ...newModelConfigs[index], diff --git a/web/app/components/app/configuration/index.tsx b/web/app/components/app/configuration/index.tsx index 249624a294..b7b80ea080 100644 --- a/web/app/components/app/configuration/index.tsx +++ b/web/app/components/app/configuration/index.tsx @@ -227,7 +227,7 @@ const Configuration: FC = () => { }, [modelModeType]) const [dataSets, setDataSets] = useState([]) - const contextVar = modelConfig.configs.prompt_variables.find((item: any) => item.is_context_var)?.key + const contextVar = modelConfig.configs.prompt_variables.find(item => item.is_context_var)?.key const hasSetContextVar = !!contextVar const [isShowSelectDataSet, { setTrue: showSelectDataSet, setFalse: hideSelectDataSet }] = useBoolean(false) const selectedIds = dataSets.map(item => item.id) @@ -245,7 +245,7 @@ const Configuration: FC = () => { formattingChangedDispatcher() let newDatasets = data if (data.find(item => !item.name)) { // has not loaded selected dataset - const newSelected = produce(data, (draft: any) => { + const newSelected = produce(data, (draft) => { data.forEach((item, index) => { if (!item.name) { // not fetched database const newItem = dataSets.find(i => i.id === item.id) @@ -513,7 +513,7 @@ const Configuration: FC = () => { if (modelConfig.chat_prompt_config && modelConfig.chat_prompt_config.prompt.length > 0) setChatPromptConfig(modelConfig.chat_prompt_config) else - setChatPromptConfig(clone(DEFAULT_CHAT_PROMPT_CONFIG) as any) + setChatPromptConfig(clone(DEFAULT_CHAT_PROMPT_CONFIG)) setCompletionPromptConfig(modelConfig.completion_prompt_config || clone(DEFAULT_COMPLETION_PROMPT_CONFIG) as any) setCanReturnToSimpleMode(false) } diff --git a/web/app/components/app/configuration/prompt-value-panel/index.tsx b/web/app/components/app/configuration/prompt-value-panel/index.tsx index 49d69d4fc0..e509ee50e4 100644 --- a/web/app/components/app/configuration/prompt-value-panel/index.tsx +++ b/web/app/components/app/configuration/prompt-value-panel/index.tsx @@ -79,7 +79,7 @@ const PromptValuePanel: FC = ({ } const onClear = () => { - const newInputs: Record = {} + const newInputs: Inputs = {} promptVariables.forEach((item) => { newInputs[item.key] = '' }) 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 9040de1b29..ee4bd57325 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 @@ -151,7 +151,7 @@ const ExternalDataToolModal: FC = ({ return } - if (localeData.variable && !/[a-zA-Z_][a-zA-Z0-9_]{0,29}/g.test(localeData.variable)) { + if (localeData.variable && !/[a-zA-Z_]\w{0,29}/g.test(localeData.variable)) { notify({ type: 'error', message: t('appDebug.varKeyError.notValid', { key: t('appDebug.feature.tools.modal.variableName.title') }) }) return } diff --git a/web/app/components/app/create-app-dialog/app-list/index.tsx b/web/app/components/app/create-app-dialog/app-list/index.tsx index 8b4b0cdbad..702a07397d 100644 --- a/web/app/components/app/create-app-dialog/app-list/index.tsx +++ b/web/app/components/app/create-app-dialog/app-list/index.tsx @@ -153,7 +153,7 @@ const Apps = ({ localStorage.setItem(NEED_REFRESH_APP_LIST_KEY, '1') getRedirection(isCurrentWorkspaceEditor, { id: app.app_id!, mode }, push) } - catch (e) { + catch { Toast.notify({ type: 'error', message: t('app.newApp.appCreateFailed') }) } } diff --git a/web/app/components/app/create-app-modal/index.tsx b/web/app/components/app/create-app-modal/index.tsx index 51a57cba93..a8a7f0db2a 100644 --- a/web/app/components/app/create-app-modal/index.tsx +++ b/web/app/components/app/create-app-modal/index.tsx @@ -90,7 +90,7 @@ function CreateApp({ onClose, onSuccess, onCreateFromTemplate }: CreateAppProps) localStorage.setItem(NEED_REFRESH_APP_LIST_KEY, '1') getRedirection(isCurrentWorkspaceEditor, app, push) } - catch (e) { + catch { notify({ type: 'error', message: t('app.newApp.appCreateFailed') }) } isCreatingRef.current = false @@ -287,7 +287,6 @@ type AppTypeCardProps = { onClick: () => void } function AppTypeCard({ icon, title, description, active, onClick }: AppTypeCardProps) { - const { t } = useTranslation() return
= ({ { value: PageType.log, text: t('appLog.title') }, { value: PageType.annotation, text: t('appAnnotation.title') }, ] - }, [appDetail]) + }, [appDetail?.mode, t]) if (!appDetail) { return ( diff --git a/web/app/components/app/log/list.tsx b/web/app/components/app/log/list.tsx index c4e46af107..b78af5cdba 100644 --- a/web/app/components/app/log/list.tsx +++ b/web/app/components/app/log/list.tsx @@ -547,7 +547,7 @@ const CompletionConversationDetailComp: FC<{ appId?: string; conversationId?: st notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) return true } - catch (err) { + catch { notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') }) return false } @@ -560,7 +560,7 @@ const CompletionConversationDetailComp: FC<{ appId?: string; conversationId?: st notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) return true } - catch (err) { + catch { notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') }) return false } @@ -591,7 +591,7 @@ const ChatConversationDetailComp: FC<{ appId?: string; conversationId?: string } notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) return true } - catch (err) { + catch { notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') }) return false } @@ -603,7 +603,7 @@ const ChatConversationDetailComp: FC<{ appId?: string; conversationId?: string } notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) return true } - catch (err) { + catch { notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') }) return false } diff --git a/web/app/components/app/overview/embedded/index.tsx b/web/app/components/app/overview/embedded/index.tsx index cb00c98355..c515331961 100644 --- a/web/app/components/app/overview/embedded/index.tsx +++ b/web/app/components/app/overview/embedded/index.tsx @@ -39,12 +39,12 @@ const OPTION_MAP = { `