compshare-cli 0.4.0__py3-none-any.whl → 0.4.2__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.
- compshare_cli/__init__.py +1 -1
- compshare_cli/cli.py +0 -9
- compshare_cli/commands/minimax.py +3 -3
- compshare_cli/i18n.py +2 -13
- {compshare_cli-0.4.0.dist-info → compshare_cli-0.4.2.dist-info}/METADATA +1 -3
- {compshare_cli-0.4.0.dist-info → compshare_cli-0.4.2.dist-info}/RECORD +10 -12
- compshare_cli/commands/ask.py +0 -31
- compshare_cli/qa.py +0 -51
- {compshare_cli-0.4.0.dist-info → compshare_cli-0.4.2.dist-info}/WHEEL +0 -0
- {compshare_cli-0.4.0.dist-info → compshare_cli-0.4.2.dist-info}/entry_points.txt +0 -0
- {compshare_cli-0.4.0.dist-info → compshare_cli-0.4.2.dist-info}/licenses/LICENSE +0 -0
- {compshare_cli-0.4.0.dist-info → compshare_cli-0.4.2.dist-info}/top_level.txt +0 -0
compshare_cli/__init__.py
CHANGED
compshare_cli/cli.py
CHANGED
|
@@ -10,7 +10,6 @@ from typer.completion import completion_init, install_callback
|
|
|
10
10
|
from typer.main import get_command
|
|
11
11
|
|
|
12
12
|
from compshare_cli import __version__
|
|
13
|
-
from compshare_cli.commands import ask as ask_command
|
|
14
13
|
from compshare_cli.commands import bandwidth, image, instance, minimax, storage, team
|
|
15
14
|
from compshare_cli.commands import doctor as doctor_command
|
|
16
15
|
from compshare_cli.commands import feedback as feedback_command
|
|
@@ -308,14 +307,6 @@ def doctor(ctx: typer.Context) -> None:
|
|
|
308
307
|
doctor_command.run(ctx.find_root().obj)
|
|
309
308
|
|
|
310
309
|
|
|
311
|
-
@app.command("ask", help="Ask a CompShare product question.")
|
|
312
|
-
def ask(
|
|
313
|
-
ctx: typer.Context,
|
|
314
|
-
question: str = typer.Argument(..., help="Question to answer."),
|
|
315
|
-
) -> None:
|
|
316
|
-
ask_command.run(ctx.find_root().obj, question)
|
|
317
|
-
|
|
318
|
-
|
|
319
310
|
@app.command("feedback")
|
|
320
311
|
def feedback(
|
|
321
312
|
ctx: typer.Context,
|
|
@@ -179,8 +179,8 @@ def _content(
|
|
|
179
179
|
text = prompt.strip()
|
|
180
180
|
if not text:
|
|
181
181
|
raise UsageError(tr("Prompt cannot be empty."))
|
|
182
|
-
if len(text) >
|
|
183
|
-
raise UsageError(tr("Prompt cannot exceed
|
|
182
|
+
if len(text) > 7000:
|
|
183
|
+
raise UsageError(tr("Prompt cannot exceed 7000 characters."))
|
|
184
184
|
if last_frame and not first_frame:
|
|
185
185
|
raise UsageError(tr("--last-frame requires --first-frame."))
|
|
186
186
|
if (first_frame or last_frame) and (reference_images or reference_videos or reference_audio):
|
|
@@ -234,7 +234,7 @@ def _task_path(task_id: str, *, query: bool) -> str:
|
|
|
234
234
|
@app.command("create", help="Create a MiniMax H3 video task.")
|
|
235
235
|
def create(
|
|
236
236
|
ctx: typer.Context,
|
|
237
|
-
prompt: str = typer.Argument(..., help="Video prompt; at most
|
|
237
|
+
prompt: str = typer.Argument(..., help="Video prompt; at most 7000 characters."),
|
|
238
238
|
resolution: str = typer.Option("768P", help="Output resolution: 768P, 1080P, or 2K."),
|
|
239
239
|
duration: int = typer.Option(5, min=4, max=15, help="Video duration in seconds (4-15)."),
|
|
240
240
|
ratio: str = typer.Option("16:9", help="Output ratio or adaptive for media input."),
|
compshare_cli/i18n.py
CHANGED
|
@@ -34,8 +34,6 @@ ZH_TRANSLATIONS: Dict[str, str] = {
|
|
|
34
34
|
"Save a CompShare API credential profile.": "保存优云智算 API 凭证配置。",
|
|
35
35
|
"Print the CLI version.": "显示 CLI 版本。",
|
|
36
36
|
"Print the CLI version and exit.": "显示 CLI 版本并退出。",
|
|
37
|
-
"Ask a CompShare product question.": "询问优云智算产品问题。",
|
|
38
|
-
"Question to answer.": "需要回答的问题。",
|
|
39
37
|
"Manage GPU instances.": "管理 GPU 实例。",
|
|
40
38
|
"Manage dedicated bandwidth.": "管理独享带宽。",
|
|
41
39
|
"List dedicated bandwidth resources.": "列出独享带宽资源。",
|
|
@@ -79,7 +77,7 @@ ZH_TRANSLATIONS: Dict[str, str] = {
|
|
|
79
77
|
"List MiniMax H3 point packages.": "列出 MiniMax H3 积分套餐包。",
|
|
80
78
|
"Show the MiniMax H3 point balance.": "查看 MiniMax H3 积分余额。",
|
|
81
79
|
"Cancel an unfinished MiniMax H3 video task.": "取消尚未结束的 MiniMax H3 视频任务。",
|
|
82
|
-
"Video prompt; at most
|
|
80
|
+
"Video prompt; at most 7000 characters.": "视频提示词,最多 7000 个字符。",
|
|
83
81
|
"Output resolution: 768P, 1080P, or 2K.": "输出分辨率:768P、1080P 或 2K。",
|
|
84
82
|
"Video duration in seconds (4-15).": "视频时长秒数(4–15)。",
|
|
85
83
|
"Output ratio or adaptive for media input.": "输出宽高比;素材输入可使用 adaptive。",
|
|
@@ -109,7 +107,7 @@ ZH_TRANSLATIONS: Dict[str, str] = {
|
|
|
109
107
|
"MiniMax H3 API returned an invalid response.": "MiniMax H3 API 返回了无效响应。",
|
|
110
108
|
"MiniMax H3 API rejected the request.": "MiniMax H3 API 拒绝了请求。",
|
|
111
109
|
"Prompt cannot be empty.": "提示词不能为空。",
|
|
112
|
-
"Prompt cannot exceed
|
|
110
|
+
"Prompt cannot exceed 7000 characters.": "提示词不能超过 7000 个字符。",
|
|
113
111
|
"--last-frame requires --first-frame.": "--last-frame 需要同时指定 --first-frame。",
|
|
114
112
|
"Frame inputs cannot be combined with reference inputs.": (
|
|
115
113
|
"首尾帧素材不能与参考图片、视频或音频混用。"
|
|
@@ -432,9 +430,6 @@ ZH_TRANSLATIONS: Dict[str, str] = {
|
|
|
432
430
|
),
|
|
433
431
|
"Operation submitted": "操作已提交",
|
|
434
432
|
"Operation completed": "操作已完成",
|
|
435
|
-
"Answer": "回答",
|
|
436
|
-
"ANSWER": "答案",
|
|
437
|
-
"SOURCES": "来源",
|
|
438
433
|
"No selectable options": "没有可选项",
|
|
439
434
|
"Automatically selected the only option.": "已自动选择唯一选项。",
|
|
440
435
|
"Please enter a number from 1 to {count}.": "请输入 1 到 {count} 之间的数字。",
|
|
@@ -840,12 +835,6 @@ ZH_TRANSLATIONS: Dict[str, str] = {
|
|
|
840
835
|
"Unable to reach the insights service.": "无法连接数据服务。",
|
|
841
836
|
"Insights service returned an invalid response.": "数据服务返回了无效响应。",
|
|
842
837
|
"Thank you for your feedback.": "感谢反馈。",
|
|
843
|
-
"Question cannot be empty.": "问题不能为空。",
|
|
844
|
-
"Question service rejected the request with HTTP {status}.": (
|
|
845
|
-
"问答服务拒绝了请求,HTTP 状态码为 {status}。"
|
|
846
|
-
),
|
|
847
|
-
"Unable to reach the question service.": "无法连接问答服务。",
|
|
848
|
-
"Question service returned an invalid response.": "问答服务返回了无效响应。",
|
|
849
838
|
"Team ID.": "团队 ID。",
|
|
850
839
|
"Team name.": "团队名称。",
|
|
851
840
|
"Team description.": "团队简介。",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: compshare-cli
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.2
|
|
4
4
|
Summary: Command-line client for CompShare GPU compute and MiniMax H3
|
|
5
5
|
Author: CompShare
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -34,7 +34,6 @@ Dynamic: license-file
|
|
|
34
34
|
- 支持独享带宽询价、购买、改配、退款预估及实例 EIP 切换
|
|
35
35
|
- 支持创建、查询和取消 MiniMax H3 视频任务,并查看积分套餐包与余额
|
|
36
36
|
- 默认中文帮助,可切换英文;所有命令支持 JSON 输出
|
|
37
|
-
- 可通过 `compshare ask` 查询产品使用和计费知识
|
|
38
37
|
- 可通过 `compshare feedback` 反馈 CLI 问题和建议
|
|
39
38
|
|
|
40
39
|
## 安装
|
|
@@ -98,7 +97,6 @@ compshare instance -h
|
|
|
98
97
|
compshare config API 凭证配置
|
|
99
98
|
compshare feedback 反馈 CLI 问题或建议
|
|
100
99
|
compshare doctor 配置、鉴权、网络与 SSH 环境诊断
|
|
101
|
-
compshare ask 产品使用和计费问答
|
|
102
100
|
compshare instance GPU 实例、规格、库存、价格和生命周期
|
|
103
101
|
compshare image 平台、自定义、社区及共享镜像
|
|
104
102
|
compshare storage 云盘和 US3 挂载
|
|
@@ -1,36 +1,34 @@
|
|
|
1
|
-
compshare_cli/__init__.py,sha256=
|
|
1
|
+
compshare_cli/__init__.py,sha256=VZIRJRd49-CIFBBBhLm0A6nY_FqPmP-Wr_bmtxyNa-E,60
|
|
2
2
|
compshare_cli/__main__.py,sha256=ftkB0R9jLZejzr717131qktgfFhTe12noFeGqQsVZMc,74
|
|
3
3
|
compshare_cli/actions.py,sha256=DWIXXrUHru_mT6DNnrV5VhkfRhgyBGsu73uQk-7o8Mc,3633
|
|
4
4
|
compshare_cli/api.py,sha256=S4hUvkbG0l7qUqQaAf7trX29GteF1yVnOGgjcJj99jc,9286
|
|
5
|
-
compshare_cli/cli.py,sha256=
|
|
5
|
+
compshare_cli/cli.py,sha256=eBb7_Y9Q8IoTAUCDu1hj0nrqmHxGD7mz1apqgQk3MVg,19639
|
|
6
6
|
compshare_cli/config.py,sha256=xzcP4dvZEclEAaQHsB0ybF7jnxKC9cY_EbWQl0w7TO4,7529
|
|
7
7
|
compshare_cli/errors.py,sha256=ZVVxqJnmaBFfV4k-Q7wuLvxA83iQhmFZ_Bx5w6o9EN4,262
|
|
8
|
-
compshare_cli/i18n.py,sha256=
|
|
8
|
+
compshare_cli/i18n.py,sha256=fEVoRRANTab7LavQvFtH-qd3J1_4MyL5K_zdmgG2hPA,57859
|
|
9
9
|
compshare_cli/insights.py,sha256=0ouShkU_8_XusQG8JttfZBW-cG6GD9YBpB_AbPS5tnU,4819
|
|
10
10
|
compshare_cli/instance_templates.py,sha256=UGDxQ5IChId4hTTDByKEVk594qswMj1r6LIuU9Qty7A,7894
|
|
11
11
|
compshare_cli/location.py,sha256=17hE_AGU3yKYEA5v-5W6HEU61l4K1JZDdgCpbGIM2KE,4324
|
|
12
12
|
compshare_cli/output.py,sha256=uvmmN3yT6jHkfMEo_GmzQTX8qMF2HHgcJ4aEKZcBBps,12525
|
|
13
13
|
compshare_cli/parsing.py,sha256=pn4W_lZY2FBhdUjHUDFAHvA_kgcc1ch6D-7uOfJZ68E,4578
|
|
14
|
-
compshare_cli/qa.py,sha256=_-irCMnpg5Qsm_BxivrWYpiNp94IxdjwDxshLa26GOc,1710
|
|
15
14
|
compshare_cli/remote_jobs.py,sha256=soAPdpJLCG5Hus-ciqQ0f0vYm-4hgl_thz62RWR1wSA,18808
|
|
16
15
|
compshare_cli/runtime.py,sha256=RQ6KRfj814Sx5mPxmXVWs_wOoNqnQI7UbBDJNt4qvo0,508
|
|
17
16
|
compshare_cli/sdk.py,sha256=-E10iHykUx0DKbNksZ6hRaFfegV93bk5yU4nsL0WTsw,2937
|
|
18
17
|
compshare_cli/ssh.py,sha256=L9RDjPu2ZXQ6IYNG2XlHkxk6NHDS_q-k4HUTSGAn574,13020
|
|
19
18
|
compshare_cli/ssh_cache.py,sha256=SrH-47kOM8pYBuueSAflscjFyfrUNaODs5Khn3Av9Cg,7148
|
|
20
19
|
compshare_cli/commands/__init__.py,sha256=Rb-d2e6JpWZ5pPUP-TjKMWGtNCwpZCMYc0GulfEXbRs,26
|
|
21
|
-
compshare_cli/commands/ask.py,sha256=thlaiDfSCeqDBcowwB7ZtB40mGzLKHM2y9F4m2WeRwY,934
|
|
22
20
|
compshare_cli/commands/bandwidth.py,sha256=4rOxbWht1cv1Gw-F-AG_yblp9sDTM0dnRUkkHnkJ1Ps,15502
|
|
23
21
|
compshare_cli/commands/common.py,sha256=BNjn4lunbHMjvo5TsLghR6e9ZYuW1xpGvzrg9C_sqmA,2359
|
|
24
22
|
compshare_cli/commands/doctor.py,sha256=JgX9Lg-wvIAql8KkyKKMh51BUyNxqK5ZGlgmBONj1q8,4564
|
|
25
23
|
compshare_cli/commands/feedback.py,sha256=wSoIq-1z_mkRr7w4h_jfWQf492aEyZCUvZcJs2lvNJM,575
|
|
26
24
|
compshare_cli/commands/image.py,sha256=e-3_9FVPOxAyRK-ZLW7L4FSWFUyiM7KyZyPAdABY4ik,22735
|
|
27
25
|
compshare_cli/commands/instance.py,sha256=ELAfNGpijeQmDozpYZgU-ZLMqnAtS01pjG-l5uklZZA,109625
|
|
28
|
-
compshare_cli/commands/minimax.py,sha256=
|
|
26
|
+
compshare_cli/commands/minimax.py,sha256=pbhCLARyMyaIdOGhJ4y47hotWXVTozWv9kQn3Ve8aPw,15364
|
|
29
27
|
compshare_cli/commands/storage.py,sha256=eUmX2KWx-aYr3ea6GVHVjffq0-58cjsEzINxLOrspyI,8975
|
|
30
28
|
compshare_cli/commands/team.py,sha256=weVCgFPOoDDl03LWmVGhXNR0BPkUvyOUwUHlxUOWyKY,23651
|
|
31
|
-
compshare_cli-0.4.
|
|
32
|
-
compshare_cli-0.4.
|
|
33
|
-
compshare_cli-0.4.
|
|
34
|
-
compshare_cli-0.4.
|
|
35
|
-
compshare_cli-0.4.
|
|
36
|
-
compshare_cli-0.4.
|
|
29
|
+
compshare_cli-0.4.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
30
|
+
compshare_cli-0.4.2.dist-info/METADATA,sha256=5BnJfbs3QXkWFUBU8xDF3FTchkt3h-0G_x_u8NlXp70,4054
|
|
31
|
+
compshare_cli-0.4.2.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
32
|
+
compshare_cli-0.4.2.dist-info/entry_points.txt,sha256=mjknQ1CnmPldcwIlJJZxM-9HJMOVCy8VfDUnovUNW8U,103
|
|
33
|
+
compshare_cli-0.4.2.dist-info/top_level.txt,sha256=ROBw509DOLNt7Z-xwrArjK066G7s4IH0jTcGiaKyMNw,14
|
|
34
|
+
compshare_cli-0.4.2.dist-info/RECORD,,
|
compshare_cli/commands/ask.py
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from typing import Any, Dict, List
|
|
4
|
-
|
|
5
|
-
from compshare_cli.output import Renderer
|
|
6
|
-
from compshare_cli.qa import ask_question
|
|
7
|
-
from compshare_cli.runtime import Runtime
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def _source_lines(response: Dict[str, Any]) -> str:
|
|
11
|
-
lines: List[str] = []
|
|
12
|
-
for index, raw in enumerate(response.get("citations") or [], start=1):
|
|
13
|
-
if not isinstance(raw, dict):
|
|
14
|
-
continue
|
|
15
|
-
number = raw.get("number") or index
|
|
16
|
-
title = raw.get("title") or raw.get("document_id")
|
|
17
|
-
if title:
|
|
18
|
-
lines.append(f"[{number}] {title}")
|
|
19
|
-
return "\n".join(lines)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def run(state: Runtime, question: str) -> None:
|
|
23
|
-
response = ask_question(question)
|
|
24
|
-
Renderer(state.json_output, state.show_sensitive).details(
|
|
25
|
-
"Answer",
|
|
26
|
-
[
|
|
27
|
-
("ANSWER", response["answer"]),
|
|
28
|
-
("SOURCES", _source_lines(response) or None),
|
|
29
|
-
],
|
|
30
|
-
response=response,
|
|
31
|
-
)
|
compshare_cli/qa.py
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import json
|
|
4
|
-
from typing import Any, Dict
|
|
5
|
-
from urllib import error as urlerror
|
|
6
|
-
from urllib import request
|
|
7
|
-
|
|
8
|
-
from compshare_cli import __version__
|
|
9
|
-
from compshare_cli.errors import CLIError
|
|
10
|
-
from compshare_cli.i18n import tr
|
|
11
|
-
|
|
12
|
-
ANSWER_URL = "http://117.50.180.139:55089/v1/answer"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def ask_question(question: str) -> Dict[str, Any]:
|
|
16
|
-
normalized = question.strip()
|
|
17
|
-
if not normalized:
|
|
18
|
-
raise CLIError(tr("Question cannot be empty."))
|
|
19
|
-
|
|
20
|
-
body = json.dumps(
|
|
21
|
-
{"question": normalized},
|
|
22
|
-
ensure_ascii=False,
|
|
23
|
-
separators=(",", ":"),
|
|
24
|
-
).encode("utf-8")
|
|
25
|
-
req = request.Request(
|
|
26
|
-
ANSWER_URL,
|
|
27
|
-
data=body,
|
|
28
|
-
headers={
|
|
29
|
-
"Accept": "application/json",
|
|
30
|
-
"Content-Type": "application/json",
|
|
31
|
-
"User-Agent": f"compshare-cli/{__version__}",
|
|
32
|
-
},
|
|
33
|
-
method="POST",
|
|
34
|
-
)
|
|
35
|
-
try:
|
|
36
|
-
with request.urlopen(req, timeout=60.0) as response:
|
|
37
|
-
content = response.read()
|
|
38
|
-
except urlerror.HTTPError as error:
|
|
39
|
-
raise CLIError(
|
|
40
|
-
tr("Question service rejected the request with HTTP {status}.", status=error.code)
|
|
41
|
-
) from error
|
|
42
|
-
except (urlerror.URLError, TimeoutError, OSError) as error:
|
|
43
|
-
raise CLIError(tr("Unable to reach the question service.")) from error
|
|
44
|
-
|
|
45
|
-
try:
|
|
46
|
-
result = json.loads(content.decode("utf-8"))
|
|
47
|
-
except (UnicodeDecodeError, json.JSONDecodeError) as error:
|
|
48
|
-
raise CLIError(tr("Question service returned an invalid response.")) from error
|
|
49
|
-
if not isinstance(result, dict) or not isinstance(result.get("answer"), str):
|
|
50
|
-
raise CLIError(tr("Question service returned an invalid response."))
|
|
51
|
-
return result
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|