@blocklet/discuss-kit-ux 1.5.212 → 1.5.214

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.
@@ -4,7 +4,7 @@ import { OnContentChangePlugin } from "@blocklet/editor/lib/ext/OnContentChangeP
4
4
  import { CtrlsShortcutPlugin } from "@blocklet/editor/lib/ext/ShortcutPlugin";
5
5
  import { SafeAreaPlugin } from "@blocklet/editor/lib/ext/SafeAreaPlugin";
6
6
  import { lazy } from "react";
7
- import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-b4081082.mjs";
7
+ import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-f257cd82.mjs";
8
8
  import "@blocklet/labels";
9
9
  import "@mui/material/styles";
10
10
  import "@mui/material/Box";
@@ -304,13 +304,13 @@ function CmdEnterShortcutPlugin({ callback, shortcut = "CMD_ENTER" }) {
304
304
  const UPLOADS_PREFIX$1 = "/uploads";
305
305
  const IMAGE_URL_PREFIX = joinUrl(inferDiscussKitApiPrefix(), UPLOADS_PREFIX$1);
306
306
  const originalExportJSON$1 = ImageNode.prototype.exportJSON;
307
- const ensureLeadingSlash = (str) => str.startsWith("/") ? str : `/${str}`;
307
+ const ensureLeadingSlash$1 = (str) => str.startsWith("/") ? str : `/${str}`;
308
308
  const stripResizeQuery = (str) => str.split("?").shift();
309
309
  ImageNode.prototype.exportJSON = function exportJSON() {
310
310
  const json = originalExportJSON$1.call(this);
311
311
  if (json.src && json.src.startsWith(IMAGE_URL_PREFIX)) {
312
312
  json.src = json.src.replace(IMAGE_URL_PREFIX, "");
313
- json.src = ensureLeadingSlash(json.src);
313
+ json.src = ensureLeadingSlash$1(json.src);
314
314
  json.src = stripResizeQuery(json.src);
315
315
  }
316
316
  return json;
@@ -341,19 +341,20 @@ function ImagePathFixerPlugin() {
341
341
  }
342
342
  const UPLOADS_PREFIX = joinUrl(inferDiscussKitApiPrefix(), "/uploads");
343
343
  const originalExportJSON = VideoNode.prototype.exportJSON;
344
+ const ensureLeadingSlash = (str) => str.startsWith("/") ? str : `/${str}`;
344
345
  VideoNode.prototype.exportJSON = function exportJSON2() {
345
346
  const json = originalExportJSON.call(this);
346
- if (this.__originalSrc__ !== void 0) {
347
- json.src = this.__originalSrc__;
347
+ if (json.src && json.src.startsWith(UPLOADS_PREFIX)) {
348
+ json.src = json.src.replace(UPLOADS_PREFIX, "");
349
+ json.src = ensureLeadingSlash(json.src);
348
350
  }
349
351
  return json;
350
352
  };
351
353
  function VideoNodeTransform(node) {
352
354
  const targetNode = node;
353
355
  const src = targetNode.getSrc();
354
- if ((src == null ? void 0 : src.startsWith("/")) && targetNode.__originalSrc__ === void 0) {
356
+ if ((src == null ? void 0 : src.startsWith("/")) && !src.startsWith(UPLOADS_PREFIX)) {
355
357
  targetNode.setSrc(joinUrl(UPLOADS_PREFIX, src));
356
- targetNode.__originalSrc__ = src;
357
358
  }
358
359
  }
359
360
  function VideoPathFixerPlugin() {
@@ -4288,9 +4289,7 @@ function DefaultEditorConfigProvider({
4288
4289
  if (typeof payload === "string") {
4289
4290
  const result2 = await request.post(
4290
4291
  joinUrl("/api/ai/completions"),
4291
- {
4292
- prompt: payload
4293
- },
4292
+ { prompt: payload },
4294
4293
  { baseURL, timeout: 3e4 }
4295
4294
  );
4296
4295
  return (_a3 = result2.data) == null ? void 0 : _a3.message;
@@ -4300,7 +4299,7 @@ function DefaultEditorConfigProvider({
4300
4299
  { ...payload, stream: false },
4301
4300
  { timeout: 3e4 }
4302
4301
  );
4303
- return result.data;
4302
+ return result.data.content || "";
4304
4303
  },
4305
4304
  imageGenerations: async (payload) => {
4306
4305
  const result = await request.post("/api/ai/image/generations", payload, { baseURL, timeout: 3e4 });
@@ -4328,15 +4327,15 @@ function DefaultEditorConfigProvider({
4328
4327
  const { offset = 0, limit = 20, tag } = params;
4329
4328
  try {
4330
4329
  const {
4331
- data: { templates }
4330
+ data: { assistants }
4332
4331
  } = await request.get(
4333
4332
  joinUrl(
4334
4333
  window.location.origin,
4335
4334
  aiAssistantMountPoint,
4336
- `/api/templates?offset=${offset}&limit=${limit}${tag ? `&tag=${tag}` : ""}`
4335
+ `/api/assistants?offset=${offset}&limit=${limit}${tag ? `&tag=${tag}` : ""}`
4337
4336
  )
4338
4337
  );
4339
- return templates;
4338
+ return assistants;
4340
4339
  } catch (e) {
4341
4340
  (_a3 = e.markAsHandled) == null ? void 0 : _a3.call(e);
4342
4341
  console.error(e);
@@ -4396,7 +4395,7 @@ function Pagination({ page, size = 20, total, onChange, routerMode = true, ...re
4396
4395
  }
4397
4396
  );
4398
4397
  }
4399
- const Editor = lazy(() => import("./editor-64b50636.mjs"));
4398
+ const Editor = lazy(() => import("./editor-6acff851.mjs"));
4400
4399
  function LazyEditor(props) {
4401
4400
  const fallback = /* @__PURE__ */ jsxs(Fragment, { children: [
4402
4401
  /* @__PURE__ */ jsx(Skeleton, {}),
package/dist/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from "@blocklet/labels";
2
- import { K, j, N, A, h, a6, B, z, y, E, Q, O, T, W, o, C, q, v, x, _, $, aa, a1, H, J, D, a9, a8, G, c, b, a7, M, P, ah, n, m, a5, R, S, a2, k, X, Z, ab, ae, ad, af, ai, F, aj, l, p, r, t, d, a3, L, e, U, w, a0, a4, u, ag, ak, Y, ac, f } from "./index-b4081082.mjs";
2
+ import { K, j, N, A, h, a6, B, z, y, E, Q, O, T, W, o, C, q, v, x, _, $, aa, a1, H, J, D, a9, a8, G, c, b, a7, M, P, ah, n, m, a5, R, S, a2, k, X, Z, ab, ae, ad, af, ai, F, aj, l, p, r, t, d, a3, L, e, U, w, a0, a4, u, ag, ak, Y, ac, f } from "./index-f257cd82.mjs";
3
3
  import "react/jsx-runtime";
4
4
  import "react";
5
5
  import "@mui/material/Box";
package/dist/index.umd.js CHANGED
@@ -246,13 +246,13 @@ var __publicField = (obj, key, value) => {
246
246
  const UPLOADS_PREFIX$1 = "/uploads";
247
247
  const IMAGE_URL_PREFIX = joinUrl(inferDiscussKitApiPrefix(), UPLOADS_PREFIX$1);
248
248
  const originalExportJSON$1 = ImageNode.ImageNode.prototype.exportJSON;
249
- const ensureLeadingSlash = (str) => str.startsWith("/") ? str : `/${str}`;
249
+ const ensureLeadingSlash$1 = (str) => str.startsWith("/") ? str : `/${str}`;
250
250
  const stripResizeQuery = (str) => str.split("?").shift();
251
251
  ImageNode.ImageNode.prototype.exportJSON = function exportJSON() {
252
252
  const json = originalExportJSON$1.call(this);
253
253
  if (json.src && json.src.startsWith(IMAGE_URL_PREFIX)) {
254
254
  json.src = json.src.replace(IMAGE_URL_PREFIX, "");
255
- json.src = ensureLeadingSlash(json.src);
255
+ json.src = ensureLeadingSlash$1(json.src);
256
256
  json.src = stripResizeQuery(json.src);
257
257
  }
258
258
  return json;
@@ -283,19 +283,20 @@ var __publicField = (obj, key, value) => {
283
283
  }
284
284
  const UPLOADS_PREFIX = joinUrl(inferDiscussKitApiPrefix(), "/uploads");
285
285
  const originalExportJSON = VideoNode.VideoNode.prototype.exportJSON;
286
+ const ensureLeadingSlash = (str) => str.startsWith("/") ? str : `/${str}`;
286
287
  VideoNode.VideoNode.prototype.exportJSON = function exportJSON() {
287
288
  const json = originalExportJSON.call(this);
288
- if (this.__originalSrc__ !== void 0) {
289
- json.src = this.__originalSrc__;
289
+ if (json.src && json.src.startsWith(UPLOADS_PREFIX)) {
290
+ json.src = json.src.replace(UPLOADS_PREFIX, "");
291
+ json.src = ensureLeadingSlash(json.src);
290
292
  }
291
293
  return json;
292
294
  };
293
295
  function VideoNodeTransform(node) {
294
296
  const targetNode = node;
295
297
  const src = targetNode.getSrc();
296
- if ((src == null ? void 0 : src.startsWith("/")) && targetNode.__originalSrc__ === void 0) {
298
+ if ((src == null ? void 0 : src.startsWith("/")) && !src.startsWith(UPLOADS_PREFIX)) {
297
299
  targetNode.setSrc(joinUrl(UPLOADS_PREFIX, src));
298
- targetNode.__originalSrc__ = src;
299
300
  }
300
301
  }
301
302
  function VideoPathFixerPlugin() {
@@ -4230,9 +4231,7 @@ var __publicField = (obj, key, value) => {
4230
4231
  if (typeof payload === "string") {
4231
4232
  const result2 = await request.post(
4232
4233
  joinUrl("/api/ai/completions"),
4233
- {
4234
- prompt: payload
4235
- },
4234
+ { prompt: payload },
4236
4235
  { baseURL, timeout: 3e4 }
4237
4236
  );
4238
4237
  return (_a3 = result2.data) == null ? void 0 : _a3.message;
@@ -4242,7 +4241,7 @@ var __publicField = (obj, key, value) => {
4242
4241
  { ...payload, stream: false },
4243
4242
  { timeout: 3e4 }
4244
4243
  );
4245
- return result.data;
4244
+ return result.data.content || "";
4246
4245
  },
4247
4246
  imageGenerations: async (payload) => {
4248
4247
  const result = await request.post("/api/ai/image/generations", payload, { baseURL, timeout: 3e4 });
@@ -4270,15 +4269,15 @@ var __publicField = (obj, key, value) => {
4270
4269
  const { offset = 0, limit = 20, tag } = params;
4271
4270
  try {
4272
4271
  const {
4273
- data: { templates }
4272
+ data: { assistants }
4274
4273
  } = await request.get(
4275
4274
  joinUrl(
4276
4275
  window.location.origin,
4277
4276
  aiAssistantMountPoint,
4278
- `/api/templates?offset=${offset}&limit=${limit}${tag ? `&tag=${tag}` : ""}`
4277
+ `/api/assistants?offset=${offset}&limit=${limit}${tag ? `&tag=${tag}` : ""}`
4279
4278
  )
4280
4279
  );
4281
- return templates;
4280
+ return assistants;
4282
4281
  } catch (e) {
4283
4282
  (_a3 = e.markAsHandled) == null ? void 0 : _a3.call(e);
4284
4283
  console.error(e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/discuss-kit-ux",
3
- "version": "1.5.212",
3
+ "version": "1.5.214",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -29,9 +29,9 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@arcblock/ws": "^1.18.103",
32
- "@blocklet/editor": "1.5.212",
33
- "@blocklet/labels": "1.5.212",
34
- "@blocklet/uploader": "^0.0.52",
32
+ "@blocklet/editor": "1.5.214",
33
+ "@blocklet/labels": "1.5.214",
34
+ "@blocklet/uploader": "^0.0.53",
35
35
  "@emotion/css": "^11.10.5",
36
36
  "@emotion/react": "^11.10.5",
37
37
  "@emotion/styled": "^11.10.5",
@@ -92,5 +92,5 @@
92
92
  "resolutions": {
93
93
  "react": "^18.2.0"
94
94
  },
95
- "gitHead": "0a5b2497a3c6470d12b5459fb05f9a507a2b7fa6"
95
+ "gitHead": "d53fbe7504dc573ab634e3615af62d4294bdc453"
96
96
  }