@open-dy/ai_coding_sdk 1.0.10 → 1.0.12

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.
Files changed (52) hide show
  1. package/README.md +37 -0
  2. package/dist/ai_platform_llm/client.d.ts +29 -0
  3. package/dist/ai_platform_llm/client.js +107 -0
  4. package/dist/ai_platform_llm/core.d.ts +22 -0
  5. package/dist/ai_platform_llm/core.js +229 -0
  6. package/dist/ai_platform_llm/index.d.ts +4 -0
  7. package/dist/ai_platform_llm/index.js +25 -0
  8. package/dist/ai_platform_llm/permission.d.ts +15 -0
  9. package/dist/ai_platform_llm/permission.js +44 -0
  10. package/dist/ai_platform_llm/types.d.ts +312 -0
  11. package/dist/ai_platform_llm/types.js +2 -0
  12. package/dist/auth/access-token.d.ts +139 -0
  13. package/dist/auth/access-token.js +99 -0
  14. package/dist/auth/core.d.ts +15 -0
  15. package/dist/auth/core.js +76 -0
  16. package/dist/auth/index.d.ts +4 -0
  17. package/dist/auth/index.js +9 -0
  18. package/dist/index.d.ts +2 -0
  19. package/dist/index.js +3 -1
  20. package/dist/openapi/account/ai_data.d.ts +18 -1
  21. package/dist/openapi/account/ai_data.js +6 -1
  22. package/dist/openapi/account/ai_items.d.ts +22 -1
  23. package/dist/openapi/account/ai_items.js +9 -1
  24. package/dist/openapi/account/ai_profile.d.ts +15 -1
  25. package/dist/openapi/account/ai_profile.js +6 -1
  26. package/dist/openapi/account/identity.d.ts +6 -2
  27. package/dist/openapi/account/identity.js +4 -2
  28. package/dist/openapi/account/profile.d.ts +9 -1
  29. package/dist/openapi/account/profile.js +8 -1
  30. package/dist/openapi/comment/comment.d.ts +18 -1
  31. package/dist/openapi/comment/comment.js +6 -1
  32. package/dist/openapi/content/follow.d.ts +2 -0
  33. package/dist/openapi/content/recommend.d.ts +18 -0
  34. package/dist/openapi/content/video.d.ts +11 -1
  35. package/dist/openapi/content/video.js +8 -1
  36. package/dist/openapi/core.d.ts +3 -0
  37. package/dist/openapi/hot/hot.d.ts +9 -1
  38. package/dist/openapi/hot/hot.js +6 -1
  39. package/dist/openapi/platform/following.d.ts +21 -1
  40. package/dist/openapi/platform/following.js +6 -1
  41. package/dist/openapi/platform/topic.d.ts +9 -1
  42. package/dist/openapi/platform/topic.js +6 -1
  43. package/dist/openapi/platform/user-basic.d.ts +17 -1
  44. package/dist/openapi/platform/user-basic.js +6 -1
  45. package/dist/openapi/search/experience.d.ts +32 -0
  46. package/dist/openapi/search/general.d.ts +11 -0
  47. package/dist/openapi/search/music.d.ts +14 -0
  48. package/dist/openapi/search/poi.d.ts +27 -0
  49. package/dist/openapi/search/search.d.ts +51 -0
  50. package/dist/openapi/search/vision.d.ts +14 -1
  51. package/dist/openapi/search/vision.js +7 -1
  52. package/package.json +17 -1
@@ -1,12 +1,20 @@
1
1
  import type { CallOptions, OpenAPIResponse } from '../core';
2
2
  export interface SearchExperienceParams {
3
+ /** 搜索关键词 */
3
4
  keyword: string;
5
+ /** 设备 ID */
4
6
  device_id?: number;
7
+ /** 抖音用户 ID */
5
8
  uid?: string;
9
+ /** 分页游标,第一页传 0,后续传上一页返回的 cursor */
6
10
  cursor?: number;
11
+ /** 每页数量 */
7
12
  count?: number;
13
+ /** 搜索 ID,首刷传空,loadmore 时传上一页返回的 search_id */
8
14
  search_id?: string;
15
+ /** 排序类型 */
9
16
  sort_type?: number;
17
+ /** 内容类型 */
10
18
  content_type?: number;
11
19
  }
12
20
  /**
@@ -21,20 +29,30 @@ export interface ExperienceCover {
21
29
  * 图文搜索结果项。
22
30
  */
