@hautechai/sdk 2.5.0 → 2.7.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/index.mjs CHANGED
@@ -10505,11 +10505,11 @@ var useVideosApi = () => {
10505
10505
  const sdk = this;
10506
10506
  const isBrowser = typeof window !== "undefined" && typeof Blob !== "undefined";
10507
10507
  if (isBrowser) {
10508
- const response = await axios2.get(fileUrl, { responseType: "blob", timeout: 3e4 });
10508
+ const response = await axios2.get(fileUrl, { responseType: "blob", timeout: 6e4 });
10509
10509
  const blob = new Blob([response.data], { type: response.headers["content-type"] });
10510
10510
  return sdk.videos.createFromFile(blob);
10511
10511
  } else {
10512
- const response = await axios2.get(fileUrl, { responseType: "stream", timeout: 3e4 });
10512
+ const response = await axios2.get(fileUrl, { responseType: "stream", timeout: 6e4 });
10513
10513
  return sdk.videos.createFromFile({
10514
10514
  stream: response.data,
10515
10515
  filename: fileUrl.split("/").pop(),
@@ -11396,7 +11396,7 @@ var getOperations = () => {
11396
11396
  // src/sdk/api-definitions/operations.ts
11397
11397
  var waitOperation = wrapCustomMethod(async function(operation, timeoutMs = 6e4) {
11398
11398
  const deadline = Date.now() + timeoutMs;
11399
- const delay = 1e3;
11399
+ const delay = 3e3;
11400
11400
  const sdk = this;
11401
11401
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
11402
11402
  const poll = async (id) => {
@@ -12055,6 +12055,14 @@ var AnimateKling21V1ResponseStatus = {
12055
12055
  failed: "failed"
12056
12056
  };
12057
12057
 
12058
+ // src/autogenerated/schemas/chatControllerListChatsV1OrderBy.ts
12059
+ var ChatControllerListChatsV1OrderBy = {
12060
+ createdAt_ASC: "createdAt_ASC",
12061
+ createdAt_DESC: "createdAt_DESC",
12062
+ updatedAt_ASC: "updatedAt_ASC",
12063
+ updatedAt_DESC: "updatedAt_DESC"
12064
+ };
12065
+
12058
12066
  // src/autogenerated/schemas/collectionEntityKind.ts
12059
12067
  var CollectionEntityKind = {
12060
12068
  collection: "collection",
@@ -13161,6 +13169,39 @@ var ListStacksParamsDtoOrderBy = {
13161
13169
  updatedAt_DESC: "updatedAt_DESC"
13162
13170
  };
13163
13171
 
13172
+ // src/autogenerated/schemas/loraControllerListV1OrderBy.ts
13173
+ var LoraControllerListV1OrderBy = {
13174
+ createdAt_ASC: "createdAt_ASC",
13175
+ createdAt_DESC: "createdAt_DESC"
13176
+ };
13177
+
13178
+ // src/autogenerated/schemas/loraControllerListV1Status.ts
13179
+ var LoraControllerListV1Status = {
13180
+ starting: "starting",
13181
+ processing: "processing",
13182
+ succeeded: "succeeded",
13183
+ failed: "failed",
13184
+ canceled: "canceled"
13185
+ };
13186
+
13187
+ // src/autogenerated/schemas/loraDtoStatus.ts
13188
+ var LoraDtoStatus = {
13189
+ starting: "starting",
13190
+ processing: "processing",
13191
+ succeeded: "succeeded",
13192
+ failed: "failed",
13193
+ canceled: "canceled"
13194
+ };
13195
+
13196
+ // src/autogenerated/schemas/loraWebhookDtoStatus.ts
13197
+ var LoraWebhookDtoStatus = {
13198
+ starting: "starting",
13199
+ processing: "processing",
13200
+ succeeded: "succeeded",
13201
+ failed: "failed",
13202
+ canceled: "canceled"
13203
+ };
13204
+
13164
13205
  // src/autogenerated/schemas/lumaPhotonV1InputAspectRatio.ts
13165
13206
  var LumaPhotonV1InputAspectRatio = {
13166
13207
  "1:1": "1:1",
@@ -14903,7 +14944,7 @@ var usePipelinesApi = () => {
14903
14944
  wait: wrapCustomMethod(async function(pipeline, timeoutMs = 6e4) {
14904
14945
  const sdk = this;
14905
14946
  const deadline = Date.now() + timeoutMs;
14906
- const delay = 1e3;
14947
+ const delay = 3e3;
14907
14948
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
14908
14949
  const poll = async (id) => {
14909
14950
  const pipeline2 = await sdk.pipelines.get(id);
@@ -14924,6 +14965,181 @@ var usePipelinesApi = () => {
14924
14965
  return useApi(api);
14925
14966
  };
14926
14967
 
14968
+ // src/autogenerated/lora/lora.ts
14969
+ var getLora = () => {
14970
+ const loraControllerStartV1 = (startLoraTrainingParamsDto, options) => {
14971
+ return axiosMutator(
14972
+ {
14973
+ url: `/v1/lora/train`,
14974
+ method: "POST",
14975
+ headers: { "Content-Type": "application/json" },
14976
+ data: startLoraTrainingParamsDto
14977
+ },
14978
+ options
14979
+ );
14980
+ };
14981
+ const loraControllerListV1 = (params, options) => {
14982
+ return axiosMutator(
14983
+ {
14984
+ url: `/v1/lora`,
14985
+ method: "GET",
14986
+ params
14987
+ },
14988
+ options
14989
+ );
14990
+ };
14991
+ const loraControllerGetV1 = (id, options) => {
14992
+ return axiosMutator(
14993
+ {
14994
+ url: `/v1/lora/${id}`,
14995
+ method: "GET"
14996
+ },
14997
+ options
14998
+ );
14999
+ };
15000
+ const loraControllerTrainingsWebhookV1 = (loraWebhookDto, options) => {
15001
+ return axiosMutator(
15002
+ {
15003
+ url: `/v1/lora/trainings/webhook`,
15004
+ method: "POST",
15005
+ headers: { "Content-Type": "application/json" },
15006
+ data: loraWebhookDto
15007
+ },
15008
+ options
15009
+ );
15010
+ };
15011
+ return { loraControllerStartV1, loraControllerListV1, loraControllerGetV1, loraControllerTrainingsWebhookV1 };
15012
+ };
15013
+
15014
+ // src/sdk/api-definitions/lora.ts
15015
+ var waitLoraStatusChange = wrapCustomMethod(async function(lora, timeoutMs = 12e4) {
15016
+ const sdk = this;
15017
+ const initialStatus = lora.status;
15018
+ const deadline = Date.now() + timeoutMs;
15019
+ const delay = 3e3;
15020
+ const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
15021
+ while (Date.now() < deadline) {
15022
+ const current = await sdk.lora.get(lora.id);
15023
+ if (!current) throw new Error("LoRA not found");
15024
+ if (current.status !== initialStatus || ["succeeded", "failed", "canceled"].includes(current.status)) {
15025
+ return current;
15026
+ }
15027
+ await sleep(delay);
15028
+ }
15029
+ throw new Error("LoRA wait timed out");
15030
+ });
15031
+ var useLoraApi = () => {
15032
+ const hautechApi = getLora();
15033
+ return useApi({
15034
+ start: hautechApi.loraControllerStartV1,
15035
+ list: hautechApi.loraControllerListV1,
15036
+ get: hautechApi.loraControllerGetV1,
15037
+ wait: waitLoraStatusChange
15038
+ });
15039
+ };
15040
+
15041
+ // src/autogenerated/upload/upload.ts
15042
+ var getUpload = () => {
15043
+ const uploadControllerInitUploadV1 = (initializeGenericUploadParamsDto, options) => {
15044
+ return axiosMutator(
15045
+ {
15046
+ url: `/v1/upload/init`,
15047
+ method: "POST",
15048
+ headers: { "Content-Type": "application/json" },
15049
+ data: initializeGenericUploadParamsDto
15050
+ },
15051
+ options
15052
+ );
15053
+ };
15054
+ const uploadControllerGetUploadedFileUrlV1 = (params, options) => {
15055
+ return axiosMutator(
15056
+ {
15057
+ url: `/v1/upload/url`,
15058
+ method: "GET",
15059
+ params
15060
+ },
15061
+ options
15062
+ );
15063
+ };
15064
+ return { uploadControllerInitUploadV1, uploadControllerGetUploadedFileUrlV1 };
15065
+ };
15066
+
15067
+ // src/sdk/api-definitions/upload.ts
15068
+ var useUploadApi = () => {
15069
+ const hautechApi = getUpload();
15070
+ return useApi({
15071
+ initUpload: hautechApi.uploadControllerInitUploadV1,
15072
+ getUploadedFileUrl: hautechApi.uploadControllerGetUploadedFileUrlV1
15073
+ });
15074
+ };
15075
+
15076
+ // src/autogenerated/chat/chat.ts
15077
+ var getChat = () => {
15078
+ const chatControllerCreateChatV1 = (createChatParamsDto, options) => {
15079
+ return axiosMutator(
15080
+ {
15081
+ url: `/v1/chat`,
15082
+ method: "POST",
15083
+ headers: { "Content-Type": "application/json" },
15084
+ data: createChatParamsDto
15085
+ },
15086
+ options
15087
+ );
15088
+ };
15089
+ const chatControllerListChatsV1 = (params, options) => {
15090
+ return axiosMutator(
15091
+ {
15092
+ url: `/v1/chat`,
15093
+ method: "GET",
15094
+ params
15095
+ },
15096
+ options
15097
+ );
15098
+ };
15099
+ const chatControllerGetChatV1 = (id, options) => {
15100
+ return axiosMutator(
15101
+ {
15102
+ url: `/v1/chat/${id}`,
15103
+ method: "GET"
15104
+ },
15105
+ options
15106
+ );
15107
+ };
15108
+ const chatControllerDeleteChatV1 = (id, options) => {
15109
+ return axiosMutator(
15110
+ {
15111
+ url: `/v1/chat/${id}`,
15112
+ method: "DELETE"
15113
+ },
15114
+ options
15115
+ );
15116
+ };
15117
+ const chatControllerAddItemsToChatV1 = (chatId, addChatItemsDto, options) => {
15118
+ return axiosMutator(
15119
+ {
15120
+ url: `/v1/chat/${chatId}/items`,
15121
+ method: "POST",
15122
+ headers: { "Content-Type": "application/json" },
15123
+ data: addChatItemsDto
15124
+ },
15125
+ options
15126
+ );
15127
+ };
15128
+ return { chatControllerCreateChatV1, chatControllerListChatsV1, chatControllerGetChatV1, chatControllerDeleteChatV1, chatControllerAddItemsToChatV1 };
15129
+ };
15130
+
15131
+ // src/sdk/api-definitions/chats.ts
15132
+ var useChatsApi = () => {
15133
+ const api = getChat();
15134
+ return useApi({
15135
+ create: api.chatControllerCreateChatV1,
15136
+ list: api.chatControllerListChatsV1,
15137
+ get: wrapApiCallNullable(api.chatControllerGetChatV1),
15138
+ delete: api.chatControllerDeleteChatV1,
15139
+ addItems: api.chatControllerAddItemsToChatV1
15140
+ });
15141
+ };
15142
+
14927
15143
  // src/sdk/ws-client.ts
14928
15144
  import { io } from "socket.io-client";
14929
15145
  var useWsClient = (config) => new WsClient(config);
@@ -15012,9 +15228,12 @@ var apiDefinitions = {
15012
15228
  groups: useGroupsApi(),
15013
15229
  accounts: useAccountsApi(),
15014
15230
  collections: useCollectionsApi(),
15231
+ chats: useChatsApi(),
15015
15232
  balances: useBalancesApi(),
15016
15233
  access: useAccessApi(),
15017
- pipelines: usePipelinesApi()
15234
+ pipelines: usePipelinesApi(),
15235
+ lora: useLoraApi(),
15236
+ upload: useUploadApi()
15018
15237
  };
15019
15238
  var pipelineDefinitions = usePipelineDefinitions();
15020
15239
  var getWsClientDefinitions = (config) => ({
@@ -15120,6 +15339,7 @@ export {
15120
15339
  AnimateKling21V1InputDuration,
15121
15340
  AnimateKling21V1ResponseKind,
15122
15341
  AnimateKling21V1ResponseStatus,
15342
+ ChatControllerListChatsV1OrderBy,
15123
15343
  CollectionEntityKind,
15124
15344
  CollectionsControllerListCollectionsV1OrderBy,
15125
15345
  CollectionsControllerListItemsV1Kind,
@@ -15294,6 +15514,10 @@ export {
15294
15514
  ListOperationsParamsDtoOrderBy,
15295
15515
  ListPosesParamsDtoOrderBy,
15296
15516
  ListStacksParamsDtoOrderBy,
15517
+ LoraControllerListV1OrderBy,
15518
+ LoraControllerListV1Status,
15519
+ LoraDtoStatus,
15520
+ LoraWebhookDtoStatus,
15297
15521
  LumaPhotonV1InputAspectRatio,
15298
15522
  LumaPhotonV1ResponseKind,
15299
15523
  LumaPhotonV1ResponseStatus,