diff --git a/api/controllers/service_api/dataset/dataset.py b/api/controllers/service_api/dataset/dataset.py index a499719fc3..f15f21d6d8 100644 --- a/api/controllers/service_api/dataset/dataset.py +++ b/api/controllers/service_api/dataset/dataset.py @@ -336,7 +336,7 @@ class DatasetApi(DatasetApiResource): Returns: dict: A dictionary with a key 'result' and a value 'success' - if the dataset was successfully deleted. Omitted in HTTP response. + if the dataset was successfully deleted. Omitted in HTTP response. int: HTTP status code 204 indicating that the operation was successful. Raises: diff --git a/api/core/agent/prompt/template.py b/api/core/agent/prompt/template.py index f5ba2119f4..c2e49d6695 100644 --- a/api/core/agent/prompt/template.py +++ b/api/core/agent/prompt/template.py @@ -13,8 +13,8 @@ Provide only ONE action per $JSON_BLOB, as shown: ``` { - "action": $TOOL_NAME, - "action_input": $ACTION_INPUT +"action": $TOOL_NAME, +"action_input": $ACTION_INPUT } ``` @@ -32,8 +32,8 @@ Thought: I know what to respond Action: ``` { - "action": "Final Answer", - "action_input": "Final response to human" +"action": "Final Answer", +"action_input": "Final response to human" } ``` @@ -62,8 +62,8 @@ Provide only ONE action per $JSON_BLOB, as shown: ``` { - "action": $TOOL_NAME, - "action_input": $ACTION_INPUT +"action": $TOOL_NAME, +"action_input": $ACTION_INPUT } ``` @@ -81,8 +81,8 @@ Thought: I know what to respond Action: ``` { - "action": "Final Answer", - "action_input": "Final response to human" +"action": "Final Answer", +"action_input": "Final response to human" } ``` diff --git a/api/core/entities/provider_configuration.py b/api/core/entities/provider_configuration.py index 66d8d0f414..4fcbc174c2 100644 --- a/api/core/entities/provider_configuration.py +++ b/api/core/entities/provider_configuration.py @@ -1064,24 +1064,24 @@ class ProviderConfigurations(BaseModel): Get available models. If preferred provider type is `system`: - Get the current **system mode** if provider supported, - if all system modes are not available (no quota), it is considered to be the **custom credential mode**. - If there is no model configured in custom mode, it is treated as no_configure. + Get the current **system mode** if provider supported, + if all system modes are not available (no quota), it is considered to be the **custom credential mode**. + If there is no model configured in custom mode, it is treated as no_configure. system > custom > no_configure If preferred provider type is `custom`: - If custom credentials are configured, it is treated as custom mode. - Otherwise, get the current **system mode** if supported, - If all system modes are not available (no quota), it is treated as no_configure. + If custom credentials are configured, it is treated as custom mode. + Otherwise, get the current **system mode** if supported, + If all system modes are not available (no quota), it is treated as no_configure. custom > system > no_configure If real mode is `system`, use system credentials to get models, - paid quotas > provider free quotas > system free quotas - include pre-defined models (exclude GPT-4, status marked as `no_permission`). + paid quotas > provider free quotas > system free quotas + include pre-defined models (exclude GPT-4, status marked as `no_permission`). If real mode is `custom`, use workspace custom credentials to get models, - include pre-defined models, custom models(manual append). + include pre-defined models, custom models(manual append). If real mode is `no_configure`, only return pre-defined models from `model runtime`. - (model status marked as `no_configure` if preferred provider type is `custom` otherwise `quota_exceeded`) + (model status marked as `no_configure` if preferred provider type is `custom` otherwise `quota_exceeded`) model status marked as `active` is available. :param provider: provider name diff --git a/api/core/indexing_runner.py b/api/core/indexing_runner.py index f2fe306179..49b8a73d47 100644 --- a/api/core/indexing_runner.py +++ b/api/core/indexing_runner.py @@ -323,7 +323,7 @@ class IndexingRunner: except Exception: logging.exception( "Delete image_files failed while indexing_estimate, \ - image_upload_file_is: {}".format(upload_file_id) + image_upload_file_is: {}".format(upload_file_id) ) db.session.delete(image_file) diff --git a/api/core/llm_generator/prompts.py b/api/core/llm_generator/prompts.py index ef81e38dc5..e7988dcdd7 100644 --- a/api/core/llm_generator/prompts.py +++ b/api/core/llm_generator/prompts.py @@ -12,9 +12,9 @@ Automatically identify the language of the user’s input (e.g. English, Chinese 3. Output Format Return **only** a valid JSON object with these exact keys and no additional text: { - "Language Type": "", - "Your Reasoning": "", - "Your Output": "" +"Language Type": "", +"Your Reasoning": "", +"Your Output": "" } User Input: @@ -207,48 +207,48 @@ Your task is to convert simple user descriptions into properly formatted JSON Sc **User Input:** I need name and age **JSON Schema Output:** { - "type": "object", - "properties": { +"type": "object", +"properties": { "name": { "type": "string" }, "age": { "type": "number" } - }, - "required": ["name", "age"] +}, +"required": ["name", "age"] } ### Example 2: **User Input:** I want to store information about books including title, author, publication year and optional page count **JSON Schema Output:** { - "type": "object", - "properties": { +"type": "object", +"properties": { "title": { "type": "string" }, "author": { "type": "string" }, "publicationYear": { "type": "integer" }, "pageCount": { "type": "integer" } - }, - "required": ["title", "author", "publicationYear"] +}, +"required": ["title", "author", "publicationYear"] } ### Example 3: **User Input:** Create a schema for user profiles with email, password, and age (must be at least 18) **JSON Schema Output:** { - "type": "object", - "properties": { +"type": "object", +"properties": { "email": { - "type": "string", - "format": "email" + "type": "string", + "format": "email" }, "password": { - "type": "string", - "minLength": 8 + "type": "string", + "minLength": 8 }, "age": { - "type": "integer", - "minimum": 18 + "type": "integer", + "minimum": 18 } - }, - "required": ["email", "password", "age"] +}, +"required": ["email", "password", "age"] } ### Example 4: diff --git a/api/core/prompt/utils/prompt_template_parser.py b/api/core/prompt/utils/prompt_template_parser.py index 8e40674bc1..d88b2512ef 100644 --- a/api/core/prompt/utils/prompt_template_parser.py +++ b/api/core/prompt/utils/prompt_template_parser.py @@ -13,10 +13,10 @@ class PromptTemplateParser: 1. Template variables must be enclosed in `{{}}`. 2. The template variable Key can only be: letters + numbers + underscore, with a maximum length of 16 characters, - and can only start with letters and underscores. + and can only start with letters and underscores. 3. The template variable Key cannot contain new lines or spaces, and must comply with rule 2. 4. In addition to the above, 3 types of special template variable Keys are accepted: - `{{#histories#}}` `{{#query#}}` `{{#context#}}`. No other `{{##}}` template variables are allowed. + `{{#histories#}}` `{{#query#}}` `{{#context#}}`. No other `{{##}}` template variables are allowed. """ def __init__(self, template: str, with_variable_tmpl: bool = False): diff --git a/api/core/provider_manager.py b/api/core/provider_manager.py index 488a394679..72b97c27e2 100644 --- a/api/core/provider_manager.py +++ b/api/core/provider_manager.py @@ -65,29 +65,29 @@ class ProviderManager: Including: 1. Basic information of the provider 2. Hosting configuration information, including: - (1. Whether to enable (support) hosting type, if enabled, the following information exists - (2. List of hosting type provider configurations - (including quota type, quota limit, current remaining quota, etc.) - (3. The current hosting type in use (whether there is a quota or not) - paid quotas > provider free quotas > hosting trial quotas - (4. Unified credentials for hosting providers + (1. Whether to enable (support) hosting type, if enabled, the following information exists + (2. List of hosting type provider configurations + (including quota type, quota limit, current remaining quota, etc.) + (3. The current hosting type in use (whether there is a quota or not) + paid quotas > provider free quotas > hosting trial quotas + (4. Unified credentials for hosting providers 3. Custom configuration information, including: - (1. Whether to enable (support) custom type, if enabled, the following information exists - (2. Custom provider configuration (including credentials) - (3. List of custom provider model configurations (including credentials) + (1. Whether to enable (support) custom type, if enabled, the following information exists + (2. Custom provider configuration (including credentials) + (3. List of custom provider model configurations (including credentials) 4. Hosting/custom preferred provider type. Provide methods: - Get the current configuration (including credentials) - Get the availability and status of the hosting configuration: active available, - quota_exceeded insufficient quota, unsupported hosting + quota_exceeded insufficient quota, unsupported hosting - Get the availability of custom configuration - Custom provider available conditions: - (1. custom provider credentials available - (2. at least one custom model credentials available + Custom provider available conditions: + (1. custom provider credentials available + (2. at least one custom model credentials available - Verify, update, and delete custom provider configuration - Verify, update, and delete custom provider model configuration - Get the list of available models (optional provider filtering, model type filtering) - Append custom provider models to the list + Append custom provider models to the list - Get provider instance - Switch selection priority diff --git a/api/core/rag/datasource/vdb/couchbase/couchbase_vector.py b/api/core/rag/datasource/vdb/couchbase/couchbase_vector.py index 68a9952789..0b0e1fb4fe 100644 --- a/api/core/rag/datasource/vdb/couchbase/couchbase_vector.py +++ b/api/core/rag/datasource/vdb/couchbase/couchbase_vector.py @@ -95,24 +95,24 @@ class CouchbaseVector(BaseVector): "sourceName": "Embeddings", "sourceUUID": "2242e4a25b4decd6650c9c7b3afa1dbf", "planParams": { - "maxPartitionsPerPIndex": 1024, - "indexPartitions": 1 + "maxPartitionsPerPIndex": 1024, + "indexPartitions": 1 }, "params": { - "doc_config": { + "doc_config": { "docid_prefix_delim": "", "docid_regexp": "", "mode": "scope.collection.type_field", "type_field": "type" - }, - "mapping": { + }, + "mapping": { "analysis": { }, "default_analyzer": "standard", "default_datetime_parser": "dateTimeOptional", "default_field": "_all", "default_mapping": { - "dynamic": true, - "enabled": true + "dynamic": true, + "enabled": true }, "default_type": "_default", "docvalues_dynamic": false, @@ -120,51 +120,51 @@ class CouchbaseVector(BaseVector): "store_dynamic": true, "type_field": "_type", "types": { - "collection_name": { + "collection_name": { "dynamic": true, "enabled": true, "properties": { - "embedding": { + "embedding": { "dynamic": false, "enabled": true, "fields": [ - { + { "dims": 1536, "index": true, "name": "embedding", "similarity": "dot_product", "type": "vector", "vector_index_optimized_for": "recall" - } + } ] - }, - "metadata": { + }, + "metadata": { "dynamic": true, "enabled": true - }, - "text": { + }, + "text": { "dynamic": false, "enabled": true, "fields": [ - { + { "index": true, "name": "text", "store": true, "type": "text" - } + } ] - } } - } + } } - }, - "store": { + } + }, + "store": { "indexType": "scorch", "segmentVersion": 16 - } + } }, "sourceParams": { } - } +} """) index_definition["name"] = self._collection_name + "_search" index_definition["uuid"] = uuid diff --git a/api/core/rag/datasource/vdb/tidb_vector/tidb_vector.py b/api/core/rag/datasource/vdb/tidb_vector/tidb_vector.py index 61c68b939e..59846040e6 100644 --- a/api/core/rag/datasource/vdb/tidb_vector/tidb_vector.py +++ b/api/core/rag/datasource/vdb/tidb_vector/tidb_vector.py @@ -207,14 +207,14 @@ class TiDBVector(BaseVector): select_statement = sql_text(f""" SELECT meta, text, distance FROM ( - SELECT + SELECT meta, text, {tidb_dist_func}(vector, :query_vector_str) AS distance - FROM {self._collection_name} - {where_clause} - ORDER BY distance ASC - LIMIT :top_k + FROM {self._collection_name} + {where_clause} + ORDER BY distance ASC + LIMIT :top_k ) t WHERE distance <= :distance """) diff --git a/api/core/rag/retrieval/router/multi_dataset_react_route.py b/api/core/rag/retrieval/router/multi_dataset_react_route.py index 33a283771d..3098c2232d 100644 --- a/api/core/rag/retrieval/router/multi_dataset_react_route.py +++ b/api/core/rag/retrieval/router/multi_dataset_react_route.py @@ -24,8 +24,8 @@ Provide only ONE action per $JSON_BLOB, as shown: ``` {{ - "action": $TOOL_NAME, - "action_input": $INPUT +"action": $TOOL_NAME, +"action_input": $INPUT }} ``` @@ -43,8 +43,8 @@ Thought: I know what to respond Action: ``` {{ - "action": "Final Answer", - "action_input": "Final response to human" +"action": "Final Answer", +"action_input": "Final response to human" }} ```""" # noqa: E501 diff --git a/api/core/tools/entities/tool_bundle.py b/api/core/tools/entities/tool_bundle.py index ffeeabbc1c..5e7b7a62b7 100644 --- a/api/core/tools/entities/tool_bundle.py +++ b/api/core/tools/entities/tool_bundle.py @@ -8,7 +8,7 @@ from core.tools.entities.tool_entities import ToolParameter class ApiToolBundle(BaseModel): """ This class is used to store the schema information of an api based tool. - such as the url, the method, the parameters, etc. + such as the url, the method, the parameters, etc. """ # server_url diff --git a/api/core/tools/entities/values.py b/api/core/tools/entities/values.py index f460df7e25..d5e7b8a761 100644 --- a/api/core/tools/entities/values.py +++ b/api/core/tools/entities/values.py @@ -3,52 +3,52 @@ from core.tools.entities.tool_entities import ToolLabel, ToolLabelEnum ICONS = { ToolLabelEnum.SEARCH: """ - + """, # noqa: E501 ToolLabelEnum.IMAGE: """ - + """, # noqa: E501 ToolLabelEnum.VIDEOS: """ - + """, # noqa: E501 ToolLabelEnum.WEATHER: """ - + """, # noqa: E501 ToolLabelEnum.FINANCE: """ - + """, # noqa: E501 ToolLabelEnum.DESIGN: """ - + """, # noqa: E501 ToolLabelEnum.TRAVEL: """ - + """, # noqa: E501 ToolLabelEnum.SOCIAL: """ - + """, # noqa: E501 ToolLabelEnum.NEWS: """ - + """, # noqa: E501 ToolLabelEnum.MEDICAL: """ - + """, # noqa: E501 ToolLabelEnum.PRODUCTIVITY: """ - + """, # noqa: E501 ToolLabelEnum.EDUCATION: """ - + """, # noqa: E501 ToolLabelEnum.BUSINESS: """ - + """, # noqa: E501 ToolLabelEnum.ENTERTAINMENT: """ - + """, # noqa: E501 ToolLabelEnum.UTILITIES: """ - + """, # noqa: E501 ToolLabelEnum.OTHER: """ - + """, # noqa: E501 } diff --git a/api/core/workflow/nodes/agent/agent_node.py b/api/core/workflow/nodes/agent/agent_node.py index 80d5a1d471..c9d8a7feaa 100644 --- a/api/core/workflow/nodes/agent/agent_node.py +++ b/api/core/workflow/nodes/agent/agent_node.py @@ -103,7 +103,7 @@ class AgentNode(ToolNode): try: # convert tool messages - agent_thoughts = [] + agent_thoughts: list = [] from core.tools.entities.tool_entities import ToolInvokeMessage diff --git a/api/core/workflow/nodes/llm/node.py b/api/core/workflow/nodes/llm/node.py index b5225ce548..f265ee5b64 100644 --- a/api/core/workflow/nodes/llm/node.py +++ b/api/core/workflow/nodes/llm/node.py @@ -911,8 +911,8 @@ class LLMNode(BaseNode[LLMNodeData]): There are two kinds of multimodal outputs: - - Inlined data encoded in base64, which would be saved to storage directly. - - Remote files referenced by an url, which would be downloaded and then saved to storage. + - Inlined data encoded in base64, which would be saved to storage directly. + - Remote files referenced by an url, which would be downloaded and then saved to storage. Currently, only image files are supported. """ diff --git a/api/core/workflow/nodes/parameter_extractor/prompts.py b/api/core/workflow/nodes/parameter_extractor/prompts.py index ab7ddcc32a..96b589b131 100644 --- a/api/core/workflow/nodes/parameter_extractor/prompts.py +++ b/api/core/workflow/nodes/parameter_extractor/prompts.py @@ -108,8 +108,8 @@ Here are the chat histories between human and assistant, inside str: dedent( """\ address: - city: Example City + city: Example City country: Example Country age: 30 gender: male diff --git a/web/app/(shareLayout)/layout.tsx b/web/app/(shareLayout)/layout.tsx index f9c8d815bd..e42ca02b54 100644 --- a/web/app/(shareLayout)/layout.tsx +++ b/web/app/(shareLayout)/layout.tsx @@ -33,7 +33,7 @@ const Layout: FC<{ ) appCode = url.pathname.split('/').pop() || null } - else { +else { appCode = pathname.split('/').pop() || null } diff --git a/web/app/components/app-sidebar/app-operations.tsx b/web/app/components/app-sidebar/app-operations.tsx index 49cad71573..ad2497b96c 100644 --- a/web/app/components/app-sidebar/app-operations.tsx +++ b/web/app/components/app-sidebar/app-operations.tsx @@ -47,7 +47,7 @@ const AppOperations = ({ operations, gap }: { updatedEntries[id] = true width += gap + childWidth } - else { +else { if (i === childrens.length - 1 && width + childWidth <= containerWidth) updatedEntries[id] = true else diff --git a/web/app/components/app-sidebar/index.tsx b/web/app/components/app-sidebar/index.tsx index b6bfc0e9ac..4cb07bff16 100644 --- a/web/app/components/app-sidebar/index.tsx +++ b/web/app/components/app-sidebar/index.tsx @@ -62,7 +62,7 @@ const AppDetailNav = ({ title, desc, isExternal, icon, icon_background, navigati }, [appSidebarExpand, setAppSiderbarExpand]) if (inWorkflowCanvas && hideHeader) { - return ( +return (
diff --git a/web/app/components/app/annotation/index.tsx b/web/app/components/app/annotation/index.tsx index 04bce1947b..9af3630959 100644 --- a/web/app/components/app/annotation/index.tsx +++ b/web/app/components/app/annotation/index.tsx @@ -82,7 +82,7 @@ const Annotation: FC = (props) => { setList(data as AnnotationItem[]) setTotal(total) } - finally { +finally { setIsLoading(false) } } diff --git a/web/app/components/app/overview/embedded/index.tsx b/web/app/components/app/overview/embedded/index.tsx index b48eac5458..2eaa6d3ac7 100644 --- a/web/app/components/app/overview/embedded/index.tsx +++ b/web/app/components/app/overview/embedded/index.tsx @@ -29,16 +29,16 @@ const OPTION_MAP = { iframe: { getContent: (url: string, token: string) => ``, }, scripts: { getContent: (url: string, token: string, primaryColor: string, isTestEnv?: boolean) => `