23
31
  export interface SearchExperienceItem {
32
+ /** 视频/作品 ID */
24
33
  item_id: string;
34
+ /** 标题 */
25
35
  title: string;
36
+ /** 封面图 URL */
26
37
  cover: ExperienceCover;
38
+ /** 内容类型 */
27
39
  content_type: number;
40
+ /** 时长(秒) */
28
41
  duration: number;
42
+ /** 用户昵称 */
29
43
  nickname: string;
30
44
  }
31
45
  /**
32
46
  * 图文搜索响应数据。
33
47
  */
34
48
  export interface SearchExperienceResponse {
49
+ /** 分页游标,第一页传 0,后续传上一页返回的 cursor */
35
50
  cursor: number;
51
+ /** 是否有更多数据 */
36
52
  has_more: boolean;
53
+ /** 搜索 ID,首刷传空,loadmore 时传上一页返回的 search_id */
37
54
  search_id: string;
55
+ /** 数据列表 */
38
56
  data: SearchExperienceItem[];
39
57
  }
40
58
  /**
@@ -46,29 +64,43 @@ export declare function searchExperience(params: SearchExperienceParams, options
46
64
  * 音乐搜索参数。
47
65
  */
48
66
  export interface SearchMusicParams {
67
+ /** 搜索关键词 */
49
68
  keyword: string;
69
+ /** 分页游标,第一页传 0,后续传上一页返回的 cursor */
50
70
  cursor?: string;
71
+ /** 每页数量 */
51
72
  count?: number;
52
73
  }
53
74
  /**
54
75
  * 音乐搜索结果项。
55
76
  */
56
77
  export interface SearchMusicItem {
78
+ /** 音乐 ID */
57
79
  mid: string;
80
+ /** 封面图 URL */
58
81
  cover: string[];
82
+ /** 作者信息 */
59
83
  author: string;
84
+ /** 时长(秒) */
60
85
  duration: number;
86
+ /** 播放地址 */
61
87
  play_addr: string;
88
+ /** 标题 */
62
89
  title: string;
90
+ /** 音乐标签 */
63
91
  tag: string;
92
+ /** 抖音分享 URL */
64
93
  doyin_share_url: string;
65
94
  }
66
95
  /**
67
96
  * 音乐搜索响应数据。
68
97
  */
69
98
  export interface SearchMusicResponse {
99
+ /** 分页游标,第一页传 0,后续传上一页返回的 cursor */
70
100
  cursor: number;
101
+ /** 是否有更多数据 */
71
102
  has_more: boolean;
103
+ /** 搜索结果列表 */
72
104
  result: SearchMusicItem[];
73
105
  }
74
106
  /**
@@ -1,20 +1,31 @@
1
1
  import type { CallOptions, OpenAPIResponse } from '../core';
2
2
  export interface GeneralSearchParams {
3
+ /** 搜索关键词 */
3
4
  keyword: string;
5
+ /** 分页游标,第一页传 0,后续传上一页返回的 cursor */
4
6
  cursor?: number;
7
+ /** 每页数量 */
5
8
  count?: number;
9
+ /** 搜索 ID,首刷传空,loadmore 时传上一页返回的 search_id */
6
10
  search_id?: string;
7
11
  }
8
12
  export interface GeneralSearchItem {
13
+ /** 视频/作品 ID */
9
14
  item_id: string;
15
+ /** 标题 */
10
16
  title: string;
17
+ /** 封面图 URL */
11
18
  cover: string;
12
19
  item_type: number;
20
+ /** 作者名称 */
13
21
  author_name: string;
14
22
  }
15
23
  export interface GeneralSearchResponse {
24
+ /** 分页游标,第一页传 0,后续传上一页返回的 cursor */
16
25
  cursor: number;
26
+ /** 是否有更多数据 */
17
27
  has_more: boolean;
28
+ /** 数据列表 */
18
29
  data: GeneralSearchItem[];
19
30
  }
20
31
  /**
@@ -1,28 +1,42 @@
1
1
  import type { CallOptions, OpenAPIResponse } from '../core';
2
2
  export interface SearchMusicParams {
3
+ /** 搜索关键词 */
3
4
  keyword: string;
5
+ /** 分页游标,第一页传 0,后续传上一页返回的 cursor */
4
6
  cursor?: string;
7
+ /** 每页数量 */
5
8
  count?: number;
6
9
  }
7
10
  /**
8
11
  * 音乐搜索结果项。
9
12
  */
