Explorar el Código

chore: docstring not match the function parameter (#17162)

tags/1.2.0
非法操作 hace 7 meses
padre
commit
44f911a0a8
No account linked to committer's email address
Se han modificado 47 ficheros con 60 adiciones y 95 borrados
  1. 1
    1
      api/configs/feature/hosted_service/__init__.py
  2. 0
    2
      api/configs/remote_settings_sources/__init__.py
  3. 1
    0
      api/controllers/service_api/dataset/dataset.py
  4. 0
    1
      api/core/app/app_config/easy_ui_based_app/model_config/converter.py
  5. 5
    5
      api/core/app/apps/advanced_chat/app_generator.py
  6. 1
    1
      api/core/app/apps/agent_chat/app_generator.py
  7. 1
    0
      api/core/app/apps/base_app_runner.py
  8. 1
    1
      api/core/app/apps/chat/app_generator.py
  9. 1
    1
      api/core/app/apps/completion/app_generator.py
  10. 5
    5
      api/core/app/apps/workflow/app_generator.py
  11. 0
    3
      api/core/app/apps/workflow/app_runner.py
  12. 1
    1
      api/core/app/task_pipeline/message_cycle_manage.py
  13. 2
    2
      api/core/app/task_pipeline/workflow_cycle_manage.py
  14. 1
    1
      api/core/file/upload_file_parser.py
  15. 1
    0
      api/core/helper/code_executor/code_executor.py
  16. 1
    1
      api/core/helper/position_helper.py
  17. 1
    6
      api/core/helper/tool_parameter_cache.py
  18. 0
    1
      api/core/model_runtime/model_providers/__base/tts_model.py
  19. 0
    1
      api/core/rag/datasource/vdb/opengauss/opengauss.py
  20. 0
    1
      api/core/rag/datasource/vdb/oracle/oraclevector.py
  21. 0
    1
      api/core/rag/datasource/vdb/pgvector/pgvector.py
  22. 2
    4
      api/core/rag/datasource/vdb/tidb_on_qdrant/tidb_service.py
  23. 0
    1
      api/core/rag/datasource/vdb/weaviate/weaviate_vector.py
  24. 2
    3
      api/core/rag/extractor/firecrawl/firecrawl_web_extractor.py
  25. 0
    9
      api/core/rag/extractor/unstructured/unstructured_markdown_extractor.py
  26. 2
    2
      api/core/rag/retrieval/dataset_retrieval.py
  27. 1
    0
      api/core/rag/retrieval/router/multi_dataset_react_route.py
  28. 2
    3
      api/core/tools/__base/tool.py
  29. 2
    2
      api/core/tools/builtin_tool/provider.py
  30. 2
    5
      api/core/tools/builtin_tool/tool.py
  31. 0
    1
      api/core/tools/custom_tool/provider.py
  32. 1
    3
      api/core/tools/custom_tool/tool.py
  33. 1
    1
      api/core/tools/entities/tool_entities.py
  34. 0
    1
      api/core/tools/tool_engine.py
  35. 6
    4
      api/core/tools/tool_manager.py
  36. 1
    5
      api/core/tools/utils/model_invocation_utils.py
  37. 6
    0
      api/core/tools/utils/parser.py
  38. 0
    1
      api/core/tools/workflow_as_tool/provider.py
  39. 1
    3
      api/core/tools/workflow_as_tool/tool.py
  40. 0
    1
      api/core/workflow/utils/variable_template_parser.py
  41. 2
    0
      api/core/workflow/workflow_entry.py
  42. 1
    0
      api/services/app_dsl_service.py
  43. 0
    1
      api/services/tools/builtin_tools_manage_service.py
  44. 1
    0
      api/services/tools/tools_transform_service.py
  45. 3
    3
      api/services/tools/workflow_tools_manage_service.py
  46. 1
    5
      api/tasks/mail_account_deletion_task.py
  47. 0
    2
      api/tasks/ops_trace_task.py

+ 1
- 1
api/configs/feature/hosted_service/__init__.py Ver fichero

from typing import Optional from typing import Optional


from pydantic import Field, NonNegativeInt, computed_field
from pydantic import Field, NonNegativeInt
from pydantic_settings import BaseSettings from pydantic_settings import BaseSettings





+ 0
- 2
api/configs/remote_settings_sources/__init__.py Ver fichero

from typing import Optional

from pydantic import Field from pydantic import Field


from .apollo import ApolloSettingsSourceInfo from .apollo import ApolloSettingsSourceInfo

+ 1
- 0
api/controllers/service_api/dataset/dataset.py Ver fichero

Deletes a dataset given its ID. Deletes a dataset given its ID.


Args: Args:
_: ignore
dataset_id (UUID): The ID of the dataset to be deleted. dataset_id (UUID): The ID of the dataset to be deleted.


Returns: Returns:

+ 0
- 1
api/core/app/app_config/easy_ui_based_app/model_config/converter.py Ver fichero

""" """
Convert app model config dict to entity. Convert app model config dict to entity.
:param app_config: app config :param app_config: app config
:param skip_check: skip check
:raises ProviderTokenNotInitError: provider token not init error :raises ProviderTokenNotInitError: provider token not init error
:return: app orchestration config entity :return: app orchestration config entity
""" """

+ 5
- 5
api/core/app/apps/advanced_chat/app_generator.py Ver fichero

:param user: account or end user :param user: account or end user
:param args: request args :param args: request args
:param invoke_from: invoke from source :param invoke_from: invoke from source
:param stream: is stream
:param streaming: is stream
""" """
if not args.get("query"): if not args.get("query"):
raise ValueError("query is required") raise ValueError("query is required")


:param app_model: App :param app_model: App
:param workflow: Workflow :param workflow: Workflow
:param node_id: the node id
:param user: account or end user :param user: account or end user
:param args: request args :param args: request args
:param invoke_from: invoke from source
:param stream: is stream
:param streaming: is streamed
""" """
if not node_id: if not node_id:
raise ValueError("node_id is required") raise ValueError("node_id is required")


:param app_model: App :param app_model: App
:param workflow: Workflow :param workflow: Workflow
:param node_id: the node id
:param user: account or end user :param user: account or end user
:param args: request args :param args: request args
:param invoke_from: invoke from source
:param stream: is stream
:param streaming: is stream
""" """
if not node_id: if not node_id:
raise ValueError("node_id is required") raise ValueError("node_id is required")

+ 1
- 1
api/core/app/apps/agent_chat/app_generator.py Ver fichero

:param user: account or end user :param user: account or end user
:param args: request args :param args: request args
:param invoke_from: invoke from source :param invoke_from: invoke from source
:param stream: is stream
:param streaming: is stream
""" """
if not streaming: if not streaming:
raise ValueError("Agent Chat App does not support blocking mode") raise ValueError("Agent Chat App does not support blocking mode")

+ 1
- 0
api/core/app/apps/base_app_runner.py Ver fichero

:param files: files :param files: files
:param query: query :param query: query
:param memory: memory :param memory: memory
:param image_detail_config: the image quality config
:return: :return:
""" """
# get prompt without memory and context # get prompt without memory and context

+ 1
- 1
api/core/app/apps/chat/app_generator.py Ver fichero

:param user: account or end user :param user: account or end user
:param args: request args :param args: request args
:param invoke_from: invoke from source :param invoke_from: invoke from source
:param stream: is stream
:param streaming: is stream
""" """
if not args.get("query"): if not args.get("query"):
raise ValueError("query is required") raise ValueError("query is required")

+ 1
- 1
api/core/app/apps/completion/app_generator.py Ver fichero

:param user: account or end user :param user: account or end user
:param args: request args :param args: request args
:param invoke_from: invoke from source :param invoke_from: invoke from source
:param stream: is stream
:param streaming: is stream
""" """
query = args["query"] query = args["query"]
if not isinstance(query, str): if not isinstance(query, str):

+ 5
- 5
api/core/app/apps/workflow/app_generator.py Ver fichero

:param user: account or end user :param user: account or end user
:param application_generate_entity: application generate entity :param application_generate_entity: application generate entity
:param invoke_from: invoke from source :param invoke_from: invoke from source
:param stream: is stream
:param streaming: is stream
:param workflow_thread_pool_id: workflow thread pool id :param workflow_thread_pool_id: workflow thread pool id
""" """
# init queue manager # init queue manager


:param app_model: App :param app_model: App
:param workflow: Workflow :param workflow: Workflow
:param node_id: the node id
:param user: account or end user :param user: account or end user
:param args: request args :param args: request args
:param invoke_from: invoke from source
:param stream: is stream
:param streaming: is streamed
""" """
if not node_id: if not node_id:
raise ValueError("node_id is required") raise ValueError("node_id is required")


:param app_model: App :param app_model: App
:param workflow: Workflow :param workflow: Workflow
:param node_id: the node id
:param user: account or end user :param user: account or end user
:param args: request args :param args: request args
:param invoke_from: invoke from source
:param stream: is stream
:param streaming: is streamed
""" """
if not node_id: if not node_id:
raise ValueError("node_id is required") raise ValueError("node_id is required")

+ 0
- 3
api/core/app/apps/workflow/app_runner.py Ver fichero

def run(self) -> None: def run(self) -> None:
""" """
Run application Run application
:param application_generate_entity: application generate entity
:param queue_manager: application queue manager
:return:
""" """
app_config = self.application_generate_entity.app_config app_config = self.application_generate_entity.app_config
app_config = cast(WorkflowAppConfig, app_config) app_config = cast(WorkflowAppConfig, app_config)

+ 1
- 1
api/core/app/task_pipeline/message_cycle_manage.py Ver fichero

def _generate_conversation_name(self, *, conversation_id: str, query: str) -> Optional[Thread]: def _generate_conversation_name(self, *, conversation_id: str, query: str) -> Optional[Thread]:
""" """
Generate conversation name. Generate conversation name.
:param conversation: conversation
:param conversation_id: conversation id
:param query: query :param query: query
:return: thread :return: thread
""" """

+ 2
- 2
api/core/app/task_pipeline/workflow_cycle_manage.py Ver fichero

) -> WorkflowRun: ) -> WorkflowRun:
""" """
Workflow run success Workflow run success
:param workflow_run: workflow run
:param workflow_run_id: workflow run id
:param start_at: start time :param start_at: start time
:param total_tokens: total tokens :param total_tokens: total tokens
:param total_steps: total steps :param total_steps: total steps
) -> WorkflowRun: ) -> WorkflowRun:
""" """
Workflow run failed Workflow run failed
:param workflow_run: workflow run
:param workflow_run_id: workflow run id
:param start_at: start time :param start_at: start time
:param total_tokens: total tokens :param total_tokens: total tokens
:param total_steps: total steps :param total_steps: total steps

