chore: Update Tavily core package and remove js-tiktoken dependency

This commit is contained in:
kangfenmao 2025-02-22 23:20:32 +08:00
parent b9402a8370
commit af9763d142
5 changed files with 70 additions and 15 deletions

View File

@ -0,0 +1,57 @@
diff --git a/dist/index.js b/dist/index.js
index 88c405a000d21b3631eaa378690907c5527b8eaf..e03e66440c7c93aee38adf57df3096c6fefcd96d 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -82,7 +82,6 @@ module.exports = __toCommonJS(index_exports);
// src/utils.ts
var import_axios = __toESM(require("axios"));
-var import_js_tiktoken = require("js-tiktoken");
var BASE_URL = "https://api.tavily.com";
var DEFAULT_MODEL_ENCODING = "gpt-3.5-turbo";
var DEFAULT_MAX_TOKENS = 4e3;
@@ -97,8 +96,7 @@ function post(endpoint, body, apiKey) {
});
}
function getTotalTokensFromString(str, encodingName = DEFAULT_MODEL_ENCODING) {
- const encoding = (0, import_js_tiktoken.encodingForModel)(encodingName);
- return encoding.encode(str).length;
+ return 0;
}
function getMaxTokensFromList(data, maxTokens = DEFAULT_MAX_TOKENS) {
var result = [];
diff --git a/dist/index.mjs b/dist/index.mjs
index 0a9ea6a0add8d709e6721e806571f373d9fe0487..b81f1ea48a2b2a30ee98d53980a1b04ea3fdc5d4 100644
--- a/dist/index.mjs
+++ b/dist/index.mjs
@@ -49,7 +49,6 @@ var __async = (__this, __arguments, generator) => {
// src/utils.ts
import axios from "axios";
-import { encodingForModel } from "js-tiktoken";
var BASE_URL = "https://api.tavily.com";
var DEFAULT_MODEL_ENCODING = "gpt-3.5-turbo";
var DEFAULT_MAX_TOKENS = 4e3;
@@ -64,8 +63,7 @@ function post(endpoint, body, apiKey) {
});
}
function getTotalTokensFromString(str, encodingName = DEFAULT_MODEL_ENCODING) {
- const encoding = encodingForModel(encodingName);
- return encoding.encode(str).length;
+ return 0;
}
function getMaxTokensFromList(data, maxTokens = DEFAULT_MAX_TOKENS) {
var result = [];
diff --git a/package.json b/package.json
index 36d4a613166a7906c1dc5377a89dc0a65f746f73..dc6e0e9363046755cad123e627cc270a2e3580d1 100644
--- a/package.json
+++ b/package.json
@@ -36,7 +36,6 @@
"typescript": "^5.6.2"
},
"dependencies": {
- "axios": "^1.7.7",
- "js-tiktoken": "^1.0.14"
+ "axios": "^1.7.7"
}
}

View File

@ -24,6 +24,7 @@ files:
- '!**/{LICENSE,LICENSE.txt,LICENSE-MIT.txt,*.LICENSE.txt,NOTICE.txt,README.md,CHANGELOG.md}' - '!**/{LICENSE,LICENSE.txt,LICENSE-MIT.txt,*.LICENSE.txt,NOTICE.txt,README.md,CHANGELOG.md}'
- '!node_modules/rollup-plugin-visualizer' - '!node_modules/rollup-plugin-visualizer'
- '!node_modules/js-tiktoken' - '!node_modules/js-tiktoken'
- '!node_modules/@tavily/core/node_modules/js-tiktoken'
- '!node_modules/pdf-parse/lib/pdf.js/{v1.9.426,v1.10.88,v2.0.550}' - '!node_modules/pdf-parse/lib/pdf.js/{v1.9.426,v1.10.88,v2.0.550}'
- '!node_modules/mammoth/{mammoth.browser.js,mammoth.browser.min.js}' - '!node_modules/mammoth/{mammoth.browser.js,mammoth.browser.min.js}'
- '!node_modules/html2canvas/dist/{html2canvas.min.js,html2canvas.esm.js}' - '!node_modules/html2canvas/dist/{html2canvas.min.js,html2canvas.esm.js}'

View File

