@9000ai/cli 0.3.0 → 0.5.0
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/dist/client.d.ts +10 -1
- package/dist/client.js +111 -2
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.js +83 -0
- package/dist/commands/monitor.js +27 -4
- package/dist/commands/search.js +33 -5
- package/dist/commands/task.js +6 -2
- package/dist/commands/transcribe.js +19 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -1
- package/dist/postinstall.js +6 -1
- package/package.json +2 -2
- package/skills/9000AI-hub/SKILL.md +76 -148
- package/skills/9000AI-hub/references/usage-guidelines.md +75 -0
- package/skills/douyin-monitor/SKILL.md +54 -1
- package/skills/douyin-topic-discovery/SKILL.md +42 -0
- package/skills/video-transcription/SKILL.md +37 -0
- package/skills/9000AI-hub/configure.py +0 -56
- package/skills/9000AI-hub/init/SKILL.md +0 -130
- package/skills/9000AI-hub/init/templates/CLAUDE.md +0 -24
- package/skills/9000AI-hub/shared/__init__.py +0 -1
- package/skills/9000AI-hub/shared/runner.py +0 -135
- package/skills/douyin-monitor/agents/openai.yaml +0 -3
- package/skills/douyin-monitor/scripts/douyin_monitor_api.py +0 -273
- package/skills/douyin-topic-discovery/agents/openai.yaml +0 -3
- package/skills/douyin-topic-discovery/scripts/douyin_topic_discovery_api.py +0 -497
- package/skills/feedback/scripts/feedback_api.py +0 -93
- package/skills/video-transcription/agents/openai.yaml +0 -3
- package/skills/video-transcription/scripts/video_transcription_api.py +0 -183
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: 9000AI-hub
|
|
3
|
-
description: 9000AI
|
|
2
|
+
name: 9000AI-hub
|
|
3
|
+
description: 9000AI 中台总入口。识别用户意图,路由到对应模块。首次使用时引导初始化。
|
|
4
4
|
triggers:
|
|
5
5
|
- /9000AI
|
|
6
6
|
- /9000AI中台
|
|
7
|
-
-
|
|
7
|
+
- /content-init
|
|
8
|
+
- /初始化工作空间
|
|
9
|
+
- 初始化
|
|
10
|
+
- 第一次用
|
|
8
11
|
role: router
|
|
9
12
|
scope: routing
|
|
10
13
|
output-format: routing-only
|
|
@@ -12,184 +15,109 @@ output-format: routing-only
|
|
|
12
15
|
|
|
13
16
|
# 9000AI 中台
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
9000AI 是一个内容创作者中台。它把抖音热榜、关键词搜索、主页监控、视频转写这些能力整合在一起,通过 `9000ai` CLI 统一调用,后端异步执行。
|
|
16
19
|
|
|
17
|
-
|
|
18
|
-
你的职责不是直接执行业务,而是:
|
|
19
|
-
1. 识别用户当前属于哪个模块
|
|
20
|
-
2. 告诉系统应该进入哪个 skill
|
|
21
|
-
3. 在必要时提示下一步怎么继续
|
|
20
|
+
你作为 AI 助手,通过这个中台帮用户完成选题发现、竞品分析、素材采集等内容创作工作流。中台只是工具层——你负责理解用户意图、编排调用、输出结果。
|
|
22
21
|
|
|
23
|
-
|
|
22
|
+
## 调用原则
|
|
24
23
|
|
|
25
|
-
|
|
24
|
+
1. **无依赖的操作必须并行。** 热榜+搜索、多个关键词——没有数据依赖就同时发出
|
|
25
|
+
2. **异步任务用 `--wait`。** 搜索和转写加 `--wait`,一条命令拿到最终结果
|
|
26
|
+
3. **有依赖的操作串行。** 上一步输出是下一步输入时,必须等
|
|
27
|
+
4. **用 `--fields` 只取需要的字段。** 永远不要全量读取
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
```bash
|
|
30
|
+
# 单任务
|
|
31
|
+
9000ai search keyword "美食探店" --wait --fields desc,likes,author_name
|
|
32
|
+
|
|
33
|
+
# 多数据源并行
|
|
34
|
+
并行 {
|
|
35
|
+
9000ai search hot
|
|
36
|
+
9000ai search keyword "关键词A" --wait --fields desc,likes,author_name
|
|
37
|
+
9000ai search keyword "关键词B" --wait --fields desc,likes,author_name
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
# 有依赖,串行
|
|
41
|
+
9000ai search keyword "xxx" --wait --fields desc,video_url,likes
|
|
42
|
+
→ 拿 video_url → 9000ai transcribe submit --json-file ... --wait
|
|
43
|
+
```
|
|
32
44
|
|
|
33
|
-
##
|
|
45
|
+
## 模块目录
|
|
34
46
|
|
|
35
|
-
###
|
|
47
|
+
### 抖音选题发现
|
|
48
|
+
- 命令: `9000ai search`
|
|
49
|
+
- 场景: 热榜、关键词搜索、候选视频发现
|
|
36
50
|
|
|
37
|
-
|
|
38
|
-
|
|
51
|
+
### 抖音主页监控
|
|
52
|
+
- 命令: `9000ai monitor`
|
|
53
|
+
- 场景: 直接获取主页视频(`monitor fetch`)、加入监控队列(`monitor submit`)
|
|
39
54
|
|
|
40
|
-
|
|
55
|
+
### 视频转写
|
|
56
|
+
- 命令: `9000ai transcribe`
|
|
57
|
+
- 场景: 批量视频转文字、查看转写结果
|
|
41
58
|
|
|
42
|
-
|
|
59
|
+
### 反馈提交
|
|
60
|
+
- 命令: `9000ai feedback`
|
|
61
|
+
- 场景: 提交反馈、查看记录。接口报错或用户不满时主动提议反馈
|
|
43
62
|
|
|
44
|
-
|
|
45
|
-
|--------|--------|--------|
|
|
46
|
-
| `--base-url` | 中台服务的网络地址 | 跑服务的那台电脑的 IP + 端口,比如 `http://192.168.1.100:8025` |
|
|
47
|
-
| `--api-key` | 你的身份钥匙 | 在中台后端的 `.env` 文件里配置,找管理员要 |
|
|
63
|
+
## 路由规则
|
|
48
64
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
65
|
+
| 用户意图 | 路由 |
|
|
66
|
+
|---------|------|
|
|
67
|
+
| 初始化 / 第一次用 / 搭建工作空间 | 执行下方"首次使用流程" |
|
|
68
|
+
| 查热榜 / 搜抖音 / 找选题 | `9000ai search` |
|
|
69
|
+
| 看某人主页 / 监控抖音号 | `9000ai monitor` |
|
|
70
|
+
| 视频转文字 / 转写 | `9000ai transcribe` |
|
|
71
|
+
| 反馈 / 建议 / 报 bug | `9000ai feedback` |
|
|
53
72
|
|
|
54
|
-
|
|
73
|
+
## 首次使用流程
|
|
55
74
|
|
|
56
|
-
|
|
75
|
+
### 1. 确认中台连接
|
|
57
76
|
|
|
58
77
|
```bash
|
|
59
|
-
9000ai config
|
|
78
|
+
9000ai config show
|
|
60
79
|
```
|
|
61
80
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
### 怎么检查当前配置?
|
|
81
|
+
未配置 → 问用户要地址和 key:
|
|
65
82
|
|
|
66
83
|
```bash
|
|
67
|
-
9000ai config
|
|
84
|
+
9000ai config set --base-url <地址> --api-key <key>
|
|
68
85
|
```
|
|
69
86
|
|
|
70
|
-
###
|
|
71
|
-
|
|
72
|
-
任何 skill 在调用中台时都会报错:`缺少 API key`,并提示你先运行上面的初始化命令。
|
|
73
|
-
|
|
74
|
-
### 配置存在哪?
|
|
75
|
-
|
|
76
|
-
保存在 `9000AI-hub-9000AI/local/config.json`(这个文件不入 git,不用担心泄露)。
|
|
77
|
-
各 skill 不需要单独配置,都从这里读。
|
|
78
|
-
|
|
79
|
-
## PowerShell 编码准则
|
|
87
|
+
### 2. 初始化工作空间
|
|
80
88
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
```powershell
|
|
85
|
-
$env:PYTHONIOENCODING = 'utf-8'
|
|
86
|
-
[Console]::InputEncoding = [System.Text.Encoding]::UTF8
|
|
87
|
-
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
89
|
+
```bash
|
|
90
|
+
9000ai init --path <项目目录>
|
|
88
91
|
```
|
|
89
92
|
|
|
90
|
-
|
|
91
|
-
- 中文关键词被打坏
|
|
92
|
-
- 返回 JSON 中文发花
|
|
93
|
-
- 复制到后续命令里的参数失真
|
|
94
|
-
|
|
95
|
-
## 模块目录
|
|
96
|
-
|
|
97
|
-
### 0. 内容工作空间初始化
|
|
98
|
-
|
|
99
|
-
- skill: `content-init`(位于 `9000AI-hub-9000AI/init/SKILL.md`)
|
|
100
|
-
- 主调用命令: `/content-init`
|
|
101
|
-
- 适用场景:
|
|
102
|
-
- 首次使用 9000AI 内容中台
|
|
103
|
-
- 初始化项目工作空间目录结构
|
|
104
|
-
- 创建 agent 人格、主张库模板、用户画像模板
|
|
105
|
-
- 查看使用指南
|
|
106
|
-
|
|
107
|
-
### 1. 抖音主页监控
|
|
108
|
-
|
|
109
|
-
- skill: `douyin-monitor-9000AI`
|
|
110
|
-
- 主调用命令: `/douyin-monitor-9000AI`
|
|
111
|
-
- 适用场景:
|
|
112
|
-
- 添加监控账号
|
|
113
|
-
- 发起主页监控
|
|
114
|
-
- 查看监控运行状态
|
|
115
|
-
- 回看监控结果
|
|
116
|
-
|
|
117
|
-
### 2. 抖音选题发现
|
|
118
|
-
|
|
119
|
-
- skill: `douyin-topic-discovery-9000AI`
|
|
120
|
-
- 主调用命令: `/douyin-topic-discovery-9000AI`
|
|
121
|
-
- 适用场景:
|
|
122
|
-
- 抖音热榜
|
|
123
|
-
- 抖音搜索流
|
|
124
|
-
- 候选视频发现
|
|
125
|
-
- 搜索结果落本地 output 文件
|
|
126
|
-
|
|
127
|
-
### 3. 视频转写
|
|
128
|
-
|
|
129
|
-
- skill: `video-transcription`
|
|
130
|
-
- 主调用命令: `/video-transcription`
|
|
131
|
-
- 适用场景:
|
|
132
|
-
- 批量视频转文字
|
|
133
|
-
- 查看转写任务状态
|
|
134
|
-
- 回看转写结果
|
|
135
|
-
|
|
136
|
-
### 4. 反馈提交
|
|
137
|
-
|
|
138
|
-
- skill: `feedback-9000AI`
|
|
139
|
-
- 主调用命令: `/feedback-9000AI`
|
|
140
|
-
- 适用场景:
|
|
141
|
-
- 提交使用反馈(工作流串联建议、Bug、功能请求等)
|
|
142
|
-
- 查看自己的反馈记录
|
|
143
|
-
|
|
144
|
-
## 路由规则
|
|
145
|
-
|
|
146
|
-
- 用户要”初始化 / 开始使用 / 搭建工作空间 / 第一次用 / 初始化内容工作空间”
|
|
147
|
-
- 路由到 `content-init`(`9000AI-hub-9000AI/init/SKILL.md`)
|
|
148
|
-
|
|
149
|
-
- 用户要”监控抖音号 / 看主页更新 / 查主页监控结果”
|
|
150
|
-
- 路由到 `douyin-monitor-9000AI`
|
|
151
|
-
|
|
152
|
-
- 用户要“查热榜 / 搜抖音内容 / 找选题 / 找候选视频”
|
|
153
|
-
- 路由到 `douyin-topic-discovery-9000AI`
|
|
93
|
+
### 3. 载入角色
|
|
154
94
|
|
|
155
|
-
|
|
156
|
-
- 路由到 `video-transcription`
|
|
95
|
+
初始化完成后,读取项目目录下的 `agents/content-agent.md` 作为你的角色设定。这个文件定义了你的工作方式、可用能力、inbox 处理规则等。
|
|
157
96
|
|
|
158
|
-
|
|
159
|
-
- 路由到 `feedback-9000AI`
|
|
97
|
+
**如果用户还没初始化**,你只有中台调度能力。**初始化后**,你才是完整的内容创作执行助手。
|
|
160
98
|
|
|
161
|
-
|
|
99
|
+
### 4. 了解用户
|
|
162
100
|
|
|
163
|
-
|
|
101
|
+
主动发起对话:
|
|
164
102
|
|
|
165
|
-
|
|
166
|
-
|
|
103
|
+
> 工作空间搭好了。我想先了解一下你,这样后面做选题会更精准。
|
|
104
|
+
> 我们可以聊几个问题,也可以你把资料丢进 inbox/(支持 .txt),我来提取。
|
|
167
105
|
|
|
168
|
-
|
|
169
|
-
1.
|
|
170
|
-
2.
|
|
171
|
-
3.
|
|
106
|
+
**对话模式** — 依次引导:
|
|
107
|
+
1. **identity.md** — 你是谁?做什么业务?目标受众?
|
|
108
|
+
2. **voice.md** — 内容风格?参考博主?什么话不说?
|
|
109
|
+
3. **topics.md** — 主攻方向?不碰的领域?
|
|
110
|
+
4. **product.md** — 产品/服务?定价?核心卖点?
|
|
172
111
|
|
|
173
|
-
|
|
112
|
+
**inbox 模式** — 读取 inbox/ 的 .txt,提取信息填充 profile/。
|
|
174
113
|
|
|
175
|
-
|
|
176
|
-
2. 优先使用子 skill 的 `output` 文件、`task_id`、`batch_id`、`row_no` 继续操作
|
|
177
|
-
3. 不在中台里展开子 skill 的全部脚本命令
|
|
178
|
-
4. 如果用户问”该用哪个模块”,中台负责判断
|
|
179
|
-
5. 如果用户已经明确说了模块名,直接进入对应 skill
|
|
180
|
-
6. 共享执行底座以 `9000AI-hub-9000AI/shared/runner.py` 为准
|
|
181
|
-
7. 统一 runner 规范以 `9000AI-hub-9000AI/references/runner-spec-v1.md` 为准
|
|
182
|
-
8. 以下情况主动提议进入 `feedback-9000AI` 提交反馈,不要等用户说:
|
|
183
|
-
- 任何 skill 出现接口报错、任务失败、结果异常
|
|
184
|
-
- 发现某个工作流可以改进或串联自动化
|
|
185
|
-
- 用户表达了不满、困惑或明确的改进意见
|
|
114
|
+
完成后:
|
|
186
115
|
|
|
187
|
-
|
|
116
|
+
> 画像建好了。现在可以开始——比如"帮我做选题调研"、"看看最近热榜"。
|
|
188
117
|
|
|
189
|
-
|
|
118
|
+
## 参考文档
|
|
190
119
|
|
|
191
|
-
|
|
192
|
-
- 告诉系统该去哪个 skill
|
|
193
|
-
- 给出主调用命令
|
|
120
|
+
需要更详细的使用规范时查阅:
|
|
194
121
|
|
|
195
|
-
|
|
122
|
+
- `references/usage-guidelines.md` — 性能准则、字段组合、串联规则、PowerShell 编码
|
|
123
|
+
- `references/env.example` — 环境变量示例
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# 9000AI 使用规范详细参考
|
|
2
|
+
|
|
3
|
+
## 性能准则
|
|
4
|
+
|
|
5
|
+
### 数据精简
|
|
6
|
+
|
|
7
|
+
所有查询命令都支持 `--fields` 和 `--compact` 参数。**默认必须用 `--fields` 只取需要的字段,禁止全量读取。**
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# 错误 — 返回 83KB 全量数据,浪费上下文
|
|
11
|
+
9000ai task results --task-id <id>
|
|
12
|
+
|
|
13
|
+
# 正确 — 只取需要的字段
|
|
14
|
+
9000ai task results --task-id <id> --fields desc,video_url,likes,author_name
|
|
15
|
+
|
|
16
|
+
# 更紧凑 — 每条一行,适合批量处理
|
|
17
|
+
9000ai task results --task-id <id> --fields desc,video_url,likes --compact
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
常用字段组合:
|
|
21
|
+
- 搜索结果概览:`--fields desc,author_name,likes,duration`
|
|
22
|
+
- 提取转写链接:`--fields video_url,download_url,play_url,desc`
|
|
23
|
+
- 监控结果摘要:`--fields desc,author_name,likes,comments,create_time`
|
|
24
|
+
- 主页视频列表:`--fields description,likes,comments,plays,publish_time`
|
|
25
|
+
|
|
26
|
+
### 并行执行
|
|
27
|
+
|
|
28
|
+
独立的操作必须并行,不要串行等待。用 subagent 或并行工具调用。
|
|
29
|
+
|
|
30
|
+
可以并行的场景:
|
|
31
|
+
- 写 inbox 文件 + 提交转写任务
|
|
32
|
+
- 多个关键词的搜索结果查询
|
|
33
|
+
- 查多个 task_id 的状态
|
|
34
|
+
- 热榜 + 关键词搜索同时拉
|
|
35
|
+
|
|
36
|
+
不能并行的场景:
|
|
37
|
+
- 搜索 → 等结果 → 筛选(有依赖关系)
|
|
38
|
+
- 创建监控对象 → 提交监控任务(需要 creator_id)
|
|
39
|
+
|
|
40
|
+
### 减少中间文件
|
|
41
|
+
|
|
42
|
+
CLI 支持 `--json-file` 也支持直接传参。简单请求直接传参,不要写中间 JSON 文件。
|
|
43
|
+
|
|
44
|
+
### 不暴露中间过程
|
|
45
|
+
|
|
46
|
+
用户要的是结果,不是过程。拿到数据后直接输出摘要或执行下一步,不要把原始 JSON 展示给用户。
|
|
47
|
+
|
|
48
|
+
## 串联规则
|
|
49
|
+
|
|
50
|
+
只有在用户明确要求多步串联时,才跨模块:
|
|
51
|
+
- 先搜索,再转写
|
|
52
|
+
- 先监控,再分析结果
|
|
53
|
+
|
|
54
|
+
串联步骤:
|
|
55
|
+
1. 先进入第一个模块完成提交
|
|
56
|
+
2. 拿到任务结果或结果引用
|
|
57
|
+
3. 再进入下一个模块继续执行
|
|
58
|
+
|
|
59
|
+
## 统一使用规范
|
|
60
|
+
|
|
61
|
+
1. 不把大结果直接塞进上下文
|
|
62
|
+
2. 优先使用 `task_id`、`batch_id`、`row_no` 继续操作
|
|
63
|
+
3. 如果用户问"该用哪个模块",中台负责判断
|
|
64
|
+
4. 如果用户已经明确说了模块名,直接进入对应 skill
|
|
65
|
+
5. 接口报错、任务失败、用户不满时,主动提议 `9000ai feedback submit` 提交反馈
|
|
66
|
+
|
|
67
|
+
## PowerShell 编码
|
|
68
|
+
|
|
69
|
+
Windows PowerShell 中文容易乱码,先设 UTF-8:
|
|
70
|
+
|
|
71
|
+
```powershell
|
|
72
|
+
$env:PYTHONIOENCODING = 'utf-8'
|
|
73
|
+
[Console]::InputEncoding = [System.Text.Encoding]::UTF8
|
|
74
|
+
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
75
|
+
```
|
|
@@ -24,13 +24,23 @@ output-format: task-oriented
|
|
|
24
24
|
|
|
25
25
|
用于:
|
|
26
26
|
- 查看当前 key 和能力
|
|
27
|
+
- **直接获取某个用户的主页视频**(同步,不入队列)
|
|
27
28
|
- 新建监控对象
|
|
28
29
|
- 查看监控对象列表
|
|
29
30
|
- 修改、启停、重置、删除监控对象
|
|
30
|
-
-
|
|
31
|
+
- 提交主页监控任务(异步,加入队列定期监控)
|
|
31
32
|
- 查看运行历史和单次运行详情
|
|
32
33
|
- 查看任务状态和任务结果
|
|
33
34
|
|
|
35
|
+
## 两种获取模式
|
|
36
|
+
|
|
37
|
+
| 模式 | 命令 | 场景 |
|
|
38
|
+
|------|------|------|
|
|
39
|
+
| **直接获取** | `9000ai monitor fetch --sec-user <id>` | 临时看某人主页、一次性分析 |
|
|
40
|
+
| **加入监控** | `9000ai monitor submit --json-file ...` | 持续跟踪、定期检查更新 |
|
|
41
|
+
|
|
42
|
+
判断标准:用户说"看一下xxx的主页/视频" → 直接获取;用户说"监控xxx/跟踪xxx" → 加入队列。
|
|
43
|
+
|
|
34
44
|
## 工作方式
|
|
35
45
|
|
|
36
46
|
主页监控的"提交运行"是异步任务,标准动作是:
|
|
@@ -89,6 +99,7 @@ output-format: task-oriented
|
|
|
89
99
|
9000ai config set --base-url http://127.0.0.1:8025 --api-key <key>
|
|
90
100
|
9000ai auth whoami
|
|
91
101
|
9000ai auth capabilities
|
|
102
|
+
9000ai monitor fetch --sec-user <sec_user_id> --fields description,likes,comments,plays
|
|
92
103
|
9000ai monitor list-creators
|
|
93
104
|
9000ai monitor create-creator --json-file creator.json
|
|
94
105
|
9000ai monitor update-creator --creator-id <creator_id> --json-file creator_update.json
|
|
@@ -103,6 +114,48 @@ output-format: task-oriented
|
|
|
103
114
|
9000ai task results --task-id <task_id>
|
|
104
115
|
```
|
|
105
116
|
|
|
117
|
+
## 性能准则(必须遵守)
|
|
118
|
+
|
|
119
|
+
### 数据精简
|
|
120
|
+
|
|
121
|
+
任务结果和监控详情都支持 `--fields` 和 `--compact`。**默认必须用 `--fields` 只取需要的字段,禁止全量读取。**
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# 错误 — 返回全量 JSON,浪费上下文
|
|
125
|
+
9000ai task results --task-id <id>
|
|
126
|
+
|
|
127
|
+
# 正确 — 只取监控摘要字段
|
|
128
|
+
9000ai task results --task-id <id> --fields desc,author_name,likes,comments,create_time
|
|
129
|
+
|
|
130
|
+
# 更紧凑 — 每条一行
|
|
131
|
+
9000ai task results --task-id <id> --fields desc,author_name,likes --compact
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
常用字段组合:
|
|
135
|
+
- 监控结果摘要:`--fields desc,author_name,likes,comments,create_time`
|
|
136
|
+
- 提取视频链接:`--fields desc,video_url,download_url,play_url`
|
|
137
|
+
- 运行状态检查:`--fields status,total,success,failed`
|
|
138
|
+
|
|
139
|
+
### 并行执行
|
|
140
|
+
|
|
141
|
+
独立操作必须并行,不要串行等待。
|
|
142
|
+
|
|
143
|
+
可以并行:
|
|
144
|
+
- 查多个 task_id 的状态或结果
|
|
145
|
+
- 写 inbox 文件 + 提交转写任务
|
|
146
|
+
|
|
147
|
+
不能并行:
|
|
148
|
+
- 创建监控对象 → 提交监控任务(需要 creator_id)
|
|
149
|
+
- 提交任务 → 查结果(需要 task_id)
|
|
150
|
+
|
|
151
|
+
### 减少中间文件
|
|
152
|
+
|
|
153
|
+
CLI 支持 `--json-file` 也支持直接传参。简单操作(启停、重置、删除)直接传参,不要写 JSON 文件。
|
|
154
|
+
|
|
155
|
+
### 不暴露中间过程
|
|
156
|
+
|
|
157
|
+
拿到监控结果后直接输出摘要或执行下一步,不要把原始 JSON 全量展示给用户。
|
|
158
|
+
|
|
106
159
|
## 参考
|
|
107
160
|
|
|
108
161
|
接口和请求体示例见:
|
|
@@ -141,6 +141,48 @@ output/
|
|
|
141
141
|
- `search` 每个关键词默认抓取 `30` 条
|
|
142
142
|
- 后端会基于 `search_general_v3` 自动翻页聚合,不需要额外传分页参数
|
|
143
143
|
|
|
144
|
+
## 性能准则(必须遵守)
|
|
145
|
+
|
|
146
|
+
### 数据精简
|
|
147
|
+
|
|
148
|
+
搜索结果和任务结果都支持 `--fields` 和 `--compact`。**默认必须用 `--fields` 只取需要的字段,禁止全量读取。**
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# 错误 — 返回全量 JSON,浪费上下文
|
|
152
|
+
9000ai search batch-result --batch-id <id>
|
|
153
|
+
|
|
154
|
+
# 正确 — 只取选题需要的字段
|
|
155
|
+
9000ai search batch-result --batch-id <id> --fields desc,author_name,likes,duration
|
|
156
|
+
|
|
157
|
+
# 更紧凑 — 每条一行
|
|
158
|
+
9000ai search batch-result --batch-id <id> --fields desc,author_name,likes --compact
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
常用字段组合:
|
|
162
|
+
- 选题概览:`--fields desc,author_name,likes,duration,comments`
|
|
163
|
+
- 提取视频链接:`--fields desc,video_url,download_url,play_url`
|
|
164
|
+
- 热榜摘要:`--fields title,hot_value,label`
|
|
165
|
+
|
|
166
|
+
### 并行执行
|
|
167
|
+
|
|
168
|
+
独立操作必须并行,不要串行等待。
|
|
169
|
+
|
|
170
|
+
可以并行:
|
|
171
|
+
- 多个 `batch-result` 查询(不同 batch_id)
|
|
172
|
+
- 写输出文件 + 查询下一批结果
|
|
173
|
+
- 多关键词搜索提交后,同时查询各自的 batch_id
|
|
174
|
+
|
|
175
|
+
不能并行:
|
|
176
|
+
- 提交搜索 → 等 batch_id 返回 → 查询结果(有依赖)
|
|
177
|
+
|
|
178
|
+
### 减少中间文件
|
|
179
|
+
|
|
180
|
+
简单的热榜或搜索请求直接用命令行参数,不要写 JSON 文件。
|
|
181
|
+
|
|
182
|
+
### 不暴露中间过程
|
|
183
|
+
|
|
184
|
+
拿到搜索结果后直接输出摘要或执行下一步,不要把原始 JSON 全量展示给用户。
|
|
185
|
+
|
|
144
186
|
## 一句话总结
|
|
145
187
|
|
|
146
188
|
这是一个”热榜 + search_general_v3 搜索流”的抖音选题发现 skill。
|
|
@@ -103,6 +103,43 @@ timecodes.sentences[*].text
|
|
|
103
103
|
9000ai transcribe text --task-id <task_id>
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
+
## 性能准则(必须遵守)
|
|
107
|
+
|
|
108
|
+
### 数据精简
|
|
109
|
+
|
|
110
|
+
任务结果支持 `--fields` 和 `--compact`。**默认必须用 `--fields` 只取需要的字段,禁止全量读取。**
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# 错误 — 返回全量转写 JSON,浪费上下文
|
|
114
|
+
9000ai task results --task-id <id>
|
|
115
|
+
|
|
116
|
+
# 正确 — 只取需要的字段
|
|
117
|
+
9000ai task results --task-id <id> --fields status,output,video_url
|
|
118
|
+
|
|
119
|
+
# 只要原文 — 用专用命令,不要读全量 JSON
|
|
120
|
+
9000ai transcribe text --task-id <task_id>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
常用字段组合:
|
|
124
|
+
- 状态检查:`--fields status,progress,message`
|
|
125
|
+
- 结果提取:`--fields status,output,video_url`
|
|
126
|
+
|
|
127
|
+
### 并行执行
|
|
128
|
+
|
|
129
|
+
独立操作必须并行,不要串行等待。
|
|
130
|
+
|
|
131
|
+
可以并行:
|
|
132
|
+
- 查多个 task_id 的状态
|
|
133
|
+
- 提取多个任务的原文(多个 `transcribe text` 并行)
|
|
134
|
+
- 写文件 + 提交下一批转写任务
|
|
135
|
+
|
|
136
|
+
不能并行:
|
|
137
|
+
- 提交任务 → 查结果(需要 task_id,且任务需时间完成)
|
|
138
|
+
|
|
139
|
+
### 不暴露中间过程
|
|
140
|
+
|
|
141
|
+
拿到转写结果后直接输出文案或执行下一步,不要把原始 JSON 全量展示给用户。
|
|
142
|
+
|
|
106
143
|
## 参考
|
|
107
144
|
|
|
108
145
|
接口细节和 JSON 示例见 `references/endpoints.md`。
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"""9000AI 中台初始化脚本(旧版,保留兼容)。
|
|
2
|
-
|
|
3
|
-
推荐使用新的 CLI 工具:
|
|
4
|
-
9000ai config set --base-url http://192.168.1.100:8025 --api-key sk-xxx
|
|
5
|
-
|
|
6
|
-
查看当前配置:
|
|
7
|
-
9000ai config show
|
|
8
|
-
"""
|
|
9
|
-
|
|
10
|
-
from __future__ import annotations
|
|
11
|
-
|
|
12
|
-
import argparse
|
|
13
|
-
import json
|
|
14
|
-
import sys
|
|
15
|
-
from pathlib import Path
|
|
16
|
-
|
|
17
|
-
HUB_ROOT = Path(__file__).resolve().parent
|
|
18
|
-
if str(HUB_ROOT) not in sys.path:
|
|
19
|
-
sys.path.insert(0, str(HUB_ROOT))
|
|
20
|
-
|
|
21
|
-
from shared.runner import _HUB_CONFIG_PATH, load_hub_config, save_hub_config # noqa: E402
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def main() -> None:
|
|
25
|
-
parser = argparse.ArgumentParser(description="9000AI 中台连接配置(首次使用前必须运行一次)")
|
|
26
|
-
parser.add_argument("--base-url", help="中台服务地址,例如 http://192.168.1.100:8025")
|
|
27
|
-
parser.add_argument("--api-key", help="你的 API Key,找管理员要")
|
|
28
|
-
parser.add_argument("--show", action="store_true", help="查看当前已保存的配置")
|
|
29
|
-
args = parser.parse_args()
|
|
30
|
-
|
|
31
|
-
if args.show:
|
|
32
|
-
cfg = load_hub_config()
|
|
33
|
-
if cfg:
|
|
34
|
-
print("当前 9000AI 中台配置:")
|
|
35
|
-
print(json.dumps(cfg, ensure_ascii=False, indent=2))
|
|
36
|
-
else:
|
|
37
|
-
print(f"还没有初始化过。请先运行:")
|
|
38
|
-
print(f" 9000ai config set --base-url <中台地址> --api-key <你的key>")
|
|
39
|
-
return
|
|
40
|
-
|
|
41
|
-
if not args.base_url or not args.api_key:
|
|
42
|
-
parser.error("--base-url 和 --api-key 都是必填项。\n"
|
|
43
|
-
" 推荐使用: 9000ai config set "
|
|
44
|
-
"--base-url http://192.168.1.100:8025 --api-key sk-xxx")
|
|
45
|
-
|
|
46
|
-
save_hub_config(base_url=args.base_url, api_key=args.api_key)
|
|
47
|
-
print(f"初始化完成!配置已保存。")
|
|
48
|
-
print(f" 中台地址: {args.base_url.rstrip('/')}")
|
|
49
|
-
print(f" API Key: {args.api_key[:8]}...")
|
|
50
|
-
print(f" 配置文件: {_HUB_CONFIG_PATH}")
|
|
51
|
-
print()
|
|
52
|
-
print("现在可以使用所有 9000AI skill 了。")
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if __name__ == "__main__":
|
|
56
|
-
main()
|