@wzyjs/utils 0.3.4 → 0.3.7

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/node.esm.js CHANGED
@@ -358,9 +358,9 @@ var require_lodash = __commonJS((exports, module) => {
358
358
  var freeProcess = moduleExports && freeGlobal.process;
359
359
  var nodeUtil = function() {
360
360
  try {
361
- var types = freeModule && freeModule.require && freeModule.require("util").types;
362
- if (types) {
363
- return types;
361
+ var types2 = freeModule && freeModule.require && freeModule.require("util").types;
362
+ if (types2) {
363
+ return types2;
364
364
  }
365
365
  return freeProcess && freeProcess.binding && freeProcess.binding("util");
366
366
  } catch (e) {}
@@ -723,7 +723,7 @@ var require_lodash = __commonJS((exports, module) => {
723
723
  var objectCtorString = funcToString.call(Object2);
724
724
  var oldDash = root._;
725
725
  var reIsNative = RegExp2("^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
726
- var Buffer2 = moduleExports ? context.Buffer : undefined2, Symbol2 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined2, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined2, symIterator = Symbol2 ? Symbol2.iterator : undefined2, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined2;
726
+ var Buffer2 = moduleExports ? context.Buffer : undefined2, Symbol2 = context.Symbol, Uint8Array = context.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined2, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined2, symIterator = Symbol2 ? Symbol2.iterator : undefined2, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined2;
727
727
  var defineProperty = function() {
728
728
  try {
729
729
  var func = getNative(Object2, "defineProperty");
@@ -1981,7 +1981,7 @@ var require_lodash = __commonJS((exports, module) => {
1981
1981
  }
1982
1982
  function cloneArrayBuffer(arrayBuffer) {
1983
1983
  var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength);
1984
- new Uint8Array2(result2).set(new Uint8Array2(arrayBuffer));
1984
+ new Uint8Array(result2).set(new Uint8Array(arrayBuffer));
1985
1985
  return result2;
1986
1986
  }
1987
1987
  function cloneDataView(dataView, isDeep) {
@@ -2563,7 +2563,7 @@ var require_lodash = __commonJS((exports, module) => {
2563
2563
  object = object.buffer;
2564
2564
  other = other.buffer;
2565
2565
  case arrayBufferTag:
2566
- if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object), new Uint8Array2(other))) {
2566
+ if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
2567
2567
  return false;
2568
2568
  }
2569
2569
  return true;
@@ -5441,14 +5441,6 @@ __p += '`;
5441
5441
  }).call(exports);
5442
5442
  });
5443
5443
 
5444
- // src/node.ts
5445
- var import_lodash = __toESM(require_lodash(), 1);
5446
- import { default as default2, DataStoreOptions } from "nedb";
5447
- import * as cheerio from "cheerio";
5448
- import { default as default4 } from "axios";
5449
- import { default as default5 } from "json5";
5450
- import { default as default6 } from "consola";
5451
-
5452
5444
  // ../../node_modules/zod/v3/external.js
5453
5445
  var exports_external = {};
5454
5446
  __export(exports_external, {
@@ -9422,13 +9414,13 @@ var coerce = {
9422
9414
  date: (arg) => ZodDate.create({ ...arg, coerce: true })
9423
9415
  };
9424
9416
  var NEVER = INVALID;
9425
- // src/common/ai/302/index.ts
9426
- var exports_302 = {};
9427
- __export(exports_302, {
9428
- image: () => exports_image,
9429
- chat: () => chat,
9430
- audio: () => exports_audio
9431
- });
9417
+ // src/node.ts
9418
+ var import_lodash = __toESM(require_lodash(), 1);
9419
+ import * as cheerio from "cheerio";
9420
+ import { default as default3 } from "axios";
9421
+ import { default as default4 } from "json5";
9422
+ import { default as default5 } from "consola";
9423
+ import { default as default6, DataStoreOptions } from "nedb";
9432
9424
 
9433
9425
  // src/common/ai/302/axios.ts
9434
9426
  import axios_ from "axios";
@@ -9453,7 +9445,7 @@ var chat = async (message, model = "gpt-4.1", isParse = true) => {
9453
9445
  message
9454
9446
  }
9455
9447
  });
9456
- console.log(666, "302 chat res", typeof data, data);
9448
+ console.log(666, typeof data, data);
9457
9449
  const output = typeof data === "string" ? json5.parse(data)?.output : data?.output;
9458
9450
  if (isParse) {
9459
9451
  const match = /```(json)?(.*)```/s.exec(output);
@@ -9465,415 +9457,9 @@ var chat = async (message, model = "gpt-4.1", isParse = true) => {
9465
9457
  }
9466
9458
  return output;
9467
9459
  } catch (error) {
9468
- const responseData = error?.response?.data;
9469
- const message2 = responseData?.error?.message_cn || responseData?.error?.message || responseData?.message || error?.response?.statusText || error?.message || "未知原因";
9470
- throw new Error(message2);
9460
+ throw new Error(error?.response?.statusText || error?.message || "未知原因");
9471
9461
  }
9472
9462
  };
9473
- // src/common/ai/302/audio/index.ts
9474
- var exports_audio = {};
9475
- __export(exports_audio, {
9476
- tts: () => exports_tts,
9477
- doubao: () => exports_doubao
9478
- });
9479
-
9480
- // src/common/ai/302/audio/tts.ts
9481
- var exports_tts = {};
9482
- __export(exports_tts, {
9483
- textToSpeech: () => textToSpeech,
9484
- fetchTask: () => fetchTask,
9485
- fetchProviders: () => fetchProviders
9486
- });
9487
- var fetchProviders = async () => {
9488
- try {
9489
- const { data } = await axios({
9490
- url: "/302/tts/provider",
9491
- method: "get"
9492
- });
9493
- return data;
9494
- } catch (error) {
9495
- throw error;
9496
- }
9497
- };
9498
- var textToSpeech = async (request) => {
9499
- try {
9500
- const { webhook, run_async, ...body } = request;
9501
- const { data } = await axios({
9502
- url: "/302/v2/audio/tts",
9503
- method: "post",
9504
- params: {
9505
- webhook,
9506
- run_async
9507
- },
9508
- data: {
9509
- ...body,
9510
- speed: body.speed ?? 1,
9511
- volume: body.volume ?? 1,
9512
- timeout: body.timeout ?? 180
9513
- }
9514
- });
9515
- return data;
9516
- } catch (error) {
9517
- throw error;
9518
- }
9519
- };
9520
- var fetchTask = async (taskId) => {
9521
- if (!taskId) {
9522
- throw new Error("taskId 不能为空");
9523
- }
9524
- try {
9525
- const { data } = await axios({
9526
- url: `/302/v2/audio/fetch/${encodeURIComponent(taskId)}`,
9527
- method: "get"
9528
- });
9529
- return data;
9530
- } catch (error) {
9531
- throw error;
9532
- }
9533
- };
9534
- // src/common/ai/302/audio/doubao.ts
9535
- var exports_doubao = {};
9536
- __export(exports_doubao, {
9537
- ttsHd: () => ttsHd
9538
- });
9539
- var createReqid = () => {
9540
- if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
9541
- return crypto.randomUUID();
9542
- }
9543
- return `${Date.now()}-${Math.random().toString(16).slice(2)}`;
9544
- };
9545
- var getUtf8ByteLength = (value) => {
9546
- return new TextEncoder().encode(value).length;
9547
- };
9548
- var assertNonEmptyString = (value, label) => {
9549
- if (typeof value !== "string" || !value.trim()) {
9550
- throw new Error(`${label} 不能为空`);
9551
- }
9552
- };
9553
- var assertSpeedRatio = (value) => {
9554
- if (value === undefined)
9555
- return;
9556
- if (typeof value !== "number" || !Number.isFinite(value)) {
9557
- throw new Error("speed_ratio 必须为数字");
9558
- }
9559
- if (value < 0.8 || value > 2) {
9560
- throw new Error("speed_ratio 取值范围为 [0.8, 2]");
9561
- }
9562
- };
9563
- var ttsHd = async (payload) => {
9564
- const { audio, request } = payload;
9565
- const { voice_type, encoding, speed_ratio } = audio;
9566
- const { text, reqid: rawReqid, operation } = request;
9567
- assertNonEmptyString(voice_type, "voice_type");
9568
- assertNonEmptyString(text, "text");
9569
- assertSpeedRatio(speed_ratio);
9570
- const textByteLength = getUtf8ByteLength(text);
9571
- if (textByteLength > 1024) {
9572
- throw new Error(`text 超出长度限制:${textByteLength}/1024 字节`);
9573
- }
9574
- const reqid = rawReqid?.trim() || createReqid();
9575
- const { data } = await axios({
9576
- url: "/doubao/tts_hd",
9577
- method: "post",
9578
- data: {
9579
- audio: {
9580
- voice_type,
9581
- encoding: encoding ?? "pcm",
9582
- speed_ratio: speed_ratio ?? 1
9583
- },
9584
- request: {
9585
- reqid,
9586
- text,
9587
- operation: operation ?? "query"
9588
- }
9589
- }
9590
- });
9591
- return data;
9592
- };
9593
- // src/common/ai/302/image/index.ts
9594
- var exports_image = {};
9595
- __export(exports_image, {
9596
- midjourney: () => exports_midjourney,
9597
- gpt: () => exports_gpt
9598
- });
9599
-
9600
- // src/common/ai/302/image/midjourney.ts
9601
- var exports_midjourney = {};
9602
- __export(exports_midjourney, {
9603
- getImageStatus: () => getImageStatus,
9604
- generateImage: () => generateImage
9605
- });
9606
- var generateImage = async (prompt, base64Array) => {
9607
- try {
9608
- const { data } = await axios({
9609
- url: "/mj/submit/imagine",
9610
- method: "post",
9611
- data: {
9612
- prompt,
9613
- base64Array,
9614
- botType: "MID_JOURNEY",
9615
- notifyHook: "",
9616
- state: ""
9617
- }
9618
- });
9619
- return data;
9620
- } catch (error) {
9621
- throw error;
9622
- }
9623
- };
9624
- var getImageStatus = async (taskId) => {
9625
- try {
9626
- const { data } = await axios({
9627
- url: `/mj/task/${taskId}/fetch`,
9628
- method: "get"
9629
- });
9630
- return data;
9631
- } catch (error) {
9632
- throw error;
9633
- }
9634
- };
9635
- // src/common/ai/302/image/gpt.ts
9636
- var exports_gpt = {};
9637
- __export(exports_gpt, {
9638
- generateImage: () => generateImage2
9639
- });
9640
- var generateImage2 = async (params) => {
9641
- if (params.model === "gpt-4o-plus") {
9642
- const { data: data2 } = await axios.post("/v1/chat/completions", {
9643
- model: params.model,
9644
- messages: [{ role: "user", content: params.prompt }]
9645
- });
9646
- const content = data2?.choices?.[0]?.message?.content || "";
9647
- const urlMatch = content.match(/!\[.*?\]\((.*?)\)/) || content.match(/(https?:\/\/[^\s]+)/);
9648
- const url = urlMatch ? urlMatch[1] : content;
9649
- return {
9650
- background: "",
9651
- created: data2.created,
9652
- data: [{ url }],
9653
- output_format: "",
9654
- quality: "",
9655
- size: "",
9656
- usage: {
9657
- input_tokens: data2.usage?.prompt_tokens || 0,
9658
- input_tokens_details: {
9659
- image_tokens: data2.usage?.prompt_tokens_details?.image_tokens || 0,
9660
- text_tokens: data2.usage?.prompt_tokens_details?.text_tokens || 0
9661
- },
9662
- output_tokens: data2.usage?.completion_tokens || 0,
9663
- output_tokens_details: {
9664
- image_tokens: data2.usage?.completion_tokens_details?.image_tokens || 0,
9665
- text_tokens: data2.usage?.completion_tokens_details?.content_tokens || 0
9666
- },
9667
- total_tokens: data2.usage?.total_tokens || 0
9668
- }
9669
- };
9670
- }
9671
- const { data } = await axios.post("/v1/images/generations", params);
9672
- return data;
9673
- };
9674
- // src/common/ai/doubao/index.ts
9675
- var exports_doubao2 = {};
9676
- __export(exports_doubao2, {
9677
- vc: () => vc,
9678
- tts: () => tts
9679
- });
9680
-
9681
- // src/common/ai/doubao/tts.ts
9682
- import axios2 from "axios";
9683
- var createReqid2 = () => {
9684
- if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
9685
- return crypto.randomUUID();
9686
- }
9687
- return `${Date.now()}-${Math.random().toString(16).slice(2)}`;
9688
- };
9689
- var decodeBase64ToArrayBuffer = (value) => {
9690
- if (typeof window !== "undefined" && typeof window.atob === "function") {
9691
- const binary = window.atob(value);
9692
- const bytes = new Uint8Array(binary.length);
9693
- for (let i = 0;i < binary.length; i++) {
9694
- bytes[i] = binary.charCodeAt(i);
9695
- }
9696
- return bytes.buffer;
9697
- }
9698
- const buf = Buffer.from(value, "base64");
9699
- return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
9700
- };
9701
- var tts = async (params) => {
9702
- const { app, user, audio, request } = params;
9703
- const url = "https://openspeech.bytedance.com/api/v3/tts/unidirectional";
9704
- const reqid = request.reqid || createReqid2();
9705
- const speechRate = audio.speed_ratio ? Math.round((audio.speed_ratio - 1) * 100) : 0;
9706
- const loudnessRate = audio.volume_ratio ? Math.round((audio.volume_ratio - 1) * 100) : 0;
9707
- const headers = {
9708
- "X-Api-App-Id": app.appid || "",
9709
- "X-Api-Access-Key": app.accessToken || "",
9710
- "Content-Type": "application/json",
9711
- "X-Api-Resource-Id": app.resourceId || "seed-tts-2.0",
9712
- "X-Api-Request-Id": reqid
9713
- };
9714
- const payload = {
9715
- user: {
9716
- uid: user?.uid || "uid"
9717
- },
9718
- req_params: {
9719
- text: request.text,
9720
- speaker: audio.voice_type,
9721
- audio_params: {
9722
- format: audio.encoding || "pcm",
9723
- sample_rate: 24000,
9724
- speech_rate: speechRate,
9725
- loudness_rate: loudnessRate,
9726
- emotion: audio.emotion,
9727
- emotion_scale: audio.emotion_scale
9728
- }
9729
- }
9730
- };
9731
- if (audio.context_texts) {
9732
- payload.req_params.additions = JSON.stringify({
9733
- context_texts: audio.context_texts
9734
- });
9735
- }
9736
- try {
9737
- const response = await axios2.post(url, payload, {
9738
- headers,
9739
- responseType: "arraybuffer"
9740
- });
9741
- const responseText = new TextDecoder().decode(response.data);
9742
- const jsonObjects = [];
9743
- let depth = 0;
9744
- let start = 0;
9745
- for (let i = 0;i < responseText.length; i++) {
9746
- if (responseText[i] === "{") {
9747
- if (depth === 0)
9748
- start = i;
9749
- depth++;
9750
- } else if (responseText[i] === "}") {
9751
- depth--;
9752
- if (depth === 0) {
9753
- try {
9754
- const jsonStr = responseText.substring(start, i + 1);
9755
- const jsonObj = JSON.parse(jsonStr);
9756
- jsonObjects.push(jsonObj);
9757
- } catch (e) {
9758
- console.warn("Failed to parse JSON chunk", e);
9759
- }
9760
- }
9761
- }
9762
- }
9763
- if (jsonObjects.length === 0) {
9764
- try {
9765
- jsonObjects.push(JSON.parse(responseText));
9766
- } catch (e) {
9767
- console.error("Doubao TTS Response Parse Error:", responseText);
9768
- throw new Error("Invalid response format");
9769
- }
9770
- }
9771
- const audioChunks = [];
9772
- let totalLength = 0;
9773
- for (const data of jsonObjects) {
9774
- const code = data.code;
9775
- const message = data.message;
9776
- if (typeof code === "number" && code !== 0 && code !== 20000000) {
9777
- console.error("Doubao TTS Error Response:", JSON.stringify(data, null, 2));
9778
- const err = new Error(`豆包语音合成失败: ${message} (code: ${code})`);
9779
- err.code = code;
9780
- err.reqid = data.reqid;
9781
- throw err;
9782
- }
9783
- if (data.data) {
9784
- const chunkBuffer = decodeBase64ToArrayBuffer(data.data);
9785
- audioChunks.push(chunkBuffer);
9786
- totalLength += chunkBuffer.byteLength;
9787
- }
9788
- }
9789
- if (totalLength === 0) {
9790
- throw new Error("豆包语音合成失败:未返回音频数据");
9791
- }
9792
- const resultBuffer = new Uint8Array(totalLength);
9793
- let offset = 0;
9794
- for (const chunk of audioChunks) {
9795
- resultBuffer.set(new Uint8Array(chunk), offset);
9796
- offset += chunk.byteLength;
9797
- }
9798
- return resultBuffer.buffer;
9799
- } catch (error) {
9800
- if (error.response) {
9801
- try {
9802
- let errorData = error.response.data;
9803
- if (errorData instanceof ArrayBuffer || typeof Buffer !== "undefined" && Buffer.isBuffer(errorData)) {
9804
- errorData = new TextDecoder().decode(errorData);
9805
- } else if (typeof errorData === "object") {
9806
- errorData = JSON.stringify(errorData);
9807
- }
9808
- throw new Error(`Doubao TTS Error: ${error.response.status} - ${errorData}`);
9809
- } catch (e) {
9810
- if (e.message && e.message.startsWith("Doubao TTS Error")) {
9811
- throw e;
9812
- }
9813
- throw new Error(`Doubao TTS Error: ${error.response.status} ${error.message}`);
9814
- }
9815
- }
9816
- throw error;
9817
- }
9818
- };
9819
- // src/common/ai/doubao/vc.ts
9820
- import axios3 from "axios";
9821
- var getHeaders = (accessToken, contentType) => {
9822
- const headers = {
9823
- Authorization: `Bearer; ${accessToken}`
9824
- };
9825
- if (contentType) {
9826
- headers["content-type"] = contentType;
9827
- }
9828
- return headers;
9829
- };
9830
- var handleResponse = (data) => {
9831
- if (data instanceof ArrayBuffer) {
9832
- return data;
9833
- }
9834
- if (typeof Buffer !== "undefined" && Buffer.isBuffer(data)) {
9835
- return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
9836
- }
9837
- return data;
9838
- };
9839
- var vc = {
9840
- submit: async (params) => {
9841
- const { app, audio, options = {} } = params;
9842
- const url = new URL("https://openspeech.bytedance.com/api/v1/vc/submit");
9843
- url.searchParams.set("appid", app.appid);
9844
- Object.entries(options).forEach(([key2, value]) => {
9845
- if (value !== undefined && value !== null) {
9846
- url.searchParams.set(key2, String(value));
9847
- }
9848
- });
9849
- const response = await axios3.post(url.toString(), audio.data, {
9850
- headers: getHeaders(app.accessToken, audio.contentType || "audio/wav"),
9851
- responseType: "arraybuffer"
9852
- });
9853
- return handleResponse(response.data);
9854
- },
9855
- query: async (params) => {
9856
- const { app, id, blocking } = params;
9857
- const url = new URL("https://openspeech.bytedance.com/api/v1/vc/query");
9858
- url.searchParams.set("appid", app.appid);
9859
- url.searchParams.set("id", id);
9860
- if (blocking !== undefined) {
9861
- url.searchParams.set("blocking", String(blocking));
9862
- }
9863
- const response = await axios3.get(url.toString(), {
9864
- headers: getHeaders(app.accessToken),
9865
- responseType: "arraybuffer"
9866
- });
9867
- return handleResponse(response.data);
9868
- }
9869
- };
9870
- // src/common/ai/keling/index.ts
9871
- var exports_keling = {};
9872
- __export(exports_keling, {
9873
- setCookie: () => setCookie,
9874
- getVideoStatus: () => getVideoStatus,
9875
- generateVideo: () => generateVideo
9876
- });
9877
9463
 
9878
9464
  // src/common/ai/keling/utils.ts
9879
9465
  import * as url from "url";
@@ -9881,7 +9467,7 @@ import * as path from "path";
9881
9467
 
9882
9468
  // src/common/ai/keling/axios.ts
9883
9469
  import axios_2 from "axios";
9884
- var axios4 = axios_2.create({
9470
+ var axios2 = axios_2.create({
9885
9471
  headers: {
9886
9472
  "Content-Type": "application/json",
9887
9473
  Cookie: "weblogger_did=web_52354269549862D; did=web_d22eeae73f6e4c74a76a4cc98e3a1188a5b0; anonymous-message-release-notice-1=true; anonymous-message-release-notice-2=true; dev-center-view-welcome-dialog-key=true; userId=2904283585; welcome-future-partner-key=true; old-user-time=1731936878621; kuaishou.ai.portal_st=ChVrdWFpc2hvdS5haS5wb3J0YWwuc3QSoAFuUNTARKNKXARahOJhWZ4iVBl2mIANSUfk2nCSr85bxCg2lrpE3PHj2Kn_kjPW0_KV8DfZS6UnNam4i6gaYeBmxRwOVAldYysCz7YtlsosEZRuiTe2iY7Ziq5SZeAP7jhTg8lxk7gvC-bEELmAc8HSrqN5HLWeU4GUFcEq-ChV7qsodJ8m42oBuvkFgX1qytVTIROpSS4cMmEiBhB3h99EGhLGi0v_iyPMOr2JVXM8LPzBvxQiIJrnuzAheyLtkeb55iZOUgZoAzXjYj0U1e4mLSonbXBGKAUwAQ; kuaishou.ai.portal_ph=2669d9adaa5c0629ac1053ab87e6c123880a"
@@ -9891,7 +9477,7 @@ var axios4 = axios_2.create({
9891
9477
  // src/common/ai/keling/utils.ts
9892
9478
  var getToken = async (filename) => {
9893
9479
  try {
9894
- const response = await axios4.get("https://klingai.kuaishou.com/api/upload/issue/token", {
9480
+ const response = await axios2.get("https://klingai.kuaishou.com/api/upload/issue/token", {
9895
9481
  params: { filename }
9896
9482
  });
9897
9483
  return response.data.data.token;
@@ -9902,7 +9488,7 @@ var getToken = async (filename) => {
9902
9488
  };
9903
9489
  var uploadFragment = async (uploadToken, imageBuffer) => {
9904
9490
  try {
9905
- const response = await axios4.post("https://upload.kuaishouzt.com/api/upload/fragment", imageBuffer, {
9491
+ const response = await axios2.post("https://upload.kuaishouzt.com/api/upload/fragment", imageBuffer, {
9906
9492
  params: {
9907
9493
  upload_token: uploadToken,
9908
9494
  fragment_id: 0
@@ -9919,7 +9505,7 @@ var uploadFragment = async (uploadToken, imageBuffer) => {
9919
9505
  };
9920
9506
  var completeUpload = async (uploadToken) => {
9921
9507
  try {
9922
- const response = await axios4.post("https://upload.kuaishouzt.com/api/upload/complete", null, {
9508
+ const response = await axios2.post("https://upload.kuaishouzt.com/api/upload/complete", null, {
9923
9509
  params: {
9924
9510
  upload_token: uploadToken,
9925
9511
  fragment_count: 1
@@ -9933,7 +9519,7 @@ var completeUpload = async (uploadToken) => {
9933
9519
  };
9934
9520
  var verifyUpload = async (token) => {
9935
9521
  try {
9936
- const response = await axios4.get("https://klingai.kuaishou.com/api/upload/verify/token", {
9522
+ const response = await axios2.get("https://klingai.kuaishou.com/api/upload/verify/token", {
9937
9523
  params: { token }
9938
9524
  });
9939
9525
  if (response.data?.result === 1 && response.data?.data?.status === 3) {
@@ -9948,7 +9534,7 @@ var verifyUpload = async (token) => {
9948
9534
  };
9949
9535
  var downloadImage = async (imageUrl) => {
9950
9536
  try {
9951
- const response = await axios4.get(imageUrl, {
9537
+ const response = await axios2.get(imageUrl, {
9952
9538
  responseType: "arraybuffer"
9953
9539
  });
9954
9540
  return Buffer.from(response.data, "binary");
@@ -10028,7 +9614,7 @@ var sbumit = async (imageUrl, prompt) => {
10028
9614
  ],
10029
9615
  type: "m2v_img2video_hq"
10030
9616
  });
10031
- const response = await axios4({
9617
+ const response = await axios2({
10032
9618
  method: "POST",
10033
9619
  url: "https://klingai.kuaishou.com/api/task/submit",
10034
9620
  data
@@ -10058,7 +9644,7 @@ var calculateProgress = (taskData) => {
10058
9644
  return progressRatio;
10059
9645
  };
10060
9646
  var setCookie = (newCookieValue) => {
10061
- axios4.defaults.headers.Cookie = newCookieValue;
9647
+ axios2.defaults.headers.Cookie = newCookieValue;
10062
9648
  };
10063
9649
 
10064
9650
  // src/common/ai/keling/index.ts
@@ -10067,7 +9653,7 @@ var getVideoStatus = async (taskId) => {
10067
9653
  return;
10068
9654
  }
10069
9655
  try {
10070
- const response = await axios4.get("https://klingai.kuaishou.com/api/task/status", {
9656
+ const response = await axios2.get("https://klingai.kuaishou.com/api/task/status", {
10071
9657
  params: { taskId }
10072
9658
  });
10073
9659
  return {
@@ -12767,7 +12353,7 @@ var retryPromise = async (promiseFn, retryInterval = 1000, retryCount = 3) => {
12767
12353
  return retryPromise(promiseFn, retryCount - 1, retryInterval);
12768
12354
  }
12769
12355
  };
12770
- // src/common/enum.ts
12356
+ // src/common/enum/index.ts
12771
12357
  class EnumItem {
12772
12358
  label;
12773
12359
  value;
@@ -12814,11 +12400,11 @@ var Enum = {
12814
12400
  return enumObj;
12815
12401
  }
12816
12402
  };
12817
- // src/common/image.ts
12818
- import axios5 from "axios";
12403
+ // src/common/image/index.ts
12404
+ import axios3 from "axios";
12819
12405
  async function imageToBase64(url2) {
12820
12406
  try {
12821
- const response = await axios5.get(url2, {
12407
+ const response = await axios3.get(url2, {
12822
12408
  responseType: "arraybuffer"
12823
12409
  });
12824
12410
  const base64String = Buffer.from(response.data).toString("base64");
@@ -12828,7 +12414,7 @@ async function imageToBase64(url2) {
12828
12414
  throw error;
12829
12415
  }
12830
12416
  }
12831
- // src/common/dayjs.ts
12417
+ // src/common/dayjs/index.ts
12832
12418
  import dayjs from "dayjs";
12833
12419
  import isBetween from "dayjs/plugin/isBetween";
12834
12420
  import weekday from "dayjs/plugin/weekday";
@@ -12894,7 +12480,7 @@ var sendMail = (config2) => {
12894
12480
  };
12895
12481
  // src/node/file.ts
12896
12482
  import fs from "fs-extra";
12897
- import axios6 from "axios";
12483
+ import axios4 from "axios";
12898
12484
  import url2 from "url";
12899
12485
  import * as path2 from "path";
12900
12486
  var replaceContentInFile = async (filePath, targetContent, replacement) => {
@@ -12926,7 +12512,7 @@ var downloadFile = async (httpUrl, outputPath) => {
12926
12512
  }
12927
12513
  outputPath = ".tmp/" + decodeURIComponent(fileName);
12928
12514
  }
12929
- const response = await axios6({
12515
+ const response = await axios4({
12930
12516
  url: httpUrl,
12931
12517
  method: "get",
12932
12518
  responseType: "stream"
@@ -12945,7 +12531,7 @@ var downloadFile = async (httpUrl, outputPath) => {
12945
12531
  };
12946
12532
  // src/node/oss.ts
12947
12533
  import OSS from "ali-oss";
12948
- import axios7 from "axios";
12534
+ import axios5 from "axios";
12949
12535
  import fs2 from "fs-extra";
12950
12536
  import * as path3 from "path";
12951
12537
  var oss = new OSS({
@@ -12960,7 +12546,7 @@ async function uploadFile(file, filename) {
12960
12546
  if (typeof file === "string") {
12961
12547
  if (/^https?:\/\//.test(file)) {
12962
12548
  try {
12963
- const response = await axios7.get(file, { responseType: "arraybuffer" });
12549
+ const response = await axios5.get(file, { responseType: "arraybuffer" });
12964
12550
  buffer = Buffer.from(response.data);
12965
12551
  } catch (error) {
12966
12552
  throw new Error(`无法从 URL 下载文件: ${error}`);
@@ -13041,6 +12627,7 @@ export {
13041
12627
  strictObjectType as strictObject,
13042
12628
  shuffleArray,
13043
12629
  setErrorMap,
12630
+ setCookie,
13044
12631
  setType as set,
13045
12632
  sendMail,
13046
12633
  schedule,
@@ -13078,9 +12665,8 @@ export {
13078
12665
  levenshteinDistance,
13079
12666
  lazyType as lazy,
13080
12667
  late,
13081
- exports_keling as keling,
13082
12668
  jsonParse,
13083
- default5 as json5,
12669
+ default4 as json5,
13084
12670
  isValidNumber,
13085
12671
  isValid,
13086
12672
  isJson,
@@ -13092,6 +12678,7 @@ export {
13092
12678
  instanceOfType as instanceof,
13093
12679
  initChinaDayjs,
13094
12680
  imageToBase64,
12681
+ getVideoStatus,
13095
12682
  getType,
13096
12683
  getTotal,
13097
12684
  getStrLength,
@@ -13107,6 +12694,7 @@ export {
13107
12694
  getCookie,
13108
12695
  getChineseByStr,
13109
12696
  getChinese,
12697
+ generateVideo,
13110
12698
  generateUniqueFileName,
13111
12699
  generateAlphabetArray,
13112
12700
  functionType as function,
@@ -13116,7 +12704,6 @@ export {
13116
12704
  enumType as enum,
13117
12705
  effectsType as effect,
13118
12706
  downloadFile,
13119
- exports_doubao2 as doubao,
13120
12707
  discriminatedUnionType as discriminatedUnion,
13121
12708
  delay,
13122
12709
  en_default as defaultErrorMap,
@@ -13124,18 +12711,18 @@ export {
13124
12711
  datetimeRegex,
13125
12712
  dateType as date,
13126
12713
  custom,
13127
- default6 as consola,
12714
+ default5 as consola,
13128
12715
  coerce,
13129
12716
  chinaDayjs,
13130
12717
  cheerio,
12718
+ chat,
13131
12719
  calcJsText,
13132
12720
  booleanType as boolean,
13133
12721
  bigIntType as bigint,
13134
- default4 as axios,
12722
+ default3 as axios,
13135
12723
  arrayType as array,
13136
12724
  anyType as any,
13137
12725
  amount,
13138
- exports_302 as ai302,
13139
12726
  addIssueToContext,
13140
12727
  export__ as _,
13141
12728
  ZodVoid,
@@ -13191,7 +12778,7 @@ export {
13191
12778
  EMPTY_PATH,
13192
12779
  Dayjs,
13193
12780
  DataStoreOptions,
13194
- default2 as DataStore,
12781
+ default6 as DataStore,
13195
12782
  DIRTY,
13196
12783
  BRAND
13197
12784
  };