+ 1
- 1
api/core/file/upload_file_parser.py Ver fichero

""" """
get signed url from upload file get signed url from upload file


:param upload_file: UploadFile object
:param upload_file_id: the id of UploadFile object
:return: :return:
""" """
base_url = dify_config.FILES_URL base_url = dify_config.FILES_URL

+ 1
- 0
api/core/helper/code_executor/code_executor.py Ver fichero

""" """
Execute code Execute code
:param language: code language :param language: code language
:param preload: the preload script
:param code: code :param code: code
:return: :return:
""" """

+ 1
- 1
api/core/helper/position_helper.py Ver fichero

""" """
Pin the items in the pin list to the beginning of the position map. Pin the items in the pin list to the beginning of the position map.
Overall logic: exclude > include > pin Overall logic: exclude > include > pin
:param position_map: the position map to be sorted and filtered
:param original_position_map: the position map to be sorted and filtered
:param pin_list: the list of pins to be put at the beginning :param pin_list: the list of pins to be put at the beginning
:return: the sorted position map :return: the sorted position map
""" """

+ 1
- 6
api/core/helper/tool_parameter_cache.py Ver fichero

return None return None


def set(self, parameters: dict) -> None: def set(self, parameters: dict) -> None:
"""
Cache model provider credentials.

:param credentials: provider credentials
:return:
"""
"""Cache model provider credentials."""
redis_client.setex(self.cache_key, 86400, json.dumps(parameters)) redis_client.setex(self.cache_key, 86400, json.dumps(parameters))


