diff --git a/javascript/package.json b/javascript/package.json index cbec243b..0e378e64 100644 --- a/javascript/package.json +++ b/javascript/package.json @@ -1,6 +1,6 @@ { "name": "@baiducloud/qianfan", - "version": "0.1.5-beta.1", + "version": "0.1.5", "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org/" @@ -34,6 +34,7 @@ "crypto-js": "^4.2.0", "dotenv": "^16.4.5", "node-fetch": "2.7.0", + "qianfan-wt": "^0.0.20", "rollup": "^3.29.4", "typescript": "^5.3.3", "web-streams-polyfill": "^4.0.0" @@ -63,4 +64,4 @@ "rollup-plugin-terser": "^7.0.2", "ts-node": "^10.9.2" } -} \ No newline at end of file +} diff --git a/javascript/src/Base/index.ts b/javascript/src/Base/index.ts index 034e2284..eedef5dd 100644 --- a/javascript/src/Base/index.ts +++ b/javascript/src/Base/index.ts @@ -15,7 +15,7 @@ import HttpClient from '../HttpClient'; import Fetch, {FetchConfig} from '../Fetch/index'; import {DEFAULT_HEADERS} from '../constant'; -import {getAccessTokenUrl, getIAMConfig, getDefaultConfig, getPath, getCurrentEnvironment} from '../utils'; +import {getAccessTokenUrl, getIAMConfig, getDefaultConfig, getPath} from '../utils'; import {Resp, AsyncIterableType, AccessTokenResp} from '../interface'; import DynamicModelEndpoint from '../DynamicModelEndpoint'; @@ -100,6 +100,39 @@ export class BaseClient { } } + /** + * 获取 IAM 路径 (配置proxy情况下) + * + * @param type 路径类型 + * @param model 模型名称 + * @returns 返回 IAM 路径 + * @throws 当 qianfanBaseUrl 包含 'aip.baidubce.com' 时,抛出错误提示设置 proxy 的 baseUrl + * @throws 当 qianfanConsoleApiBaseUrl 未设置时,抛出错误提示未设置 qianfanConsoleApiBaseUrl + * @throws 当 Endpoint 未设置且 qianfanConsoleApiBaseUrl 不包含 'qianfan.baidubce.com' 时,抛出错误提示未设置 Endpoint + */ + private async getIAMPath(type, model) { + if (this.qianfanBaseUrl.includes('aip.baidubce.com')) { + throw new Error('请设置proxy的baseUrl'); + } + const dynamicModelEndpoint = new DynamicModelEndpoint( + null, + this.qianfanConsoleApiBaseUrl, + this.qianfanBaseUrl + ); + return await dynamicModelEndpoint.getEndpoint(type, model); + } + + public async getAllModels(type): Promise { + const dynamicModelEndpoint = new DynamicModelEndpoint( + null, + this.qianfanConsoleApiBaseUrl, + this.qianfanBaseUrl + ); + const map = await dynamicModelEndpoint.getDynamicMap(type); + const keysArray: string[] = Array.from(map.keys()); // 将Map的键转换为数组 + return keysArray; + } + protected async sendRequest( type: string, model: string, @@ -107,10 +140,9 @@ export class BaseClient { requestBody: string, stream = false ): Promise { - // 判断当前环境,node需要鉴权,浏览器不需要鉴权(需要设置proxy的baseUrl、consoleUrl)· - const env = getCurrentEnvironment(); let fetchOptions; - if (env === 'node') { + // 如果baseUrl是aip.baidubce.com,证明用户未配置proxy url,则认为需要放开鉴权 + if (this.qianfanBaseUrl.includes('aip.baidubce.com')) { // 检查鉴权信息 if (!(this.qianfanAccessKey && this.qianfanSecretKey) && !(this.qianfanAk && this.qianfanSk)) { throw new Error('请设置AK/SK或QIANFAN_ACCESS_KEY/QIANFAN_SECRET_KEY'); @@ -160,49 +192,18 @@ export class BaseClient { }; } } - else if (env === 'browser') { - // 浏览器环境 需要设置proxy - if (this.qianfanBaseUrl.includes('aip.baidubce.com')) { - throw new Error('请设置proxy的baseUrl'); - } - // 如果设置了管控api,则使用管控api获取最新模型 - if (this.qianfanConsoleApiBaseUrl && !this.qianfanConsoleApiBaseUrl.includes('qianfan.baidubce.com')) { - const dynamicModelEndpoint = new DynamicModelEndpoint( - null, - this.qianfanConsoleApiBaseUrl, - this.qianfanBaseUrl - ); - let IAMPath = ''; - if (this.Endpoint) { - IAMPath = getPath({ - Authentication: 'IAM', - api_base: this.qianfanBaseUrl, - endpoint: this.Endpoint, - type, - }); - } - else { - IAMPath = await dynamicModelEndpoint.getEndpoint(type, model); - } - if (!IAMPath) { - throw new Error(`${model} is not supported`); - } - fetchOptions = { - url: `${this.qianfanBaseUrl}${IAMPath}`, - method: 'POST', - headers: this.headers, - body: requestBody, - }; - } - else { - const url = `${AKPath}`; - fetchOptions = { - url: url, - method: 'POST', - headers: this.headers, - body: requestBody, - }; + else { + // 设置了proxy url走prxoy + const IAMPath = await this.getIAMPath(type, model); + if (!IAMPath) { + throw new Error(`${model} is not supported`); } + fetchOptions = { + url: `${this.qianfanBaseUrl}${IAMPath}`, + method: 'POST', + headers: this.headers, + body: requestBody, + }; } try { const {url, ...rest} = fetchOptions; diff --git a/javascript/src/ChatCompletion/index.ts b/javascript/src/ChatCompletion/index.ts index 57738434..10991340 100644 --- a/javascript/src/ChatCompletion/index.ts +++ b/javascript/src/ChatCompletion/index.ts @@ -14,10 +14,11 @@ import {BaseClient} from '../Base'; import {ChatBody, Resp} from '../interface'; -import {modelInfoMap} from './utils'; -import {getPathAndBody, getUpperCaseModelAndModelMap} from '../utils'; +import {getPathAndBody} from '../utils'; +import {getTypeMap, typeModelEndpointMap} from '../DynamicModelEndpoint/utils'; import {ModelType} from '../enum'; +const type = ModelType.CHAT; class ChatCompletion extends BaseClient { /** * chat @@ -28,22 +29,21 @@ class ChatCompletion extends BaseClient { */ public async chat(body: ChatBody, model = 'ERNIE-Lite-8K'): Promise> { const stream = body.stream ?? false; - const {modelInfoMapUppercase, modelUppercase, modelLowercase} = getUpperCaseModelAndModelMap( - model, - modelInfoMap - ); - const type = ModelType.CHAT; - + const modelKey = model.toLowerCase(); + const typeMap = getTypeMap(typeModelEndpointMap, type) ?? new Map(); + const endPoint = typeMap.get(modelKey) || ''; const {AKPath, requestBody} = getPathAndBody({ - model: Number(this.version) === 2 ? modelLowercase : modelUppercase, - modelInfoMap: modelInfoMapUppercase, baseUrl: this.qianfanBaseUrl, body, - endpoint: this.Endpoint, + endpoint: this.Endpoint ?? endPoint, type, }); return this.sendRequest(type, model, AKPath, requestBody, stream); } + + public async getModels(): Promise { + return this.getAllModels(type); + } } export default ChatCompletion; diff --git a/javascript/src/Completions/index.ts b/javascript/src/Completions/index.ts index c74e9b36..8fe2b1ff 100644 --- a/javascript/src/Completions/index.ts +++ b/javascript/src/Completions/index.ts @@ -16,6 +16,7 @@ import {BaseClient} from '../Base'; import {ChatBody, CompletionBody, Resp} from '../interface'; import {modelInfoMap, isCompletionBody} from './utils'; import {getPathAndBody, getUpperCaseModelAndModelMap} from '../utils'; +import {getTypeMap, typeModelEndpointMap} from '../DynamicModelEndpoint/utils'; import {ModelType} from '../enum'; class Completions extends BaseClient { @@ -50,12 +51,15 @@ class Completions extends BaseClient { else { reqBody = body; } + const modelKey = model.toLowerCase(); + const typeMap = getTypeMap(typeModelEndpointMap, type) ?? new Map(); + const endPoint = typeMap.get(modelKey) || ''; const {AKPath, requestBody} = getPathAndBody({ model: modelUppercase, modelInfoMap: modelInfoMapUppercase, baseUrl: this.qianfanBaseUrl, body: reqBody, - endpoint: this.Endpoint, + endpoint: this.Endpoint ?? endPoint, type, }); return this.sendRequest(type, model, AKPath, requestBody, stream); diff --git a/javascript/src/DynamicModelEndpoint/index.ts b/javascript/src/DynamicModelEndpoint/index.ts index 79d8a393..7563d9b2 100644 --- a/javascript/src/DynamicModelEndpoint/index.ts +++ b/javascript/src/DynamicModelEndpoint/index.ts @@ -140,6 +140,10 @@ class DynamicModelEndpoint { // console.log('Failed to update dynamic model endpoint map', error); } } + public async getDynamicMap(type: string): Promise | undefined> { + await this.updateDynamicModelEndpoint(type); + return this.getDynamicTypeModelEndpointMap().get(type); + } getDynamicMapExpireAt() { return this.dynamicMapExpireAt; diff --git a/javascript/src/Embedding/index.ts b/javascript/src/Embedding/index.ts index 1e8da78f..9cd8d690 100644 --- a/javascript/src/Embedding/index.ts +++ b/javascript/src/Embedding/index.ts @@ -14,8 +14,8 @@ import {BaseClient} from '../Base'; import {EmbeddingBody, EmbeddingResp} from '../interface'; -import {modelInfoMap} from './utils'; -import {getPathAndBody, getUpperCaseModelAndModelMap} from '../utils'; +import {getPathAndBody} from '../utils'; +import {getTypeMap, typeModelEndpointMap} from '../DynamicModelEndpoint/utils'; import {ModelType} from '../enum'; class Eembedding extends BaseClient { @@ -26,14 +26,14 @@ class Eembedding extends BaseClient { * @returns Promise> */ public async embedding(body: EmbeddingBody, model = 'Embedding-V1'): Promise { - const {modelInfoMapUppercase, modelUppercase} = getUpperCaseModelAndModelMap(model, modelInfoMap); const type = ModelType.EMBEDDINGS; + const modelKey = model.toLowerCase(); + const typeMap = getTypeMap(typeModelEndpointMap, type) ?? new Map(); + const endPoint = typeMap.get(modelKey) || ''; const {AKPath, requestBody} = getPathAndBody({ - model: modelUppercase, - modelInfoMap: modelInfoMapUppercase, baseUrl: this.qianfanBaseUrl, body, - endpoint: this.Endpoint, + endpoint: this.Endpoint ?? endPoint, type, }); const resp = await this.sendRequest(type, model, AKPath, requestBody); diff --git a/javascript/src/Images/image2text.ts b/javascript/src/Images/image2text.ts index 63409025..66295c1e 100644 --- a/javascript/src/Images/image2text.ts +++ b/javascript/src/Images/image2text.ts @@ -14,8 +14,8 @@ import {BaseClient} from '../Base'; import {Image2TextBody, RespBase} from '../interface'; -import {image2TextModelInfoMap} from './utils'; -import {getPathAndBody, getUpperCaseModelAndModelMap} from '../utils'; +import {getPathAndBody} from '../utils'; +import {getTypeMap, typeModelEndpointMap} from '../DynamicModelEndpoint/utils'; import {ModelType} from '../enum'; class Image2Text extends BaseClient { @@ -28,14 +28,14 @@ class Image2Text extends BaseClient { body: Image2TextBody, model = 'Fuyu-8B' ): Promise { - const {modelInfoMapUppercase, modelUppercase} = getUpperCaseModelAndModelMap(model, image2TextModelInfoMap); const type = ModelType.IMAGE_2_TEXT; + const modelKey = model.toLowerCase(); + const typeMap = getTypeMap(typeModelEndpointMap, type) ?? new Map(); + const endPoint = typeMap.get(modelKey) || ''; const {AKPath, requestBody} = getPathAndBody({ - model: modelUppercase, - modelInfoMap: modelInfoMapUppercase, baseUrl: this.qianfanBaseUrl, body, - endpoint: this.Endpoint, + endpoint: this.Endpoint ?? endPoint, type, }); const resp = await this.sendRequest(type, model, AKPath, requestBody); diff --git a/javascript/src/Images/text2image.ts b/javascript/src/Images/text2image.ts index 30710552..33925984 100644 --- a/javascript/src/Images/text2image.ts +++ b/javascript/src/Images/text2image.ts @@ -16,6 +16,7 @@ import {BaseClient} from '../Base'; import {Text2ImageBody, Text2ImageResp} from '../interface'; import {text2ImageModelInfoMap} from './utils'; import {getPathAndBody, getUpperCaseModelAndModelMap} from '../utils'; +import {getTypeMap, typeModelEndpointMap} from '../DynamicModelEndpoint/utils'; import {ModelType} from '../enum'; class Text2Image extends BaseClient { @@ -29,14 +30,14 @@ class Text2Image extends BaseClient { body: Text2ImageBody, model = 'Stable-Diffusion-XL' ): Promise { - const {modelInfoMapUppercase, modelUppercase} = getUpperCaseModelAndModelMap(model, text2ImageModelInfoMap); const type = ModelType.TEXT_2_IMAGE; + const modelKey = model.toLowerCase(); + const typeMap = getTypeMap(typeModelEndpointMap, type) ?? new Map(); + const endPoint = typeMap.get(modelKey) || ''; const {AKPath, requestBody} = getPathAndBody({ - model: modelUppercase, - modelInfoMap: modelInfoMapUppercase, baseUrl: this.qianfanBaseUrl, body, - endpoint: this.Endpoint, + endpoint: this.Endpoint ?? endPoint, type, }); const resp = await this.sendRequest(type, model, AKPath, requestBody); diff --git a/javascript/src/Plugin/index.ts b/javascript/src/Plugin/index.ts index 09eca2b9..317049f2 100644 --- a/javascript/src/Plugin/index.ts +++ b/javascript/src/Plugin/index.ts @@ -13,9 +13,9 @@ // limitations under the License. import {BaseClient} from '../Base'; -import {modelInfoMap} from './utilts'; import {PluginsBody, PluginsResp, YiYanPluginBody} from '../interface'; -import {getPathAndBody, getUpperCaseModelAndModelMap} from '../utils'; +import {getPathAndBody} from '../utils'; +import {getTypeMap, typeModelEndpointMap} from '../DynamicModelEndpoint/utils'; import {ModelType} from '../enum'; class Plugin extends BaseClient { @@ -30,15 +30,17 @@ class Plugin extends BaseClient { model = 'EBPluginV2' ): Promise> { const stream = body.stream ?? false; - const {modelInfoMapUppercase, modelUppercase} = getUpperCaseModelAndModelMap(model, modelInfoMap); const type = ModelType.PLUGIN; + const modelKey = model.toLowerCase(); + const typeMap = getTypeMap(typeModelEndpointMap, type) ?? new Map(); + const endPoint = typeMap.get(modelKey) || ''; const {AKPath, requestBody} = getPathAndBody({ - model: modelUppercase, - modelInfoMap: modelInfoMapUppercase, baseUrl: this.qianfanBaseUrl, + endpoint: endPoint, body, type, }); + console.log(AKPath); return (await this.sendRequest(type, model, AKPath, requestBody, stream)) as | PluginsResp | AsyncIterable; diff --git a/javascript/src/Reranker/index.ts b/javascript/src/Reranker/index.ts index 14b475a7..404c4380 100644 --- a/javascript/src/Reranker/index.ts +++ b/javascript/src/Reranker/index.ts @@ -16,6 +16,7 @@ import {BaseClient} from '../Base'; import {modelInfoMap} from './utilts'; import {getPathAndBody, getUpperCaseModelAndModelMap} from '../utils'; import {RerankerBody, RerankerResp} from '../interface'; +import {getTypeMap, typeModelEndpointMap} from '../DynamicModelEndpoint/utils'; import {ModelType} from '../enum'; class Reranker extends BaseClient { @@ -23,12 +24,15 @@ class Reranker extends BaseClient { public async reranker(body: RerankerBody, model = 'bce-reranker-base_v1'): Promise { const {modelInfoMapUppercase, modelUppercase} = getUpperCaseModelAndModelMap(model, modelInfoMap); const type = ModelType.RERANKER; + const modelKey = model.toLowerCase(); + const typeMap = getTypeMap(typeModelEndpointMap, type) ?? new Map(); + const endPoint = typeMap.get(modelKey) || ''; const {AKPath, requestBody} = getPathAndBody({ model: modelUppercase, modelInfoMap: modelInfoMapUppercase, baseUrl: this.qianfanBaseUrl, body, - endpoint: this.Endpoint, + endpoint: this.Endpoint ?? endPoint, type, }); const resp = await this.sendRequest(type, model, AKPath, requestBody); diff --git a/javascript/src/streaming/index.ts b/javascript/src/streaming/index.ts index 8e928d4d..f9478f83 100644 --- a/javascript/src/streaming/index.ts +++ b/javascript/src/streaming/index.ts @@ -169,9 +169,6 @@ export class Stream implements AsyncIterable { const iter = readableStreamAsyncIterable(response.body); for await (const chunk of iter) { - if (chunk[0] === 10) { - continue; - } if (previousChunkLastByte === 10) { buffer = concatUint8Arrays(buffer, chunk as Uint8Array); diff --git a/javascript/src/utils.ts b/javascript/src/utils.ts index 7947f842..2d91b3a0 100644 --- a/javascript/src/utils.ts +++ b/javascript/src/utils.ts @@ -122,6 +122,7 @@ export const getPath = ({ ? `${BASE_PATH}${modelEndpoint}` : `${api_base}${modelEndpoint}`; } + throw new Error('Model is not supported'); }; diff --git a/javascript/yarn.lock b/javascript/yarn.lock index ce13724c..d1b38f88 100644 --- a/javascript/yarn.lock +++ b/javascript/yarn.lock @@ -19,25 +19,25 @@ picocolors "^1.0.0" "@babel/compat-data@^7.22.6", "@babel/compat-data@^7.24.8": - version "7.24.8" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.24.8.tgz#f9196455334c38d059ac8b1a16a51decda9d30d3" - integrity sha512-c4IM7OTg6k1Q+AJ153e2mc2QVTezTwnb4VzquwcyiEzGnW0Kedv4do/TrkU98qPeC5LNiMt/QXwIjzYXLBpyZg== + version "7.24.9" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.24.9.tgz#53eee4e68f1c1d0282aa0eb05ddb02d033fc43a0" + integrity sha512-e701mcfApCJqMMueQI0Fb68Amflj83+dvAvHawoBpAz+GDjCIyGHzNwnefjsWJ3xiYAqqiQFoWbspGYBdb2/ng== "@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.23.9", "@babel/core@^7.24.0": - version "7.24.8" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.24.8.tgz#c24f83985214f599cee5fc26d393d9ab320342f4" - integrity sha512-6AWcmZC/MZCO0yKys4uhg5NlxL0ESF3K6IAaoQ+xSXvPyPyxNWRafP+GDbI88Oh68O7QkJgmEtedWPM9U0pZNg== + version "7.24.9" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.24.9.tgz#dc07c9d307162c97fa9484ea997ade65841c7c82" + integrity sha512-5e3FI4Q3M3Pbr21+5xJwCv6ZT6KmGkI0vw3Tozy5ODAQFTIWe37iT8Cr7Ice2Ntb+M3iSKCEWMB1MBgKrW3whg== dependencies: "@ampproject/remapping" "^2.2.0" "@babel/code-frame" "^7.24.7" - "@babel/generator" "^7.24.8" + "@babel/generator" "^7.24.9" "@babel/helper-compilation-targets" "^7.24.8" - "@babel/helper-module-transforms" "^7.24.8" + "@babel/helper-module-transforms" "^7.24.9" "@babel/helpers" "^7.24.8" "@babel/parser" "^7.24.8" "@babel/template" "^7.24.7" "@babel/traverse" "^7.24.8" - "@babel/types" "^7.24.8" + "@babel/types" "^7.24.9" convert-source-map "^2.0.0" debug "^4.1.0" gensync "^1.0.0-beta.2" @@ -60,12 +60,12 @@ dependencies: eslint-rule-composer "^0.3.0" -"@babel/generator@^7.24.8", "@babel/generator@^7.7.2": - version "7.24.8" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.24.8.tgz#1802d6ac4d77a9199c75ae3eb6a08336e5d1d39a" - integrity sha512-47DG+6F5SzOi0uEvK4wMShmn5yY0mVjVJoWTphdY2B4Rx9wHgjK7Yhtr0ru6nE+sn0v38mzrWOlah0p/YlHHOQ== +"@babel/generator@^7.24.8", "@babel/generator@^7.24.9", "@babel/generator@^7.7.2": + version "7.24.10" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.24.10.tgz#a4ab681ec2a78bbb9ba22a3941195e28a81d8e76" + integrity sha512-o9HBZL1G2129luEUlG1hB4N/nlYNWHnpwlND9eOMclRqqu1YDy2sSYVCFUZwl8I1Gxh+QSRrP2vD7EpUmFVXxg== dependencies: - "@babel/types" "^7.24.8" + "@babel/types" "^7.24.9" "@jridgewell/gen-mapping" "^0.3.5" "@jridgewell/trace-mapping" "^0.3.25" jsesc "^2.5.1" @@ -169,10 +169,10 @@ "@babel/traverse" "^7.24.7" "@babel/types" "^7.24.7" -"@babel/helper-module-transforms@^7.24.7", "@babel/helper-module-transforms@^7.24.8": - version "7.24.8" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.24.8.tgz#b1f2df4f96f3465b0d035b697ec86cb51ff348fe" - integrity sha512-m4vWKVqvkVAWLXfHCCfff2luJj86U+J0/x+0N3ArG/tP0Fq7zky2dYwMbtPmkc/oulkkbjdL3uWzuoBwQ8R00Q== +"@babel/helper-module-transforms@^7.24.7", "@babel/helper-module-transforms@^7.24.8", "@babel/helper-module-transforms@^7.24.9": + version "7.24.9" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.24.9.tgz#e13d26306b89eea569180868e652e7f514de9d29" + integrity sha512-oYbh+rtFKj/HwBQkFlUzvcybzklmVdVV3UU+mN7n2t/q3yGHbuVdNxyFvSBO1tfvjyArpHNcWMAzsSPdyI46hw== dependencies: "@babel/helper-environment-visitor" "^7.24.7" "@babel/helper-module-imports" "^7.24.7" @@ -1052,10 +1052,10 @@ debug "^4.3.1" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.24.7", "@babel/types@^7.24.8", "@babel/types@^7.3.3", "@babel/types@^7.4.4": - version "7.24.8" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.24.8.tgz#d51ffa9043b17d36622efa44e861a49e69e130a8" - integrity sha512-SkSBEHwwJRU52QEVZBmMBnE5Ux2/6WU1grdYyOhpbCNxbmJrDuDCphBzKZSO3taf0zztp+qkWlymE5tVL5l0TA== +"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.24.7", "@babel/types@^7.24.8", "@babel/types@^7.24.9", "@babel/types@^7.3.3", "@babel/types@^7.4.4": + version "7.24.9" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.24.9.tgz#228ce953d7b0d16646e755acf204f4cf3d08cc73" + integrity sha512-xm8XrMKz0IlUdocVbYJe0Z9xEgidU7msskG8BbhnTPK/HZ2z/7FP7ykqPgrUH+C+r414mNfNWam1f2vqOjqjYQ== dependencies: "@babel/helper-string-parser" "^7.24.8" "@babel/helper-validator-identifier" "^7.24.7" @@ -1608,9 +1608,9 @@ form-data "^4.0.0" "@types/node@*", "@types/node@^20.11.13": - version "20.14.10" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.10.tgz#a1a218290f1b6428682e3af044785e5874db469a" - integrity sha512-MdiXf+nDuMvY0gJKxyfZ7/6UFsETO7mGKF54MVD/ekJS6HdFtpZFBgrh6Pseu64XTb2MLyFPlbW6hj8HYRQNOQ== + version "20.14.11" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.11.tgz#09b300423343460455043ddd4d0ded6ac579b74b" + integrity sha512-kprQpL8MMeszbz6ojB5/tU8PLN4kesnN8Gjzw349rDlNgsSzg90lAVj3llK99Dh7JON+t9AuscPPFW6mPbTnSA== dependencies: undici-types "~5.26.4" @@ -1637,36 +1637,36 @@ "@types/yargs-parser" "*" "@typescript-eslint/parser@^7.1.0": - version "7.16.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-7.16.0.tgz#53fae8112f8c912024aea7b499cf7374487af6d8" - integrity sha512-ar9E+k7CU8rWi2e5ErzQiC93KKEFAXA2Kky0scAlPcxYblLt8+XZuHUZwlyfXILyQa95P6lQg+eZgh/dDs3+Vw== - dependencies: - "@typescript-eslint/scope-manager" "7.16.0" - "@typescript-eslint/types" "7.16.0" - "@typescript-eslint/typescript-estree" "7.16.0" - "@typescript-eslint/visitor-keys" "7.16.0" + version "7.16.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-7.16.1.tgz#84c581cf86c8b2becd48d33ddc41a6303d57b274" + integrity sha512-u+1Qx86jfGQ5i4JjK33/FnawZRpsLxRnKzGE6EABZ40KxVT/vWsiZFEBBHjFOljmmV3MBYOHEKi0Jm9hbAOClA== + dependencies: + "@typescript-eslint/scope-manager" "7.16.1" + "@typescript-eslint/types" "7.16.1" + "@typescript-eslint/typescript-estree" "7.16.1" + "@typescript-eslint/visitor-keys" "7.16.1" debug "^4.3.4" -"@typescript-eslint/scope-manager@7.16.0": - version "7.16.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-7.16.0.tgz#eb0757af5720c9c53c8010d7a0355ae27e17b7e5" - integrity sha512-8gVv3kW6n01Q6TrI1cmTZ9YMFi3ucDT7i7aI5lEikk2ebk1AEjrwX8MDTdaX5D7fPXMBLvnsaa0IFTAu+jcfOw== +"@typescript-eslint/scope-manager@7.16.1": + version "7.16.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-7.16.1.tgz#2b43041caabf8ddd74512b8b550b9fc53ca3afa1" + integrity sha512-nYpyv6ALte18gbMz323RM+vpFpTjfNdyakbf3nsLvF43uF9KeNC289SUEW3QLZ1xPtyINJ1dIsZOuWuSRIWygw== dependencies: - "@typescript-eslint/types" "7.16.0" - "@typescript-eslint/visitor-keys" "7.16.0" + "@typescript-eslint/types" "7.16.1" + "@typescript-eslint/visitor-keys" "7.16.1" -"@typescript-eslint/types@7.16.0": - version "7.16.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-7.16.0.tgz#60a19d7e7a6b1caa2c06fac860829d162a036ed2" - integrity sha512-fecuH15Y+TzlUutvUl9Cc2XJxqdLr7+93SQIbcZfd4XRGGKoxyljK27b+kxKamjRkU7FYC6RrbSCg0ALcZn/xw== +"@typescript-eslint/types@7.16.1": + version "7.16.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-7.16.1.tgz#bbab066276d18e398bc64067b23f1ce84dfc6d8c" + integrity sha512-AQn9XqCzUXd4bAVEsAXM/Izk11Wx2u4H3BAfQVhSfzfDOm/wAON9nP7J5rpkCxts7E5TELmN845xTUCQrD1xIQ== -"@typescript-eslint/typescript-estree@7.16.0": - version "7.16.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-7.16.0.tgz#98ac779d526fab2a781e5619c9250f3e33867c09" - integrity sha512-a5NTvk51ZndFuOLCh5OaJBELYc2O3Zqxfl3Js78VFE1zE46J2AaVuW+rEbVkQznjkmlzWsUI15BG5tQMixzZLw== +"@typescript-eslint/typescript-estree@7.16.1": + version "7.16.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-7.16.1.tgz#9b145ba4fd1dde1986697e1ce57dc501a1736dd3" + integrity sha512-0vFPk8tMjj6apaAZ1HlwM8w7jbghC8jc1aRNJG5vN8Ym5miyhTQGMqU++kuBFDNKe9NcPeZ6x0zfSzV8xC1UlQ== dependencies: - "@typescript-eslint/types" "7.16.0" - "@typescript-eslint/visitor-keys" "7.16.0" + "@typescript-eslint/types" "7.16.1" + "@typescript-eslint/visitor-keys" "7.16.1" debug "^4.3.4" globby "^11.1.0" is-glob "^4.0.3" @@ -1674,12 +1674,12 @@ semver "^7.6.0" ts-api-utils "^1.3.0" -"@typescript-eslint/visitor-keys@7.16.0": - version "7.16.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-7.16.0.tgz#a1d99fa7a3787962d6e0efd436575ef840e23b06" - integrity sha512-rMo01uPy9C7XxG7AFsxa8zLnWXTF8N3PYclekWSrurvhwiw1eW88mrKiAYe6s53AUY57nTRz8dJsuuXdkAhzCg== +"@typescript-eslint/visitor-keys@7.16.1": + version "7.16.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-7.16.1.tgz#4287bcf44c34df811ff3bb4d269be6cfc7d8c74b" + integrity sha512-Qlzzx4sE4u3FsHTPQAAQFJFNOuqtuY0LFrZHwQ8IHK705XxBiWOFkfKRWu6niB7hwfgnwIpO4jTC75ozW1PHWg== dependencies: - "@typescript-eslint/types" "7.16.0" + "@typescript-eslint/types" "7.16.1" eslint-visitor-keys "^3.4.3" "@ungap/structured-clone@^1.2.0": @@ -2058,9 +2058,9 @@ camelcase@^6.2.0: integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== caniuse-lite@^1.0.30001640: - version "1.0.30001641" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001641.tgz#3572862cd18befae3f637f2a1101cc033c6782ac" - integrity sha512-Phv5thgl67bHYo1TtMY/MurjkHhV4EDaCosezRXgZ8jzA/Ub+wjxAvbGvjoFENStinwi5kCyOYV3mi5tOGykwA== + version "1.0.30001642" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001642.tgz#6aa6610eb24067c246d30c57f055a9d0a7f8d05f" + integrity sha512-3XQ0DoRgLijXJErLSl+bLnJ+Et4KqV1PY6JJBGAFlsNsz31zeAIncyeZfLCabHK/jtSh+671RM9YMldxjUPZtA== chalk@^2.4.2: version "2.4.2" @@ -2365,14 +2365,14 @@ dotenv@^16.4.5: integrity sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg== electron-to-chromium@^1.4.820: - version "1.4.827" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.827.tgz#76068ed1c71dd3963e1befc8ae815004b2da6a02" - integrity sha512-VY+J0e4SFcNfQy19MEoMdaIcZLmDCprqvBtkii1WTCTQHpRvf5N8+3kTYCgL/PcntvwQvmMJWTuDPsq+IlhWKQ== + version "1.4.830" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.830.tgz#a11899bc3343bc28f57a87fcf83060e0d28038d4" + integrity sha512-TrPKKH20HeN0J1LHzsYLs2qwXrp8TF4nHdu4sq61ozGbzMpWhI7iIOPYPPkxeq1azMT9PZ8enPFcftbs/Npcjg== elliptic@^6.5.3, elliptic@^6.5.5: - version "6.5.5" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.5.tgz#c715e09f78b6923977610d4c2346d6ce22e6dded" - integrity sha512-7EjbcmUm17NQFu4Pmgmq2olYMj8nwMnpcddByChSUjArp8F5DQWcIcpriwO4ZToLNAJig0yiyjswfyGNje/ixw== + version "6.5.6" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.6.tgz#ee5f7c3a00b98a2144ac84d67d01f04d438fa53e" + integrity sha512-mpzdtpeCLuS3BmE3pO3Cpp5bbjlOPY2Q0PgoF+Od1XZrHLYI28Xe3ossCmYCQt11FQKEYd9+PF8jymTvtWJSHQ== dependencies: bn.js "^4.11.9" brorand "^1.1.0" @@ -2927,9 +2927,9 @@ is-builtin-module@^3.2.1: builtin-modules "^3.3.0" is-core-module@^2.13.0: - version "2.14.0" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.14.0.tgz#43b8ef9f46a6a08888db67b1ffd4ec9e3dfd59d1" - integrity sha512-a5dFJih5ZLYlRtDc0dZWP7RiKr6xIKzmn/oAYCDvdLThadVgyJwlaoQPmRtMSpz+rk0OGAgIu+TcM9HUF0fk1A== + version "2.15.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.15.0.tgz#71c72ec5442ace7e76b306e9d48db361f22699ea" + integrity sha512-Dd+Lb2/zvk9SKy1TGCt1wFJFo/MWBPMX5x7KcvLajWTGuomczdQX61PvY5yK6SVACwpoexWo81IfFyoKY2QnTA== dependencies: hasown "^2.0.2" @@ -3777,9 +3777,9 @@ node-int64@^0.4.0: integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== node-releases@^2.0.14: - version "2.0.14" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.14.tgz#2ffb053bceb8b2be8495ece1ab6ce600c4461b0b" - integrity sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw== + version "2.0.17" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.17.tgz#d74bc4fec38d839eec5db2a3c9c963d4f33cb366" + integrity sha512-Ww6ZlOiEQfPfXM45v17oabk77Z7mg5bOt7AjDyzy7RjK9OrLrLC8dyZQoAPEOtFX9SaNf1Tdvr5gRJWdTJj7GA== normalize-path@^3.0.0: version "3.0.0" @@ -3964,9 +3964,9 @@ prelude-ls@^1.2.1: integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== prettier@^3.2.5: - version "3.3.2" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.3.2.tgz#03ff86dc7c835f2d2559ee76876a3914cec4a90a" - integrity sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA== + version "3.3.3" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.3.3.tgz#30c54fe0be0d8d12e6ae61dbb10109ea00d53105" + integrity sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew== pretty-format@^29.0.0, pretty-format@^29.7.0: version "29.7.0" @@ -4027,6 +4027,43 @@ pure-rand@^6.0.0: resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.1.0.tgz#d173cf23258231976ccbdb05247c9787957604f2" integrity sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA== +qianfan-wt@^0.0.20: + version "0.0.20" + resolved "https://registry.yarnpkg.com/qianfan-wt/-/qianfan-wt-0.0.20.tgz#3ca1d4240646b727b376feec5f183eecd0d0aa14" + integrity sha512-wLJIuH2+7N8OCdOhQ0swysiBmlwnQ866RbUFo9MW0cVpVtQn6fMHAny4vqn3HcDcwYqVJM5dkDdSZAVSXI67Jg== + dependencies: + "@babel/preset-react" "^7.24.6" + "@rollup/plugin-inject" "^5.0.5" + "@rollup/plugin-json" "^6.1.0" + "@types/node-fetch" "^2.6.11" + async-mutex "^0.5.0" + bottleneck "^2.19.5" + crypto-js "^4.2.0" + dotenv "^16.4.5" + node-fetch "2.7.0" + qianfan-wt "^0.1.5-beta.2" + rollup "^3.29.4" + typescript "^5.3.3" + web-streams-polyfill "^4.0.0" + +qianfan-wt@^0.1.5-beta.2: + version "0.1.5-beta.2" + resolved "https://registry.yarnpkg.com/qianfan-wt/-/qianfan-wt-0.1.5-beta.2.tgz#086164065485a6d61f1986b5a3df7c1892b876ae" + integrity sha512-wAQINlb4R6WF/imiSTZvjHujXYKXXc7ioq4L6gIDMz3sdMP44qbusWtQNPKTJD/axCryoINICLw3c1RR8tWoyw== + dependencies: + "@babel/preset-react" "^7.24.6" + "@rollup/plugin-inject" "^5.0.5" + "@rollup/plugin-json" "^6.1.0" + "@types/node-fetch" "^2.6.11" + async-mutex "^0.5.0" + bottleneck "^2.19.5" + crypto-js "^4.2.0" + dotenv "^16.4.5" + node-fetch "2.7.0" + rollup "^3.29.4" + typescript "^5.3.3" + web-streams-polyfill "^4.0.0" + queue-microtask@^1.2.2: version "1.2.3" resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" @@ -4271,9 +4308,9 @@ semver@^6.3.0, semver@^6.3.1: integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== semver@^7.3.5, semver@^7.5.3, semver@^7.5.4, semver@^7.6.0: - version "7.6.2" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.2.tgz#1e3b34759f896e8f14d6134732ce798aeb0c6e13" - integrity sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w== + version "7.6.3" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143" + integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== semver@~2.3.1: version "2.3.2" @@ -4450,9 +4487,9 @@ supports-preserve-symlinks-flag@^1.0.0: integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== terser@^5.0.0: - version "5.31.2" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.31.2.tgz#b5ca188107b706084dca82f988089fa6102eba11" - integrity sha512-LGyRZVFm/QElZHy/CPr/O4eNZOZIzsrQ92y4v9UJe/pFJjypje2yI3C2FmPtvUEnhadlSbmG2nXtdcjHOjCfxw== + version "5.31.3" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.31.3.tgz#b24b7beb46062f4653f049eea4f0cd165d0f0c38" + integrity sha512-pAfYn3NIZLyZpa83ZKigvj6Rn9c/vd5KfYGX7cN1mnzqgDcxWvrU5ZtAfIKhEXz9nRecw4z3LXkjaq96/qZqAA== dependencies: "@jridgewell/source-map" "^0.3.3" acorn "^8.8.2"