10
13
  export interface SearchMusicItem {
14
+ /** 音乐 ID */
11
15
  mid: string;
16
+ /** 封面图 URL */
12
17
  cover: string[];
18
+ /** 作者信息 */
13
19
  author: string;
20
+ /** 时长(秒) */
14
21
  duration: number;
22
+ /** 播放地址 */
15
23
  play_addr: string;
24
+ /** 标题 */
16
25
  title: string;
26
+ /** 音乐标签 */
17
27
  tag: string;
28
+ /** 抖音分享 URL */
18
29
  doyin_share_url: string;
19
30
  }
20
31
  /**
21
32
  * 音乐搜索响应数据。
22
33
  */
23
34
  export interface SearchMusicResponse {
35
+ /** 分页游标,第一页传 0,后续传上一页返回的 cursor */
24
36
  cursor: number;
37
+ /** 是否有更多数据 */
25
38
  has_more: boolean;
39
+ /** 搜索结果列表 */
26
40
  result: SearchMusicItem[];
27
41
  }
28
42
  /**
@@ -1,47 +1,74 @@
1
1
  import type { CallOptions, OpenAPIResponse } from '../core';
2
2
  export interface PoiSearchParams {
3
+ /** 搜索关键词 */
3
4
  keyword: string;
5
+ /** 每页数量 */
4
6
  count: number;
7
+ /** 分页游标,第一页传 0,后续传上一页返回的 cursor */
5
8
  cursor?: number;
9
+ /** 搜索 ID,首刷传空,loadmore 时传上一页返回的 search_id */
6
10
  search_id?: string;
11
+ /** 设备 ID */
7
12
  device_id?: string;
8
13
  sort_params?: {
9
14
  filter_params?: Array<{
10
15
  id?: string;
16
+ /** 榜单类型 */
11
17
  type?: string;
18
+ /** 条件字段 */
12
19
  condition_field?: string;
20
+ /** 条件值 */
13
21
  condition_value?: string;
22
+ /** 日志信息 */
14
23
  log_info?: {
15
24
  data_id?: string;
16
25
  };
26
+ /** 日志文本 */
17
27
  log_text?: string;
18
28
  }>;
19
29
  rank_param?: {
20
30
  id?: string;
31
+ /** 榜单类型 */
21
32
  type?: string;
33
+ /** 条件字段 */
22
34
  condition_field?: string;
35
+ /** 条件值 */
23
36
  condition_value?: string;
37
+ /** 日志信息 */
24
38
  log_info?: {
25
39
  data_id?: string;
26
40
  };
41
+ /** 日志文本 */
27
42
  log_text?: string;
28
43
  };
29
44
  };
30
45
  }
31
46
  export interface PoiItem {
47
+ /** POI ID */
32
48
  poi_id: string;
49
+ /** POI 名称 */
33
50
  poi_name: string;
51
+ /** 地址 */
34
52
  address: string;
53
+ /** 城市 */
35
54
  city: string;
55
+ /** 纬度 */
36
56
  latitude: number;
57
+ /** 经度 */
37
58
  longitude: number;
59
+ /** 均价 */
38
60
  avg_price: number;
61
+ /** POI 图片 URL */
39
62
  poi_image: string;
40
63
  }
41
64
  export interface PoiSearchResponse {
65
+ /** 分页游标,第一页传 0,后续传上一页返回的 cursor */
42
66
  cursor: number;
67
+ /** 是否有更多数据 */
43
68
  has_more: boolean;
69
+ /** 搜索 ID,首刷传空,loadmore 时传上一页返回的 search_id */
44
70
  search_id: string;
71
+ /** 数据列表 */
45
72
  data: PoiItem[];
46
73
  }
47
74
  export declare function searchPoi(params: PoiSearchParams, options?: CallOptions): Promise<OpenAPIResponse<PoiSearchResponse>>;
@@ -1,31 +1,50 @@
1
1
  import type { CallOptions, OpenAPIResponse } from '../core';
2
2
  export interface VideoSearchParams {
3
3
  [key: string]: string | number | undefined;
4
+ /** 设备 ID */
4
5
  device_id: number;
6
+ /** 搜索关键词 */
5
7
  keyword: string;
8
+ /** 每页数量 */
6
9
  count: number;
10
+ /** 分页游标,第一页传 0,后续传上一页返回的 cursor */
7
11
  cursor?: number;
12
+ /** 用户的 open_id */
8
13
  open_id?: string;
9
14
  publish_time?: number;
15
+ /** 搜索 ID,首刷传空,loadmore 时传上一页返回的 search_id */
10
16
  search_id?: string;
17
+ /** 排序类型 */
11
18
  sort_type?: number;
12
19
  }