def delete(self) -> None: def delete(self) -> None:

+ 0
- 1
api/core/model_runtime/model_providers/__base/tts_model.py Ver fichero

:param credentials: model credentials :param credentials: model credentials
:param voice: model timbre :param voice: model timbre
:param content_text: text content to be translated :param content_text: text content to be translated
:param streaming: output is streaming
:param user: unique user id :param user: unique user id
:return: translated audio file :return: translated audio file
""" """

+ 0
- 1
api/core/rag/datasource/vdb/opengauss/opengauss.py Ver fichero

Search the nearest neighbors to a vector. Search the nearest neighbors to a vector.


:param query_vector: The input vector to search for similar items. :param query_vector: The input vector to search for similar items.
:param top_k: The number of nearest neighbors to return, default is 5.
:return: List of Documents that are nearest to the query vector. :return: List of Documents that are nearest to the query vector.
""" """
top_k = kwargs.get("top_k", 4) top_k = kwargs.get("top_k", 4)

+ 0
- 1
api/core/rag/datasource/vdb/oracle/oraclevector.py Ver fichero

Search the nearest neighbors to a vector. Search the nearest neighbors to a vector.


:param query_vector: The input vector to search for similar items. :param query_vector: The input vector to search for similar items.
:param top_k: The number of nearest neighbors to return, default is 5.
:return: List of Documents that are nearest to the query vector. :return: List of Documents that are nearest to the query vector.
""" """
top_k = kwargs.get("top_k", 4) top_k = kwargs.get("top_k", 4)

