From 7b150fc3b26d7f44fa4943be0fdd35192d742cc1 Mon Sep 17 00:00:00 2001 From: jingrow Date: Fri, 21 Nov 2025 21:30:25 +0800 Subject: [PATCH] add remove_background tool --- apps/jingrow/frontend/src/app/router/index.ts | 2 +- .../remove_background.vue} | 2 +- .../{tools.py => remove_background/remove_background.py} | 7 +------ 3 files changed, 3 insertions(+), 8 deletions(-) rename apps/jingrow/frontend/src/views/tools/{RemoveBackground.vue => remove_background/remove_background.vue} (99%) rename apps/jingrow/jingrow/tools/{tools.py => remove_background/remove_background.py} (96%) diff --git a/apps/jingrow/frontend/src/app/router/index.ts b/apps/jingrow/frontend/src/app/router/index.ts index 652a06e..6027be7 100644 --- a/apps/jingrow/frontend/src/app/router/index.ts +++ b/apps/jingrow/frontend/src/app/router/index.ts @@ -93,7 +93,7 @@ const router = createRouter({ { path: 'tools/remove-background', name: 'RemoveBackground', - component: () => import('../../views/tools/RemoveBackground.vue') + component: () => import('../../views/tools/remove_background/remove_background.vue') }, { path: 'search', diff --git a/apps/jingrow/frontend/src/views/tools/RemoveBackground.vue b/apps/jingrow/frontend/src/views/tools/remove_background/remove_background.vue similarity index 99% rename from apps/jingrow/frontend/src/views/tools/RemoveBackground.vue rename to apps/jingrow/frontend/src/views/tools/remove_background/remove_background.vue index 7666ad6..892d44c 100644 --- a/apps/jingrow/frontend/src/views/tools/RemoveBackground.vue +++ b/apps/jingrow/frontend/src/views/tools/remove_background/remove_background.vue @@ -408,7 +408,7 @@ const handleRemoveBackground = async () => { const base64Data = await base64Promise const response = await axios.post( - '/jingrow.tools.tools.remove_background', + '/jingrow.tools.remove_background.remove_background.remove_background_from_file', { image_data: base64Data }, diff --git a/apps/jingrow/jingrow/tools/tools.py b/apps/jingrow/jingrow/tools/remove_background/remove_background.py similarity index 96% rename from apps/jingrow/jingrow/tools/tools.py rename to apps/jingrow/jingrow/tools/remove_background/remove_background.py index 3596065..977e9a6 100644 --- a/apps/jingrow/jingrow/tools/tools.py +++ b/apps/jingrow/jingrow/tools/remove_background/remove_background.py @@ -1,11 +1,6 @@ # Copyright (c) 2025, JINGROW and contributors # For license information, please see license.txt -""" -Jingrow Tools API -提供各种工具服务的API端点 -""" - import base64 import requests from typing import Dict, Any, Union @@ -18,7 +13,7 @@ logger = logging.getLogger(__name__) @jingrow.whitelist() -def remove_background(image_data: Union[str, list]) -> Dict[str, Any]: +def remove_background_from_file(image_data: Union[str, list]) -> Dict[str, Any]: """ 图片去背景工具 调用 Jingrow Cloud API 实现图片背景移除