@ -88,7 +88,7 @@
"@kangfenmao/keyv-storage": "^0.1.0", "@kangfenmao/keyv-storage": "^0.1.0",
"@llm-tools/embedjs-loader-image": "^0.1.28", "@llm-tools/embedjs-loader-image": "^0.1.28",
"@reduxjs/toolkit": "^2.2.5", "@reduxjs/toolkit": "^2.2.5",
"@tavily/core": "^0.3.1", "@tavily/core": "patch:@tavily/core@npm%3A0.3.1#~/.yarn/patches/@tavily-core-npm-0.3.1-fe69bf2bea.patch",
"@types/adm-zip": "^0", "@types/adm-zip": "^0",
"@types/fs-extra": "^11", "@types/fs-extra": "^11",
"@types/lodash": "^4.17.5", "@types/lodash": "^4.17.5",

View File

@ -188,8 +188,6 @@ const CitationsTitle = styled.div`
color: var(--color-text-1); color: var(--color-text-1);
` `
const CitationItem = styled.li``
const CitationLink = styled.a` const CitationLink = styled.a`
font-size: 14px; font-size: 14px;
line-height: 1.6; line-height: 1.6;

View File

@ -2351,16 +2351,24 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@tavily/core@npm:^0.3.1": "@tavily/core@npm:0.3.1":
version: 0.3.1 version: 0.3.1
resolution: "@tavily/core@npm:0.3.1" resolution: "@tavily/core@npm:0.3.1"
dependencies: dependencies:
axios: "npm:^1.7.7" axios: "npm:^1.7.7"
js-tiktoken: "npm:^1.0.14"
checksum: 10c0/ddf711848f09c9dfe7f094ffdf4ea1291f7af980a8335a52e5c534a62ed9fbd234b3405e3b7baa598926cdd241425e0a4890badc85f883281c03840145de6d98 checksum: 10c0/ddf711848f09c9dfe7f094ffdf4ea1291f7af980a8335a52e5c534a62ed9fbd234b3405e3b7baa598926cdd241425e0a4890badc85f883281c03840145de6d98
languageName: node languageName: node
linkType: hard linkType: hard
"@tavily/core@patch:@tavily/core@npm%3A0.3.1#~/.yarn/patches/@tavily-core-npm-0.3.1-fe69bf2bea.patch":
version: 0.3.1
resolution: "@tavily/core@patch:@tavily/core@npm%3A0.3.1#~/.yarn/patches/@tavily-core-npm-0.3.1-fe69bf2bea.patch::version=0.3.1&hash=d1f3ab"
dependencies:
axios: "npm:^1.7.7"
checksum: 10c0/e25a76960491a8a463ae8f38a058b8b48d2d72314aa12d922aea4bf8d2cb1231c5357d1b0f7ed9650c48a756fc68617f0de3e1ff929aaca3fc5319dc250a545c
languageName: node
linkType: hard
"@tokenizer/token@npm:^0.3.0": "@tokenizer/token@npm:^0.3.0":
version: 0.3.0 version: 0.3.0
resolution: "@tokenizer/token@npm:0.3.0" resolution: "@tokenizer/token@npm:0.3.0"
@ -3011,7 +3019,7 @@ __metadata:
"@llm-tools/embedjs-openai": "npm:^0.1.28" "@llm-tools/embedjs-openai": "npm:^0.1.28"
"@notionhq/client": "npm:^2.2.15" "@notionhq/client": "npm:^2.2.15"
"@reduxjs/toolkit": "npm:^2.2.5" "@reduxjs/toolkit": "npm:^2.2.5"
"@tavily/core": "npm:^0.3.1" "@tavily/core": "patch:@tavily/core@npm%3A0.3.1#~/.yarn/patches/@tavily-core-npm-0.3.1-fe69bf2bea.patch"
"@types/adm-zip": "npm:^0" "@types/adm-zip": "npm:^0"
"@types/fs-extra": "npm:^11" "@types/fs-extra": "npm:^11"
"@types/lodash": "npm:^4.17.5" "@types/lodash": "npm:^4.17.5"
@ -8064,15 +8072,6 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"js-tiktoken@npm:^1.0.14":
version: 1.0.19
resolution: "js-tiktoken@npm:1.0.19"
dependencies:
base64-js: "npm:^1.5.1"
checksum: 10c0/528779571e4f72ba2f8d07c3840214401225652481a5c1619a84b634da635dc07fb1db09fd6b3580a5c2f926405dea57822c56684e0fe21b89bef2af3ab19427
languageName: node
linkType: hard
"js-tokens@npm:^3.0.0 || ^4.0.0, js-tokens@npm:^4.0.0": "js-tokens@npm:^3.0.0 || ^4.0.0, js-tokens@npm:^4.0.0":
version: 4.0.0 version: 4.0.0
resolution: "js-tokens@npm:4.0.0" resolution: "js-tokens@npm:4.0.0"