+ 0
- 1
api/core/rag/datasource/vdb/pgvector/pgvector.py Ver fichero

Search the nearest neighbors to a vector. Search the nearest neighbors to a vector.


:param query_vector: The input vector to search for similar items. :param query_vector: The input vector to search for similar items.
:param top_k: The number of nearest neighbors to return, default is 5.
:return: List of Documents that are nearest to the query vector. :return: List of Documents that are nearest to the query vector.
""" """
top_k = kwargs.get("top_k", 4) top_k = kwargs.get("top_k", 4)

+ 2
- 4
api/core/rag/datasource/vdb/tidb_on_qdrant/tidb_service.py Ver fichero

:param iam_url: The URL of the TiDB Cloud IAM API (required). :param iam_url: The URL of the TiDB Cloud IAM API (required).
:param public_key: The public key for the API (required). :param public_key: The public key for the API (required).
:param private_key: The private key for the API (required). :param private_key: The private key for the API (required).
:param display_name: The user-friendly display name of the cluster (required).
:param region: The region where the cluster will be created (required). :param region: The region where the cluster will be created (required).


:return: The response from the API. :return: The response from the API.
): ):
""" """
Update the status of a new TiDB Serverless cluster. Update the status of a new TiDB Serverless cluster.
:param tidb_serverless_list: The TiDB serverless list (required).
:param project_id: The project ID of the TiDB Cloud project (required). :param project_id: The project ID of the TiDB Cloud project (required).
:param api_url: The URL of the TiDB Cloud API (required). :param api_url: The URL of the TiDB Cloud API (required).
:param iam_url: The URL of the TiDB Cloud IAM API (required). :param iam_url: The URL of the TiDB Cloud IAM API (required).
:param public_key: The public key for the API (required). :param public_key: The public key for the API (required).
:param private_key: The private key for the API (required). :param private_key: The private key for the API (required).
:param display_name: The user-friendly display name of the cluster (required).
:param region: The region where the cluster will be created (required).


