@blocklet/search-kit-js 0.5.11 → 0.5.13

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
@@ -5,15 +5,12 @@ const component = require('@blocklet/sdk/lib/component');
5
5
  const verifySign = require('@blocklet/sdk/lib/util/verify-sign');
6
6
  const axios = require('axios');
7
7
  const ufo = require('ufo');
8
- const getWallet = require('@blocklet/sdk/lib/wallet');
9
8
  const env = require('@blocklet/sdk/lib/env');
10
9
  const crypto = require('crypto');
11
10
 
12
11
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
13
12
 
14
13
  const axios__default = /*#__PURE__*/_interopDefaultCompat(axios);
15
- const getWallet__default = /*#__PURE__*/_interopDefaultCompat(getWallet);
16
- const env__default = /*#__PURE__*/_interopDefaultCompat(env);
17
14
  const crypto__default = /*#__PURE__*/_interopDefaultCompat(crypto);
18
15
 
19
16
  const SEARCH_KIT_DID = "z8iZorY6mvb5tZrxXTqhBmwu89xjEEazrgT3t";
@@ -42,19 +39,18 @@ class SearchKitClient extends meilisearch.MeiliSearch {
42
39
 
43
40
  const hash = (str, salt) => crypto__default.createHash("sha256").update(str + salt).digest("hex");
44
41
 
45
- const wallet = getWallet__default();
46
42
  const resolveRestEmbedders = ({ documentTemplate, ...rest }) => {
47
43
  const mountPoint = component.getComponentMountPoint("ai-kit");
48
- if (!wallet.secretKey || !mountPoint) {
44
+ if (!mountPoint) {
49
45
  throw new Error("wallet.secretKey or ai-kit blocklet is not found");
50
46
  }
51
47
  return {
52
48
  default: {
53
49
  source: "rest",
54
50
  // Communicate via the public network to avoid URL changes caused by port changes.
55
- url: ufo.joinURL(env__default.appUrl, mountPoint, "/api/meilisearch/embeddings"),
51
+ url: ufo.joinURL(env.env.appUrl, mountPoint, "/api/meilisearch/embeddings"),
56
52
  dimensions: 1536,
57
- apiKey: hash(wallet.secretKey, ":/ai-kit/api/meilisearch/embeddings"),
53
+ apiKey: hash(process.env.BLOCKLET_APP_ASK || process.env.BLOCKLET_APP_SK, ":/ai-kit/api/meilisearch/embeddings"),
58
54
  request: { data: { text: "{{text}}" } },
59
55
  response: { data: { embedding: "{{embedding}}" } },
60
56
  distribution: { mean: 0.7, sigma: 0.3 },
package/dist/index.mjs CHANGED
@@ -4,8 +4,7 @@ import { getComponentWebEndpoint, getComponentMountPoint } from '@blocklet/sdk/l
4
4
  import { sign } from '@blocklet/sdk/lib/util/verify-sign';
5
5
  import axios from 'axios';
6
6
  import { joinURL } from 'ufo';
7
- import getWallet from '@blocklet/sdk/lib/wallet';
8
- import env from '@blocklet/sdk/lib/env';
7
+ import { env } from '@blocklet/sdk/lib/env';
9
8
  import crypto from 'crypto';
10
9
 
11
10
  const SEARCH_KIT_DID = "z8iZorY6mvb5tZrxXTqhBmwu89xjEEazrgT3t";
@@ -34,10 +33,9 @@ class SearchKitClient extends MeiliSearch {
34
33
 
35
34
  const hash = (str, salt) => crypto.createHash("sha256").update(str + salt).digest("hex");
36
35
 
37
- const wallet = getWallet();
38
36
  const resolveRestEmbedders = ({ documentTemplate, ...rest }) => {
39
37
  const mountPoint = getComponentMountPoint("ai-kit");
40
- if (!wallet.secretKey || !mountPoint) {
38
+ if (!mountPoint) {
41
39
  throw new Error("wallet.secretKey or ai-kit blocklet is not found");
42
40
  }
43
41
  return {
@@ -46,7 +44,7 @@ const resolveRestEmbedders = ({ documentTemplate, ...rest }) => {
46
44
  // Communicate via the public network to avoid URL changes caused by port changes.
47
45
  url: joinURL(env.appUrl, mountPoint, "/api/meilisearch/embeddings"),
48
46
  dimensions: 1536,
49
- apiKey: hash(wallet.secretKey, ":/ai-kit/api/meilisearch/embeddings"),
47
+ apiKey: hash(process.env.BLOCKLET_APP_ASK || process.env.BLOCKLET_APP_SK, ":/ai-kit/api/meilisearch/embeddings"),
50
48
  request: { data: { text: "{{text}}" } },
51
49
  response: { data: { embedding: "{{embedding}}" } },
52
50
  distribution: { mean: 0.7, sigma: 0.3 },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/search-kit-js",
3
- "version": "0.5.11",
3
+ "version": "0.5.13",
4
4
  "author": "Arcblock <blocklet@arcblock.io> https://github.com/blocklet",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -19,6 +19,7 @@
19
19
  "README.md"
20
20
  ],
21
21
  "dependencies": {
22
+ "@blocklet/sdk": "^1.16.54-beta-20251027-105624-dfa978f8",
22
23
  "axios": "^1.7.9",
23
24
  "meilisearch": "^0.47.0",
24
25
  "ufo": "^1.5.4",