cmdbox 0.6.4.1__py3-none-any.whl → 0.6.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cmdbox might be problematic. Click here for more details.
- cmdbox/app/app.py +7 -0
- cmdbox/app/client.py +4 -3
- cmdbox/app/common.py +85 -7
- cmdbox/app/commons/convert.py +3 -1
- cmdbox/app/edge.py +12 -12
- cmdbox/app/features/cli/_cmdbox_vision_install.py +214 -0
- cmdbox/app/features/cli/_cmdbox_vision_predict.py +496 -0
- cmdbox/app/features/cli/_cmdbox_vision_start.py +234 -0
- cmdbox/app/features/cli/cmdbox_cmd_list.py +3 -3
- cmdbox/app/features/cli/cmdbox_cmd_load.py +3 -3
- cmdbox/app/features/cli/cmdbox_tts_install.py +4 -2
- cmdbox/app/features/cli/cmdbox_tts_say.py +2 -1
- cmdbox/app/features/cli/cmdbox_web_apikey_add.py +3 -3
- cmdbox/app/features/cli/cmdbox_web_apikey_del.py +3 -3
- cmdbox/app/features/cli/cmdbox_web_group_add.py +3 -3
- cmdbox/app/features/cli/cmdbox_web_group_del.py +3 -3
- cmdbox/app/features/cli/cmdbox_web_group_edit.py +3 -3
- cmdbox/app/features/cli/cmdbox_web_group_list.py +3 -3
- cmdbox/app/features/cli/cmdbox_web_start.py +10 -10
- cmdbox/app/features/cli/cmdbox_web_user_add.py +3 -3
- cmdbox/app/features/cli/cmdbox_web_user_del.py +3 -3
- cmdbox/app/features/cli/cmdbox_web_user_edit.py +3 -3
- cmdbox/app/features/cli/cmdbox_web_user_list.py +3 -3
- cmdbox/app/features/web/cmdbox_web_exec_cmd.py +12 -14
- cmdbox/app/features/web/cmdbox_web_versions_used.py +1 -1
- cmdbox/app/filer.py +5 -2
- cmdbox/app/mcp.py +4 -3
- cmdbox/app/options.py +8 -0
- cmdbox/app/web.py +50 -36
- cmdbox/licenses/LICENSE_Hypercorn_0_17_3_MIT_License.txt +22 -0
- cmdbox/licenses/{LICENSE_cffi_1_17_1_MIT_License.txt → LICENSE_cffi_2_0_0_UNKNOWN.txt} +2 -5
- cmdbox/licenses/{LICENSE_jsonschema-specifications_2025_4_1_UNKNOWN.txt → LICENSE_h2_4_3_0_MIT_License.txt} +3 -1
- cmdbox/licenses/{LICENSE_backoff_2_2_1_MIT_License.txt → LICENSE_hpack_4_1_0_MIT_License.txt} +1 -1
- cmdbox/licenses/{LICENSE_graphviz_0_21_UNKNOWN.txt → LICENSE_hyperframe_6_1_0_MIT_License.txt} +1 -1
- cmdbox/licenses/{LICENSE_jsonschema_4_25_0_UNKNOWN.txt → LICENSE_priority_2_0_0_MIT_License.txt} +2 -2
- cmdbox/licenses/files.txt +26 -147
- cmdbox/version.py +2 -2
- cmdbox/web/assets/cmdbox/svgicon.js +9 -0
- cmdbox/web/voicevox_license_list.txt +41 -0
- {cmdbox-0.6.4.1.dist-info → cmdbox-0.6.5.dist-info}/METADATA +3 -1
- {cmdbox-0.6.4.1.dist-info → cmdbox-0.6.5.dist-info}/RECORD +65 -186
- cmdbox/app/features/cli/cmdbox_mcp_client.py +0 -174
- cmdbox/app/features/cli/cmdbox_mcp_proxy.py +0 -96
- cmdbox/licenses/LICENSE_APScheduler_3_11_0_MIT_License.txt +0 -19
- cmdbox/licenses/LICENSE_Authlib_1_6_1_BSD_License.txt +0 -29
- cmdbox/licenses/LICENSE_SQLAlchemy_2_0_42_MIT.txt +0 -19
- cmdbox/licenses/LICENSE_SQLAlchemy_2_0_43_MIT.txt +0 -19
- cmdbox/licenses/LICENSE_Werkzeug_3_1_1_BSD_License.txt +0 -28
- cmdbox/licenses/LICENSE_absolufy-imports_0_3_1_MIT_License.txt +0 -21
- cmdbox/licenses/LICENSE_aiohttp_3_12_15_Apache-2_0_AND_MIT.txt +0 -13
- cmdbox/licenses/LICENSE_aiosignal_1_4_0_Apache_Software_License.txt +0 -201
- cmdbox/licenses/LICENSE_anyio_4_9_0_MIT_License.txt +0 -20
- cmdbox/licenses/LICENSE_attrs_25_3_0_UNKNOWN.txt +0 -21
- cmdbox/licenses/LICENSE_cachetools_5_5_2_MIT_License.txt +0 -20
- cmdbox/licenses/LICENSE_certifi_2025_7_14_Mozilla_Public_License_2_0-MPL_2_0.txt +0 -20
- cmdbox/licenses/LICENSE_charset-normalizer_3_4_2_MIT_License.txt +0 -21
- cmdbox/licenses/LICENSE_cloudpickle_3_1_1_BSD_License.txt +0 -1
- cmdbox/licenses/LICENSE_cryptography_45_0_6_Apache-2_0_OR_BSD-3-Clause.txt +0 -3
- cmdbox/licenses/LICENSE_cyclopts_3_22_5_Apache_Software_License.txt +0 -201
- cmdbox/licenses/LICENSE_distro_1_9_0_Apache_Software_License.txt +0 -202
- cmdbox/licenses/LICENSE_dnspython_2_7_0_ISC_License-ISCL.txt +0 -35
- cmdbox/licenses/LICENSE_docstring_parser_0_17_0_MIT_License.txt +0 -21
- cmdbox/licenses/LICENSE_email_validator_2_2_0_The_Unlicense-Unlicense.txt +0 -27
- cmdbox/licenses/LICENSE_exceptiongroup_1_3_0_MIT_License.txt +0 -73
- cmdbox/licenses/LICENSE_fastapi-sso_0_18_0_MIT_License.txt +0 -21
- cmdbox/licenses/LICENSE_fastmcp_2_11_0_Apache_Software_License.txt +0 -201
- cmdbox/licenses/LICENSE_fastmcp_2_11_3_Apache_Software_License.txt +0 -201
- cmdbox/licenses/LICENSE_filelock_3_18_0_The_Unlicense-Unlicense.txt +0 -24
- cmdbox/licenses/LICENSE_frozenlist_1_7_0_Apache-2_0.txt +0 -201
- cmdbox/licenses/LICENSE_fsspec_2025_7_0_BSD_License.txt +0 -29
- cmdbox/licenses/LICENSE_google-adk_1_10_0_Apache_Software_License.txt +0 -202
- cmdbox/licenses/LICENSE_google-adk_1_9_0_Apache_Software_License.txt +0 -202
- cmdbox/licenses/LICENSE_google-api-core_2_25_1_Apache_Software_License.txt +0 -202
- cmdbox/licenses/LICENSE_google-api-python-client_2_177_0_Apache_Software_License.txt +0 -201
- cmdbox/licenses/LICENSE_google-api-python-client_2_178_0_Apache_Software_License.txt +0 -201
- cmdbox/licenses/LICENSE_google-auth-httplib2_0_2_0_Apache_Software_License.txt +0 -201
- cmdbox/licenses/LICENSE_google-auth_2_40_3_Apache_Software_License.txt +0 -201
- cmdbox/licenses/LICENSE_google-cloud-aiplatform_1_106_0_Apache_2_0.txt +0 -202
- cmdbox/licenses/LICENSE_google-cloud-aiplatform_1_108_0_Apache_2_0.txt +0 -202
- cmdbox/licenses/LICENSE_google-cloud-appengine-logging_1_6_2_Apache_Software_License.txt +0 -202
- cmdbox/licenses/LICENSE_google-cloud-audit-log_0_3_2_Apache_Software_License.txt +0 -202
- cmdbox/licenses/LICENSE_google-cloud-bigquery_3_35_1_Apache_Software_License.txt +0 -202
- cmdbox/licenses/LICENSE_google-cloud-core_2_4_3_Apache_Software_License.txt +0 -202
- cmdbox/licenses/LICENSE_google-cloud-logging_3_12_1_Apache_Software_License.txt +0 -202
- cmdbox/licenses/LICENSE_google-cloud-resource-manager_1_14_2_Apache_Software_License.txt +0 -202
- cmdbox/licenses/LICENSE_google-cloud-secret-manager_2_24_0_Apache_Software_License.txt +0 -202
- cmdbox/licenses/LICENSE_google-cloud-speech_2_33_0_Apache_Software_License.txt +0 -202
- cmdbox/licenses/LICENSE_google-cloud-storage_2_19_0_Apache_Software_License.txt +0 -202
- cmdbox/licenses/LICENSE_google-cloud-trace_1_16_2_Apache_Software_License.txt +0 -202
- cmdbox/licenses/LICENSE_google-crc32c_1_7_1_Apache_2_0.txt +0 -202
- cmdbox/licenses/LICENSE_google-genai_1_28_0_Apache_Software_License.txt +0 -202
- cmdbox/licenses/LICENSE_google-genai_1_29_0_Apache_Software_License.txt +0 -202
- cmdbox/licenses/LICENSE_google-resumable-media_2_7_2_Apache_Software_License.txt +0 -202
- cmdbox/licenses/LICENSE_googleapis-common-protos_1_70_0_Apache_Software_License.txt +0 -202
- cmdbox/licenses/LICENSE_greenlet_3_2_3_MIT_AND_Python-2_0.txt +0 -30
- cmdbox/licenses/LICENSE_grpc-google-iam-v1_0_14_2_Apache_Software_License.txt +0 -202
- cmdbox/licenses/LICENSE_grpcio-status_1_74_0_Apache_Software_License.txt +0 -610
- cmdbox/licenses/LICENSE_grpcio_1_74_0_Apache_Software_License.txt +0 -610
- cmdbox/licenses/LICENSE_httpcore_1_0_9_BSD_License.txt +0 -27
- cmdbox/licenses/LICENSE_httplib2_0_22_0_MIT_License.txt +0 -23
- cmdbox/licenses/LICENSE_httpx-sse_0_4_1_MIT.txt +0 -21
- cmdbox/licenses/LICENSE_httpx_0_28_1_BSD_License.txt +0 -12
- cmdbox/licenses/LICENSE_huggingface-hub_0_34_3_Apache_Software_License.txt +0 -201
- cmdbox/licenses/LICENSE_huggingface-hub_0_34_4_Apache_Software_License.txt +0 -201
- cmdbox/licenses/LICENSE_isodate_0_7_2_BSD_License.txt +0 -26
- cmdbox/licenses/LICENSE_jiter_0_10_0_MIT_License.txt +0 -1
- cmdbox/licenses/LICENSE_jsonschema-path_0_3_4_Apache_Software_License.txt +0 -201
- cmdbox/licenses/LICENSE_lazy-object-proxy_1_11_0_BSD_License.txt +0 -20
- cmdbox/licenses/LICENSE_litellm-enterprise_0_1_19_UNKNOWN.txt +0 -37
- cmdbox/licenses/LICENSE_litellm_1_74_12_MIT_License.txt +0 -26
- cmdbox/licenses/LICENSE_litellm_1_75_5_post1_MIT_License.txt +0 -26
- cmdbox/licenses/LICENSE_markdown-it-py_3_0_0_MIT_License.txt +0 -21
- cmdbox/licenses/LICENSE_mcp_1_12_3_MIT_License.txt +0 -21
- cmdbox/licenses/LICENSE_mcp_1_12_4_MIT_License.txt +0 -21
- cmdbox/licenses/LICENSE_multidict_6_6_3_Apache_License_2_0.txt +0 -13
- cmdbox/licenses/LICENSE_multidict_6_6_4_Apache_License_2_0.txt +0 -13
- cmdbox/licenses/LICENSE_oauthlib_3_3_1_BSD-3-Clause.txt +0 -27
- cmdbox/licenses/LICENSE_openai_1_98_0_Apache_Software_License.txt +0 -201
- cmdbox/licenses/LICENSE_openai_1_99_9_Apache_Software_License.txt +0 -201
- cmdbox/licenses/LICENSE_openapi-core_0_19_5_BSD_License.txt +0 -29
- cmdbox/licenses/LICENSE_openapi-pydantic_0_5_1_MIT_License.txt +0 -40
- cmdbox/licenses/LICENSE_openapi-schema-validator_0_6_3_BSD_License.txt +0 -29
- cmdbox/licenses/LICENSE_openapi-spec-validator_0_7_2_Apache_Software_License.txt +0 -201
- cmdbox/licenses/LICENSE_opentelemetry-api_1_36_0_UNKNOWN.txt +0 -201
- cmdbox/licenses/LICENSE_opentelemetry-exporter-gcp-trace_1_9_0_Apache_Software_License.txt +0 -201
- cmdbox/licenses/LICENSE_opentelemetry-resourcedetector-gcp_1_9_0a0_Apache_Software_License.txt +0 -201
- cmdbox/licenses/LICENSE_opentelemetry-sdk_1_36_0_UNKNOWN.txt +0 -201
- cmdbox/licenses/LICENSE_opentelemetry-semantic-conventions_0_57b0_UNKNOWN.txt +0 -201
- cmdbox/licenses/LICENSE_orjson_3_11_1_Apache_Software_License-MIT_License.txt +0 -201
- cmdbox/licenses/LICENSE_parse_1_20_2_MIT_License.txt +0 -19
- cmdbox/licenses/LICENSE_pathable_0_4_4_Apache_Software_License.txt +0 -201
- cmdbox/licenses/LICENSE_propcache_0_3_2_Apache_Software_License.txt +0 -202
- cmdbox/licenses/LICENSE_proto-plus_1_26_1_Apache_Software_License.txt +0 -202
- cmdbox/licenses/LICENSE_protobuf_6_31_1_3-Clause_BSD_License.txt +0 -32
- cmdbox/licenses/LICENSE_pyasn1_0_6_1_BSD_License.txt +0 -24
- cmdbox/licenses/LICENSE_pyasn1_modules_0_4_2_BSD_License.txt +0 -24
- cmdbox/licenses/LICENSE_pydantic-settings_2_10_1_MIT_License.txt +0 -21
- cmdbox/licenses/LICENSE_pyparsing_3_2_3_MIT_License.txt +0 -18
- cmdbox/licenses/LICENSE_pyperclip_1_9_0_BSD_License.txt +0 -27
- cmdbox/licenses/LICENSE_python-dateutil_2_9_0_post0_Apache_Software_License-BSD_License.txt +0 -54
- cmdbox/licenses/LICENSE_python-dotenv_1_1_1_BSD_License.txt +0 -27
- cmdbox/licenses/LICENSE_pywin32_311_Python_Software_Foundation_License.txt +0 -1
- cmdbox/licenses/LICENSE_redis_6_2_0_MIT_License.txt +0 -21
- cmdbox/licenses/LICENSE_referencing_0_36_2_UNKNOWN.txt +0 -19
- cmdbox/licenses/LICENSE_regex_2025_7_34_UNKNOWN.txt +0 -208
- cmdbox/licenses/LICENSE_rfc3339-validator_0_1_4_MIT_License.txt +0 -22
- cmdbox/licenses/LICENSE_rich-rst_1_3_1_MIT_License.txt +0 -7
- cmdbox/licenses/LICENSE_rpds-py_0_26_0_MIT.txt +0 -19
- cmdbox/licenses/LICENSE_rpds-py_0_27_0_UNKNOWN.txt +0 -19
- cmdbox/licenses/LICENSE_rsa_4_9_1_Apache_Software_License.txt +0 -13
- cmdbox/licenses/LICENSE_shapely_2_1_1_BSD_License.txt +0 -29
- cmdbox/licenses/LICENSE_sphinx-intl_2_3_1_BSD_License.txt +0 -25
- cmdbox/licenses/LICENSE_sse-starlette_3_0_2_UNKNOWN.txt +0 -27
- cmdbox/licenses/LICENSE_tenacity_8_5_0_Apache_Software_License.txt +0 -202
- cmdbox/licenses/LICENSE_tenacity_9_1_2_Apache_Software_License.txt +0 -202
- cmdbox/licenses/LICENSE_tiktoken_0_11_0_MIT_License-Copyright-c-2022_OpenAI-Shantanu_Jain-Permission_is_hereby_granted-free_of_charge-to_any_per.txt +0 -21
- cmdbox/licenses/LICENSE_tiktoken_0_9_0_MIT_License-Copyright-c-2022_OpenAI-Shantanu_Jain-Permission_is_hereby_granted-free_of_charge-to_any_pers.txt +0 -21
- cmdbox/licenses/LICENSE_tokenizers_0_21_4_Apache_Software_License.txt +0 -1
- cmdbox/licenses/LICENSE_tqdm_4_67_1_MIT_License-Mozilla_Public_License_2_0-MPL_2_0.txt +0 -49
- cmdbox/licenses/LICENSE_typing_extensions_4_14_1_UNKNOWN.txt +0 -279
- cmdbox/licenses/LICENSE_tzlocal_5_3_1_MIT_License.txt +0 -19
- cmdbox/licenses/LICENSE_uritemplate_4_2_0_BSD_3-Clause_OR_Apache-2_0.txt +0 -3
- cmdbox/licenses/LICENSE_uvicorn_0_35_0_BSD_License.txt +0 -27
- cmdbox/licenses/LICENSE_voicevox_core_0_16_0_MIT.txt +0 -20
- cmdbox/licenses/LICENSE_watchdog_6_0_0_Apache_Software_License.txt +0 -16
- cmdbox/licenses/LICENSE_websockets_15_0_1_BSD_License.txt +0 -24
- cmdbox/licenses/LICENSE_yarl_1_20_1_Apache_Software_License.txt +0 -202
- /cmdbox/licenses/{LICENSE_click_8_2_1_UNKNOWN.txt → LICENSE_click_8_3_0_UNKNOWN.txt} +0 -0
- /cmdbox/licenses/{LICENSE_cryptography_45_0_5_Apache-2_0_OR_BSD-3-Clause.txt → LICENSE_cryptography_46_0_1_UNKNOWN.txt} +0 -0
- /cmdbox/licenses/{LICENSE_fastapi_0_116_1_MIT_License.txt → LICENSE_fastapi_0_116_2_MIT_License.txt} +0 -0
- /cmdbox/licenses/{LICENSE_gevent_25_5_1_MIT.txt → LICENSE_gevent_25_9_1_MIT.txt} +0 -0
- /cmdbox/licenses/{LICENSE_jaraco_functools_4_2_1_UNKNOWN.txt → LICENSE_jaraco_functools_4_3_0_UNKNOWN.txt} +0 -0
- /cmdbox/licenses/{LICENSE_more-itertools_10_7_0_MIT_License.txt → LICENSE_more-itertools_10_8_0_UNKNOWN.txt} +0 -0
- /cmdbox/licenses/{LICENSE_numpy_2_3_2_BSD_License.txt → LICENSE_numpy_2_3_3_BSD_License.txt} +0 -0
- /cmdbox/licenses/{LICENSE_prompt_toolkit_3_0_51_BSD_License.txt → LICENSE_prompt_toolkit_3_0_52_BSD_License.txt} +0 -0
- /cmdbox/licenses/{LICENSE_psycopg-binary_3_2_9_GNU_Lesser_General_Public_License_v3-LGPLv3.txt → LICENSE_psycopg-binary_3_2_10_GNU_Lesser_General_Public_License_v3-LGPLv3.txt} +0 -0
- /cmdbox/licenses/{LICENSE_psycopg_3_2_9_GNU_Lesser_General_Public_License_v3-LGPLv3.txt → LICENSE_psycopg_3_2_10_GNU_Lesser_General_Public_License_v3-LGPLv3.txt} +0 -0
- /cmdbox/licenses/{LICENSE_pycparser_2_22_BSD_License.txt → LICENSE_pycparser_2_23_BSD_License.txt} +0 -0
- /cmdbox/licenses/{LICENSE_pydantic_2_11_7_MIT_License.txt → LICENSE_pydantic_2_11_9_MIT_License.txt} +0 -0
- /cmdbox/licenses/{LICENSE_questionary_2_1_0_MIT_License.txt → LICENSE_questionary_2_1_1_MIT_License.txt} +0 -0
- /cmdbox/licenses/{LICENSE_requests_2_32_4_Apache_Software_License.txt → LICENSE_requests_2_32_5_Apache_Software_License.txt} +0 -0
- /cmdbox/licenses/{LICENSE_sphinx-sitemap_2_7_2_UNKNOWN.txt → LICENSE_sphinx-sitemap_2_8_0_UNKNOWN.txt} +0 -0
- /cmdbox/licenses/{LICENSE_starlette_0_47_2_BSD_License.txt → LICENSE_starlette_0_48_0_BSD_License.txt} +0 -0
- /cmdbox/licenses/{LICENSE_twine_6_1_0_Apache_Software_License.txt → LICENSE_twine_6_2_0_UNKNOWN.txt} +0 -0
- /cmdbox/licenses/{LICENSE_aiohappyeyeballs_2_6_1_Python_Software_Foundation_License.txt → LICENSE_typing_extensions_4_15_0_UNKNOWN.txt} +0 -0
- /cmdbox/licenses/{LICENSE_zope_event_5_1_1_Zope_Public_License.txt → LICENSE_zope_event_6_0_Zope_Public_License.txt} +0 -0
- /cmdbox/licenses/{LICENSE_zope_interface_7_2_Zope_Public_License.txt → LICENSE_zope_interface_8_0_Zope_Public_License.txt} +0 -0
- {cmdbox-0.6.4.1.dist-info → cmdbox-0.6.5.dist-info}/WHEEL +0 -0
- {cmdbox-0.6.4.1.dist-info → cmdbox-0.6.5.dist-info}/entry_points.txt +0 -0
- {cmdbox-0.6.4.1.dist-info → cmdbox-0.6.5.dist-info}/licenses/LICENSE +0 -0
- {cmdbox-0.6.4.1.dist-info → cmdbox-0.6.5.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
from cmdbox import version
|
|
2
|
+
from cmdbox.app import common, client, feature
|
|
3
|
+
from cmdbox.app.commons import convert, redis_client
|
|
4
|
+
from cmdbox.app.options import Options
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import Dict, Any, Tuple, List, Union
|
|
7
|
+
import argparse
|
|
8
|
+
import logging
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class VisionStart(feature.UnsupportEdgeFeature):
|
|
12
|
+
VISION_MODEL = dict()
|
|
13
|
+
VISION_MODEL['092824/sam2.1_hiera_tiny'] = dict(type='sam2',
|
|
14
|
+
path='092824/sam2.1_hiera_tiny.pt',
|
|
15
|
+
conf='configs/sam2.1/sam2.1_hiera_t.yaml',
|
|
16
|
+
url='https://dl.fbaipublicfiles.com/segment_anything_2/092824/sam2.1_hiera_tiny.pt')
|
|
17
|
+
VISION_MODEL['092824/sam2.1_hiera_small'] = dict(type='sam2',
|
|
18
|
+
path='092824/sam2.1_hiera_small.pt',
|
|
19
|
+
conf='configs/sam2.1/sam2.1_hiera_s.yaml',
|
|
20
|
+
url='https://dl.fbaipublicfiles.com/segment_anything_2/092824/sam2.1_hiera_small.pt')
|
|
21
|
+
VISION_MODEL['092824/sam2.1_hiera_base_plus'] = dict(type='sam2',
|
|
22
|
+
path='092824/sam2.1_hiera_base_plus.pt',
|
|
23
|
+
conf='configs/sam2.1/sam2.1_hiera_b+.yaml',
|
|
24
|
+
url='https://dl.fbaipublicfiles.com/segment_anything_2/092824/sam2.1_hiera_base_plus.pt')
|
|
25
|
+
VISION_MODEL['092824/sam2.1_hiera_large'] = dict(type='sam2',
|
|
26
|
+
path='092824/sam2.1_hiera_large.pt',
|
|
27
|
+
conf='configs/sam2.1/sam2.1_hiera_l.yaml',
|
|
28
|
+
url='https://dl.fbaipublicfiles.com/segment_anything_2/092824/sam2.1_hiera_large.pt')
|
|
29
|
+
|
|
30
|
+
def get_mode(self) -> Union[str, List[str]]:
|
|
31
|
+
"""
|
|
32
|
+
この機能のモードを返します
|
|
33
|
+
|
|
34
|
+
Returns:
|
|
35
|
+
Union[str, List[str]]: モード
|
|
36
|
+
"""
|
|
37
|
+
return 'vision'
|
|
38
|
+
|
|
39
|
+
def get_cmd(self):
|
|
40
|
+
"""
|
|
41
|
+
この機能のコマンドを返します
|
|
42
|
+
|
|
43
|
+
Returns:
|
|
44
|
+
str: コマンド
|
|
45
|
+
"""
|
|
46
|
+
return 'start'
|
|
47
|
+
|
|
48
|
+
def get_option(self):
|
|
49
|
+
"""
|
|
50
|
+
この機能のオプションを返します
|
|
51
|
+
|
|
52
|
+
Returns:
|
|
53
|
+
Dict[str, Any]: オプション
|
|
54
|
+
"""
|
|
55
|
+
return dict(
|
|
56
|
+
use_redis=self.USE_REDIS_MEIGHT, nouse_webmode=False, use_agent=True,
|
|
57
|
+
description_ja="画像/動画の推論を開始します。",
|
|
58
|
+
description_en="Starts inference on images/videos.",
|
|
59
|
+
choice=[
|
|
60
|
+
dict(opt="host", type=Options.T_STR, default=self.default_host, required=True, multi=False, hide=True, choice=None, web="mask",
|
|
61
|
+
description_ja="Redisサーバーのサービスホストを指定します。",
|
|
62
|
+
description_en="Specify the service host of the Redis server."),
|
|
63
|
+
dict(opt="port", type=Options.T_INT, default=self.default_port, required=True, multi=False, hide=True, choice=None, web="mask",
|
|
64
|
+
description_ja="Redisサーバーのサービスポートを指定します。",
|
|
65
|
+
description_en="Specify the service port of the Redis server."),
|
|
66
|
+
dict(opt="password", type=Options.T_STR, default=self.default_pass, required=True, multi=False, hide=True, choice=None, web="mask",
|
|
67
|
+
description_ja=f"Redisサーバーのアクセスパスワード(任意)を指定します。省略時は `{self.default_pass}` を使用します。",
|
|
68
|
+
description_en=f"Specify the access password of the Redis server (optional). If omitted, `{self.default_pass}` is used."),
|
|
69
|
+
dict(opt="svname", type=Options.T_STR, default=self.default_svname, required=True, multi=False, hide=True, choice=None, web="readonly",
|
|
70
|
+
description_ja="サーバーのサービス名を指定します。省略時は `server` を使用します。",
|
|
71
|
+
description_en="Specify the service name of the inference server. If omitted, `server` is used."),
|
|
72
|
+
dict(opt="retry_count", type=Options.T_INT, default=3, required=False, multi=False, hide=True, choice=None,
|
|
73
|
+
description_ja="Redisサーバーへの再接続回数を指定します。0以下を指定すると永遠に再接続を行います。",
|
|
74
|
+
description_en="Specifies the number of reconnections to the Redis server.If less than 0 is specified, reconnection is forever."),
|
|
75
|
+
dict(opt="retry_interval", type=Options.T_INT, default=5, required=False, multi=False, hide=True, choice=None,
|
|
76
|
+
description_ja="Redisサーバーに再接続までの秒数を指定します。",
|
|
77
|
+
description_en="Specifies the number of seconds before reconnecting to the Redis server."),
|
|
78
|
+
dict(opt="timeout", type=Options.T_INT, default="60", required=False, multi=False, hide=True, choice=None,
|
|
79
|
+
description_ja="サーバーの応答が返ってくるまでの最大待ち時間を指定。",
|
|
80
|
+
description_en="Specify the maximum waiting time until the server responds."),
|
|
81
|
+
dict(opt="vision_engine", type=Options.T_STR, default="sam2", required=True, multi=False, hide=False,
|
|
82
|
+
choice=["sam2"],
|
|
83
|
+
choice_show=dict(sam2=["sam2_model"]),
|
|
84
|
+
description_ja="使用するVisionエンジンを指定します。",
|
|
85
|
+
description_en="Specify the Vision engine to use."),
|
|
86
|
+
dict(opt="sam2_model", type=Options.T_STR, default="092824/sam2.1_hiera_tiny.pt", required=True, multi=False, hide=False,
|
|
87
|
+
choice=[k for k in self.VISION_MODEL.keys() if self.VISION_MODEL[k]['type'] == 'sam2'],
|
|
88
|
+
choice_edit=True,
|
|
89
|
+
description_ja="使用するSAM2モデルを指定します。",
|
|
90
|
+
description_en="Specify the SAM2 model to use."),
|
|
91
|
+
]
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
def get_svcmd(self):
|
|
95
|
+
"""
|
|
96
|
+
この機能のサーバー側のコマンドを返します
|
|
97
|
+
|
|
98
|
+
Returns:
|
|
99
|
+
str: サーバー側のコマンド
|
|
100
|
+
"""
|
|
101
|
+
return 'vision_start'
|
|
102
|
+
|
|
103
|
+
def apprun(self, logger:logging.Logger, args:argparse.Namespace, tm:float, pf:List[Dict[str, float]]=[]) -> Tuple[int, Dict[str, Any], Any]:
|
|
104
|
+
"""
|
|
105
|
+
この機能の実行を行います
|
|
106
|
+
|
|
107
|
+
Args:
|
|
108
|
+
logger (logging.Logger): ロガー
|
|
109
|
+
args (argparse.Namespace): 引数
|
|
110
|
+
tm (float): 実行開始時間
|
|
111
|
+
pf (List[Dict[str, float]]): 呼出元のパフォーマンス情報
|
|
112
|
+
|
|
113
|
+
Returns:
|
|
114
|
+
Tuple[int, Dict[str, Any], Any]: 終了コード, 結果, オブジェクト
|
|
115
|
+
"""
|
|
116
|
+
if args.vision_engine is None:
|
|
117
|
+
msg = dict(warn=f"Please specify the --vision_engine option.")
|
|
118
|
+
common.print_format(msg, False, tm, args.output_json, args.output_json_append, pf=pf)
|
|
119
|
+
return self.RESP_WARN, msg, None
|
|
120
|
+
if args.vision_engine == 'sam2':
|
|
121
|
+
if args.sam2_model is None:
|
|
122
|
+
msg = dict(warn=f"Please specify the --sam2_model option.")
|
|
123
|
+
common.print_format(msg, False, tm, args.output_json, args.output_json_append, pf=pf)
|
|
124
|
+
return self.RESP_WARN, msg, None
|
|
125
|
+
|
|
126
|
+
vision_engine_b64 = convert.str2b64str(args.vision_engine)
|
|
127
|
+
sam2_model_b64 = convert.str2b64str(args.sam2_model)
|
|
128
|
+
cl = client.Client(logger, redis_host=args.host, redis_port=args.port, redis_password=args.password, svname=args.svname)
|
|
129
|
+
ret = cl.redis_cli.send_cmd(self.get_svcmd(),
|
|
130
|
+
[vision_engine_b64, sam2_model_b64],
|
|
131
|
+
retry_count=args.retry_count, retry_interval=args.retry_interval, timeout=args.timeout, nowait=False)
|
|
132
|
+
common.print_format(ret, False, tm, None, False, pf=pf)
|
|
133
|
+
if 'success' not in ret:
|
|
134
|
+
return self.RESP_WARN, ret, cl
|
|
135
|
+
return self.RESP_SUCCESS, ret, cl
|
|
136
|
+
|
|
137
|
+
msg = dict(warn=f"Unsupported vision engine: {args.vision_engine}")
|
|
138
|
+
common.print_format(msg, False, tm, args.output_json, args.output_json_append, pf=pf)
|
|
139
|
+
return self.RESP_WARN, msg, None
|
|
140
|
+
|
|
141
|
+
def is_cluster_redirect(self):
|
|
142
|
+
"""
|
|
143
|
+
クラスター宛のメッセージの場合、メッセージを転送するかどうかを返します
|
|
144
|
+
|
|
145
|
+
Returns:
|
|
146
|
+
bool: メッセージを転送する場合はTrue
|
|
147
|
+
"""
|
|
148
|
+
return True
|
|
149
|
+
|
|
150
|
+
def svrun(self, data_dir:Path, logger:logging.Logger, redis_cli:redis_client.RedisClient, msg:List[str],
|
|
151
|
+
sessions:Dict[str, Dict[str, Any]]) -> int:
|
|
152
|
+
"""
|
|
153
|
+
この機能のサーバー側の実行を行います
|
|
154
|
+
|
|
155
|
+
Args:
|
|
156
|
+
data_dir (Path): データディレクトリ
|
|
157
|
+
logger (logging.Logger): ロガー
|
|
158
|
+
redis_cli (redis_client.RedisClient): Redisクライアント
|
|
159
|
+
msg (List[str]): 受信メッセージ
|
|
160
|
+
sessions (Dict[str, Dict[str, Any]]): セッション情報
|
|
161
|
+
|
|
162
|
+
Returns:
|
|
163
|
+
int: 終了コード
|
|
164
|
+
"""
|
|
165
|
+
if logger.level == logging.DEBUG:
|
|
166
|
+
logger.debug(f"audit write svrun msg: {msg}")
|
|
167
|
+
vision_engine = convert.b64str2str(msg[2])
|
|
168
|
+
sam2_model = convert.b64str2str(msg[3])
|
|
169
|
+
st = self.start(msg[1], vision_engine, sam2_model, data_dir, logger, redis_cli, sessions)
|
|
170
|
+
return st
|
|
171
|
+
|
|
172
|
+
def start(self, reskey:str, vision_engine:str, sam2_model:str, data_dir:Path, logger:logging.Logger,
|
|
173
|
+
redis_cli:redis_client.RedisClient, sessions:Dict[str, Dict[str, Any]]) -> int:
|
|
174
|
+
"""
|
|
175
|
+
SAM2のモデルを開始します
|
|
176
|
+
|
|
177
|
+
Args:
|
|
178
|
+
reskey (str): レスポンスキー
|
|
179
|
+
vision_engine (str): Visionエンジン
|
|
180
|
+
sam2_model (str): SAM2モデル
|
|
181
|
+
data_dir (Path): データディレクトリ
|
|
182
|
+
logger (logging.Logger): ロガー
|
|
183
|
+
redis_cli (redis_client.RedisClient): Redisクライアント
|
|
184
|
+
sessions (Dict[str, Dict[str, Any]]): セッション情報
|
|
185
|
+
|
|
186
|
+
Returns:
|
|
187
|
+
int: レスポンスコード
|
|
188
|
+
"""
|
|
189
|
+
try:
|
|
190
|
+
if 'vision' not in sessions:
|
|
191
|
+
sessions['vision'] = {}
|
|
192
|
+
if vision_engine == 'sam2':
|
|
193
|
+
#===============================================================
|
|
194
|
+
# SAM2モデルの初期化
|
|
195
|
+
from sam2.build_sam import build_sam2
|
|
196
|
+
from sam2.sam2_image_predictor import SAM2ImagePredictor
|
|
197
|
+
#from sam2.sam2_video_predictor import SAM2VideoPredictor
|
|
198
|
+
import torch
|
|
199
|
+
|
|
200
|
+
sam2_dir = Path(version.__file__).parent / '.sam2' / 'model'
|
|
201
|
+
if not sam2_dir.exists():
|
|
202
|
+
logger.error(f"Failed to start SAM2 model: sam2 directory does not exist: {sam2_dir}")
|
|
203
|
+
redis_cli.rpush(reskey, dict(warn=f"Failed to start SAM2 model: sam2 directory does not exist: {sam2_dir}"))
|
|
204
|
+
return self.RESP_WARN
|
|
205
|
+
|
|
206
|
+
model_file = sam2_dir / self.VISION_MODEL[sam2_model]['path']
|
|
207
|
+
config_file = self.VISION_MODEL[sam2_model]['conf']
|
|
208
|
+
if not model_file.exists():
|
|
209
|
+
logger.error(f"Failed to start SAM2 model: model file does not exist: {model_file}")
|
|
210
|
+
redis_cli.rpush(reskey, dict(warn=f"Failed to start SAM2 model: model file does not exist: {model_file}"))
|
|
211
|
+
return self.RESP_WARN
|
|
212
|
+
|
|
213
|
+
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
|
214
|
+
# vvmファイルの読込み
|
|
215
|
+
predictor = SAM2ImagePredictor(build_sam2(config_file, model_file, device=device))
|
|
216
|
+
if vision_engine not in sessions['vision']:
|
|
217
|
+
sessions['vision'][vision_engine] = {}
|
|
218
|
+
sessions['vision'][vision_engine][sam2_model] = dict(
|
|
219
|
+
info=self.VISION_MODEL[sam2_model].copy(),
|
|
220
|
+
predictor=predictor,
|
|
221
|
+
)
|
|
222
|
+
#===============================================================
|
|
223
|
+
# 成功時の処理
|
|
224
|
+
rescode, msg = (self.RESP_SUCCESS, dict(success=f'Success to start SAM2. Model: {sam2_model}'))
|
|
225
|
+
redis_cli.rpush(reskey, msg)
|
|
226
|
+
return rescode
|
|
227
|
+
else:
|
|
228
|
+
logger.warning(f"Unsupported vision engine: {vision_engine}")
|
|
229
|
+
redis_cli.rpush(reskey, dict(warn=f"Unsupported vision engine: {vision_engine}"))
|
|
230
|
+
return self.RESP_WARN
|
|
231
|
+
except Exception as e:
|
|
232
|
+
logger.warning(f"Failed to start: {e}", exc_info=True)
|
|
233
|
+
redis_cli.rpush(reskey, dict(warn=f"Failed to start: {e}"))
|
|
234
|
+
return self.RESP_WARN
|
|
@@ -45,9 +45,9 @@ class CmdList(feature.OneshotResultEdgeFeature):
|
|
|
45
45
|
dict(opt="kwd", type=Options.T_STR, default=None, required=False, multi=False, hide=False, choice=None,
|
|
46
46
|
description_ja=f"検索したいコマンド名を指定します。中間マッチで検索します。",
|
|
47
47
|
description_en=f"Specify the name of the command you want to search. Search with intermediate matches."),
|
|
48
|
-
dict(opt="signin_file", type=Options.T_FILE, default=
|
|
49
|
-
description_ja="
|
|
50
|
-
description_en="Specify a file containing users and passwords with which they can signin."),
|
|
48
|
+
dict(opt="signin_file", type=Options.T_FILE, default=None, required=False, multi=False, hide=False, choice=None, fileio="in",
|
|
49
|
+
description_ja=f"サインイン可能なユーザーとパスワードを記載したファイルを指定します。通常 '.{self.ver.__appid__}/user_list.yml' を指定します。",
|
|
50
|
+
description_en=f"Specify a file containing users and passwords with which they can signin.Typically, specify '.{self.ver.__appid__}/user_list.yml'."),
|
|
51
51
|
dict(opt="groups", type=Options.T_STR, default=None, required=False, multi=True, hide=False, choice=None,
|
|
52
52
|
description_ja="`signin_file` を指定した場合に、このユーザーグループに許可されているコマンドリストを返すように指定します。",
|
|
53
53
|
description_en="Specifies that `signin_file`, if specified, should return the list of commands allowed for this user group."),
|
|
@@ -45,9 +45,9 @@ class CmdLoad(feature.OneshotResultEdgeFeature):
|
|
|
45
45
|
dict(opt="title", type=Options.T_STR, default=None, required=False, multi=False, hide=False, choice=None,
|
|
46
46
|
description_ja=f"読込みたいコマンド名を指定します。",
|
|
47
47
|
description_en=f"Specify the name of the command to be read."),
|
|
48
|
-
dict(opt="signin_file", type=Options.T_FILE, default=
|
|
49
|
-
description_ja="
|
|
50
|
-
description_en="Specify a file containing users and passwords with which they can signin."),
|
|
48
|
+
dict(opt="signin_file", type=Options.T_FILE, default=None, required=False, multi=False, hide=False, choice=None, fileio="in",
|
|
49
|
+
description_ja=f"サインイン可能なユーザーとパスワードを記載したファイルを指定します。通常 '.{self.ver.__appid__}/user_list.yml' を指定します。",
|
|
50
|
+
description_en=f"Specify a file containing users and passwords with which they can signin.Typically, specify '.{self.ver.__appid__}/user_list.yml'."),
|
|
51
51
|
dict(opt="groups", type=Options.T_STR, default=None, required=False, multi=True, hide=True, choice=None,
|
|
52
52
|
description_ja="`signin_file` を指定した場合に、このユーザーグループに許可されているコマンドリストを返すように指定します。",
|
|
53
53
|
description_en="Specifies that `signin_file`, if specified, should return the list of commands allowed for this user group."),
|
|
@@ -254,8 +254,9 @@ class TtsInstall(feature.UnsupportEdgeFeature):
|
|
|
254
254
|
_msg = f"Failed to download VoiceVox core: {responce.status_code} {responce.reason}. {downloader_url}"
|
|
255
255
|
logger.error(_msg, exc_info=True)
|
|
256
256
|
return dict(warn=_msg)
|
|
257
|
-
|
|
257
|
+
def _wd(f):
|
|
258
258
|
f.write(responce.content)
|
|
259
|
+
common.save_file(dlfile, _wd, mode='wb')
|
|
259
260
|
# ダウンローダーの実行権限を付与
|
|
260
261
|
if voicevox_os != 'windows':
|
|
261
262
|
dlfile.chmod(dlfile.stat().st_mode | 0o111)
|
|
@@ -296,8 +297,9 @@ class TtsInstall(feature.UnsupportEdgeFeature):
|
|
|
296
297
|
_msg = f"Failed to download VoiceVox whl: {responce.status_code} {responce.reason}. {whl_url}"
|
|
297
298
|
logger.error(_msg, exc_info=True)
|
|
298
299
|
return dict(warn=_msg)
|
|
299
|
-
|
|
300
|
+
def _ww(f):
|
|
300
301
|
f.write(responce.content)
|
|
302
|
+
common.save_file(voicevox_whl, _ww, mode='wb')
|
|
301
303
|
# whlファイルをpipでインストール
|
|
302
304
|
if logger.level == logging.DEBUG:
|
|
303
305
|
logger.debug(f"pip install {voicevox_whl}")
|
|
@@ -81,8 +81,9 @@ class TtsSay(cmdbox_tts_start.TtsStart):
|
|
|
81
81
|
if 'success' in ret and 'data' in ret['success']:
|
|
82
82
|
wav_b64 = ret['success']['data']
|
|
83
83
|
wav_data = convert.b64str2bytes(wav_b64)
|
|
84
|
-
|
|
84
|
+
def _w(f):
|
|
85
85
|
f.write(wav_data)
|
|
86
|
+
common.save_file(args.tts_output, _w, mode='wb')
|
|
86
87
|
del ret['success']['data'] # 音声データは削除
|
|
87
88
|
common.print_format(ret, False, tm, None, False, pf=pf)
|
|
88
89
|
if 'success' not in ret:
|
|
@@ -43,9 +43,9 @@ class WebApikeyAdd(feature.UnsupportEdgeFeature):
|
|
|
43
43
|
dict(opt="apikey_name", type=Options.T_STR, default=None, required=True, multi=False, hide=False, choice=None,
|
|
44
44
|
description_ja="このユーザーのApiKey名を指定します。",
|
|
45
45
|
description_en="Specify the ApiKey name for this user."),
|
|
46
|
-
dict(opt="signin_file", type=Options.T_FILE, default=
|
|
47
|
-
description_ja="
|
|
48
|
-
description_en="Specify a file containing users and passwords with which they can signin.
|
|
46
|
+
dict(opt="signin_file", type=Options.T_FILE, default=None, required=True, multi=False, hide=False, choice=None, fileio="in",
|
|
47
|
+
description_ja=f"サインイン可能なユーザーとパスワードを記載したファイルを指定します。通常 '.{self.ver.__appid__}/user_list.yml' を指定します。",
|
|
48
|
+
description_en=f"Specify a file containing users and passwords with which they can signin.Typically, specify '.{self.ver.__appid__}/user_list.yml'."),
|
|
49
49
|
dict(opt="stdout_log", type=Options.T_BOOL, default=True, required=False, multi=False, hide=True, choice=[True, False],
|
|
50
50
|
description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力をConsole logに出力します。",
|
|
51
51
|
description_en="Available only in GUI mode. Outputs standard output during command execution to Console log."),
|
|
@@ -43,9 +43,9 @@ class WebApikeyDel(feature.UnsupportEdgeFeature):
|
|
|
43
43
|
dict(opt="apikey_name", type=Options.T_STR, default=None, required=True, multi=False, hide=False, choice=None,
|
|
44
44
|
description_ja="このユーザーのApiKey名を指定します。",
|
|
45
45
|
description_en="Specify the ApiKey name for this user."),
|
|
46
|
-
dict(opt="signin_file", type=Options.T_FILE, default=
|
|
47
|
-
description_ja="
|
|
48
|
-
description_en="Specify a file containing users and passwords with which they can signin.
|
|
46
|
+
dict(opt="signin_file", type=Options.T_FILE, default=None, required=False, multi=False, hide=True, choice=None, fileio="in",
|
|
47
|
+
description_ja=f"サインイン可能なユーザーとパスワードを記載したファイルを指定します。通常 '.{self.ver.__appid__}/user_list.yml' を指定します。",
|
|
48
|
+
description_en=f"Specify a file containing users and passwords with which they can signin.Typically, specify '.{self.ver.__appid__}/user_list.yml'."),
|
|
49
49
|
dict(opt="stdout_log", type=Options.T_BOOL, default=True, required=False, multi=False, hide=True, choice=[True, False],
|
|
50
50
|
description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力をConsole logに出力します。",
|
|
51
51
|
description_en="Available only in GUI mode. Outputs standard output during command execution to Console log."),
|
|
@@ -46,9 +46,9 @@ class WebGroupAdd(feature.UnsupportEdgeFeature):
|
|
|
46
46
|
dict(opt="group_parent", type=Options.T_STR, default=None, required=False, multi=False, hide=False, choice=None,
|
|
47
47
|
description_ja="親グループ名を指定します。",
|
|
48
48
|
description_en="Specifies the parent group name."),
|
|
49
|
-
dict(opt="signin_file", type=Options.T_FILE, default=
|
|
50
|
-
description_ja="
|
|
51
|
-
description_en="Specify a file containing users and passwords with which they can signin.
|
|
49
|
+
dict(opt="signin_file", type=Options.T_FILE, default=None, required=True, multi=False, hide=False, choice=None, fileio="in",
|
|
50
|
+
description_ja=f"サインイン可能なユーザーとパスワードを記載したファイルを指定します。通常 '.{self.ver.__appid__}/user_list.yml' を指定します。",
|
|
51
|
+
description_en=f"Specify a file containing users and passwords with which they can signin.Typically, specify '.{self.ver.__appid__}/user_list.yml'."),
|
|
52
52
|
dict(opt="stdout_log", type=Options.T_BOOL, default=True, required=False, multi=False, hide=True, choice=[True, False],
|
|
53
53
|
description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力をConsole logに出力します。",
|
|
54
54
|
description_en="Available only in GUI mode. Outputs standard output during command execution to Console log."),
|
|
@@ -40,9 +40,9 @@ class WebGroupDel(feature.UnsupportEdgeFeature):
|
|
|
40
40
|
dict(opt="group_id", type=Options.T_INT, default=None, required=True, multi=False, hide=False, choice=None,
|
|
41
41
|
description_ja="グループIDを指定します。",
|
|
42
42
|
description_en="Specify the group ID. Do not duplicate other groups."),
|
|
43
|
-
dict(opt="signin_file", type=Options.T_FILE, default=
|
|
44
|
-
description_ja="
|
|
45
|
-
description_en="Specify a file containing users and passwords with which they can signin.
|
|
43
|
+
dict(opt="signin_file", type=Options.T_FILE, default=None, required=True, multi=False, hide=False, choice=None, fileio="in",
|
|
44
|
+
description_ja=f"サインイン可能なユーザーとパスワードを記載したファイルを指定します。通常 '.{self.ver.__appid__}/user_list.yml' を指定します。",
|
|
45
|
+
description_en=f"Specify a file containing users and passwords with which they can signin.Typically, specify '.{self.ver.__appid__}/user_list.yml'."),
|
|
46
46
|
dict(opt="stdout_log", type=Options.T_BOOL, default=True, required=False, multi=False, hide=True, choice=[True, False],
|
|
47
47
|
description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力をConsole logに出力します。",
|
|
48
48
|
description_en="Available only in GUI mode. Outputs standard output during command execution to Console log."),
|
|
@@ -46,9 +46,9 @@ class WebGroupEdit(feature.UnsupportEdgeFeature):
|
|
|
46
46
|
dict(opt="group_parent", type=Options.T_STR, default=None, required=False, multi=False, hide=False, choice=None,
|
|
47
47
|
description_ja="親グループ名を指定します。",
|
|
48
48
|
description_en="Specifies the parent group name."),
|
|
49
|
-
dict(opt="signin_file", type=Options.T_FILE, default=
|
|
50
|
-
description_ja="
|
|
51
|
-
description_en="Specify a file containing users and passwords with which they can signin.
|
|
49
|
+
dict(opt="signin_file", type=Options.T_FILE, default=None, required=True, multi=False, hide=False, choice=None, fileio="in",
|
|
50
|
+
description_ja=f"サインイン可能なユーザーとパスワードを記載したファイルを指定します。通常 '.{self.ver.__appid__}/user_list.yml' を指定します。",
|
|
51
|
+
description_en=f"Specify a file containing users and passwords with which they can signin.Typically, specify '.{self.ver.__appid__}/user_list.yml'."),
|
|
52
52
|
dict(opt="stdout_log", type=Options.T_BOOL, default=True, required=False, multi=False, hide=True, choice=[True, False],
|
|
53
53
|
description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力をConsole logに出力します。",
|
|
54
54
|
description_en="Available only in GUI mode. Outputs standard output during command execution to Console log."),
|
|
@@ -40,9 +40,9 @@ class WebGroupList(feature.UnsupportEdgeFeature):
|
|
|
40
40
|
dict(opt="group_name", type=Options.T_STR, default=None, required=False, multi=False, hide=False, choice=None,
|
|
41
41
|
description_ja="グループ名を指定して取得します。省略した時は全てのグループを取得します。",
|
|
42
42
|
description_en="Retrieved by specifying a group name. If omitted, all groups are retrieved."),
|
|
43
|
-
dict(opt="signin_file", type=Options.T_FILE, default=
|
|
44
|
-
description_ja="
|
|
45
|
-
description_en="Specify a file containing users and passwords with which they can signin.
|
|
43
|
+
dict(opt="signin_file", type=Options.T_FILE, default=None, required=True, multi=False, hide=False, choice=None, fileio="in",
|
|
44
|
+
description_ja=f"サインイン可能なユーザーとパスワードを記載したファイルを指定します。通常 '.{self.ver.__appid__}/user_list.yml' を指定します。",
|
|
45
|
+
description_en=f"Specify a file containing users and passwords with which they can signin.Typically, specify '.{self.ver.__appid__}/user_list.yml'."),
|
|
46
46
|
dict(opt="stdout_log", type=Options.T_BOOL, default=True, required=False, multi=False, hide=True, choice=[True, False],
|
|
47
47
|
description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力をConsole logに出力します。",
|
|
48
48
|
description_en="Available only in GUI mode. Outputs standard output during command execution to Console log."),
|
|
@@ -78,9 +78,9 @@ class WebStart(feature.UnsupportEdgeFeature, agent_base.AgentBase):
|
|
|
78
78
|
dict(opt="ssl_ca_certs", type=Options.T_FILE, default=None, required=False, multi=False, hide=True, choice=None, fileio="in",
|
|
79
79
|
description_ja="SSLサーバーCA証明書ファイルを指定します。",
|
|
80
80
|
description_en="Specify the SSL server CA certificate file."),
|
|
81
|
-
dict(opt="signin_file", type=Options.T_FILE, default=None, required=False, multi=False, hide=
|
|
82
|
-
description_ja="
|
|
83
|
-
description_en="Specify a file containing users and passwords with which they can signin.
|
|
81
|
+
dict(opt="signin_file", type=Options.T_FILE, default=None, required=False, multi=False, hide=False, choice=None, fileio="in",
|
|
82
|
+
description_ja=f"サインイン可能なユーザーとパスワードを記載したファイルを指定します。通常 '.{self.ver.__appid__}/user_list.yml' を指定します。",
|
|
83
|
+
description_en=f"Specify a file containing users and passwords with which they can signin.Typically, specify '.{self.ver.__appid__}/user_list.yml'."),
|
|
84
84
|
dict(opt="session_domain", type=Options.T_STR, default=None, required=False, multi=False, hide=True, choice=None,
|
|
85
85
|
description_ja="サインインしたユーザーのセッションが有効なドメインを指定します。",
|
|
86
86
|
description_en="Specify the domain for which the signed-in user's session is valid."),
|
|
@@ -93,12 +93,12 @@ class WebStart(feature.UnsupportEdgeFeature, agent_base.AgentBase):
|
|
|
93
93
|
dict(opt="session_timeout", type=Options.T_INT, default="900", required=False, multi=False, hide=True, choice=None,
|
|
94
94
|
description_ja="サインインしたユーザーのセッションタイムアウトの時間を秒で指定します。",
|
|
95
95
|
description_en="Specify the session timeout in seconds for signed-in users."),
|
|
96
|
-
dict(opt="
|
|
97
|
-
description_ja="
|
|
98
|
-
description_en="Specifies the number of
|
|
99
|
-
dict(opt="
|
|
100
|
-
description_ja="
|
|
101
|
-
description_en="Specify the timeout duration of the
|
|
96
|
+
dict(opt="gunicorn_workers", type=Options.T_INT, default=multiprocessing.cpu_count()*2, required=False, multi=False, hide=True, choice=None,
|
|
97
|
+
description_ja="gunicornワーカー数を指定します。Linux環境でのみ有効です。-1又は未指定の場合はCPU数の2倍を使用します。",
|
|
98
|
+
description_en="Specifies the number of gunicorn workers, valid only in Linux environment. If -1 or unspecified, twice the number of CPUs is used."),
|
|
99
|
+
dict(opt="gunicorn_timeout", type=Options.T_INT, default=30, required=False, multi=False, hide=True, choice=None,
|
|
100
|
+
description_ja="gunicornワーカーのタイムアウトの時間を秒で指定します。",
|
|
101
|
+
description_en="Specify the timeout duration of the gunicorn worker in seconds."),
|
|
102
102
|
dict(opt="client_only", type=Options.T_BOOL, default=False, required=False, multi=False, hide=True, choice=[True, False],
|
|
103
103
|
description_ja="サーバーへの接続を行わないようにします。",
|
|
104
104
|
description_en="Do not make connections to the server."),
|
|
@@ -232,5 +232,5 @@ class WebStart(feature.UnsupportEdgeFeature, agent_base.AgentBase):
|
|
|
232
232
|
ssl_cert=args.ssl_cert, ssl_key=args.ssl_key, ssl_keypass=args.ssl_keypass, ssl_ca_certs=args.ssl_ca_certs,
|
|
233
233
|
session_domain=args.session_domain, session_path=args.session_path,
|
|
234
234
|
session_secure=args.session_secure, session_timeout=args.session_timeout,
|
|
235
|
-
outputs_key=args.outputs_key,
|
|
235
|
+
outputs_key=args.outputs_key, gunicorn_workers=args.gunicorn_workers, gunicorn_timeout=args.gunicorn_timeout,
|
|
236
236
|
agent_runner=agent_runner, mcp=mcp,)
|
|
@@ -55,9 +55,9 @@ class WebUserAdd(feature.UnsupportEdgeFeature):
|
|
|
55
55
|
dict(opt="user_group", type=Options.T_STR, default=None, required=True, multi=True, hide=False, choice=None,
|
|
56
56
|
description_ja="ユーザーが所属するグループを指定します。",
|
|
57
57
|
description_en="Specifies the groups to which the user belongs."),
|
|
58
|
-
dict(opt="signin_file", type=Options.T_FILE, default=
|
|
59
|
-
description_ja="
|
|
60
|
-
description_en="Specify a file containing users and passwords with which they can signin.
|
|
58
|
+
dict(opt="signin_file", type=Options.T_FILE, default=None, required=True, multi=False, hide=False, choice=None, fileio="in",
|
|
59
|
+
description_ja=f"サインイン可能なユーザーとパスワードを記載したファイルを指定します。通常 '.{self.ver.__appid__}/user_list.yml' を指定します。",
|
|
60
|
+
description_en=f"Specify a file containing users and passwords with which they can signin.Typically, specify '.{self.ver.__appid__}/user_list.yml'."),
|
|
61
61
|
dict(opt="stdout_log", type=Options.T_BOOL, default=True, required=False, multi=False, hide=True, choice=[True, False],
|
|
62
62
|
description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力をConsole logに出力します。",
|
|
63
63
|
description_en="Available only in GUI mode. Outputs standard output during command execution to Console log."),
|
|
@@ -40,9 +40,9 @@ class WebUserDel(feature.UnsupportEdgeFeature):
|
|
|
40
40
|
dict(opt="user_id", type=Options.T_INT, default=None, required=True, multi=False, hide=False, choice=None,
|
|
41
41
|
description_ja="ユーザーIDを指定します。",
|
|
42
42
|
description_en="Specify the user ID."),
|
|
43
|
-
dict(opt="signin_file", type=Options.T_FILE, default=
|
|
44
|
-
description_ja="
|
|
45
|
-
description_en="Specify a file containing users and passwords with which they can signin.
|
|
43
|
+
dict(opt="signin_file", type=Options.T_FILE, default=None, required=True, multi=False, hide=False, choice=None, fileio="in",
|
|
44
|
+
description_ja=f"サインイン可能なユーザーとパスワードを記載したファイルを指定します。通常 '.{self.ver.__appid__}/user_list.yml' を指定します。",
|
|
45
|
+
description_en=f"Specify a file containing users and passwords with which they can signin.Typically, specify '.{self.ver.__appid__}/user_list.yml'."),
|
|
46
46
|
dict(opt="stdout_log", type=Options.T_BOOL, default=True, required=False, multi=False, hide=True, choice=[True, False],
|
|
47
47
|
description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力をConsole logに出力します。",
|
|
48
48
|
description_en="Available only in GUI mode. Outputs standard output during command execution to Console log."),
|
|
@@ -55,9 +55,9 @@ class WebUserEdit(feature.UnsupportEdgeFeature):
|
|
|
55
55
|
dict(opt="user_group", type=Options.T_STR, default=None, required=True, multi=True, hide=False, choice=None,
|
|
56
56
|
description_ja="ユーザーが所属するグループを指定します。",
|
|
57
57
|
description_en="Specifies the groups to which the user belongs."),
|
|
58
|
-
dict(opt="signin_file", type=Options.T_FILE, default=
|
|
59
|
-
description_ja="
|
|
60
|
-
description_en="Specify a file containing users and passwords with which they can signin.
|
|
58
|
+
dict(opt="signin_file", type=Options.T_FILE, default=None, required=True, multi=False, hide=False, choice=None, fileio="in",
|
|
59
|
+
description_ja=f"サインイン可能なユーザーとパスワードを記載したファイルを指定します。通常 '.{self.ver.__appid__}/user_list.yml' を指定します。",
|
|
60
|
+
description_en=f"Specify a file containing users and passwords with which they can signin.Typically, specify '.{self.ver.__appid__}/user_list.yml'."),
|
|
61
61
|
dict(opt="stdout_log", type=Options.T_BOOL, default=True, required=False, multi=False, hide=True, choice=[True, False],
|
|
62
62
|
description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力をConsole logに出力します。",
|
|
63
63
|
description_en="Available only in GUI mode. Outputs standard output during command execution to Console log."),
|
|
@@ -40,9 +40,9 @@ class WebUserList(feature.UnsupportEdgeFeature):
|
|
|
40
40
|
dict(opt="user_name", type=Options.T_STR, default=None, required=False, multi=False, hide=False, choice=None,
|
|
41
41
|
description_ja="ユーザー名を指定して取得します。省略した時は全てのユーザーを取得します。",
|
|
42
42
|
description_en="Retrieved by specifying a user name. If omitted, all users are retrieved."),
|
|
43
|
-
dict(opt="signin_file", type=Options.T_FILE, default=
|
|
44
|
-
description_ja="
|
|
45
|
-
description_en="Specify a file containing users and passwords with which they can signin.
|
|
43
|
+
dict(opt="signin_file", type=Options.T_FILE, default=None, required=True, multi=False, hide=False, choice=None, fileio="in",
|
|
44
|
+
description_ja=f"サインイン可能なユーザーとパスワードを記載したファイルを指定します。通常 '.{self.ver.__appid__}/user_list.yml' を指定します。",
|
|
45
|
+
description_en=f"Specify a file containing users and passwords with which they can signin.Typically, specify '.{self.ver.__appid__}/user_list.yml'."),
|
|
46
46
|
dict(opt="stdout_log", type=Options.T_BOOL, default=True, required=False, multi=False, hide=True, choice=[True, False],
|
|
47
47
|
description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力をConsole logに出力します。",
|
|
48
48
|
description_en="Available only in GUI mode. Outputs standard output during command execution to Console log."),
|
|
@@ -34,16 +34,14 @@ class ExecCmd(cmdbox_web_load_cmd.LoadCmd):
|
|
|
34
34
|
raise HTTPException(status_code=401, detail=self.DEFAULT_401_MESSAGE)
|
|
35
35
|
opt = None
|
|
36
36
|
content_type = req.headers.get('content-type')
|
|
37
|
-
def _marge_opt(opt, param):
|
|
38
|
-
|
|
39
|
-
if k in param: opt[k] = param[k]
|
|
37
|
+
def _marge_opt(opt:Dict[str, Any], param:Dict[str, Any]) -> Dict[str, Any]:
|
|
38
|
+
opt.update(param)
|
|
40
39
|
return opt
|
|
40
|
+
opt_def = self.load_cmd(web, title)
|
|
41
41
|
if content_type is None:
|
|
42
|
-
opt =
|
|
43
|
-
opt = _marge_opt(opt, req.query_params)
|
|
42
|
+
opt = _marge_opt(opt_def, req.query_params)
|
|
44
43
|
elif content_type.startswith('multipart/form-data'):
|
|
45
|
-
opt =
|
|
46
|
-
opt = _marge_opt(opt, req.query_params)
|
|
44
|
+
opt = _marge_opt(opt_def, req.query_params)
|
|
47
45
|
form = await req.form()
|
|
48
46
|
#files = {key: value for key, value in form.multi_items() if isinstance(value, UploadFile)}
|
|
49
47
|
for key, fv in form.multi_items():
|
|
@@ -52,13 +50,12 @@ class ExecCmd(cmdbox_web_load_cmd.LoadCmd):
|
|
|
52
50
|
if key == 'input_file': opt['stdin'] = False
|
|
53
51
|
elif content_type.startswith('application/json'):
|
|
54
52
|
opt = await req.json()
|
|
53
|
+
opt = _marge_opt(opt_def, opt)
|
|
55
54
|
elif content_type.startswith('application/octet-stream'):
|
|
56
|
-
opt =
|
|
57
|
-
opt = _marge_opt(opt, req.query_params)
|
|
55
|
+
opt = _marge_opt(opt_def, req.query_params)
|
|
58
56
|
opt['_stdin_body'] = await req.body()
|
|
59
57
|
else:
|
|
60
|
-
opt =
|
|
61
|
-
opt = _marge_opt(opt, req.query_params)
|
|
58
|
+
opt = _marge_opt(opt_def, req.query_params)
|
|
62
59
|
if 'mode' not in opt or 'cmd' not in opt:
|
|
63
60
|
raise HTTPException(status_code=404, detail='mode or cmd is not found.')
|
|
64
61
|
opt['capture_stdout'] = nothread = True
|
|
@@ -147,9 +144,10 @@ class ExecCmd(cmdbox_web_load_cmd.LoadCmd):
|
|
|
147
144
|
if 'port' in opt: opt['port'] = web.redis_port
|
|
148
145
|
if 'password' in opt: opt['password'] = web.redis_password
|
|
149
146
|
if 'svname' in opt: opt['svname'] = web.svname
|
|
150
|
-
if
|
|
151
|
-
if '
|
|
152
|
-
|
|
147
|
+
if not 'clmsg_id' in opt: # optに含まれる場合は処理しない
|
|
148
|
+
if req.session is not None and 'signin' in req.session and req.session['signin'] is not None:
|
|
149
|
+
if 'clmsg_id' in req.session['signin'] and req.session['signin']['clmsg_id'] is not None:
|
|
150
|
+
opt['clmsg_id'] = req.session['signin']['clmsg_id']
|
|
153
151
|
ap.sv = None
|
|
154
152
|
ap.cl = None
|
|
155
153
|
ap.web = None
|
|
@@ -25,7 +25,7 @@ class VersionsUsed(feature.WebFeature):
|
|
|
25
25
|
for i, line in enumerate(f.readlines()):
|
|
26
26
|
parts = line.strip().split('\t')
|
|
27
27
|
ret.append(parts)
|
|
28
|
-
with open(Path(cmdbox.__file__).parent / '
|
|
28
|
+
with open(Path(cmdbox.__file__).parent / 'web' / 'voicevox_license_list.txt', 'r', encoding='utf-8') as f:
|
|
29
29
|
for i, line in enumerate(f.readlines()):
|
|
30
30
|
parts = line.strip().split('\t')
|
|
31
31
|
ret.append(parts)
|
cmdbox/app/filer.py
CHANGED
|
@@ -206,13 +206,15 @@ class Filer(object):
|
|
|
206
206
|
try:
|
|
207
207
|
mime_type, encoding = mimetypes.guess_type(str(abspath))
|
|
208
208
|
fname = abspath.name
|
|
209
|
-
|
|
209
|
+
def _r(f):
|
|
210
210
|
fd = f.read()
|
|
211
211
|
if mime_type is not None and mime_type != 'image/svg+xml' and mime_type.startswith('image') and img_thumbnail > 0:
|
|
212
212
|
img = convert.imgbytes2thumbnail(fd, (img_thumbnail, img_thumbnail))
|
|
213
213
|
fd = convert.img2byte(img, "jpeg")
|
|
214
214
|
fname = f"{fname}.thumbnail.jpg"
|
|
215
215
|
data = convert.bytes2b64str(fd)
|
|
216
|
+
return data
|
|
217
|
+
data = common.load_file(abspath, _r, mode='rb')
|
|
216
218
|
return self.RESP_SUCCESS, dict(success=dict(name=fname, data=data, mime_type=mime_type))
|
|
217
219
|
except Exception as e:
|
|
218
220
|
self.logger.warning(f"Failed to download {abspath}. {e}")
|
|
@@ -252,8 +254,9 @@ class Filer(object):
|
|
|
252
254
|
try:
|
|
253
255
|
if mkdir:
|
|
254
256
|
save_path.parent.mkdir(parents=True, exist_ok=True)
|
|
255
|
-
|
|
257
|
+
def _w(f):
|
|
256
258
|
f.write(file_data)
|
|
259
|
+
common.save_file(Path(save_path), _w, mode='wb')
|
|
257
260
|
return self.RESP_SUCCESS, dict(success=f"Uploaded {save_path}")
|
|
258
261
|
except Exception as e:
|
|
259
262
|
self.logger.warning(f"Failed to upload {save_path}. {e}")
|