:return: The response from the API. :return: The response from the API.
""" """
) -> list[dict]: ) -> list[dict]:
""" """
Creates a new TiDB Serverless cluster. Creates a new TiDB Serverless cluster.
:param batch_size: The batch size (required).
:param project_id: The project ID of the TiDB Cloud project (required). :param project_id: The project ID of the TiDB Cloud project (required).
:param api_url: The URL of the TiDB Cloud API (required). :param api_url: The URL of the TiDB Cloud API (required).
:param iam_url: The URL of the TiDB Cloud IAM API (required). :param iam_url: The URL of the TiDB Cloud IAM API (required).
:param public_key: The public key for the API (required). :param public_key: The public key for the API (required).
:param private_key: The private key for the API (required). :param private_key: The private key for the API (required).
:param display_name: The user-friendly display name of the cluster (required).
:param region: The region where the cluster will be created (required). :param region: The region where the cluster will be created (required).


:return: The response from the API. :return: The response from the API.

+ 0
- 1
api/core/rag/datasource/vdb/weaviate/weaviate_vector.py Ver fichero



Args: Args:
query: Text to look up documents similar to. query: Text to look up documents similar to.
k: Number of Documents to return. Defaults to 4.


Returns: Returns:
List of Documents most similar to the query. List of Documents most similar to the query.

+ 2
- 3
api/core/rag/extractor/firecrawl/firecrawl_web_extractor.py Ver fichero

""" """
Crawl and scrape websites and return content in clean llm-ready markdown. Crawl and scrape websites and return content in clean llm-ready markdown.



Args: Args:
url: The URL to scrape. url: The URL to scrape.
api_key: The API key for Firecrawl.
base_url: The base URL for the Firecrawl API. Defaults to 'https://api.firecrawl.dev'.
job_id: The crawl job id.
tenant_id: The tenant id.
mode: The mode of operation. Defaults to 'scrape'. Options are 'crawl', 'scrape' and 'crawl_return_urls'. mode: The mode of operation. Defaults to 'scrape'. Options are 'crawl', 'scrape' and 'crawl_return_urls'.
only_main_content: Only return the main content of the page excluding headers, navs, footers, etc. only_main_content: Only return the main content of the page excluding headers, navs, footers, etc.
""" """

+ 0
- 9
api/core/rag/extractor/unstructured/unstructured_markdown_extractor.py Ver fichero

Args: Args:
file_path: Path to the file to load. file_path: Path to the file to load.


remove_hyperlinks: Whether to remove hyperlinks from the text.

remove_images: Whether to remove images from the text.

encoding: File encoding to use. If `None`, the file will be loaded
with the default system encoding.

autodetect_encoding: Whether to try to autodetect the file encoding
if the specified encoding fails.
""" """


def __init__(self, file_path: str, api_url: Optional[str] = None, api_key: str = ""): def __init__(self, file_path: str, api_url: Optional[str] = None, api_key: str = ""):

+ 2
- 2
api/core/rag/retrieval/dataset_retrieval.py Ver fichero

:param hit_callback: hit callback :param hit_callback: hit callback
:param message_id: message id :param message_id: message id
:param memory: memory :param memory: memory
:param inputs: inputs
:return: :return:
""" """
dataset_ids = config.dataset_ids dataset_ids = config.dataset_ids
Calculate keywords scores Calculate keywords scores
:param query: search query :param query: search query
:param documents: documents for reranking :param documents: documents for reranking
:param top_k: top k


:return: :return:
""" """
) -> tuple[ModelInstance, ModelConfigWithCredentialsEntity]: ) -> tuple[ModelInstance, ModelConfigWithCredentialsEntity]:
""" """
Fetch model config Fetch model config
:param node_data: node data
:return:
""" """
if model is None: if model is None:
raise ValueError("single_retrieval_config is required") raise ValueError("single_retrieval_config is required")