13
20
  export interface VideoSearchItem {
21
+ /** 视频/作品 ID */
14
22
  item_id: string;
23
+ /** 标题 */
15
24
  title: string;
25
+ /** 封面图 URL */
16
26
  cover: string;
27
+ /** 创建时间(时间戳) */
17
28
  create_time: number;
29
+ /** 用户头像 URL */
18
30
  avatar: string;
31
+ /** 用户昵称 */
19
32
  nickname: string;
20
33
  statistics: {
34
+ /** 点赞数 */
21
35
  digg_count: number;
22
36
  };
37
+ /** 视频链接 */
23
38
  link: string;
24
39
  }
25
40
  export interface VideoSearchResponse {
41
+ /** 视频列表 */
26
42
  video_list: VideoSearchItem[];
43
+ /** 是否有更多数据 */
27
44
  has_more: boolean;
45
+ /** 分页游标,第一页传 0,后续传上一页返回的 cursor */
28
46
  cursor: number;
47
+ /** 搜索 ID,首刷传空,loadmore 时传上一页返回的 search_id */
29
48
  search_id: string;
30
49
  }
31
50
  /**
@@ -36,9 +55,13 @@ export declare function searchVideo(params: VideoSearchParams, options?: CallOpt
36
55
  * 用户星座信息响应数据。
37
56
  */
38
57
  export interface SearchUserParams {
58
+ /** 搜索 ID,首刷传空,loadmore 时传上一页返回的 search_id */
39
59
  search_id?: string;
60
+ /** 搜索关键词 */
40
61
  keyword: string;
62
+ /** 分页游标,第一页传 0,后续传上一页返回的 cursor */
41
63
  cursor?: string;
64
+ /** 每页数量 */
42
65
  count?: number;
43
66
  }
44
67
  /**
@@ -53,21 +76,32 @@ export interface AvatarThumb {
53
76
  * 搜索结果用户项。
54
77
  */
55
78
  export interface SearchUserItem {
79
+ /** 用户昵称 */
56
80
  nickname: string;
81
+ /** 用户头像缩略图 */
57
82
  avatar_thumb: AvatarThumb;
83
+ /** 自定义认证信息 */
58
84
  custom_verify: string;
85
+ /** 认证类型 */
59
86
  verification_type: number;
87
+ /** 账号认证信息 */
60
88
  account_cert_info: string;
89
+ /** 直播状态 */
61
90
  live_status: number;
91
+ /** 直播间 ID */
62
92
  room_id: number;
63
93
  }
64
94
  /**
65
95
  * 搜索用户响应数据。
66
96
  */
67
97
  export interface SearchUserResponse {
98
+ /** 分页游标,第一页传 0,后续传上一页返回的 cursor */
68
99
  cursor: number;
100
+ /** 是否有更多数据 */
69
101
  has_more: boolean;
102
+ /** 搜索 ID,首刷传空,loadmore 时传上一页返回的 search_id */
70
103
  search_id: string;
104
+ /** 搜索结果列表 */
71
105
  result: SearchUserItem[];
72
106
  }
73
107
  /**
@@ -79,16 +113,22 @@ export declare function searchUser(params: SearchUserParams, options?: CallOptio
79
113
  * 搜索用户参数。
80
114
  */
81
115
  export interface SearchLiveParams {
116
+ /** 搜索 ID,首刷传空,loadmore 时传上一页返回的 search_id */
82
117
  search_id?: string;
118
+ /** 搜索关键词 */
83
119
  keyword: string;
120
+ /** 分页游标,第一页传 0,后续传上一页返回的 cursor */
84
121
  cursor?: string;
122
+ /** 每页数量 */
85
123
  count?: number;
86
124
  }
87
125
  /**
88
126
  * 直播作者信息。
89
127
  */
90
128
  export interface LiveAuthor {
129
+ /** 用户昵称 */
91
130
  nickname: string;
131
+ /** 用户头像缩略图 */
92
132
  avatar_thumb: AvatarThumb;
93
133
  }
94
134
  /**
@@ -101,31 +141,42 @@ export interface LiveCover {
101
141
  * 直播原始数据。
102
142
  */
