@blocklet/search-kit-js 0.5.24 → 0.5.26

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.cjs CHANGED
@@ -39,17 +39,21 @@ class SearchKitClient extends meilisearch.MeiliSearch {
39
39
  const hash = (str, salt) => crypto__default.createHash("sha256").update(str + salt).digest("hex");
40
40
 
41
41
  const resolveRestEmbedders = ({ documentTemplate, ...rest }) => {
42
- const mountPoint = component.getComponentMountPoint("ai-kit");
43
- if (!mountPoint) {
44
- throw new Error("wallet.secretKey or ai-kit blocklet is not found");
42
+ const apiURL = process.env.BLOCKLET_AIGNE_API_URL || "";
43
+ if (!apiURL) {
44
+ throw new Error("AIGNE Hub not connected. Configure it in blocklet dashboard to enable embeddings.");
45
45
  }
46
+ const mountPoint = component.getComponentMountPoint("z8iZorY6mvb5tZrxXTqhBmwu89xjEEazrgT3t");
46
47
  return {
47
48
  default: {
48
49
  source: "rest",
49
50
  // Communicate via the public network to avoid URL changes caused by port changes.
50
51
  url: ufo.joinURL(env.env.appUrl, mountPoint, "/api/meilisearch/embeddings"),
51
52
  dimensions: 1536,
52
- apiKey: hash(process.env.BLOCKLET_APP_ASK || process.env.BLOCKLET_APP_SK, ":/ai-kit/api/meilisearch/embeddings"),
53
+ apiKey: hash(
54
+ process.env.BLOCKLET_APP_ASK || process.env.BLOCKLET_APP_SK,
55
+ ":/search-kit/api/meilisearch/embeddings"
56
+ ),
53
57
  request: { data: { text: "{{text}}" } },
54
58
  response: { data: { embedding: "{{embedding}}" } },
55
59
  distribution: { mean: 0.7, sigma: 0.3 },
@@ -60,6 +64,7 @@ const resolveRestEmbedders = ({ documentTemplate, ...rest }) => {
60
64
  };
61
65
 
62
66
  exports.SearchKitClient = SearchKitClient;
67
+ exports.hash = hash;
63
68
  exports.resolveRestEmbedders = resolveRestEmbedders;
64
69
  Object.keys(meilisearch).forEach(function (k) {
65
70
  if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = meilisearch[k];
package/dist/index.d.cts CHANGED
@@ -10,4 +10,6 @@ type PartialRestEmbedder = Partial<RestEmbedder> & {
10
10
  };
11
11
  declare const resolveRestEmbedders: ({ documentTemplate, ...rest }: PartialRestEmbedder) => Embedders;
12
12
 
13
- export { SearchKitClient, resolveRestEmbedders };
13
+ declare const hash: (str: string, salt: string) => string;
14
+
15
+ export { SearchKitClient, hash, resolveRestEmbedders };
package/dist/index.d.mts CHANGED
@@ -10,4 +10,6 @@ type PartialRestEmbedder = Partial<RestEmbedder> & {
10
10
  };
11
11
  declare const resolveRestEmbedders: ({ documentTemplate, ...rest }: PartialRestEmbedder) => Embedders;
12
12
 
13
- export { SearchKitClient, resolveRestEmbedders };
13
+ declare const hash: (str: string, salt: string) => string;
14
+
15
+ export { SearchKitClient, hash, resolveRestEmbedders };
package/dist/index.d.ts CHANGED
@@ -10,4 +10,6 @@ type PartialRestEmbedder = Partial<RestEmbedder> & {
10
10
  };
11
11
  declare const resolveRestEmbedders: ({ documentTemplate, ...rest }: PartialRestEmbedder) => Embedders;
12
12
 
13
- export { SearchKitClient, resolveRestEmbedders };
13
+ declare const hash: (str: string, salt: string) => string;
14
+
15
+ export { SearchKitClient, hash, resolveRestEmbedders };
package/dist/index.mjs CHANGED
@@ -33,17 +33,21 @@ class SearchKitClient extends MeiliSearch {
33
33
  const hash = (str, salt) => crypto.createHash("sha256").update(str + salt).digest("hex");
34
34
 
35
35
  const resolveRestEmbedders = ({ documentTemplate, ...rest }) => {
36
- const mountPoint = getComponentMountPoint("ai-kit");
37
- if (!mountPoint) {
38
- throw new Error("wallet.secretKey or ai-kit blocklet is not found");
36
+ const apiURL = process.env.BLOCKLET_AIGNE_API_URL || "";
37
+ if (!apiURL) {
38
+ throw new Error("AIGNE Hub not connected. Configure it in blocklet dashboard to enable embeddings.");
39
39
  }
40
+ const mountPoint = getComponentMountPoint("z8iZorY6mvb5tZrxXTqhBmwu89xjEEazrgT3t");
40
41
  return {
41
42
  default: {
42
43
  source: "rest",
43
44
  // Communicate via the public network to avoid URL changes caused by port changes.
44
45
  url: joinURL(env.appUrl, mountPoint, "/api/meilisearch/embeddings"),
45
46
  dimensions: 1536,
46
- apiKey: hash(process.env.BLOCKLET_APP_ASK || process.env.BLOCKLET_APP_SK, ":/ai-kit/api/meilisearch/embeddings"),
47
+ apiKey: hash(
48
+ process.env.BLOCKLET_APP_ASK || process.env.BLOCKLET_APP_SK,
49
+ ":/search-kit/api/meilisearch/embeddings"
50
+ ),
47
51
  request: { data: { text: "{{text}}" } },
48
52
  response: { data: { embedding: "{{embedding}}" } },
49
53
  distribution: { mean: 0.7, sigma: 0.3 },
@@ -53,4 +57,4 @@ const resolveRestEmbedders = ({ documentTemplate, ...rest }) => {
53
57
  };
54
58
  };
55
59
 
56
- export { SearchKitClient, resolveRestEmbedders };
60
+ export { SearchKitClient, hash, resolveRestEmbedders };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/search-kit-js",
3
- "version": "0.5.24",
3
+ "version": "0.5.26",
4
4
  "author": "Arcblock <blocklet@arcblock.io> https://github.com/blocklet",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",