+ 1
- 0
api/core/rag/retrieval/router/multi_dataset_react_route.py Ver fichero

tools: List of tools the agent will have access to, used to format the tools: List of tools the agent will have access to, used to format the
prompt. prompt.
prefix: String to put before the list of tools. prefix: String to put before the list of tools.
format_instructions: The format instruction prompt.
Returns: Returns:
A PromptTemplate with the template assembled from the pieces here. A PromptTemplate with the template assembled from the pieces here.
""" """

+ 2
- 3
api/core/tools/__base/tool.py Ver fichero



def fork_tool_runtime(self, runtime: ToolRuntime) -> "Tool": def fork_tool_runtime(self, runtime: ToolRuntime) -> "Tool":
""" """
fork a new tool with meta data

:param meta: the meta data of a tool call processing, tenant_id is required
fork a new tool with metadata
:return: the new tool :return: the new tool
""" """
return self.__class__( return self.__class__(
create a blob message create a blob message


:param blob: the blob :param blob: the blob
:param meta: the meta info of blob object
:return: the blob message :return: the blob message
""" """
return ToolInvokeMessage( return ToolInvokeMessage(

+ 2
- 2
api/core/tools/builtin_tool/provider.py Ver fichero

""" """
validate the credentials of the provider validate the credentials of the provider


:param tool_name: the name of the tool, defined in `get_tools`
:param user_id: use id
:param credentials: the credentials of the tool :param credentials: the credentials of the tool
""" """
# validate credentials format # validate credentials format
""" """
validate the credentials of the provider validate the credentials of the provider


:param tool_name: the name of the tool, defined in `get_tools`
:param user_id: use id
:param credentials: the credentials of the tool :param credentials: the credentials of the tool
""" """
pass pass

+ 2
- 5
api/core/tools/builtin_tool/tool.py Ver fichero



def fork_tool_runtime(self, runtime: ToolRuntime) -> "BuiltinTool": def fork_tool_runtime(self, runtime: ToolRuntime) -> "BuiltinTool":
""" """
fork a new tool with meta data

:param meta: the meta data of a tool call processing, tenant_id is required
fork a new tool with metadata
:return: the new tool :return: the new tool
""" """
return self.__class__( return self.__class__(
""" """
invoke model invoke model


:param model_config: the model config
:param user_id: the user id
:param prompt_messages: the prompt messages :param prompt_messages: the prompt messages
:param stop: the stop words :param stop: the stop words
:return: the model result :return: the model result
""" """
get max tokens get max tokens


:param model_config: the model config
:return: the max tokens :return: the max tokens
""" """
if self.runtime is None: if self.runtime is None:

+ 0
- 1
api/core/tools/custom_tool/provider.py Ver fichero

""" """
fetch tools from database fetch tools from database


:param user_id: the user id
:param tenant_id: the tenant id :param tenant_id: the tenant id
:return: the tools :return: the tools
""" """

+ 1
- 3
api/core/tools/custom_tool/tool.py Ver fichero



def fork_tool_runtime(self, runtime: ToolRuntime): def fork_tool_runtime(self, runtime: ToolRuntime):
""" """
fork a new tool with meta data

:param meta: the meta data of a tool call processing, tenant_id is required
fork a new tool with metadata
:return: the new tool :return: the new tool
""" """
if self.api_bundle is None: if self.api_bundle is None:

+ 1
- 1
api/core/tools/entities/tool_entities.py Ver fichero



:param name: the name of the parameter :param name: the name of the parameter
:param llm_description: the description presented to the LLM :param llm_description: the description presented to the LLM
:param type: the type of the parameter
:param typ: the type of the parameter
:param required: if the parameter is required :param required: if the parameter is required
:param options: the options of the parameter :param options: the options of the parameter
""" """

+ 0
- 1
api/core/tools/tool_engine.py Ver fichero

""" """
Create message file Create message file


:param messages: messages
:return: message file ids :return: message file ids
""" """
result = [] result = []

+ 6
- 4
api/core/tools/tool_manager.py Ver fichero

get the tool runtime get the tool runtime


:param provider_type: the type of the provider :param provider_type: the type of the provider
:param provider_name: the name of the provider
:param provider_id: the id of the provider
:param tool_name: the name of the tool :param tool_name: the name of the tool
:param tenant_id: the tenant id
:param invoke_from: invoke from
:param tool_invoke_from: the tool invoke from


:return: the tool :return: the tool
""" """
get the absolute path of the icon of the hardcoded provider get the absolute path of the icon of the hardcoded provider


:param provider: the name of the provider :param provider: the name of the provider
:param tenant_id: the id of the tenant

:return: the absolute path of the icon, the mime type of the icon :return: the absolute path of the icon, the mime type of the icon
""" """
# get provider # get provider
""" """
get the api provider get the api provider


:param provider_name: the name of the provider
:param tenant_id: the id of the tenant
:param provider_id: the id of the provider


:return: the provider controller, the credentials :return: the provider controller, the credentials
""" """

+ 1
- 5
api/core/tools/utils/model_invocation_utils.py Ver fichero



:param user_id: user id :param user_id: user id
:param tenant_id: tenant id, the tenant id of the creator of the tool :param tenant_id: tenant id, the tenant id of the creator of the tool
:param tool_provider: tool provider
:param tool_id: tool id
:param tool_type: tool type
:param tool_name: tool name :param tool_name: tool name
:param provider: model provider
:param model: model name
:param model_parameters: model parameters
:param prompt_messages: prompt messages :param prompt_messages: prompt messages
:return: AssistantPromptMessage :return: AssistantPromptMessage
""" """

+ 6
- 0
api/core/tools/utils/parser.py Ver fichero

parse openapi yaml to tool bundle parse openapi yaml to tool bundle


:param yaml: the yaml string :param yaml: the yaml string
:param extra_info: the extra info
:param warning: the warning message
:return: the tool bundle :return: the tool bundle
""" """
warning = warning if warning is not None else {} warning = warning if warning is not None else {}
parse openapi plugin yaml to tool bundle parse openapi plugin yaml to tool bundle


:param json: the json string :param json: the json string
:param extra_info: the extra info
:param warning: the warning message
:return: the tool bundle :return: the tool bundle
""" """
warning = warning if warning is not None else {} warning = warning if warning is not None else {}
auto parse to tool bundle auto parse to tool bundle


:param content: the content :param content: the content
:param extra_info: the extra info
:param warning: the warning message
:return: tools bundle, schema_type :return: tools bundle, schema_type
""" """
warning = warning if warning is not None else {} warning = warning if warning is not None else {}

+ 0
- 1
api/core/tools/workflow_as_tool/provider.py Ver fichero

""" """
fetch tools from database fetch tools from database


:param user_id: the user id
:param tenant_id: the tenant id :param tenant_id: the tenant id
:return: the tools :return: the tools
""" """

+ 1
- 3
api/core/tools/workflow_as_tool/tool.py Ver fichero



def fork_tool_runtime(self, runtime: ToolRuntime) -> "WorkflowTool": def fork_tool_runtime(self, runtime: ToolRuntime) -> "WorkflowTool":
""" """
fork a new tool with meta data
fork a new tool with metadata


:param meta: the meta data of a tool call processing, tenant_id is required
:return: the new tool :return: the new tool
""" """
return self.__class__( return self.__class__(
""" """
extract files from the result extract files from the result


:param result: the result
:return: the result, files :return: the result, files
""" """
files: list[File] = [] files: list[File] = []

+ 0
- 1
api/core/workflow/utils/variable_template_parser.py Ver fichero



Args: Args:
inputs: A dictionary containing the values for the template variables. inputs: A dictionary containing the values for the template variables.
remove_template_variables: A boolean indicating whether to remove the template variables from the output.


Returns: Returns:
The formatted string with template variables replaced by their values. The formatted string with template variables replaced by their values.

+ 2
- 0
api/core/workflow/workflow_entry.py Ver fichero

NOTE: only parameter_extractor/question_classifier are supported NOTE: only parameter_extractor/question_classifier are supported


:param node_data: node data :param node_data: node data
:param node_id: node id
:param tenant_id: tenant id
:param user_id: user id :param user_id: user id
:param user_inputs: user inputs :param user_inputs: user inputs
:return: :return:

+ 1
- 0
api/services/app_dsl_service.py Ver fichero

""" """
Export app Export app
:param app_model: App instance :param app_model: App instance
:param include_secret: Whether include secret variable
:return: :return:
""" """
app_mode = AppMode.value_of(app_model.mode) app_mode = AppMode.value_of(app_model.mode)

+ 0
- 1
api/services/tools/builtin_tools_manage_service.py Ver fichero

""" """
list builtin tool provider tools list builtin tool provider tools


:param user_id: the id of the user
:param tenant_id: the id of the tenant :param tenant_id: the id of the tenant
:param provider: the name of the provider :param provider: the name of the provider



+ 1
- 0
api/services/tools/tools_transform_service.py Ver fichero

""" """
repack provider repack provider


:param tenant_id: the tenant id
:param provider: the provider dict :param provider: the provider dict
""" """
if isinstance(provider, dict) and "icon" in provider: if isinstance(provider, dict) and "icon" in provider:

+ 3
- 3
api/services/tools/workflow_tools_manage_service.py Ver fichero

Delete a workflow tool. Delete a workflow tool.
:param user_id: the user id :param user_id: the user id
:param tenant_id: the tenant id :param tenant_id: the tenant id
:param workflow_app_id: the workflow app id
:param workflow_tool_id: the workflow tool id
""" """
db.session.query(WorkflowToolProvider).filter( db.session.query(WorkflowToolProvider).filter(
WorkflowToolProvider.tenant_id == tenant_id, WorkflowToolProvider.id == workflow_tool_id WorkflowToolProvider.tenant_id == tenant_id, WorkflowToolProvider.id == workflow_tool_id
Get a workflow tool. Get a workflow tool.
:param user_id: the user id :param user_id: the user id
:param tenant_id: the tenant id :param tenant_id: the tenant id
:param workflow_app_id: the workflow app id
:param workflow_tool_id: the workflow tool id
:return: the tool :return: the tool
""" """
db_tool: WorkflowToolProvider | None = ( db_tool: WorkflowToolProvider | None = (
List workflow tool provider tools. List workflow tool provider tools.
:param user_id: the user id :param user_id: the user id
:param tenant_id: the tenant id :param tenant_id: the tenant id
:param workflow_app_id: the workflow app id
:param workflow_tool_id: the workflow tool id
:return: the list of tools :return: the list of tools
""" """
db_tool: WorkflowToolProvider | None = ( db_tool: WorkflowToolProvider | None = (

+ 1
- 5
api/tasks/mail_account_deletion_task.py Ver fichero



@shared_task(queue="mail") @shared_task(queue="mail")
def send_deletion_success_task(to): def send_deletion_success_task(to):
"""Send email to user regarding account deletion.

Args:
log (AccountDeletionLog): Account deletion log object
"""
"""Send email to user regarding account deletion."""
if not mail.is_inited(): if not mail.is_inited():
return return



+ 0
- 2
api/tasks/ops_trace_task.py Ver fichero

def process_trace_tasks(file_info): def process_trace_tasks(file_info):
""" """
Async process trace tasks Async process trace tasks
:param tasks_data: List of dictionaries containing task data

Usage: process_trace_tasks.delay(tasks_data) Usage: process_trace_tasks.delay(tasks_data)
""" """
from core.ops.ops_trace_manager import OpsTraceManager from core.ops.ops_trace_manager import OpsTraceManager

Cargando…
Cancelar
Guardar