@pippit-dev/cli 1.0.1 → 1.0.3
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.
- package/README.md +33 -3
- package/checksums.txt +6 -6
- package/cmd/download_result.go +1 -1
- package/cmd/generate_video/generate_video.go +48 -0
- package/cmd/generate_video/query_result.go +42 -0
- package/cmd/generate_video_test.go +542 -0
- package/cmd/get_thread.go +1 -0
- package/cmd/list_thread_file.go +1 -1
- package/cmd/root.go +27 -2
- package/cmd/short_drama/short_drama.go +52 -9
- package/cmd/short_drama_test.go +19 -19
- package/cmd/update/update.go +8 -8
- package/internal/common/client.go +29 -21
- package/internal/common/download_results.go +20 -14
- package/internal/common/error_log.go +62 -1
- package/internal/common/error_log_test.go +30 -0
- package/internal/common/get_thread.go +28 -14
- package/internal/common/get_thread_test.go +74 -0
- package/{cmd → internal/common}/json.go +3 -2
- package/internal/common/list_thread_file.go +6 -6
- package/internal/common/submit_run.go +29 -0
- package/internal/common/upload_file.go +23 -19
- package/internal/config/config.go +1 -1
- package/internal/generate_video/generate_video.go +199 -0
- package/internal/generate_video/query_result.go +344 -0
- package/internal/generate_video/query_result_test.go +31 -0
- package/internal/short_drama/submit_run.go +8 -28
- package/package.json +1 -1
- package/skills/short-drama/SKILL.md +8 -8
- package/skills/xyq-nest-skill/scripts/download_results.py +3 -1
- package/skills/xyq-nest-skill/scripts/upload_file.py +2 -2
- package/skills/xyq-nest-skill/scripts/xyq_common.py +4 -3
- package/cmd/upload_file.go +0 -50
package/README.md
CHANGED
|
@@ -196,7 +196,7 @@ npx @pippit-dev/cli@latest install
|
|
|
196
196
|
export XYQ_ACCESS_KEY="<access-key>"
|
|
197
197
|
pippit-tool-cli --version
|
|
198
198
|
pippit-tool-cli short-drama +submit-run --message "写一个赛博朋克短剧开头"
|
|
199
|
-
pippit-tool-cli upload-file --path ./reference.doc
|
|
199
|
+
pippit-tool-cli short-drama +upload-file --path ./reference.doc
|
|
200
200
|
pippit-tool-cli get-thread --thread-id thread_123 --run-id run_456
|
|
201
201
|
pippit-tool-cli list-thread-file --thread-id thread_123 --page-num 1 --page-size 200
|
|
202
202
|
pippit-tool-cli download-result --output-path ./thread_123/results/result.mp4 --url URL --updated-at 1779716734
|
|
@@ -205,15 +205,45 @@ pippit-tool-cli download-result --output-path ./thread_123/results/result.mp4 --
|
|
|
205
205
|
`+submit-run`: 输出 `thread_id`、`run_id` 和 `web_thread_link`;其中 `--message` 为必填参数。
|
|
206
206
|
`get-thread`: 请求中带 `version=v2`,并输出 `readable_text`。
|
|
207
207
|
`list-thread-file`: 输出会话文件列表、分页提示和可直接传给下载命令的 `file_path`。
|
|
208
|
-
|
|
208
|
+
`+upload-file`: 输出返回的 `asset_id`。 当前仅支持 `.doc`、`.docx` 和 `.txt` 文件。
|
|
209
209
|
`download-result`: 会把结果 URL 下载到 `--output-path` 指定的文件路径;传入 `--updated-at` 后,如果本地文件早于该时间戳会覆盖更新,否则跳过。
|
|
210
210
|
|
|
211
211
|
短剧命令的错误日志会追加写入本地每日日志文件:`~/.pippit_tool_cli/logs/yyyy-mm-dd.log`。日志路径会基于当前用户主目录和系统路径分隔符生成,因此可在 macOS、Linux 和 Windows 上使用。
|
|
212
212
|
|
|
213
|
+
## 生视频 CLI
|
|
214
|
+
|
|
215
|
+
`generate-video` 会上传本地参考图片和视频,然后向视频片段 Agent 提交生视频请求:
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
pippit-tool-cli generate-video \
|
|
219
|
+
--prompt "做个小猫视频" \
|
|
220
|
+
--image "~/images/cat1.jpg" \
|
|
221
|
+
--image "~/images/cat2.jpg" \
|
|
222
|
+
--video "~/images/video1.mp4" \
|
|
223
|
+
--video "~/images/video2.mp4" \
|
|
224
|
+
--duration 5 \
|
|
225
|
+
--ratio "9:16" \
|
|
226
|
+
--model "seedance2.0_direct" \
|
|
227
|
+
--resolution "720p"
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
命令输出 `thread_id`、`run_id` 和 `web_thread_link`。提交生视频 HTTP 请求时,参考图和参考视频会使用上传接口返回的 `pippit_asset_id`。图片最多 9 张,支持 `.jpg`、`.jpeg`、`.png`、`.gif`、`.bmp`、`.webp`、`.svg`;视频最多 3 个,支持 `.mp4`、`.avi`、`.mov`、`.wmv`、`.flv`、`.webm`、`.mkv`、`.m4v`。普通用户支持模型 `seedance2.0_direct` 和 `seedance2.0_fast_direct`;VIP 用户额外支持 `seedance2.0_vision` 和 `seedance2.0_fast_vision`。模型、比例、分辨率、素材数量等参数的语义校验当前预留在后续实现。
|
|
231
|
+
|
|
232
|
+
查询并下载生视频结果:
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
pippit-tool-cli query-result \
|
|
236
|
+
--thread-id "skill_xxx" \
|
|
237
|
+
--run-id "skill_xxx" \
|
|
238
|
+
--download-dir "./output"
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
`query-result` 会查询指定 Run 并输出 JSON。Run 成功完成后下载视频产物,`completed=true`,`videos` 中只包含 `download_url` 和 `output_path`;Run 失败也视为终态,`completed=true` 且填充 `error_message`;Run 未到终态时 `completed=false`。
|
|
242
|
+
|
|
213
243
|
## HTTP 客户端
|
|
214
244
|
|
|
215
245
|
命令模块通过 `common.Runner` 发起服务调用。运行时配置,例如基础地址、HTTP 超时时间和接口路径,由 `internal/config` 加载,并在运行器中与 `common.Client` 组合使用。
|
|
216
246
|
|
|
217
247
|
## 鉴权
|
|
218
248
|
|
|
219
|
-
`short-drama +submit-run`、`get-thread`、`list-thread-file`、`upload-file` 以及 `xyq-skill` Python 脚本都使用 `Authorization: Bearer <XYQ_ACCESS_KEY>` 鉴权。OAuth 命令代码仍保留在仓库中,但短剧运行时请求不使用 OAuth。
|
|
249
|
+
`short-drama +submit-run`、`get-thread`、`list-thread-file`、`short-drama +upload-file` 以及 `xyq-skill` Python 脚本都使用 `Authorization: Bearer <XYQ_ACCESS_KEY>` 鉴权。OAuth 命令代码仍保留在仓库中,但短剧运行时请求不使用 OAuth。
|
package/checksums.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
e344cebed19cb97f0aef66df54118cb7425714d614f2488c1072ff72d24d91cf pippit-tool-cli-1.0.3-darwin-amd64.tar.gz
|
|
2
|
+
a1a516570d4553ef0514442f938da11f0147ad524c9fa7fb078a1ab5d1d0e27d pippit-tool-cli-1.0.3-darwin-arm64.tar.gz
|
|
3
|
+
b7840c3b3d6cab08d74de8af15a88f09e9bc5f7c98cc14f7d80487edad505bfe pippit-tool-cli-1.0.3-linux-amd64.tar.gz
|
|
4
|
+
9ef478103cf1e04d825da9a9e1065e76fec6e8e79407fa4543c8010c54ca1bb6 pippit-tool-cli-1.0.3-linux-arm64.tar.gz
|
|
5
|
+
f691764e9d5be6fe2d05b2039318458bb1c5763c5e17060389ba39d2b358f2b6 pippit-tool-cli-1.0.3-windows-amd64.zip
|
|
6
|
+
58899eafda91b4d1c9768d3aaa8d1d04279b7f7f7c2a18541a9873da33882960 pippit-tool-cli-1.0.3-windows-arm64.zip
|
package/cmd/download_result.go
CHANGED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
package generate_video
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"io"
|
|
5
|
+
"strconv"
|
|
6
|
+
|
|
7
|
+
"github.com/Pippit-dev/pippit-cli/internal/common"
|
|
8
|
+
internalgen "github.com/Pippit-dev/pippit-cli/internal/generate_video"
|
|
9
|
+
"github.com/spf13/cobra"
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
// NewCommand builds the generate-video command.
|
|
13
|
+
func NewCommand(stdout, stderr io.Writer, runner *common.Runner) *cobra.Command {
|
|
14
|
+
opts := &internalgen.Options{}
|
|
15
|
+
var durationSec int
|
|
16
|
+
|
|
17
|
+
cmd := &cobra.Command{
|
|
18
|
+
Use: "generate-video",
|
|
19
|
+
Short: "Generate a video with the video part agent",
|
|
20
|
+
Args: cobra.NoArgs,
|
|
21
|
+
RunE: func(cmd *cobra.Command, args []string) error {
|
|
22
|
+
if cmd.Flags().Changed("duration") {
|
|
23
|
+
opts.DurationSec = &durationSec
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
result, err := internalgen.Run(cmd.Context(), opts, runner)
|
|
27
|
+
if err != nil {
|
|
28
|
+
_ = common.AppendDailyErrorLog("generate-video", err, map[string]string{
|
|
29
|
+
"image_count": strconv.Itoa(len(opts.ImagePaths)),
|
|
30
|
+
"video_count": strconv.Itoa(len(opts.VideoPaths)),
|
|
31
|
+
})
|
|
32
|
+
return err
|
|
33
|
+
}
|
|
34
|
+
return common.WriteJSON(stdout, result)
|
|
35
|
+
},
|
|
36
|
+
}
|
|
37
|
+
cmd.SetOut(stdout)
|
|
38
|
+
cmd.SetErr(stderr)
|
|
39
|
+
flags := cmd.Flags()
|
|
40
|
+
flags.StringVar(&opts.Prompt, "prompt", "", "video generation prompt")
|
|
41
|
+
flags.StringArrayVar(&opts.ImagePaths, "image", nil, "local reference image path; repeat for multiple images, up to 9")
|
|
42
|
+
flags.StringArrayVar(&opts.VideoPaths, "video", nil, "local reference video path; repeat for multiple videos, up to 3")
|
|
43
|
+
flags.IntVar(&durationSec, "duration", 0, "video duration in seconds")
|
|
44
|
+
flags.StringVar(&opts.Ratio, "ratio", "", "video ratio, such as 9:16, 16:9, 3:4, 4:3")
|
|
45
|
+
flags.StringVar(&opts.Model, "model", "", "video model; normal users: seedance2.0_direct, seedance2.0_fast_direct; VIP users: seedance2.0_direct, seedance2.0_fast_direct, seedance2.0_vision, seedance2.0_fast_vision")
|
|
46
|
+
flags.StringVar(&opts.Resolution, "resolution", "", "video resolution, such as 720p, 1080p")
|
|
47
|
+
return cmd
|
|
48
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
package generate_video
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"encoding/json"
|
|
5
|
+
"io"
|
|
6
|
+
"strings"
|
|
7
|
+
|
|
8
|
+
"github.com/Pippit-dev/pippit-cli/internal/common"
|
|
9
|
+
internalgen "github.com/Pippit-dev/pippit-cli/internal/generate_video"
|
|
10
|
+
"github.com/spf13/cobra"
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
// NewQueryResultCommand builds the query-result command.
|
|
14
|
+
func NewQueryResultCommand(stdout, stderr io.Writer, runner *common.Runner) *cobra.Command {
|
|
15
|
+
opts := &internalgen.QueryResultOptions{}
|
|
16
|
+
|
|
17
|
+
cmd := &cobra.Command{
|
|
18
|
+
Use: "query-result",
|
|
19
|
+
Short: "Query a generate-video run result and download completed videos",
|
|
20
|
+
Args: cobra.NoArgs,
|
|
21
|
+
RunE: func(cmd *cobra.Command, _ []string) error {
|
|
22
|
+
result, err := internalgen.QueryResult(cmd.Context(), opts, runner)
|
|
23
|
+
if err != nil {
|
|
24
|
+
_ = common.AppendDailyErrorLog("query-result", err, map[string]string{
|
|
25
|
+
"thread_id": strings.TrimSpace(opts.ThreadID),
|
|
26
|
+
"run_id": strings.TrimSpace(opts.RunID),
|
|
27
|
+
"download_dir": strings.TrimSpace(opts.DownloadDir),
|
|
28
|
+
})
|
|
29
|
+
return err
|
|
30
|
+
}
|
|
31
|
+
encoder := json.NewEncoder(stdout)
|
|
32
|
+
encoder.SetIndent("", " ")
|
|
33
|
+
return encoder.Encode(result)
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
cmd.SetOut(stdout)
|
|
37
|
+
cmd.SetErr(stderr)
|
|
38
|
+
cmd.Flags().StringVar(&opts.ThreadID, "thread-id", "", "thread_id from generate-video output")
|
|
39
|
+
cmd.Flags().StringVar(&opts.RunID, "run-id", "", "run_id from generate-video output")
|
|
40
|
+
cmd.Flags().StringVar(&opts.DownloadDir, "download-dir", "", "directory to download completed videos into")
|
|
41
|
+
return cmd
|
|
42
|
+
}
|