103
143
  export interface LiveRawData {
144
+ /** 视频流标签 */
104
145
  video_feed_tag: string;
146
+ /** 直播间 ID(字符串) */
105
147
  id_str: string;
148
+ /** 状态 */
106
149
  status: number;
150
+ /** 封面图 URL */
107
151
  cover: LiveCover;
152
+ /** 标题 */
108
153
  title: string;
109
154
  }
110
155
  /**
111
156
  * 直播信息。
112
157
  */
113
158
  export interface LiveInfo {
159
+ /** 作者信息 */
114
160
  author: LiveAuthor;
161
+ /** 原始数据 */
115
162
  rawdata: LiveRawData;
116
163
  }
117
164
  /**
118
165
  * 搜索直播结果项。
119
166
  */
120
167
  export interface SearchLiveItem {
168
+ /** 直播信息 */
121
169
  lives: LiveInfo;
122
170
  }
123
171
  /**
124
172
  * 搜索直播响应数据。
125
173
  */
126
174
  export interface SearchLiveResponse {
175
+ /** 数据列表 */
127
176
  data: SearchLiveItem[];
177
+ /** 分页游标,第一页传 0,后续传上一页返回的 cursor */
128
178
  cursor: number;
179
+ /** 是否有更多数据 */
129
180
  has_more: boolean;
130
181
  }
131
182
  /**
@@ -24,14 +24,27 @@ export interface VisionSearchParams {
24
24
  ts: string;
25
25
  }
26
26
  export interface VisionSearchItem {
27
+ /** 视频/作品 ID */
27
28
  item_id: string;
29
+ /** 标题 */
28
30
  title: string;
31
+ /** 封面图 URL */
29
32
  cover: string;
33
+ /** 作者名称 */
30
34
  author_name: string;
35
+ /** 相似度 */
31
36
  similarity: number;
32
37
  }
33
38
  export interface VisionSearchResponse {
39
+ /** 业务配置 */
34
40
  business_config: Record<string, unknown>;
41
+ /** 业务数据 */
35
42
  business_data: VisionSearchItem[];
36
43
  }
37
- export declare function searchVision(params: VisionSearchParams, options?: CallOptions): Promise<OpenAPIResponse<VisionSearchResponse>>;
44
+ export declare function searchVision(
45
+ /**
46
+ * 抖音视觉图搜(dy.open.vison.search)
47
+ * 以图搜图,支持 URL/Blob/ArrayBuffer/Uint8Array/base64 格式的图片
48
+ * @param params.image 图片(URL 会自动下载后以 form-data 上传)
49
+ */
50
+ params: VisionSearchParams, options?: CallOptions): Promise<OpenAPIResponse<VisionSearchResponse>>;
@@ -33,7 +33,13 @@ async function downloadImageAsBlob(url) {
33
33
  }
34
34
  return await resp.blob();
35
35
  }
36
- async function searchVision(params, options) {
36
+ async function searchVision(
37
+ /**
38
+ * 抖音视觉图搜(dy.open.vison.search)
39
+ * 以图搜图,支持 URL/Blob/ArrayBuffer/Uint8Array/base64 格式的图片
40
+ * @param params.image 图片(URL 会自动下载后以 form-data 上传)
41
+ */
42
+ params, options) {
37
43
  const { image: _, ...queryParams } = params;
38
44
  const imageBlob = typeof params.image === 'string' && isImageUrl(params.image)
39
45
  ? await downloadImageAsBlob(params.image)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-dy/ai_coding_sdk",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "AI Coding SDK — 抖音开放平台 OpenAPI 客户端与工具集",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -85,6 +85,22 @@
85
85
  "./openapi/platform/*": {
86
86
  "types": "./dist/openapi/platform/*.d.ts",
87
87
  "default": "./dist/openapi/platform/*.js"
88
+ },
89
+ "./auth": {
90
+ "types": "./dist/auth/index.d.ts",
91
+ "default": "./dist/auth/index.js"
92
+ },
93
+ "./auth/*": {
94
+ "types": "./dist/auth/*.d.ts",
95
+ "default": "./dist/auth/*.js"
96
+ },
97
+ "./ai_platform_llm": {
98
+ "types": "./dist/ai_platform_llm/index.d.ts",
99
+ "default": "./dist/ai_platform_llm/index.js"
100
+ },
101
+ "./ai_platform_llm/*": {
102
+ "types": "./dist/ai_platform_llm/*.d.ts",
103
+ "default": "./dist/ai_platform_llm/*.js"
88
104
  }
89
105
  }
90
106
  }