@open-dy/ai_coding_sdk 1.0.24 → 1.0.26-beta.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/openapi/core.js
CHANGED
|
@@ -94,7 +94,10 @@ function buildOpenAPIErrorMessage(errMsg, errNo, logId, subErrMsg, subErrNo) {
|
|
|
94
94
|
}
|
|
95
95
|
async function callOpenAPI(params, options) {
|
|
96
96
|
const { path, method = 'GET', queryParams, body, domain = 'open.douyin.com', requiresUserAuth, } = params;
|
|
97
|
-
const
|
|
97
|
+
const providedAccessToken = options?.accessToken ?? options?.delegateToken;
|
|
98
|
+
const accessToken = requiresUserAuth || !isCloudEnvironment()
|
|
99
|
+
? providedAccessToken
|
|
100
|
+
: undefined;
|
|
98
101
|
const envPpeEnv = process.env.APP_ENV?.startsWith('ppe_') ? process.env.APP_ENV : undefined;
|
|
99
102
|
const ppeEnv = options?.ppeEnv || envPpeEnv;
|
|
100
103
|
const extraHeaders = options?.logid ? { 'x-tt-logid': options.logid } : {};
|
|
@@ -56,12 +56,7 @@ export interface TextCensorResult {
|
|
|
56
56
|
/** 审核命中结果 */
|
|
57
57
|
predicts?: TextCensorPredict[];
|
|
58
58
|
}
|
|
59
|
-
export
|
|
60
|
-
/** 日志 ID */
|
|
61
|
-
log_id?: string;
|
|
62
|
-
/** 文本审核结果列表 */
|
|
63
|
-
data?: TextCensorResult[];
|
|
64
|
-
}
|
|
59
|
+
export type TextCensorResponse = TextCensorResult[];
|
|
65
60
|
/**
|
|
66
61
|
* 检测文本是否包含违法违规内容 V2
|
|
67
62
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-dy/ai_coding_sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.26-beta.0",
|
|
4
4
|
"description": "AI Coding SDK — 抖音开放平台 OpenAPI 客户端与工具集",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
],
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "tsc",
|
|
12
|
+
"test": "vitest run",
|
|
12
13
|
"prepublishOnly": "tsc"
|
|
13
14
|
},
|
|
14
15
|
"publishConfig": {
|
|
@@ -22,8 +23,9 @@
|
|
|
22
23
|
],
|
|
23
24
|
"license": "Apache-2.0",
|
|
24
25
|
"devDependencies": {
|
|
26
|
+
"@types/node": "^20.0.0",
|
|
25
27
|
"typescript": "^5.0.0",
|
|
26
|
-
"
|
|
28
|
+
"vitest": "^3.2.7"
|
|
27
29
|
},
|
|
28
30
|
"exports": {
|
|
29
31
|
".": {
|
|
@@ -143,4 +145,4 @@
|
|
|
143
145
|
"default": "./dist/ai_platform_llm/*.js"
|
|
144
146
|
}
|
|
145
147
|
}
|
|
146
|
-
}
|
|
148
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/openapi/im/index.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { CallOptions, OpenAPIResponse } from '../core';
|
|
2
|
-
export interface UploadSitemapRequest {
|
|
3
|
-
/** 小程序 app_id */
|
|
4
|
-
app_id: string;
|
|
5
|
-
/** 页面路径列表 */
|
|
6
|
-
page_paths: string[];
|
|
7
|
-
}
|
|
8
|
-
export interface DeleteIndexRequest {
|
|
9
|
-
/** 小程序 app_id */
|
|
10
|
-
app_id: string;
|
|
11
|
-
/** 在控制台显示的文件名称 */
|
|
12
|
-
name: string;
|
|
13
|
-
/** 待删除路径集合 */
|
|
14
|
-
path_list: string[];
|
|
15
|
-
}
|
|
16
|
-
export interface WebSearchOperationResponse {
|
|
17
|
-
err_no: number;
|
|
18
|
-
err_msg: string;
|
|
19
|
-
log_id: string;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* 提交小程序页面路径
|
|
23
|
-
* - Path: `/api/apps/v1/search/upload_sitemap/`
|
|
24
|
-
* - Capability: `ma.web.search`
|
|
25
|
-
* - Scope: `ma.search`
|
|
26
|
-
* - 需要用户授权: `否`
|
|
27
|
-
*/
|
|
28
|
-
export declare function uploadSitemap(params: UploadSitemapRequest, options?: CallOptions): Promise<OpenAPIResponse<WebSearchOperationResponse>>;
|
|
29
|
-
/**
|
|
30
|
-
* 删除索引
|
|
31
|
-
* - Path: `/api/apps/v1/search/delete_index/`
|
|
32
|
-
* - Capability: `ma.web.search`
|
|
33
|
-
* - Scope: `ma.search`
|
|
34
|
-
* - 需要用户授权: `否`
|
|
35
|
-
*/
|
|
36
|
-
export declare function deleteIndex(params: DeleteIndexRequest, options?: CallOptions): Promise<OpenAPIResponse<WebSearchOperationResponse>>;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.uploadSitemap = uploadSitemap;
|
|
4
|
-
exports.deleteIndex = deleteIndex;
|
|
5
|
-
const core_1 = require("../core");
|
|
6
|
-
/**
|
|
7
|
-
* 提交小程序页面路径
|
|
8
|
-
* - Path: `/api/apps/v1/search/upload_sitemap/`
|
|
9
|
-
* - Capability: `ma.web.search`
|
|
10
|
-
* - Scope: `ma.search`
|
|
11
|
-
* - 需要用户授权: `否`
|
|
12
|
-
*/
|
|
13
|
-
async function uploadSitemap(params, options) {
|
|
14
|
-
return (0, core_1.callOpenAPI)({
|
|
15
|
-
path: '/api/apps/v1/search/upload_sitemap/',
|
|
16
|
-
method: 'POST',
|
|
17
|
-
body: params,
|
|
18
|
-
domain: 'open.douyin.com',
|
|
19
|
-
}, options);
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* 删除索引
|
|
23
|
-
* - Path: `/api/apps/v1/search/delete_index/`
|
|
24
|
-
* - Capability: `ma.web.search`
|
|
25
|
-
* - Scope: `ma.search`
|
|
26
|
-
* - 需要用户授权: `否`
|
|
27
|
-
*/
|
|
28
|
-
async function deleteIndex(params, options) {
|
|
29
|
-
return (0, core_1.callOpenAPI)({
|
|
30
|
-
path: '/api/apps/v1/search/delete_index/',
|
|
31
|
-
method: 'POST',
|
|
32
|
-
body: params,
|
|
33
|
-
domain: 'open.douyin.com',
|
|
34
|
-
}, options);
|
|
35
|
-
}
|