mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-10-18 21:38:14 +00:00
feat(app): remove compute-dot
, make cosine default
This commit is contained in:
@@ -29,8 +29,8 @@
|
|||||||
"better-sqlite3": "^11.9.1",
|
"better-sqlite3": "^11.9.1",
|
||||||
"clsx": "^2.1.0",
|
"clsx": "^2.1.0",
|
||||||
"compute-cosine-similarity": "^1.1.0",
|
"compute-cosine-similarity": "^1.1.0",
|
||||||
"compute-dot": "^1.1.0",
|
|
||||||
"drizzle-orm": "^0.40.1",
|
"drizzle-orm": "^0.40.1",
|
||||||
|
"framer-motion": "^12.23.24",
|
||||||
"html-to-text": "^9.0.5",
|
"html-to-text": "^9.0.5",
|
||||||
"jspdf": "^3.0.1",
|
"jspdf": "^3.0.1",
|
||||||
"langchain": "^0.3.30",
|
"langchain": "^0.3.30",
|
||||||
|
5
src/lib/types/compute-dot.d.ts
vendored
5
src/lib/types/compute-dot.d.ts
vendored
@@ -1,5 +0,0 @@
|
|||||||
declare function computeDot(vectorA: number[], vectorB: number[]): number;
|
|
||||||
|
|
||||||
declare module 'compute-dot' {
|
|
||||||
export default computeDot;
|
|
||||||
}
|
|
@@ -1,17 +1,7 @@
|
|||||||
import dot from 'compute-dot';
|
|
||||||
import cosineSimilarity from 'compute-cosine-similarity';
|
import cosineSimilarity from 'compute-cosine-similarity';
|
||||||
import { getSimilarityMeasure } from '../config';
|
|
||||||
|
|
||||||
const computeSimilarity = (x: number[], y: number[]): number => {
|
const computeSimilarity = (x: number[], y: number[]): number => {
|
||||||
const similarityMeasure = getSimilarityMeasure();
|
return cosineSimilarity(x, y) as number;
|
||||||
|
|
||||||
if (similarityMeasure === 'cosine') {
|
|
||||||
return cosineSimilarity(x, y) as number;
|
|
||||||
} else if (similarityMeasure === 'dot') {
|
|
||||||
return dot(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new Error('Invalid similarity measure');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default computeSimilarity;
|
export default computeSimilarity;
|
||||||
|
21
yarn.lock
21
yarn.lock
@@ -2709,6 +2709,15 @@ fraction.js@^4.3.7:
|
|||||||
resolved "https://registry.yarnpkg.com/fraction.js/-/fraction.js-4.3.7.tgz#06ca0085157e42fda7f9e726e79fefc4068840f7"
|
resolved "https://registry.yarnpkg.com/fraction.js/-/fraction.js-4.3.7.tgz#06ca0085157e42fda7f9e726e79fefc4068840f7"
|
||||||
integrity sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==
|
integrity sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==
|
||||||
|
|
||||||
|
framer-motion@^12.23.24:
|
||||||
|
version "12.23.24"
|
||||||
|
resolved "https://registry.yarnpkg.com/framer-motion/-/framer-motion-12.23.24.tgz#4895b67e880bd2b1089e61fbaa32ae802fc24b8c"
|
||||||
|
integrity sha512-HMi5HRoRCTou+3fb3h9oTLyJGBxHfW+HnNE25tAXOvVx/IvwMHK0cx7IR4a2ZU6sh3IX1Z+4ts32PcYBOqka8w==
|
||||||
|
dependencies:
|
||||||
|
motion-dom "^12.23.23"
|
||||||
|
motion-utils "^12.23.6"
|
||||||
|
tslib "^2.4.0"
|
||||||
|
|
||||||
fs-constants@^1.0.0:
|
fs-constants@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad"
|
resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad"
|
||||||
@@ -3674,6 +3683,18 @@ mkdirp-classic@^0.5.2, mkdirp-classic@^0.5.3:
|
|||||||
resolved "https://registry.yarnpkg.com/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz#fa10c9115cc6d8865be221ba47ee9bed78601113"
|
resolved "https://registry.yarnpkg.com/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz#fa10c9115cc6d8865be221ba47ee9bed78601113"
|
||||||
integrity sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==
|
integrity sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==
|
||||||
|
|
||||||
|
motion-dom@^12.23.23:
|
||||||
|
version "12.23.23"
|
||||||
|
resolved "https://registry.yarnpkg.com/motion-dom/-/motion-dom-12.23.23.tgz#8f874333ea1a04ee3a89eb928f518b463d589e0e"
|
||||||
|
integrity sha512-n5yolOs0TQQBRUFImrRfs/+6X4p3Q4n1dUEqt/H58Vx7OW6RF+foWEgmTVDhIWJIMXOuNNL0apKH2S16en9eiA==
|
||||||
|
dependencies:
|
||||||
|
motion-utils "^12.23.6"
|
||||||
|
|
||||||
|
motion-utils@^12.23.6:
|
||||||
|
version "12.23.6"
|
||||||
|
resolved "https://registry.yarnpkg.com/motion-utils/-/motion-utils-12.23.6.tgz#fafef80b4ea85122dd0d6c599a0c63d72881f312"
|
||||||
|
integrity sha512-eAWoPgr4eFEOFfg2WjIsMoqJTW6Z8MTUCgn/GZ3VRpClWBdnbjryiA3ZSNLyxCTmCQx4RmYX6jX1iWHbenUPNQ==
|
||||||
|
|
||||||
ms@2.1.2:
|
ms@2.1.2:
|
||||||
version "2.1.2"
|
version "2.1.2"
|
||||||
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
|
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
|
||||||
|
Reference in New Issue
Block a user