aidee-pro 1.0.0__tar.gz
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.
- aidee_pro-1.0.0/PKG-INFO +6 -0
- aidee_pro-1.0.0/README.md +183 -0
- aidee_pro-1.0.0/__init__.py +3 -0
- aidee_pro-1.0.0/aidee_cli.py +404 -0
- aidee_pro-1.0.0/aidee_pro.egg-info/PKG-INFO +6 -0
- aidee_pro-1.0.0/aidee_pro.egg-info/SOURCES.txt +36 -0
- aidee_pro-1.0.0/aidee_pro.egg-info/dependency_links.txt +1 -0
- aidee_pro-1.0.0/aidee_pro.egg-info/entry_points.txt +2 -0
- aidee_pro-1.0.0/aidee_pro.egg-info/requires.txt +2 -0
- aidee_pro-1.0.0/aidee_pro.egg-info/top_level.txt +4 -0
- aidee_pro-1.0.0/core/__init__.py +1 -0
- aidee_pro-1.0.0/core/config.py +50 -0
- aidee_pro-1.0.0/core/device.py +55 -0
- aidee_pro-1.0.0/core/expo.py +20 -0
- aidee_pro-1.0.0/core/feedback.py +30 -0
- aidee_pro-1.0.0/core/firmware.py +15 -0
- aidee_pro-1.0.0/core/group.py +36 -0
- aidee_pro-1.0.0/core/industry.py +10 -0
- aidee_pro-1.0.0/core/membership.py +35 -0
- aidee_pro-1.0.0/core/position.py +10 -0
- aidee_pro-1.0.0/core/recording.py +129 -0
- aidee_pro-1.0.0/core/redemption.py +30 -0
- aidee_pro-1.0.0/core/session.py +98 -0
- aidee_pro-1.0.0/core/summary.py +63 -0
- aidee_pro-1.0.0/core/template.py +50 -0
- aidee_pro-1.0.0/core/template_category.py +15 -0
- aidee_pro-1.0.0/core/thirdparty.py +10 -0
- aidee_pro-1.0.0/core/user.py +35 -0
- aidee_pro-1.0.0/core/websocket.py +40 -0
- aidee_pro-1.0.0/core/word_library.py +35 -0
- aidee_pro-1.0.0/pyproject.toml +22 -0
- aidee_pro-1.0.0/setup.cfg +4 -0
- aidee_pro-1.0.0/tests/test_core.py +177 -0
- aidee_pro-1.0.0/tests/test_full_e2e.py +118 -0
- aidee_pro-1.0.0/utils/__init__.py +1 -0
- aidee_pro-1.0.0/utils/aidee_backend.py +133 -0
- aidee_pro-1.0.0/utils/output.py +41 -0
- aidee_pro-1.0.0/utils/repl_skin.py +57 -0
aidee_pro-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# AIDEE CLI
|
|
2
|
+
|
|
3
|
+
AIDEE CLI 是一个面向 AIDEE 服务的命令行工具,适合客户或运维同学通过终端快速完成基础查询与常用操作,例如查看账号信息、查询录音、查看摘要、兑换权益等。
|
|
4
|
+
|
|
5
|
+
本文档以日常使用为主,只保留基础说明和基础案例。
|
|
6
|
+
|
|
7
|
+
更多中文说明可参考 [README.zh-CN.md](/Users/jeyyu/pyProject/aidee-cli/README.zh-CN.md)。
|
|
8
|
+
|
|
9
|
+
## 适用场景
|
|
10
|
+
|
|
11
|
+
- 查看当前账号信息
|
|
12
|
+
- 查询录音列表与录音详情
|
|
13
|
+
- 查看摘要结果
|
|
14
|
+
- 使用兑换码查询权益信息
|
|
15
|
+
- 查看自己的兑换记录
|
|
16
|
+
|
|
17
|
+
## 认证方式
|
|
18
|
+
|
|
19
|
+
支持以下两种认证方式,二选一即可:
|
|
20
|
+
|
|
21
|
+
- `Token`:通过 `IM-TOKEN` 认证
|
|
22
|
+
- `API Key`:通过 `X-Api-Key` 认证
|
|
23
|
+
|
|
24
|
+
可使用以下任一方式配置:
|
|
25
|
+
|
|
26
|
+
- `AIDEE_TOKEN`
|
|
27
|
+
- `AIDEE_API_KEY`
|
|
28
|
+
|
|
29
|
+
一般情况下,只需要提供其中一个,不需要同时配置。
|
|
30
|
+
|
|
31
|
+
## 基础配置
|
|
32
|
+
|
|
33
|
+
默认服务地址:
|
|
34
|
+
|
|
35
|
+
```text
|
|
36
|
+
https://api.aidee.me/aidee-server
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
首次使用前,建议先设置服务地址和认证信息。
|
|
40
|
+
|
|
41
|
+
使用 Token:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
cli-anything-aidee config set-base-url https://api.aidee.me/aidee-server
|
|
45
|
+
cli-anything-aidee config set-token YOUR_IM_TOKEN
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
使用 API Key:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
cli-anything-aidee config set-base-url https://api.aidee.me/aidee-server
|
|
52
|
+
cli-anything-aidee config set-api-key YOUR_API_KEY
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
查看当前配置:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
cli-anything-aidee config show
|
|
59
|
+
cli-anything-aidee session status
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## 基础使用案例
|
|
63
|
+
|
|
64
|
+
### 1. 查看账号信息
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
cli-anything-aidee user info
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 2. 查看录音列表
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
cli-anything-aidee recording list
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
如果希望控制分页:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
cli-anything-aidee recording list --page 1 --size 20
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 3. 查看某条录音详情
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
cli-anything-aidee recording get RECORDING_CODE
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### 4. 创建一条录音记录
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
cli-anything-aidee recording create --title "客户沟通纪要"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 5. 查看某条录音的摘要列表
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
cli-anything-aidee summary list RECORDING_CODE
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### 6. 查看某条摘要详情
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
cli-anything-aidee summary get SUMMARY_ID
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### 7. 查询兑换码可兑换内容
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
cli-anything-aidee redemption code-detail CODE_STRING
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
说明:这里是查询兑换码详情,不是创建兑换码。
|
|
113
|
+
|
|
114
|
+
### 8. 查看当前账号的兑换记录
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
cli-anything-aidee redemption records
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
如果需要按来源筛选:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
cli-anything-aidee redemption records --redeem-source aideeApp
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## 常用命令
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
cli-anything-aidee --help
|
|
130
|
+
cli-anything-aidee --version
|
|
131
|
+
cli-anything-aidee config show
|
|
132
|
+
cli-anything-aidee user info
|
|
133
|
+
cli-anything-aidee recording list
|
|
134
|
+
cli-anything-aidee summary list RECORDING_CODE
|
|
135
|
+
cli-anything-aidee redemption code-detail CODE_STRING
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## 交互模式
|
|
139
|
+
|
|
140
|
+
可以直接进入交互模式:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
cli-anything-aidee
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
或者:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
cli-anything-aidee repl
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
如果参数中包含空格,请使用引号:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
recording create --title "一对一客户回访"
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## 环境变量方式
|
|
159
|
+
|
|
160
|
+
如果不想把认证信息写入本地配置,也可以直接使用环境变量:
|
|
161
|
+
|
|
162
|
+
使用 Token:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
export AIDEE_BASE_URL="https://api.aidee.me/aidee-server"
|
|
166
|
+
export AIDEE_TOKEN="YOUR_IM_TOKEN"
|
|
167
|
+
cli-anything-aidee user info
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
使用 API Key:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
export AIDEE_BASE_URL="https://api.aidee.me/aidee-server"
|
|
174
|
+
export AIDEE_API_KEY="YOUR_API_KEY"
|
|
175
|
+
cli-anything-aidee recording list
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## 说明
|
|
179
|
+
|
|
180
|
+
- 文档中的命令名为 `cli-anything-aidee`
|
|
181
|
+
- 本工具支持 `Token` 和 `API Key` 两种认证方式,任选其一即可
|
|
182
|
+
- 当前客户文档仅展示基础能力和常用案例
|
|
183
|
+
- 如需查看全部命令,请执行 `cli-anything-aidee --help`
|
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
"""AIDEE CLI — Main entry point."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import click
|
|
5
|
+
|
|
6
|
+
from __init__ import __version__
|
|
7
|
+
|
|
8
|
+
from core.session import get_api_key, get_base_url, get_token
|
|
9
|
+
from core.recording import (
|
|
10
|
+
create as recording_create,
|
|
11
|
+
update as recording_update,
|
|
12
|
+
list_recordings,
|
|
13
|
+
get_summary_templates,
|
|
14
|
+
update_summary_template,
|
|
15
|
+
merged_summary as recording_merged_summary,
|
|
16
|
+
)
|
|
17
|
+
from core.summary import (
|
|
18
|
+
list_by_recording as summary_list,
|
|
19
|
+
get as summary_get,
|
|
20
|
+
)
|
|
21
|
+
from core.group import (
|
|
22
|
+
create as group_create,
|
|
23
|
+
delete as group_delete,
|
|
24
|
+
list_all as group_list,
|
|
25
|
+
)
|
|
26
|
+
from utils.output import print_result as _print_result
|
|
27
|
+
from utils.aidee_backend import upload_file as _upload_file
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _ctx_base(ctx):
|
|
31
|
+
return ctx.obj.get("base_url") or get_base_url()
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _ctx_token(ctx):
|
|
35
|
+
return ctx.obj.get("token") or get_token()
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _output(result, json_mode: bool):
|
|
39
|
+
_print_result(result, json_mode)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@click.group()
|
|
43
|
+
@click.version_option(version=__version__, prog_name="aidee-pro")
|
|
44
|
+
@click.option("--json", "json_mode", is_flag=True, help="Output as JSON")
|
|
45
|
+
@click.option("--base-url", envvar="AIDEE_BASE_URL", help="AIDEE API base URL")
|
|
46
|
+
@click.option("--token", envvar="AIDEE_TOKEN", help="Auth token")
|
|
47
|
+
@click.option("--api-key", envvar="AIDEE_API_KEY", help="AIDEE API key (sent as X-Api-Key)")
|
|
48
|
+
@click.pass_context
|
|
49
|
+
def cli(ctx, json_mode, base_url, token, api_key):
|
|
50
|
+
"""AIDEE CLI — AI recording, transcription, and summarization API client."""
|
|
51
|
+
ctx.ensure_object(dict)
|
|
52
|
+
ctx.obj["json_mode"] = json_mode
|
|
53
|
+
ctx.obj["base_url"] = base_url
|
|
54
|
+
ctx.obj["token"] = token
|
|
55
|
+
ctx.obj["api_key"] = api_key or get_api_key()
|
|
56
|
+
if ctx.obj["api_key"]:
|
|
57
|
+
os.environ["AIDEE_API_KEY"] = ctx.obj["api_key"]
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
# --- recording ---
|
|
61
|
+
@cli.group("recording")
|
|
62
|
+
def recording_group():
|
|
63
|
+
"""Recording management."""
|
|
64
|
+
pass
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
@recording_group.command("create")
|
|
68
|
+
@click.option("--title", required=True)
|
|
69
|
+
@click.option("--description", required=True)
|
|
70
|
+
@click.option("--file-url")
|
|
71
|
+
@click.option("--file-name", required=True)
|
|
72
|
+
@click.option("--content-type", required=True)
|
|
73
|
+
@click.option("--file-created-at", required=True)
|
|
74
|
+
@click.option("--duration", type=int)
|
|
75
|
+
@click.option("--summary-template-id")
|
|
76
|
+
@click.option("--group-code")
|
|
77
|
+
@click.option("--device-id")
|
|
78
|
+
@click.option("--speaker-count", type=int)
|
|
79
|
+
@click.option("--latitude", type=float)
|
|
80
|
+
@click.option("--longitude", type=float)
|
|
81
|
+
@click.option("--address")
|
|
82
|
+
@click.option("--address-brief")
|
|
83
|
+
@click.option("--json", "json_mode", is_flag=True)
|
|
84
|
+
@click.pass_context
|
|
85
|
+
def recording_create_cmd(ctx, title, description, file_url, file_name, duration,
|
|
86
|
+
content_type, summary_template_id, group_code, device_id,
|
|
87
|
+
speaker_count, file_created_at, latitude, longitude,
|
|
88
|
+
address, address_brief, json_mode):
|
|
89
|
+
"""创建录音记录。"""
|
|
90
|
+
base = _ctx_base(ctx)
|
|
91
|
+
tok = _ctx_token(ctx)
|
|
92
|
+
kwargs = {k: v for k, v in {
|
|
93
|
+
"description": description,
|
|
94
|
+
"fileUrl": file_url,
|
|
95
|
+
"fileName": file_name,
|
|
96
|
+
"duration": duration,
|
|
97
|
+
"recordingContentType": content_type,
|
|
98
|
+
"summaryTemplatesId": summary_template_id,
|
|
99
|
+
"recordingsGroupCode": group_code,
|
|
100
|
+
"deviceId": device_id,
|
|
101
|
+
"speakerCount": speaker_count,
|
|
102
|
+
"fileCreatedAt": file_created_at,
|
|
103
|
+
"latitude": latitude,
|
|
104
|
+
"longitude": longitude,
|
|
105
|
+
"address": address,
|
|
106
|
+
"addressBrief": address_brief,
|
|
107
|
+
}.items() if v is not None}
|
|
108
|
+
r = recording_create(base, tok, title=title, **kwargs)
|
|
109
|
+
_output(r, json_mode or ctx.obj.get("json_mode"))
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
@recording_group.command("update")
|
|
113
|
+
@click.argument("code")
|
|
114
|
+
@click.option("--title")
|
|
115
|
+
@click.option("--description")
|
|
116
|
+
@click.option("--file-url")
|
|
117
|
+
@click.option("--file-name")
|
|
118
|
+
@click.option("--duration", type=int, help="录音时长(毫秒)")
|
|
119
|
+
@click.option("--content-type")
|
|
120
|
+
@click.option("--group-code")
|
|
121
|
+
@click.option("--ai-summary")
|
|
122
|
+
@click.option("--status")
|
|
123
|
+
@click.option("--json", "json_mode", is_flag=True)
|
|
124
|
+
@click.pass_context
|
|
125
|
+
def recording_update_cmd(ctx, code, title, description, file_url, file_name, duration,
|
|
126
|
+
content_type, group_code, ai_summary, status, json_mode):
|
|
127
|
+
"""编辑录音记录。"""
|
|
128
|
+
kwargs = {k: v for k, v in {
|
|
129
|
+
"title": title,
|
|
130
|
+
"description": description,
|
|
131
|
+
"fileUrl": file_url,
|
|
132
|
+
"fileName": file_name,
|
|
133
|
+
"duration": duration,
|
|
134
|
+
"recordingContentType": content_type,
|
|
135
|
+
"recordingsGroupCode": group_code,
|
|
136
|
+
"aiSummary": ai_summary,
|
|
137
|
+
"status": status,
|
|
138
|
+
}.items() if v is not None}
|
|
139
|
+
r = recording_update(_ctx_base(ctx), _ctx_token(ctx), code, **kwargs)
|
|
140
|
+
_output(r, json_mode or ctx.obj.get("json_mode"))
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
@recording_group.command("list")
|
|
144
|
+
@click.option("--page", default=1, type=int, help="页码,从 1 开始")
|
|
145
|
+
@click.option("--limit", default=10, type=int, help="每页条数")
|
|
146
|
+
@click.option("--title", help="录音标题,模糊匹配")
|
|
147
|
+
@click.option("--keyword", help="关键词,匹配标题/简介/description")
|
|
148
|
+
@click.option("--status", help="录音状态,如 COMPLETED")
|
|
149
|
+
@click.option("--group-code", help="录音组 code")
|
|
150
|
+
@click.option("--device-id", help="设备 ID")
|
|
151
|
+
@click.option("--entry-type", help="条目类型:SINGLE / MERGED_SUMMARY")
|
|
152
|
+
@click.option("--content-type", help="内容类型:ENVIRONMENT / IMPORTED / CALL / MERGED_SUMMARY")
|
|
153
|
+
@click.option("--start-time", help="开始时间,如 2026-06-01T00:00:00")
|
|
154
|
+
@click.option("--end-time", help="结束时间,如 2026-06-10T23:59:59")
|
|
155
|
+
@click.option("--order-by", help="排序字段,默认 file_created_at")
|
|
156
|
+
@click.option("--order-direction", help="排序方向:asc / desc")
|
|
157
|
+
@click.option("--sort-type", help="RECORDING_TIME / UPDATED_TIME")
|
|
158
|
+
@click.option("--json", "json_mode", is_flag=True)
|
|
159
|
+
@click.pass_context
|
|
160
|
+
def recording_list_cmd(ctx, page, limit, title, keyword, status, group_code, device_id,
|
|
161
|
+
entry_type, content_type, start_time, end_time,
|
|
162
|
+
order_by, order_direction, sort_type, json_mode):
|
|
163
|
+
"""录音列表查询。"""
|
|
164
|
+
kwargs = {k: v for k, v in {
|
|
165
|
+
"title": title,
|
|
166
|
+
"keyword": keyword,
|
|
167
|
+
"status": status,
|
|
168
|
+
"recordingsGroupCode": group_code,
|
|
169
|
+
"deviceId": device_id,
|
|
170
|
+
"recordingEntryType": entry_type,
|
|
171
|
+
"recordingContentType": content_type,
|
|
172
|
+
"startTime": start_time,
|
|
173
|
+
"endTime": end_time,
|
|
174
|
+
"orderBy": order_by,
|
|
175
|
+
"orderDirection": order_direction,
|
|
176
|
+
"sortType": sort_type,
|
|
177
|
+
}.items() if v is not None}
|
|
178
|
+
r = list_recordings(_ctx_base(ctx), _ctx_token(ctx), page=page, limit=limit, **kwargs)
|
|
179
|
+
_output(r, json_mode or ctx.obj.get("json_mode"))
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
@recording_group.command("summary-templates")
|
|
183
|
+
@click.option("--sort-scheme", help="排序方案:DEFAULT / INDUSTRY")
|
|
184
|
+
@click.option("--json", "json_mode", is_flag=True)
|
|
185
|
+
@click.pass_context
|
|
186
|
+
def recording_templates_cmd(ctx, sort_scheme, json_mode):
|
|
187
|
+
"""总结模板列表查询。"""
|
|
188
|
+
kwargs = {"sortScheme": sort_scheme} if sort_scheme else {}
|
|
189
|
+
r = get_summary_templates(_ctx_base(ctx), _ctx_token(ctx), **kwargs)
|
|
190
|
+
_output(r, json_mode or ctx.obj.get("json_mode"))
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
@recording_group.command("update-summary-template")
|
|
194
|
+
@click.option("--recording-code", required=True, help="目标录音 code")
|
|
195
|
+
@click.option("--summary-template-id", help="总结模板 ID,不传则默认 zhinengzongjie-neice")
|
|
196
|
+
@click.option("--summary-no", type=int, help="指定则重新生成该次历史总结,不传则新建")
|
|
197
|
+
@click.option("--template-selection-mode", help="MANUAL / AUTO_TEMPLATE")
|
|
198
|
+
@click.option("--json", "json_mode", is_flag=True)
|
|
199
|
+
@click.pass_context
|
|
200
|
+
def recording_update_summary_template_cmd(ctx, recording_code, summary_template_id,
|
|
201
|
+
summary_no, template_selection_mode, json_mode):
|
|
202
|
+
"""开启 AI 总结,返回预估耗时。"""
|
|
203
|
+
params = {k: v for k, v in {
|
|
204
|
+
"recordingCode": recording_code,
|
|
205
|
+
"summaryTemplatesId": summary_template_id,
|
|
206
|
+
"summaryNo": summary_no,
|
|
207
|
+
"templateSelectionMode": template_selection_mode,
|
|
208
|
+
}.items() if v is not None}
|
|
209
|
+
r = update_summary_template(_ctx_base(ctx), _ctx_token(ctx), **params)
|
|
210
|
+
_output(r, json_mode or ctx.obj.get("json_mode"))
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
@recording_group.command("upload")
|
|
214
|
+
@click.argument("file_path")
|
|
215
|
+
@click.option("--recording-code", required=True, help="录音 code")
|
|
216
|
+
@click.option("--json", "json_mode", is_flag=True)
|
|
217
|
+
@click.pass_context
|
|
218
|
+
def recording_upload_cmd(ctx, file_path, recording_code, json_mode):
|
|
219
|
+
"""上传音频文件到指定录音。"""
|
|
220
|
+
r = _upload_file(
|
|
221
|
+
path=file_path,
|
|
222
|
+
base_url=_ctx_base(ctx),
|
|
223
|
+
recording_code=recording_code,
|
|
224
|
+
token=_ctx_token(ctx),
|
|
225
|
+
api_key=ctx.obj.get("api_key"),
|
|
226
|
+
)
|
|
227
|
+
_output(r, json_mode or ctx.obj.get("json_mode"))
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
@recording_group.command("merged-summary")
|
|
231
|
+
@click.option("--recording-codes", required=True, help="来源录音 code,多个用逗号分隔,如 rec_a,rec_b")
|
|
232
|
+
@click.option("--merged-recording-code", help="已有合并录音 code,传则追加来源,不传则新建")
|
|
233
|
+
@click.option("--summary-template-id", help="总结模板 ID,新建时不传默认 smart")
|
|
234
|
+
@click.option("--json", "json_mode", is_flag=True)
|
|
235
|
+
@click.pass_context
|
|
236
|
+
def recording_merged_summary_cmd(ctx, recording_codes, merged_recording_code,
|
|
237
|
+
summary_template_id, json_mode):
|
|
238
|
+
"""合并多条录音总结为一份汇总总结。"""
|
|
239
|
+
codes = [c.strip() for c in recording_codes.split(",")]
|
|
240
|
+
kwargs = {k: v for k, v in {
|
|
241
|
+
"recordingCodes": codes,
|
|
242
|
+
"mergedRecordingCode": merged_recording_code,
|
|
243
|
+
"summaryTemplatesId": summary_template_id,
|
|
244
|
+
}.items() if v is not None}
|
|
245
|
+
r = recording_merged_summary(_ctx_base(ctx), _ctx_token(ctx), **kwargs)
|
|
246
|
+
_output(r, json_mode or ctx.obj.get("json_mode"))
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
# --- summary ---
|
|
250
|
+
@cli.group("summary")
|
|
251
|
+
def summary_group():
|
|
252
|
+
"""Recording summary management."""
|
|
253
|
+
pass
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
@summary_group.command("list")
|
|
257
|
+
@click.argument("recording_code")
|
|
258
|
+
@click.option("--json", "json_mode", is_flag=True)
|
|
259
|
+
@click.pass_context
|
|
260
|
+
def summary_list_cmd(ctx, recording_code, json_mode):
|
|
261
|
+
"""录音总结列表查询。"""
|
|
262
|
+
r = summary_list(_ctx_base(ctx), _ctx_token(ctx), recording_code)
|
|
263
|
+
_output(r, json_mode or ctx.obj.get("json_mode"))
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
@summary_group.command("get")
|
|
267
|
+
@click.argument("id", type=int)
|
|
268
|
+
@click.option("--json", "json_mode", is_flag=True)
|
|
269
|
+
@click.pass_context
|
|
270
|
+
def summary_get_cmd(ctx, id, json_mode):
|
|
271
|
+
"""总结详情查询。"""
|
|
272
|
+
r = summary_get(_ctx_base(ctx), _ctx_token(ctx), id)
|
|
273
|
+
_output(r, json_mode or ctx.obj.get("json_mode"))
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
# --- group ---
|
|
277
|
+
@cli.group("group")
|
|
278
|
+
def group_group():
|
|
279
|
+
"""Recording group management."""
|
|
280
|
+
pass
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
@group_group.command("list")
|
|
284
|
+
@click.option("--json", "json_mode", is_flag=True)
|
|
285
|
+
@click.pass_context
|
|
286
|
+
def group_list_cmd(ctx, json_mode):
|
|
287
|
+
"""分组列表查询。"""
|
|
288
|
+
r = group_list(_ctx_base(ctx), _ctx_token(ctx))
|
|
289
|
+
_output(r, json_mode or ctx.obj.get("json_mode"))
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
@group_group.command("create")
|
|
293
|
+
@click.option("--name", "group_name", required=True, help="分组名称,同一用户下唯一,最长 64 字符")
|
|
294
|
+
@click.option("--description", help="分组描述,最长 500 字符")
|
|
295
|
+
@click.option("--json", "json_mode", is_flag=True)
|
|
296
|
+
@click.pass_context
|
|
297
|
+
def group_create_cmd(ctx, group_name, description, json_mode):
|
|
298
|
+
"""创建录音分组。"""
|
|
299
|
+
kwargs = {"description": description} if description else {}
|
|
300
|
+
r = group_create(_ctx_base(ctx), _ctx_token(ctx), group_name=group_name, **kwargs)
|
|
301
|
+
_output(r, json_mode or ctx.obj.get("json_mode"))
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
@group_group.command("delete")
|
|
305
|
+
@click.argument("code")
|
|
306
|
+
@click.option("--json", "json_mode", is_flag=True)
|
|
307
|
+
@click.pass_context
|
|
308
|
+
def group_delete_cmd(ctx, code, json_mode):
|
|
309
|
+
"""删除录音分组。"""
|
|
310
|
+
r = group_delete(_ctx_base(ctx), _ctx_token(ctx), code)
|
|
311
|
+
_output(r, json_mode or ctx.obj.get("json_mode"))
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
# --- transcribe ---
|
|
315
|
+
@cli.command("transcribe")
|
|
316
|
+
@click.option("--title", required=True, help="录音标题")
|
|
317
|
+
@click.option("--description", required=True, help="录音描述")
|
|
318
|
+
@click.option("--file", "file_path", default=None, help="本地音频文件路径")
|
|
319
|
+
@click.option("--url", "file_url", default=None, help="录音网址链接")
|
|
320
|
+
@click.option("--file-name", required=True, help="原始文件名")
|
|
321
|
+
@click.option("--file-created-at", required=True, help="文件创建时间,格式 yyyy-MM-dd HH:mm:ss")
|
|
322
|
+
@click.option("--content-type", default="IMPORTED", show_default=True,
|
|
323
|
+
help="内容类型:ENVIRONMENT / IMPORTED / CALL / MERGED_SUMMARY")
|
|
324
|
+
@click.option("--template-id", required=True, help="AI 总结模板 ID(可通过 recording summary-templates 获取)")
|
|
325
|
+
@click.option("--json", "json_mode", is_flag=True)
|
|
326
|
+
@click.pass_context
|
|
327
|
+
def transcribe_cmd(ctx, title, description, file_path, file_url, file_name,
|
|
328
|
+
file_created_at, content_type, template_id, json_mode):
|
|
329
|
+
"""一键完成:创建录音 → 上传/绑定文件 → 触发 AI 总结。
|
|
330
|
+
|
|
331
|
+
\b
|
|
332
|
+
两种模式:
|
|
333
|
+
--file 本地文件:上传后自动回写文件 URL
|
|
334
|
+
--url 网络链接:直接绑定到录音记录
|
|
335
|
+
"""
|
|
336
|
+
if not file_path and not file_url:
|
|
337
|
+
raise click.UsageError("必须提供 --file(本地文件)或 --url(录音链接)之一")
|
|
338
|
+
if file_path and file_url:
|
|
339
|
+
raise click.UsageError("--file 和 --url 不能同时使用")
|
|
340
|
+
|
|
341
|
+
base = _ctx_base(ctx)
|
|
342
|
+
tok = _ctx_token(ctx)
|
|
343
|
+
api_key = ctx.obj.get("api_key")
|
|
344
|
+
jm = json_mode or ctx.obj.get("json_mode")
|
|
345
|
+
|
|
346
|
+
create_kwargs = {
|
|
347
|
+
"description": description,
|
|
348
|
+
"fileName": file_name,
|
|
349
|
+
"recordingContentType": content_type,
|
|
350
|
+
"fileCreatedAt": file_created_at,
|
|
351
|
+
"summaryTemplatesId": template_id,
|
|
352
|
+
}
|
|
353
|
+
if file_url:
|
|
354
|
+
create_kwargs["fileUrl"] = file_url
|
|
355
|
+
|
|
356
|
+
click.echo("▶ 创建录音记录...")
|
|
357
|
+
result = recording_create(base, tok, title=title, **create_kwargs)
|
|
358
|
+
code = (result.get("data") or {}).get("code")
|
|
359
|
+
if not code:
|
|
360
|
+
_output(result, jm)
|
|
361
|
+
return
|
|
362
|
+
|
|
363
|
+
click.echo(f" 录音 code: {code}")
|
|
364
|
+
|
|
365
|
+
if file_path:
|
|
366
|
+
click.echo(f"▶ 上传音频文件 {file_path}...")
|
|
367
|
+
upload_result = _upload_file(
|
|
368
|
+
path=file_path,
|
|
369
|
+
base_url=base,
|
|
370
|
+
recording_code=code,
|
|
371
|
+
token=tok,
|
|
372
|
+
api_key=api_key,
|
|
373
|
+
)
|
|
374
|
+
uploaded_url = (upload_result.get("data") or {}).get("url")
|
|
375
|
+
if not uploaded_url:
|
|
376
|
+
click.echo("✗ 上传失败", err=True)
|
|
377
|
+
_output(upload_result, jm)
|
|
378
|
+
return
|
|
379
|
+
|
|
380
|
+
click.echo(f" 文件 URL: {uploaded_url}")
|
|
381
|
+
click.echo("▶ 回写文件 URL...")
|
|
382
|
+
recording_update(base, tok, code, fileUrl=uploaded_url)
|
|
383
|
+
|
|
384
|
+
click.echo("▶ 触发 AI 总结...")
|
|
385
|
+
summary_result = update_summary_template(
|
|
386
|
+
base, tok,
|
|
387
|
+
recordingCode=code,
|
|
388
|
+
summaryTemplatesId=template_id,
|
|
389
|
+
)
|
|
390
|
+
estimated = (summary_result.get("data") or {}).get("totalEstimatedMinutes", "?")
|
|
391
|
+
click.echo(f" 预计耗时:{estimated} 分钟")
|
|
392
|
+
click.echo(f"✓ 完成!录音 code: {code}")
|
|
393
|
+
click.echo(f" 查询总结:aidee --json summary list {code}")
|
|
394
|
+
|
|
395
|
+
if jm:
|
|
396
|
+
_output({"recordingCode": code, "estimatedMinutes": estimated}, jm)
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
def main():
|
|
400
|
+
cli()
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
if __name__ == "__main__":
|
|
404
|
+
main()
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
__init__.py
|
|
3
|
+
aidee_cli.py
|
|
4
|
+
pyproject.toml
|
|
5
|
+
aidee_pro.egg-info/PKG-INFO
|
|
6
|
+
aidee_pro.egg-info/SOURCES.txt
|
|
7
|
+
aidee_pro.egg-info/dependency_links.txt
|
|
8
|
+
aidee_pro.egg-info/entry_points.txt
|
|
9
|
+
aidee_pro.egg-info/requires.txt
|
|
10
|
+
aidee_pro.egg-info/top_level.txt
|
|
11
|
+
core/__init__.py
|
|
12
|
+
core/config.py
|
|
13
|
+
core/device.py
|
|
14
|
+
core/expo.py
|
|
15
|
+
core/feedback.py
|
|
16
|
+
core/firmware.py
|
|
17
|
+
core/group.py
|
|
18
|
+
core/industry.py
|
|
19
|
+
core/membership.py
|
|
20
|
+
core/position.py
|
|
21
|
+
core/recording.py
|
|
22
|
+
core/redemption.py
|
|
23
|
+
core/session.py
|
|
24
|
+
core/summary.py
|
|
25
|
+
core/template.py
|
|
26
|
+
core/template_category.py
|
|
27
|
+
core/thirdparty.py
|
|
28
|
+
core/user.py
|
|
29
|
+
core/websocket.py
|
|
30
|
+
core/word_library.py
|
|
31
|
+
tests/test_core.py
|
|
32
|
+
tests/test_full_e2e.py
|
|
33
|
+
utils/__init__.py
|
|
34
|
+
utils/aidee_backend.py
|
|
35
|
+
utils/output.py
|
|
36
|
+
utils/repl_skin.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Core modules for AIDEE CLI."""
|