From 31859abad8ccf1a9a2457675c319f5b722a77b71 Mon Sep 17 00:00:00 2001
From: Massimiliano Pasquini
Date: Thu, 30 Nov 2023 08:16:49 +0100
Subject: [PATCH] Update raycast-ollama extension
- Merge pull request #9 from MassimilianoPasquini97/dev
- Updated README.md and CHANGELOG.md files.
- Load PDF and Text based files on prompt for query chains.
- Code splitted
- Merge pull request #6 from MassimilianoPasquini97/OllamaResponseApiFix
- Updated changelog.md
- TextField apper if ModelsOnRegistry is undefined
- Fixed ModelsOnRegistry.lengh undefined
- Deleted \'error\' message on event emitter
- Deleted field no longher used by Ollama Generate Response API
- CHANGELOG.md update
- Merge pull request #5 from MassimilianoPasquini97/clipboard_fallback
- New Preference \'Enable Input Source Fallback\'.
- New Preference \'Input Source\'
- Removed unused embedding from codebase
- Merge branch \'contributions/merge-1697691587951609000\'
- Pull contributions
- Updated CHANGELOG.md
- Updated README.md with new model name.
- Metrics metadata now available on Chat Command.
- Ollama Host is now configurable throw Preferences.
- New Action.Open for quickly go to \'Manage Models\'.
- Moved Model preferences to LocalStorage.
- Updated Models Library link on README.md
- Reduced re-rendering on models downloading.
- Deleted navigationTitle from Form.
- Last fixes before publish.
- Improvement on \'Chat With Ollama\' ActionPanel
- New command \'Manage Models\'
- OllamaApiTags() function returns Promise
- Error Handling for \'ollama-custom-create\'
- Implemented new command \'Create Custom Command\'
- Multiple chat saving feature
- Convertation is now saved only when inference is done.
- Chat is now saved on LocalStorage
- First implementation of a chat command.
- [Improvement and BugFix] - 2023-08-12
- Merge pull request #2 from suhaildawood/main
- Changed CHANGELOG.md file.
- feat: support for llama2:70b
- Import optimized images
- Pull contributions
- CHANGELOG Update
- Updated README and minor fix
- Fixed CHANGELOG and README
- [Improvement] - 2023-07-31
- Improvement] - 2023-07-30 v2
- [Improvement] - 2023-07-30
- [Code Improvement and BugFix] - 2023-07-29
- ray lint --fix runned
- Added git repository
- Initial commit
- Initial commit
---
extensions/raycast-ollama/CHANGELOG.md | 5 +
extensions/raycast-ollama/README.md | 26 +-
extensions/raycast-ollama/package-lock.json | 2478 ++++++++++++++++-
extensions/raycast-ollama/package.json | 12 +-
extensions/raycast-ollama/src/api/errors.ts | 3 +
.../raycast-ollama/src/api/langchain.ts | 316 +++
extensions/raycast-ollama/src/api/main.tsx | 654 -----
extensions/raycast-ollama/src/api/ollama.ts | 199 +-
.../src/api/polyfill/node-fetch.js | 19 +
extensions/raycast-ollama/src/api/types.ts | 70 +-
.../raycast-ollama/src/api/ui/AnswerView.tsx | 296 ++
.../raycast-ollama/src/api/ui/ChainView.tsx | 139 +
.../raycast-ollama/src/api/ui/ChatView.tsx | 502 ++++
.../src/api/ui/DocumentLoaderFileView.tsx | 117 +
.../raycast-ollama/src/api/ui/ModelView.tsx | 302 ++
.../src/api/ui/SaveChatView.tsx | 45 +
.../src/api/ui/SetModelView.tsx | 158 ++
.../raycast-ollama/src/ollama-casual.tsx | 6 +-
extensions/raycast-ollama/src/ollama-chat.tsx | 4 +-
.../src/ollama-code-explain.tsx | 6 +-
.../raycast-ollama/src/ollama-confident.tsx | 6 +-
.../src/ollama-custom-command.tsx | 4 +-
.../raycast-ollama/src/ollama-explain.tsx | 6 +-
.../src/ollama-fix-spelling-grammar.tsx | 6 +-
.../raycast-ollama/src/ollama-friendly.tsx | 6 +-
.../src/ollama-improve-writing.tsx | 6 +-
.../raycast-ollama/src/ollama-longer.tsx | 6 +-
.../raycast-ollama/src/ollama-models.tsx | 191 +-
.../src/ollama-professional.tsx | 6 +-
.../raycast-ollama/src/ollama-shorter.tsx | 6 +-
.../raycast-ollama/src/ollama-translate.tsx | 5 +-
.../raycast-ollama/src/ollama-tweet.tsx | 6 +-
32 files changed, 4567 insertions(+), 1044 deletions(-)
create mode 100644 extensions/raycast-ollama/src/api/langchain.ts
delete mode 100644 extensions/raycast-ollama/src/api/main.tsx
create mode 100644 extensions/raycast-ollama/src/api/polyfill/node-fetch.js
create mode 100644 extensions/raycast-ollama/src/api/ui/AnswerView.tsx
create mode 100644 extensions/raycast-ollama/src/api/ui/ChainView.tsx
create mode 100644 extensions/raycast-ollama/src/api/ui/ChatView.tsx
create mode 100644 extensions/raycast-ollama/src/api/ui/DocumentLoaderFileView.tsx
create mode 100644 extensions/raycast-ollama/src/api/ui/ModelView.tsx
create mode 100644 extensions/raycast-ollama/src/api/ui/SaveChatView.tsx
create mode 100644 extensions/raycast-ollama/src/api/ui/SetModelView.tsx
diff --git a/extensions/raycast-ollama/CHANGELOG.md b/extensions/raycast-ollama/CHANGELOG.md
index bba93efd466..a05edf316ea 100644
--- a/extensions/raycast-ollama/CHANGELOG.md
+++ b/extensions/raycast-ollama/CHANGELOG.md
@@ -1,5 +1,10 @@
# raycast-ollama Changelog
+## [Improvement] - 2023-11-30
+
+- [Improvement] Query you pdf or text based file with Ollama. More information on how to use is on README.md.
+- [Improvement] On Command 'Manage Models' is now possible to view all Modelfile parameters. If a specific parameter isn't set on Modelfile it display the default value.
+
## [BugFix] - 2023-11-5
- [BugFix] Fixed error `ModelsOnRegistry.lengh undefined`.
diff --git a/extensions/raycast-ollama/README.md b/extensions/raycast-ollama/README.md
index bf36baf80ed..ded5b8ec127 100644
--- a/extensions/raycast-ollama/README.md
+++ b/extensions/raycast-ollama/README.md
@@ -1,21 +1,25 @@
-# Raycast Ollama
+
+
+
Raycast Ollama
+
Use [Ollama](https://ollama.ai) for local llama inference on Raycast.
## Requirements
-1. Ollama installed and running.
-2. At least one model installed. Use 'Manage Models' commands for pulling images or ollama cli.
+[Ollama](https://ollama.ai) installed and running on your mac. At least one model need to be installed throw Ollama cli tools or with 'Manage Models' Command. You can find all available model [here](https://ollama.ai/library).
-```bash
-ollama pull orca-mini
-ollama pull llama2
-```
+## How to Use
-## Use a different model
+### Command: Chat With Ollama
-This plugin allows you to select a different model for each command. Keep in mind that you need to have the corresponding model installed on your machine. You can find all available model [here](https://ollama.ai/library).
+Chat with your preferred model from Raycast, with the following features:
-## Create your own custom commands
+- Save conversation with `CMD+S` keyboard shortcut. You can access your saved conversation with `CMD+P` keyboard shortcut.
+- Change model with `CMD+M` keyboard shortcuts. For embedding is recommended to use a lower parameters model for better performance.
+- Copy your Question, Answer or even the entire Chat to the clipboard.
+- Is now possible to ask the model about one or more files. Select the files using `CMD+F`, at this stage only text based files and PDF are supported. And finally use tag `/file` for query about selected files. By default it use 'Stuff' Chain, you can change Chain type from 'Document Loader' submenu. This feature is currently experimental.
-With '***Create Custom Command***' you can create your own custom command or chatbot using whatever model you want.
+### Command: Create Custom Commands
+
+With '***Create Custom Command***' you can create your own custom Command using whatever model you want.
diff --git a/extensions/raycast-ollama/package-lock.json b/extensions/raycast-ollama/package-lock.json
index 2a7cb0f2d04..bcbffb41d11 100644
--- a/extensions/raycast-ollama/package-lock.json
+++ b/extensions/raycast-ollama/package-lock.json
@@ -9,14 +9,18 @@
"dependencies": {
"@raycast/api": "^1.55.2",
"@raycast/utils": "^1.9.0",
- "node-fetch": "^3.3.2"
+ "langchain": "^0.0.183",
+ "mime-types": "^2.1.35",
+ "node-fetch": "^3.3.2",
+ "pdf-parse": "^1.1.1"
},
"devDependencies": {
"@raycast/eslint-config": "1.0.5",
- "@types/node": "18.8.3",
- "@types/react": "18.0.9",
+ "@types/mime-types": "^2.1.4",
+ "@types/node": "18.18.4",
+ "@types/react": "18.2.27",
"eslint": "^7.32.0",
- "prettier": "^2.5.1",
+ "prettier": "^2.8.8",
"typescript": "^4.4.3"
}
},
@@ -29,6 +33,49 @@
"node": ">=0.10.0"
}
},
+ "node_modules/@anthropic-ai/sdk": {
+ "version": "0.6.8",
+ "resolved": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-0.6.8.tgz",
+ "integrity": "sha512-z4gDFrBf+W2wOVvwA3CA+5bfKOxQhPeXQo7+ITWj3r3XPulIMEasVT0KrD41G+anr5Yc3d2PKvXKB6b1LSon5w==",
+ "dependencies": {
+ "@types/node": "^18.11.18",
+ "@types/node-fetch": "^2.6.4",
+ "abort-controller": "^3.0.0",
+ "agentkeepalive": "^4.2.1",
+ "digest-fetch": "^1.3.0",
+ "form-data-encoder": "1.7.2",
+ "formdata-node": "^4.3.2",
+ "node-fetch": "^2.6.7",
+ "web-streams-polyfill": "^3.2.1"
+ }
+ },
+ "node_modules/@anthropic-ai/sdk/node_modules/@types/node": {
+ "version": "18.18.9",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.9.tgz",
+ "integrity": "sha512-0f5klcuImLnG4Qreu9hPj/rEfFq6YRc5n2mAjSsH+ec/mJL+3voBH0+8T7o8RpFjH7ovc+TRsL/c7OYIQsPTfQ==",
+ "dependencies": {
+ "undici-types": "~5.26.4"
+ }
+ },
+ "node_modules/@anthropic-ai/sdk/node_modules/node-fetch": {
+ "version": "2.7.0",
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
+ "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
+ "dependencies": {
+ "whatwg-url": "^5.0.0"
+ },
+ "engines": {
+ "node": "4.x || >=6.0.0"
+ },
+ "peerDependencies": {
+ "encoding": "^0.1.0"
+ },
+ "peerDependenciesMeta": {
+ "encoding": {
+ "optional": true
+ }
+ }
+ },
"node_modules/@babel/code-frame": {
"version": "7.12.11",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz",
@@ -39,21 +86,21 @@
}
},
"node_modules/@babel/helper-validator-identifier": {
- "version": "7.22.5",
- "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.5.tgz",
- "integrity": "sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ==",
+ "version": "7.22.20",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz",
+ "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==",
"dev": true,
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@babel/highlight": {
- "version": "7.22.10",
- "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.10.tgz",
- "integrity": "sha512-78aUtVcT7MUscr0K5mIEnkwxPE0MaxkR5RxRwuHaQ+JuU5AmTPhY+do2mdzVTnIJJpyBglql2pehuBIWHug+WQ==",
+ "version": "7.22.20",
+ "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.20.tgz",
+ "integrity": "sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==",
"dev": true,
"dependencies": {
- "@babel/helper-validator-identifier": "^7.22.5",
+ "@babel/helper-validator-identifier": "^7.22.20",
"chalk": "^2.4.2",
"js-tokens": "^4.0.0"
},
@@ -148,9 +195,9 @@
}
},
"node_modules/@eslint-community/regexpp": {
- "version": "4.6.2",
- "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.6.2.tgz",
- "integrity": "sha512-pPTNuaAG3QMH+buKyBIGJs3g/S5y0caxw0ygM3YyE6yJFySwiGGSzA+mM3KJ8QQvzeLh3blwgSonkFjgQdxzMw==",
+ "version": "4.10.0",
+ "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz",
+ "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==",
"dev": true,
"engines": {
"node": "^12.0.0 || ^14.0.0 || >=16.0.0"
@@ -241,22 +288,22 @@
}
},
"node_modules/@raycast/api": {
- "version": "1.57.1",
- "resolved": "https://registry.npmjs.org/@raycast/api/-/api-1.57.1.tgz",
- "integrity": "sha512-E66UOmBehkefxePO5pqq7LGpus1rgdI+RMWOnzKmiqv4q9HT2INdJxRA5XrM1wIJjWzxO1pU3s/qeVanOG8Z6Q==",
+ "version": "1.61.2",
+ "resolved": "https://registry.npmjs.org/@raycast/api/-/api-1.61.2.tgz",
+ "integrity": "sha512-p5bJio+n8Ns+yhu6IYjCyl4uytFKq2bH898BorgT45xAWH9TgO/dIMReJaMgsDKJst38PWiOO59aJbtQn4HYbg==",
"hasInstallScript": true,
"dependencies": {
- "@types/node": "18.8.3",
- "@types/react": "18.0.9",
- "react": "18.1.0",
- "react-reconciler": "0.28.0"
+ "@types/node": "^18.18.4",
+ "@types/react": "^18.2.27",
+ "react": "18.2.0"
},
"bin": {
"ray": "bin/ray"
},
"peerDependencies": {
- "@types/node": "18.8.3",
- "@types/react": "18.0.9"
+ "@types/node": "18.18.4",
+ "@types/react": "18.2.27",
+ "react-devtools": "4.28.4"
},
"peerDependenciesMeta": {
"@types/node": {
@@ -264,9 +311,30 @@
},
"@types/react": {
"optional": true
+ },
+ "react-devtools": {
+ "optional": true
}
}
},
+ "node_modules/@raycast/api/node_modules/@types/node": {
+ "version": "18.18.9",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.9.tgz",
+ "integrity": "sha512-0f5klcuImLnG4Qreu9hPj/rEfFq6YRc5n2mAjSsH+ec/mJL+3voBH0+8T7o8RpFjH7ovc+TRsL/c7OYIQsPTfQ==",
+ "dependencies": {
+ "undici-types": "~5.26.4"
+ }
+ },
+ "node_modules/@raycast/api/node_modules/@types/react": {
+ "version": "18.2.37",
+ "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.37.tgz",
+ "integrity": "sha512-RGAYMi2bhRgEXT3f4B92WTohopH6bIXw05FuGlmJEnv/omEn190+QYEIYxIAuIBdKgboYYdVved2p1AxZVQnaw==",
+ "dependencies": {
+ "@types/prop-types": "*",
+ "@types/scheduler": "*",
+ "csstype": "^3.0.2"
+ }
+ },
"node_modules/@raycast/eslint-config": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/@raycast/eslint-config/-/eslint-config-1.0.5.tgz",
@@ -286,9 +354,9 @@
}
},
"node_modules/@raycast/eslint-plugin": {
- "version": "1.0.5",
- "resolved": "https://registry.npmjs.org/@raycast/eslint-plugin/-/eslint-plugin-1.0.5.tgz",
- "integrity": "sha512-+qLHlIdaGDflmfZaQeKDH2s83H6ZXmuvRRxv4L++gnU016Jsx4z70pQxA/94pyY3zEP7UsafHssA/Of90lRN5g==",
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/@raycast/eslint-plugin/-/eslint-plugin-1.0.7.tgz",
+ "integrity": "sha512-JSoX/cNcg0PzVvXCXjuvXjAGZdTBT+1UZgTAn7fxQ2XhufGx3C+7KOtJOeem4k0k0ptLsskvHksgCZRUwY95fg==",
"dev": true,
"dependencies": {
"@typescript-eslint/utils": "^5.48.1",
@@ -299,9 +367,9 @@
}
},
"node_modules/@raycast/utils": {
- "version": "1.9.1",
- "resolved": "https://registry.npmjs.org/@raycast/utils/-/utils-1.9.1.tgz",
- "integrity": "sha512-/lkxze0WP32pOrpQiAyOGNi8ylbF4Igneo7KBTG1QOZZmwUePXTZC7jCeyKEDyEpOIG0dapGFs9Jynw14tVyZg==",
+ "version": "1.10.1",
+ "resolved": "https://registry.npmjs.org/@raycast/utils/-/utils-1.10.1.tgz",
+ "integrity": "sha512-XvSTbbNSNE3ioLm0OIHpdy6484vg464Siz+AZVnpsjkma36+mej54NIoC6wyqTJeituJR5qWxRGmNXn47M6p4Q==",
"dependencies": {
"content-type": "^1.0.5",
"cross-fetch": "^3.1.6",
@@ -315,48 +383,74 @@
}
},
"node_modules/@rushstack/eslint-patch": {
- "version": "1.3.3",
- "resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.3.3.tgz",
- "integrity": "sha512-0xd7qez0AQ+MbHatZTlI1gu5vkG8r7MYRUJAHPAHJBmGLs16zpkrpAVLvjQKQOqaXPDUBwOiJzNc00znHSCVBw==",
+ "version": "1.5.1",
+ "resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.5.1.tgz",
+ "integrity": "sha512-6i/8UoL0P5y4leBIGzvkZdS85RDMG9y1ihZzmTZQ5LdHUYmZ7pKFoj8X0236s3lusPs1Fa5HTQUpwI+UfTcmeA==",
"dev": true
},
"node_modules/@types/json-schema": {
- "version": "7.0.12",
- "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.12.tgz",
- "integrity": "sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==",
+ "version": "7.0.15",
+ "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
+ "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==",
+ "dev": true
+ },
+ "node_modules/@types/mime-types": {
+ "version": "2.1.4",
+ "resolved": "https://registry.npmjs.org/@types/mime-types/-/mime-types-2.1.4.tgz",
+ "integrity": "sha512-lfU4b34HOri+kAY5UheuFMWPDOI+OPceBSHZKp69gEyTL/mmJ4cnU6Y/rlme3UL3GyOn6Y42hyIEw0/q8sWx5w==",
"dev": true
},
"node_modules/@types/node": {
- "version": "18.8.3",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-18.8.3.tgz",
- "integrity": "sha512-0os9vz6BpGwxGe9LOhgP/ncvYN5Tx1fNcd2TM3rD/aCGBkysb+ZWpXEocG24h6ZzOi13+VB8HndAQFezsSOw1w=="
+ "version": "18.18.4",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.4.tgz",
+ "integrity": "sha512-t3rNFBgJRugIhackit2mVcLfF6IRc0JE4oeizPQL8Zrm8n2WY/0wOdpOPhdtG0V9Q2TlW/axbF1MJ6z+Yj/kKQ=="
+ },
+ "node_modules/@types/node-fetch": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.9.tgz",
+ "integrity": "sha512-bQVlnMLFJ2d35DkPNjEPmd9ueO/rh5EiaZt2bhqiSarPjZIuIV6bPQVqcrEyvNo+AfTrRGVazle1tl597w3gfA==",
+ "dependencies": {
+ "@types/node": "*",
+ "form-data": "^4.0.0"
+ }
},
"node_modules/@types/prop-types": {
- "version": "15.7.5",
- "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz",
- "integrity": "sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w=="
+ "version": "15.7.10",
+ "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.10.tgz",
+ "integrity": "sha512-mxSnDQxPqsZxmeShFH+uwQ4kO4gcJcGahjjMFeLbKE95IAZiiZyiEepGZjtXJ7hN/yfu0bu9xN2ajcU0JcxX6A=="
},
"node_modules/@types/react": {
- "version": "18.0.9",
- "resolved": "https://registry.npmjs.org/@types/react/-/react-18.0.9.tgz",
- "integrity": "sha512-9bjbg1hJHUm4De19L1cHiW0Jvx3geel6Qczhjd0qY5VKVE2X5+x77YxAepuCwVh4vrgZJdgEJw48zrhRIeF4Nw==",
+ "version": "18.2.27",
+ "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.27.tgz",
+ "integrity": "sha512-Wfv7B7FZiR2r3MIqbAlXoY1+tXm4bOqfz4oRr+nyXdBqapDBZ0l/IGcSlAfvxIHEEJjkPU0MYAc/BlFPOcrgLw==",
+ "dev": true,
"dependencies": {
"@types/prop-types": "*",
"@types/scheduler": "*",
"csstype": "^3.0.2"
}
},
+ "node_modules/@types/retry": {
+ "version": "0.12.0",
+ "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.0.tgz",
+ "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA=="
+ },
"node_modules/@types/scheduler": {
- "version": "0.16.3",
- "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.3.tgz",
- "integrity": "sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ=="
+ "version": "0.16.6",
+ "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.6.tgz",
+ "integrity": "sha512-Vlktnchmkylvc9SnwwwozTv04L/e1NykF5vgoQ0XTmI8DD+wxfjQuHuvHS3p0r2jz2x2ghPs2h1FVeDirIteWA=="
},
"node_modules/@types/semver": {
- "version": "7.5.0",
- "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.0.tgz",
- "integrity": "sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==",
+ "version": "7.5.5",
+ "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.5.tgz",
+ "integrity": "sha512-+d+WYC1BxJ6yVOgUgzK8gWvp5qF8ssV5r4nsDcZWKRWcDQLQ619tvWAxJQYGgBrO1MnLJC7a5GtiYsAoQ47dJg==",
"dev": true
},
+ "node_modules/@types/uuid": {
+ "version": "9.0.7",
+ "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.7.tgz",
+ "integrity": "sha512-WUtIVRUZ9i5dYXefDEAI7sh9/O7jGvHg7Df/5O/gtH3Yabe5odI3UWopVR1qbPXQtvOxWu3mM4XxlYeZtMWF4g=="
+ },
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "5.62.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.62.0.tgz",
@@ -545,6 +639,17 @@
"url": "https://opencollective.com/typescript-eslint"
}
},
+ "node_modules/abort-controller": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
+ "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
+ "dependencies": {
+ "event-target-shim": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=6.5"
+ }
+ },
"node_modules/acorn": {
"version": "7.4.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz",
@@ -566,6 +671,17 @@
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
}
},
+ "node_modules/agentkeepalive": {
+ "version": "4.5.0",
+ "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz",
+ "integrity": "sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==",
+ "dependencies": {
+ "humanize-ms": "^1.2.1"
+ },
+ "engines": {
+ "node": ">= 8.0.0"
+ }
+ },
"node_modules/ajv": {
"version": "6.12.6",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
@@ -642,12 +758,135 @@
"node": ">=8"
}
},
+ "node_modules/asynckit": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
+ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
+ },
+ "node_modules/axios": {
+ "version": "1.6.1",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.1.tgz",
+ "integrity": "sha512-vfBmhDpKafglh0EldBEbVuoe7DyAavGSLWhuSm5ZSEKQnHhBf0xAAwybbNH1IkrJNGnS/VG4I5yxig1pCEXE4g==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "follow-redirects": "^1.15.0",
+ "form-data": "^4.0.0",
+ "proxy-from-env": "^1.1.0"
+ }
+ },
+ "node_modules/b4a": {
+ "version": "1.6.4",
+ "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.4.tgz",
+ "integrity": "sha512-fpWrvyVHEKyeEvbKZTVOeZF3VSKKWtJxFIxX/jaVPf+cLbGUSitjb49pHLqPV2BUNNZ0LcoeEGfE/YCpyDYHIw==",
+ "optional": true,
+ "peer": true
+ },
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"dev": true
},
+ "node_modules/base-64": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/base-64/-/base-64-0.1.0.tgz",
+ "integrity": "sha512-Y5gU45svrR5tI2Vt/X9GPd3L0HNIKzGu202EjxrXMpuc2V2CiKgemAbUUsqYmZJvPtCXoUKjNZwBJzsNScUbXA=="
+ },
+ "node_modules/base64-js": {
+ "version": "1.5.1",
+ "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
+ "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ]
+ },
+ "node_modules/binary-extensions": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
+ "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/binary-search": {
+ "version": "1.3.6",
+ "resolved": "https://registry.npmjs.org/binary-search/-/binary-search-1.3.6.tgz",
+ "integrity": "sha512-nbE1WxOTTrUWIfsfZ4aHGYu5DOuNkbxGokjV6Z2kxfJK3uaAb8zNK1muzOeipoLHZjInT4Br88BHpzevc681xA=="
+ },
+ "node_modules/bindings": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
+ "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "file-uri-to-path": "1.0.0"
+ }
+ },
+ "node_modules/bl": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
+ "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "buffer": "^5.5.0",
+ "inherits": "^2.0.4",
+ "readable-stream": "^3.4.0"
+ }
+ },
+ "node_modules/bl/node_modules/buffer": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
+ "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "base64-js": "^1.3.1",
+ "ieee754": "^1.1.13"
+ }
+ },
+ "node_modules/bl/node_modules/readable-stream": {
+ "version": "3.6.2",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
+ "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "inherits": "^2.0.3",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
"node_modules/brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
@@ -670,6 +909,62 @@
"node": ">=8"
}
},
+ "node_modules/browserify-zlib": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.1.4.tgz",
+ "integrity": "sha512-19OEpq7vWgsH6WkvkBJQDFvJS1uPcbFOQ4v9CU839dO+ZZXUZO6XpE6hNCqvlIIj+4fZvRiJ6DsAQ382GwiyTQ==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "pako": "~0.2.0"
+ }
+ },
+ "node_modules/browserify-zlib/node_modules/pako": {
+ "version": "0.2.9",
+ "resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz",
+ "integrity": "sha512-NUcwaKxUxWrZLpDG+z/xZaCgQITkA/Dv4V/T6bw7VON6l1Xz/VnrBqrYjZQ12TamKHzITTfOEIYUj48y2KXImA==",
+ "optional": true,
+ "peer": true
+ },
+ "node_modules/buffer": {
+ "version": "6.0.3",
+ "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
+ "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "base64-js": "^1.3.1",
+ "ieee754": "^1.2.1"
+ }
+ },
+ "node_modules/buffer-equal-constant-time": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz",
+ "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==",
+ "optional": true,
+ "peer": true
+ },
+ "node_modules/buffer-from": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
+ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
+ "optional": true,
+ "peer": true
+ },
"node_modules/callsites": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
@@ -679,6 +974,17 @@
"node": ">=6"
}
},
+ "node_modules/camelcase": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz",
+ "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
@@ -695,6 +1001,164 @@
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
+ "node_modules/charenc": {
+ "version": "0.0.2",
+ "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz",
+ "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==",
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/chownr": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz",
+ "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==",
+ "optional": true,
+ "peer": true,
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/closevector-browserify-zlib": {
+ "version": "0.1.0-alpha.3",
+ "resolved": "https://registry.npmjs.org/closevector-browserify-zlib/-/closevector-browserify-zlib-0.1.0-alpha.3.tgz",
+ "integrity": "sha512-xDouPVKyincvxRI2jskcWGrJgvDRv6yP4lvOjKYBuSjESvZF0aopSt6OIKPk+07g7P2GpD1OaqePY/7865482g==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "buffer": "^6.0.3",
+ "closevector-stream-browserify": "0.1.0-alpha.1",
+ "pako": "~1.0.5",
+ "process": "^0.11.10"
+ }
+ },
+ "node_modules/closevector-common": {
+ "version": "0.1.0-alpha.1",
+ "resolved": "https://registry.npmjs.org/closevector-common/-/closevector-common-0.1.0-alpha.1.tgz",
+ "integrity": "sha512-SnQZxEn4pmYeprRCIyrF2e/aRDUJA3DaZkuVCDzOfnC7tav7c42UF8Uemo4lOcZfjARTkeSzDSZzFAOudnWwhw==",
+ "optional": true,
+ "peer": true
+ },
+ "node_modules/closevector-crypto-jwt": {
+ "version": "0.1.0-alpha.3",
+ "resolved": "https://registry.npmjs.org/closevector-crypto-jwt/-/closevector-crypto-jwt-0.1.0-alpha.3.tgz",
+ "integrity": "sha512-hYfUIrCEk62r8QF3REVWvrAlYji1SYxoSta6tGKpvYsk7RT+bFex7t/rriRNzcBCCNAvqLjqpxnQiENEjwxU0A==",
+ "optional": true,
+ "peer": true
+ },
+ "node_modules/closevector-hnswlib-node": {
+ "version": "0.1.0-alpha.2",
+ "resolved": "https://registry.npmjs.org/closevector-hnswlib-node/-/closevector-hnswlib-node-0.1.0-alpha.2.tgz",
+ "integrity": "sha512-4AsGbACcGAAv0huYslPVfaIdS0Z9dkXt9l2MRkme4Ysbc9JNQ7EPc+WsmcjCy1sYYeEO9SLKujX8+xawr7MdNQ==",
+ "hasInstallScript": true,
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "bindings": "^1.5.0",
+ "node-addon-api": "^7.0.0"
+ }
+ },
+ "node_modules/closevector-hnswlib-wasm": {
+ "version": "0.1.0-alpha.3",
+ "resolved": "https://registry.npmjs.org/closevector-hnswlib-wasm/-/closevector-hnswlib-wasm-0.1.0-alpha.3.tgz",
+ "integrity": "sha512-wQxKSQ4zZdVNQhebWP3j1iM7AAZFt7rDsN6PdYd3TukG8jsGgb1MjLjlXuCdoUgzFpbO6TWjbYfBkeZHuUb6WQ==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "bindings": "^1.5.0",
+ "node-addon-api": "^7.0.0"
+ }
+ },
+ "node_modules/closevector-node": {
+ "version": "0.1.0-alpha.10",
+ "resolved": "https://registry.npmjs.org/closevector-node/-/closevector-node-0.1.0-alpha.10.tgz",
+ "integrity": "sha512-NASLTOVR1eOaZAGy6WAdw6TlMen2mnkOD9XESpmMcYz5CYgxoUVZrofaL8Chg/PQAsFWkJunLz+XgCzwZPNDGg==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "axios": "^1.4.0",
+ "closevector-common": "0.1.0-alpha.1",
+ "closevector-hnswlib-node": "0.1.0-alpha.2",
+ "jsonwebtoken": "^9.0.0",
+ "tar": "^6.1.15",
+ "typescript": "^5.1.6"
+ }
+ },
+ "node_modules/closevector-node/node_modules/typescript": {
+ "version": "5.2.2",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz",
+ "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==",
+ "optional": true,
+ "peer": true,
+ "bin": {
+ "tsc": "bin/tsc",
+ "tsserver": "bin/tsserver"
+ },
+ "engines": {
+ "node": ">=14.17"
+ }
+ },
+ "node_modules/closevector-readable-stream": {
+ "version": "0.1.0-alpha.1",
+ "resolved": "https://registry.npmjs.org/closevector-readable-stream/-/closevector-readable-stream-0.1.0-alpha.1.tgz",
+ "integrity": "sha512-6ZDx3GQbDTQR4l25ukpx5ziDALdmGfVMdzHOXS0uaGG61JVCQMO0AzWaopzKRX8mL1Q9fqmdA9LJLC8vOrB19w==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "buffer": "^6.0.3",
+ "events": "^3.3.0",
+ "inherits": "^2.0.3",
+ "process": "^0.11.10",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/closevector-stream-browserify": {
+ "version": "0.1.0-alpha.1",
+ "resolved": "https://registry.npmjs.org/closevector-stream-browserify/-/closevector-stream-browserify-0.1.0-alpha.1.tgz",
+ "integrity": "sha512-euUPB8e4CATWziuP6XxNW5W3Kj9+0JBT3bmiu6uexCtvgrJUV0DOsgH94A43g7DwUPPdcRXqWnD2/uwMhAJcsA==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "closevector-readable-stream": "0.1.0-alpha.1",
+ "events": "^3.3.0"
+ }
+ },
+ "node_modules/closevector-web": {
+ "version": "0.1.0-alpha.16",
+ "resolved": "https://registry.npmjs.org/closevector-web/-/closevector-web-0.1.0-alpha.16.tgz",
+ "integrity": "sha512-12l+R1pghFUPMoW94I22Wi9AoEAKYX+dS1GEzL3zG+4tmgcDZKd7CRNOkwns/E9rgYv14rcLockLPLUq2UIrKQ==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "axios": "^1.4.0",
+ "closevector-browserify-zlib": "0.1.0-alpha.3",
+ "closevector-common": "0.1.0-alpha.1",
+ "closevector-crypto-jwt": "0.1.0-alpha.3",
+ "closevector-hnswlib-wasm": "0.1.0-alpha.3",
+ "closevector-stream-browserify": "0.1.0-alpha.1",
+ "gunzip-maybe": "^1.4.2",
+ "tar-stream": "^3.1.6",
+ "typescript": "^5.1.6"
+ }
+ },
+ "node_modules/closevector-web/node_modules/typescript": {
+ "version": "5.2.2",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz",
+ "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==",
+ "optional": true,
+ "peer": true,
+ "bin": {
+ "tsc": "bin/tsc",
+ "tsserver": "bin/tsserver"
+ },
+ "engines": {
+ "node": ">=14.17"
+ }
+ },
"node_modules/color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
@@ -713,6 +1177,25 @@
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true
},
+ "node_modules/combined-stream": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
+ "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
+ "dependencies": {
+ "delayed-stream": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/commander": {
+ "version": "10.0.1",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz",
+ "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==",
+ "engines": {
+ "node": ">=14"
+ }
+ },
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@@ -727,6 +1210,13 @@
"node": ">= 0.6"
}
},
+ "node_modules/core-util-is": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
+ "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==",
+ "optional": true,
+ "peer": true
+ },
"node_modules/cross-fetch": {
"version": "3.1.8",
"resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.8.tgz",
@@ -736,9 +1226,9 @@
}
},
"node_modules/cross-fetch/node_modules/node-fetch": {
- "version": "2.6.13",
- "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.13.tgz",
- "integrity": "sha512-StxNAxh15zr77QvvkmveSQ8uCQ4+v5FkvNTj0OESmiHu+VRi/gXArXtkWMElOsOUNLtUEvI4yS+rdtOHZTwlQA==",
+ "version": "2.7.0",
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
+ "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
"dependencies": {
"whatwg-url": "^5.0.0"
},
@@ -754,25 +1244,6 @@
}
}
},
- "node_modules/cross-fetch/node_modules/tr46": {
- "version": "0.0.3",
- "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
- "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
- },
- "node_modules/cross-fetch/node_modules/webidl-conversions": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
- "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
- },
- "node_modules/cross-fetch/node_modules/whatwg-url": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
- "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
- "dependencies": {
- "tr46": "~0.0.3",
- "webidl-conversions": "^3.0.0"
- }
- },
"node_modules/cross-spawn": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
@@ -787,6 +1258,14 @@
"node": ">= 8"
}
},
+ "node_modules/crypt": {
+ "version": "0.0.2",
+ "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz",
+ "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==",
+ "engines": {
+ "node": "*"
+ }
+ },
"node_modules/csstype": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz",
@@ -817,12 +1296,54 @@
}
}
},
+ "node_modules/decamelize": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
+ "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/decompress-response": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz",
+ "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "mimic-response": "^3.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/deep-extend": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
+ "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
+ "optional": true,
+ "peer": true,
+ "engines": {
+ "node": ">=4.0.0"
+ }
+ },
"node_modules/deep-is": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
"integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
"dev": true
},
+ "node_modules/delayed-stream": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
+ "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
"node_modules/dequal": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz",
@@ -831,6 +1352,25 @@
"node": ">=6"
}
},
+ "node_modules/detect-libc": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz",
+ "integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==",
+ "optional": true,
+ "peer": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/digest-fetch": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/digest-fetch/-/digest-fetch-1.3.0.tgz",
+ "integrity": "sha512-CGJuv6iKNM7QyZlM2T3sPAdZWd/p9zQiRNS9G+9COUCwzWFTs0Xp8NF5iePx7wtvhDykReiRRrSeNb4oMmB8lA==",
+ "dependencies": {
+ "base-64": "^0.1.0",
+ "md5": "^2.3.0"
+ }
+ },
"node_modules/dir-glob": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",
@@ -855,12 +1395,45 @@
"node": ">=6.0.0"
}
},
+ "node_modules/duplexify": {
+ "version": "3.7.1",
+ "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz",
+ "integrity": "sha512-07z8uv2wMyS51kKhD1KsdXJg5WQ6t93RneqRxUHnskXVtlYYkLqM0gqStQZ3pj073g687jPCHrqNfCzawLYh5g==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "end-of-stream": "^1.0.0",
+ "inherits": "^2.0.1",
+ "readable-stream": "^2.0.0",
+ "stream-shift": "^1.0.0"
+ }
+ },
+ "node_modules/ecdsa-sig-formatter": {
+ "version": "1.0.11",
+ "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz",
+ "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "safe-buffer": "^5.0.1"
+ }
+ },
"node_modules/emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
"dev": true
},
+ "node_modules/end-of-stream": {
+ "version": "1.4.4",
+ "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
+ "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "once": "^1.4.0"
+ }
+ },
"node_modules/enquirer": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.4.1.tgz",
@@ -1118,16 +1691,84 @@
"node": ">=0.10.0"
}
},
- "node_modules/fast-deep-equal": {
- "version": "3.1.3",
- "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
- "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
- "dev": true
+ "node_modules/event-target-shim": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
+ "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/eventemitter3": {
+ "version": "4.0.7",
+ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
+ "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw=="
+ },
+ "node_modules/events": {
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
+ "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==",
+ "optional": true,
+ "peer": true,
+ "engines": {
+ "node": ">=0.8.x"
+ }
+ },
+ "node_modules/expand-template": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz",
+ "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==",
+ "optional": true,
+ "peer": true,
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/expr-eval": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/expr-eval/-/expr-eval-2.0.2.tgz",
+ "integrity": "sha512-4EMSHGOPSwAfBiibw3ndnP0AvjDWLsMvGOvWEZ2F96IGk0bIVdjQisOHxReSkE13mHcfbuCiXw+G4y0zv6N8Eg=="
+ },
+ "node_modules/faiss-node": {
+ "version": "0.5.1",
+ "resolved": "https://registry.npmjs.org/faiss-node/-/faiss-node-0.5.1.tgz",
+ "integrity": "sha512-zD8wobJn8C6OLWo68Unho+Ih8l6nSRB2w3Amj01a+xc4bsEvd2mBDLklAn7VocA9XO3WDvQL/bLpi5flkCn/XQ==",
+ "hasInstallScript": true,
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "bindings": "^1.5.0",
+ "node-addon-api": "^6.0.0",
+ "prebuild-install": "^7.1.1"
+ },
+ "engines": {
+ "node": ">= 14.0.0"
+ }
+ },
+ "node_modules/faiss-node/node_modules/node-addon-api": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-6.1.0.tgz",
+ "integrity": "sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA==",
+ "optional": true,
+ "peer": true
+ },
+ "node_modules/fast-deep-equal": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
+ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
+ "dev": true
+ },
+ "node_modules/fast-fifo": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz",
+ "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==",
+ "optional": true,
+ "peer": true
},
"node_modules/fast-glob": {
- "version": "3.3.1",
- "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz",
- "integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==",
+ "version": "3.3.2",
+ "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz",
+ "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==",
"dev": true,
"dependencies": {
"@nodelib/fs.stat": "^2.0.2",
@@ -1183,14 +1824,6 @@
"node": "^12.20 || >= 14.13"
}
},
- "node_modules/fetch-blob/node_modules/web-streams-polyfill": {
- "version": "3.2.1",
- "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz",
- "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==",
- "engines": {
- "node": ">= 8"
- }
- },
"node_modules/file-entry-cache": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
@@ -1203,6 +1836,13 @@
"node": "^10.12.0 || >=12.0.0"
}
},
+ "node_modules/file-uri-to-path": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
+ "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
+ "optional": true,
+ "peer": true
+ },
"node_modules/fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
@@ -1215,25 +1855,93 @@
"node": ">=8"
}
},
+ "node_modules/flat": {
+ "version": "5.0.2",
+ "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz",
+ "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==",
+ "bin": {
+ "flat": "cli.js"
+ }
+ },
"node_modules/flat-cache": {
- "version": "3.0.4",
- "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz",
- "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==",
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.1.1.tgz",
+ "integrity": "sha512-/qM2b3LUIaIgviBQovTLvijfyOQXPtSRnRK26ksj2J7rzPIecePUIpJsZ4T02Qg+xiAEKIs5K8dsHEd+VaKa/Q==",
"dev": true,
"dependencies": {
- "flatted": "^3.1.0",
+ "flatted": "^3.2.9",
+ "keyv": "^4.5.3",
"rimraf": "^3.0.2"
},
"engines": {
- "node": "^10.12.0 || >=12.0.0"
+ "node": ">=12.0.0"
}
},
"node_modules/flatted": {
- "version": "3.2.7",
- "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz",
- "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==",
+ "version": "3.2.9",
+ "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.9.tgz",
+ "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==",
"dev": true
},
+ "node_modules/follow-redirects": {
+ "version": "1.15.3",
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz",
+ "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==",
+ "funding": [
+ {
+ "type": "individual",
+ "url": "https://github.com/sponsors/RubenVerborgh"
+ }
+ ],
+ "optional": true,
+ "peer": true,
+ "engines": {
+ "node": ">=4.0"
+ },
+ "peerDependenciesMeta": {
+ "debug": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/form-data": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
+ "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
+ "dependencies": {
+ "asynckit": "^0.4.0",
+ "combined-stream": "^1.0.8",
+ "mime-types": "^2.1.12"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/form-data-encoder": {
+ "version": "1.7.2",
+ "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.2.tgz",
+ "integrity": "sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A=="
+ },
+ "node_modules/formdata-node": {
+ "version": "4.4.1",
+ "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-4.4.1.tgz",
+ "integrity": "sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==",
+ "dependencies": {
+ "node-domexception": "1.0.0",
+ "web-streams-polyfill": "4.0.0-beta.3"
+ },
+ "engines": {
+ "node": ">= 12.20"
+ }
+ },
+ "node_modules/formdata-node/node_modules/web-streams-polyfill": {
+ "version": "4.0.0-beta.3",
+ "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz",
+ "integrity": "sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==",
+ "engines": {
+ "node": ">= 14"
+ }
+ },
"node_modules/formdata-polyfill": {
"version": "4.0.10",
"resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz",
@@ -1245,6 +1953,39 @@
"node": ">=12.20.0"
}
},
+ "node_modules/fs-constants": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
+ "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==",
+ "optional": true,
+ "peer": true
+ },
+ "node_modules/fs-minipass": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz",
+ "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "minipass": "^3.0.0"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/fs-minipass/node_modules/minipass": {
+ "version": "3.3.6",
+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
+ "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "yallist": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@@ -1257,6 +1998,13 @@
"integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==",
"dev": true
},
+ "node_modules/github-from-package": {
+ "version": "0.0.0",
+ "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz",
+ "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==",
+ "optional": true,
+ "peer": true
+ },
"node_modules/glob": {
"version": "7.2.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
@@ -1290,9 +2038,9 @@
}
},
"node_modules/globals": {
- "version": "13.21.0",
- "resolved": "https://registry.npmjs.org/globals/-/globals-13.21.0.tgz",
- "integrity": "sha512-ybyme3s4yy/t/3s35bewwXKOf7cvzfreG2lH0lZl0JB7I4GxRP2ghxOK/Nb9EkRXdbBXZLfq/p/0W2JUONB/Gg==",
+ "version": "13.23.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-13.23.0.tgz",
+ "integrity": "sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA==",
"dev": true,
"dependencies": {
"type-fest": "^0.20.2"
@@ -1330,6 +2078,24 @@
"integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==",
"dev": true
},
+ "node_modules/gunzip-maybe": {
+ "version": "1.4.2",
+ "resolved": "https://registry.npmjs.org/gunzip-maybe/-/gunzip-maybe-1.4.2.tgz",
+ "integrity": "sha512-4haO1M4mLO91PW57BMsDFf75UmwoRX0GkdD+Faw+Lr+r/OZrOCS0pIBwOL1xCKQqnQzbNFGgK2V2CpBUPeFNTw==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "browserify-zlib": "^0.1.4",
+ "is-deflate": "^1.0.0",
+ "is-gzip": "^1.0.0",
+ "peek-stream": "^1.1.0",
+ "pumpify": "^1.3.3",
+ "through2": "^2.0.3"
+ },
+ "bin": {
+ "gunzip-maybe": "bin.js"
+ }
+ },
"node_modules/has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
@@ -1339,11 +2105,59 @@
"node": ">=8"
}
},
+ "node_modules/hnswlib-node": {
+ "version": "1.4.2",
+ "resolved": "https://registry.npmjs.org/hnswlib-node/-/hnswlib-node-1.4.2.tgz",
+ "integrity": "sha512-76PIzOaNcX8kOpKwlFPl07uelpctqDMzbiC+Qsk2JWNVkzeU/6iXRk4tfE9z3DoK1RCBrOaFXmQ6RFb1BVF9LA==",
+ "hasInstallScript": true,
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "bindings": "^1.5.0",
+ "node-addon-api": "^6.0.0"
+ }
+ },
+ "node_modules/hnswlib-node/node_modules/node-addon-api": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-6.1.0.tgz",
+ "integrity": "sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA==",
+ "optional": true,
+ "peer": true
+ },
+ "node_modules/humanize-ms": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz",
+ "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==",
+ "dependencies": {
+ "ms": "^2.0.0"
+ }
+ },
+ "node_modules/ieee754": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
+ "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "optional": true,
+ "peer": true
+ },
"node_modules/ignore": {
"version": "5.2.4",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz",
"integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==",
- "dev": true,
+ "devOptional": true,
"engines": {
"node": ">= 4"
}
@@ -1387,7 +2201,31 @@
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
- "dev": true
+ "devOptional": true
+ },
+ "node_modules/ini": {
+ "version": "1.3.8",
+ "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
+ "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==",
+ "optional": true,
+ "peer": true
+ },
+ "node_modules/is-any-array": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/is-any-array/-/is-any-array-2.0.1.tgz",
+ "integrity": "sha512-UtilS7hLRu++wb/WBAw9bNuP1Eg04Ivn1vERJck8zJthEvXCBEBpGR/33u/xLKWEQf95803oalHrVDptcAvFdQ=="
+ },
+ "node_modules/is-buffer": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
+ "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w=="
+ },
+ "node_modules/is-deflate": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-deflate/-/is-deflate-1.0.0.tgz",
+ "integrity": "sha512-YDoFpuZWu1VRXlsnlYMzKyVRITXj7Ej/V9gXQ2/pAe7X1J7M/RNOqaIYi6qUn+B7nGyB9pDXrv02dsB58d2ZAQ==",
+ "optional": true,
+ "peer": true
},
"node_modules/is-extglob": {
"version": "2.1.1",
@@ -1419,6 +2257,16 @@
"node": ">=0.10.0"
}
},
+ "node_modules/is-gzip": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-gzip/-/is-gzip-1.0.0.tgz",
+ "integrity": "sha512-rcfALRIb1YewtnksfRIHGcIY93QnK8BIQ/2c9yDYcG/Y6+vRoJuTWBmmSEbyLLYtXm7q35pHOHbZFQBaLrhlWQ==",
+ "optional": true,
+ "peer": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/is-number": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
@@ -1428,12 +2276,27 @@
"node": ">=0.12.0"
}
},
+ "node_modules/isarray": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
+ "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==",
+ "optional": true,
+ "peer": true
+ },
"node_modules/isexe": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
"dev": true
},
+ "node_modules/js-tiktoken": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/js-tiktoken/-/js-tiktoken-1.0.7.tgz",
+ "integrity": "sha512-biba8u/clw7iesNEWLOLwrNGoBP2lA+hTaBLs/D45pJdUPFXyxD6nhcDVtADChghv4GgyAiMKYMiRx7x6h7Biw==",
+ "dependencies": {
+ "base64-js": "^1.5.1"
+ }
+ },
"node_modules/js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@@ -1452,6 +2315,12 @@
"js-yaml": "bin/js-yaml.js"
}
},
+ "node_modules/json-buffer": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz",
+ "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==",
+ "dev": true
+ },
"node_modules/json-schema-traverse": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
@@ -1464,6 +2333,539 @@
"integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==",
"dev": true
},
+ "node_modules/jsonpointer": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-5.0.1.tgz",
+ "integrity": "sha512-p/nXbhSEcu3pZRdkW1OfJhpsVtW1gd4Wa1fnQc9YLiTfAjn0312eMKimbdIQzuZl9aa9xUGaRlP9T/CJE/ditQ==",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/jsonwebtoken": {
+ "version": "9.0.2",
+ "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz",
+ "integrity": "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "jws": "^3.2.2",
+ "lodash.includes": "^4.3.0",
+ "lodash.isboolean": "^3.0.3",
+ "lodash.isinteger": "^4.0.4",
+ "lodash.isnumber": "^3.0.3",
+ "lodash.isplainobject": "^4.0.6",
+ "lodash.isstring": "^4.0.1",
+ "lodash.once": "^4.0.0",
+ "ms": "^2.1.1",
+ "semver": "^7.5.4"
+ },
+ "engines": {
+ "node": ">=12",
+ "npm": ">=6"
+ }
+ },
+ "node_modules/jwa": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz",
+ "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "buffer-equal-constant-time": "1.0.1",
+ "ecdsa-sig-formatter": "1.0.11",
+ "safe-buffer": "^5.0.1"
+ }
+ },
+ "node_modules/jws": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz",
+ "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "jwa": "^1.4.1",
+ "safe-buffer": "^5.0.1"
+ }
+ },
+ "node_modules/keyv": {
+ "version": "4.5.4",
+ "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz",
+ "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==",
+ "dev": true,
+ "dependencies": {
+ "json-buffer": "3.0.1"
+ }
+ },
+ "node_modules/langchain": {
+ "version": "0.0.183",
+ "resolved": "https://registry.npmjs.org/langchain/-/langchain-0.0.183.tgz",
+ "integrity": "sha512-Atyd2CWMycTfLiw6ZO9+FzESkW989PFUipQ53Jp0fffDYZWODB2AbjSI1a0pjFj2JTB06RMXt8hqk+vkT5G2Mw==",
+ "dependencies": {
+ "@anthropic-ai/sdk": "^0.6.2",
+ "ansi-styles": "^5.0.0",
+ "binary-extensions": "^2.2.0",
+ "camelcase": "6",
+ "decamelize": "^1.2.0",
+ "expr-eval": "^2.0.2",
+ "flat": "^5.0.2",
+ "js-tiktoken": "^1.0.7",
+ "js-yaml": "^4.1.0",
+ "jsonpointer": "^5.0.1",
+ "langchainhub": "~0.0.6",
+ "langsmith": "~0.0.48",
+ "ml-distance": "^4.0.0",
+ "openai": "^4.16.1",
+ "openapi-types": "^12.1.3",
+ "p-queue": "^6.6.2",
+ "p-retry": "4",
+ "uuid": "^9.0.0",
+ "yaml": "^2.2.1",
+ "zod": "^3.22.3",
+ "zod-to-json-schema": "^3.20.4"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "@aws-crypto/sha256-js": "^5.0.0",
+ "@aws-sdk/client-bedrock-runtime": "^3.422.0",
+ "@aws-sdk/client-dynamodb": "^3.310.0",
+ "@aws-sdk/client-kendra": "^3.352.0",
+ "@aws-sdk/client-lambda": "^3.310.0",
+ "@aws-sdk/client-s3": "^3.310.0",
+ "@aws-sdk/client-sagemaker-runtime": "^3.310.0",
+ "@aws-sdk/client-sfn": "^3.310.0",
+ "@aws-sdk/credential-provider-node": "^3.388.0",
+ "@azure/storage-blob": "^12.15.0",
+ "@clickhouse/client": "^0.0.14",
+ "@cloudflare/ai": "^1.0.12",
+ "@elastic/elasticsearch": "^8.4.0",
+ "@getmetal/metal-sdk": "*",
+ "@getzep/zep-js": "^0.9.0",
+ "@gomomento/sdk": "^1.44.1",
+ "@gomomento/sdk-core": "^1.44.1",
+ "@gomomento/sdk-web": "^1.44.1",
+ "@google-ai/generativelanguage": "^0.2.1",
+ "@google-cloud/storage": "^6.10.1",
+ "@huggingface/inference": "^2.6.4",
+ "@mozilla/readability": "*",
+ "@notionhq/client": "^2.2.10",
+ "@opensearch-project/opensearch": "*",
+ "@pinecone-database/pinecone": "^1.1.0",
+ "@planetscale/database": "^1.8.0",
+ "@qdrant/js-client-rest": "^1.2.0",
+ "@raycast/api": "^1.55.2",
+ "@smithy/eventstream-codec": "^2.0.5",
+ "@smithy/protocol-http": "^3.0.6",
+ "@smithy/signature-v4": "^2.0.10",
+ "@smithy/util-utf8": "^2.0.0",
+ "@supabase/postgrest-js": "^1.1.1",
+ "@supabase/supabase-js": "^2.10.0",
+ "@tensorflow-models/universal-sentence-encoder": "*",
+ "@tensorflow/tfjs-converter": "*",
+ "@tensorflow/tfjs-core": "*",
+ "@upstash/redis": "^1.20.6",
+ "@vercel/kv": "^0.2.3",
+ "@vercel/postgres": "^0.5.0",
+ "@writerai/writer-sdk": "^0.40.2",
+ "@xata.io/client": "^0.25.1",
+ "@xenova/transformers": "^2.5.4",
+ "@zilliz/milvus2-sdk-node": ">=2.2.7",
+ "apify-client": "^2.7.1",
+ "assemblyai": "^2.0.2",
+ "axios": "*",
+ "cassandra-driver": "^4.7.2",
+ "cheerio": "^1.0.0-rc.12",
+ "chromadb": "*",
+ "closevector-common": "0.1.0-alpha.1",
+ "closevector-node": "0.1.0-alpha.10",
+ "closevector-web": "0.1.0-alpha.16",
+ "cohere-ai": ">=6.0.0",
+ "convex": "^1.3.1",
+ "d3-dsv": "^2.0.0",
+ "epub2": "^3.0.1",
+ "faiss-node": "^0.5.1",
+ "fast-xml-parser": "^4.2.7",
+ "firebase-admin": "^11.9.0",
+ "google-auth-library": "^8.9.0",
+ "googleapis": "^126.0.1",
+ "hnswlib-node": "^1.4.2",
+ "html-to-text": "^9.0.5",
+ "ignore": "^5.2.0",
+ "ioredis": "^5.3.2",
+ "jsdom": "*",
+ "llmonitor": "^0.5.8",
+ "lodash": "^4.17.21",
+ "mammoth": "*",
+ "mongodb": "^5.2.0",
+ "mysql2": "^3.3.3",
+ "neo4j-driver": "*",
+ "node-llama-cpp": "*",
+ "notion-to-md": "^3.1.0",
+ "pdf-parse": "1.1.1",
+ "peggy": "^3.0.2",
+ "pg": "^8.11.0",
+ "pg-copy-streams": "^6.0.5",
+ "pickleparser": "^0.2.1",
+ "playwright": "^1.32.1",
+ "portkey-ai": "^0.1.11",
+ "puppeteer": "^19.7.2",
+ "redis": "^4.6.4",
+ "replicate": "^0.18.0",
+ "sonix-speech-recognition": "^2.1.1",
+ "srt-parser-2": "^1.2.2",
+ "typeorm": "^0.3.12",
+ "typesense": "^1.5.3",
+ "usearch": "^1.1.1",
+ "vectordb": "^0.1.4",
+ "voy-search": "0.6.2",
+ "weaviate-ts-client": "^1.4.0",
+ "web-auth-library": "^1.0.3",
+ "ws": "^8.14.2",
+ "youtube-transcript": "^1.0.6",
+ "youtubei.js": "^5.8.0"
+ },
+ "peerDependenciesMeta": {
+ "@aws-crypto/sha256-js": {
+ "optional": true
+ },
+ "@aws-sdk/client-bedrock-runtime": {
+ "optional": true
+ },
+ "@aws-sdk/client-dynamodb": {
+ "optional": true
+ },
+ "@aws-sdk/client-kendra": {
+ "optional": true
+ },
+ "@aws-sdk/client-lambda": {
+ "optional": true
+ },
+ "@aws-sdk/client-s3": {
+ "optional": true
+ },
+ "@aws-sdk/client-sagemaker-runtime": {
+ "optional": true
+ },
+ "@aws-sdk/client-sfn": {
+ "optional": true
+ },
+ "@aws-sdk/credential-provider-node": {
+ "optional": true
+ },
+ "@azure/storage-blob": {
+ "optional": true
+ },
+ "@clickhouse/client": {
+ "optional": true
+ },
+ "@cloudflare/ai": {
+ "optional": true
+ },
+ "@elastic/elasticsearch": {
+ "optional": true
+ },
+ "@getmetal/metal-sdk": {
+ "optional": true
+ },
+ "@getzep/zep-js": {
+ "optional": true
+ },
+ "@gomomento/sdk": {
+ "optional": true
+ },
+ "@gomomento/sdk-core": {
+ "optional": true
+ },
+ "@gomomento/sdk-web": {
+ "optional": true
+ },
+ "@google-ai/generativelanguage": {
+ "optional": true
+ },
+ "@google-cloud/storage": {
+ "optional": true
+ },
+ "@huggingface/inference": {
+ "optional": true
+ },
+ "@mozilla/readability": {
+ "optional": true
+ },
+ "@notionhq/client": {
+ "optional": true
+ },
+ "@opensearch-project/opensearch": {
+ "optional": true
+ },
+ "@pinecone-database/pinecone": {
+ "optional": true
+ },
+ "@planetscale/database": {
+ "optional": true
+ },
+ "@qdrant/js-client-rest": {
+ "optional": true
+ },
+ "@raycast/api": {
+ "optional": true
+ },
+ "@smithy/eventstream-codec": {
+ "optional": true
+ },
+ "@smithy/protocol-http": {
+ "optional": true
+ },
+ "@smithy/signature-v4": {
+ "optional": true
+ },
+ "@smithy/util-utf8": {
+ "optional": true
+ },
+ "@supabase/postgrest-js": {
+ "optional": true
+ },
+ "@supabase/supabase-js": {
+ "optional": true
+ },
+ "@tensorflow-models/universal-sentence-encoder": {
+ "optional": true
+ },
+ "@tensorflow/tfjs-converter": {
+ "optional": true
+ },
+ "@tensorflow/tfjs-core": {
+ "optional": true
+ },
+ "@upstash/redis": {
+ "optional": true
+ },
+ "@vercel/kv": {
+ "optional": true
+ },
+ "@vercel/postgres": {
+ "optional": true
+ },
+ "@writerai/writer-sdk": {
+ "optional": true
+ },
+ "@xata.io/client": {
+ "optional": true
+ },
+ "@xenova/transformers": {
+ "optional": true
+ },
+ "@zilliz/milvus2-sdk-node": {
+ "optional": true
+ },
+ "apify-client": {
+ "optional": true
+ },
+ "assemblyai": {
+ "optional": true
+ },
+ "axios": {
+ "optional": true
+ },
+ "cassandra-driver": {
+ "optional": true
+ },
+ "cheerio": {
+ "optional": true
+ },
+ "chromadb": {
+ "optional": true
+ },
+ "closevector-common": {
+ "optional": true
+ },
+ "closevector-node": {
+ "optional": true
+ },
+ "closevector-web": {
+ "optional": true
+ },
+ "cohere-ai": {
+ "optional": true
+ },
+ "convex": {
+ "optional": true
+ },
+ "d3-dsv": {
+ "optional": true
+ },
+ "epub2": {
+ "optional": true
+ },
+ "faiss-node": {
+ "optional": true
+ },
+ "fast-xml-parser": {
+ "optional": true
+ },
+ "firebase-admin": {
+ "optional": true
+ },
+ "google-auth-library": {
+ "optional": true
+ },
+ "googleapis": {
+ "optional": true
+ },
+ "hnswlib-node": {
+ "optional": true
+ },
+ "html-to-text": {
+ "optional": true
+ },
+ "ignore": {
+ "optional": true
+ },
+ "ioredis": {
+ "optional": true
+ },
+ "jsdom": {
+ "optional": true
+ },
+ "llmonitor": {
+ "optional": true
+ },
+ "lodash": {
+ "optional": true
+ },
+ "mammoth": {
+ "optional": true
+ },
+ "mongodb": {
+ "optional": true
+ },
+ "mysql2": {
+ "optional": true
+ },
+ "neo4j-driver": {
+ "optional": true
+ },
+ "node-llama-cpp": {
+ "optional": true
+ },
+ "notion-to-md": {
+ "optional": true
+ },
+ "pdf-parse": {
+ "optional": true
+ },
+ "peggy": {
+ "optional": true
+ },
+ "pg": {
+ "optional": true
+ },
+ "pg-copy-streams": {
+ "optional": true
+ },
+ "pickleparser": {
+ "optional": true
+ },
+ "playwright": {
+ "optional": true
+ },
+ "portkey-ai": {
+ "optional": true
+ },
+ "puppeteer": {
+ "optional": true
+ },
+ "redis": {
+ "optional": true
+ },
+ "replicate": {
+ "optional": true
+ },
+ "sonix-speech-recognition": {
+ "optional": true
+ },
+ "srt-parser-2": {
+ "optional": true
+ },
+ "typeorm": {
+ "optional": true
+ },
+ "typesense": {
+ "optional": true
+ },
+ "usearch": {
+ "optional": true
+ },
+ "vectordb": {
+ "optional": true
+ },
+ "voy-search": {
+ "optional": true
+ },
+ "weaviate-ts-client": {
+ "optional": true
+ },
+ "web-auth-library": {
+ "optional": true
+ },
+ "ws": {
+ "optional": true
+ },
+ "youtube-transcript": {
+ "optional": true
+ },
+ "youtubei.js": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/langchain/node_modules/ansi-styles": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz",
+ "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/langchain/node_modules/argparse": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
+ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
+ },
+ "node_modules/langchain/node_modules/js-yaml": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
+ "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
+ "dependencies": {
+ "argparse": "^2.0.1"
+ },
+ "bin": {
+ "js-yaml": "bin/js-yaml.js"
+ }
+ },
+ "node_modules/langchainhub": {
+ "version": "0.0.6",
+ "resolved": "https://registry.npmjs.org/langchainhub/-/langchainhub-0.0.6.tgz",
+ "integrity": "sha512-SW6105T+YP1cTe0yMf//7kyshCgvCTyFBMTgH2H3s9rTAR4e+78DA/BBrUL/Mt4Q5eMWui7iGuAYb3pgGsdQ9w=="
+ },
+ "node_modules/langsmith": {
+ "version": "0.0.48",
+ "resolved": "https://registry.npmjs.org/langsmith/-/langsmith-0.0.48.tgz",
+ "integrity": "sha512-s0hW8iZ90Q9XLTnDK0Pgee245URV3b1cXQjPDj5OKm1+KN7iSK1pKx+4CO7RcFLz58Ixe7Mt+mVcomYqUuryxQ==",
+ "dependencies": {
+ "@types/uuid": "^9.0.1",
+ "commander": "^10.0.1",
+ "p-queue": "^6.6.2",
+ "p-retry": "4",
+ "uuid": "^9.0.0"
+ },
+ "bin": {
+ "langsmith": "dist/cli/main.cjs"
+ }
+ },
"node_modules/levn": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",
@@ -1477,12 +2879,61 @@
"node": ">= 0.8.0"
}
},
+ "node_modules/lodash.includes": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
+ "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==",
+ "optional": true,
+ "peer": true
+ },
+ "node_modules/lodash.isboolean": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz",
+ "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==",
+ "optional": true,
+ "peer": true
+ },
+ "node_modules/lodash.isinteger": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz",
+ "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==",
+ "optional": true,
+ "peer": true
+ },
+ "node_modules/lodash.isnumber": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz",
+ "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==",
+ "optional": true,
+ "peer": true
+ },
+ "node_modules/lodash.isplainobject": {
+ "version": "4.0.6",
+ "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz",
+ "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==",
+ "optional": true,
+ "peer": true
+ },
+ "node_modules/lodash.isstring": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz",
+ "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==",
+ "optional": true,
+ "peer": true
+ },
"node_modules/lodash.merge": {
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
"integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",
"dev": true
},
+ "node_modules/lodash.once": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz",
+ "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==",
+ "optional": true,
+ "peer": true
+ },
"node_modules/lodash.truncate": {
"version": "4.4.2",
"resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz",
@@ -1504,7 +2955,7 @@
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
- "dev": true,
+ "devOptional": true,
"dependencies": {
"yallist": "^4.0.0"
},
@@ -1512,6 +2963,16 @@
"node": ">=10"
}
},
+ "node_modules/md5": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz",
+ "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==",
+ "dependencies": {
+ "charenc": "0.0.2",
+ "crypt": "0.0.2",
+ "is-buffer": "~1.1.6"
+ }
+ },
"node_modules/media-typer": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz",
@@ -1542,6 +3003,38 @@
"node": ">=8.6"
}
},
+ "node_modules/mime-db": {
+ "version": "1.52.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
+ "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/mime-types": {
+ "version": "2.1.35",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
+ "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
+ "dependencies": {
+ "mime-db": "1.52.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/mimic-response": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz",
+ "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==",
+ "optional": true,
+ "peer": true,
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
@@ -1554,11 +3047,124 @@
"node": "*"
}
},
+ "node_modules/minimist": {
+ "version": "1.2.8",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
+ "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
+ "optional": true,
+ "peer": true,
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/minipass": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz",
+ "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==",
+ "optional": true,
+ "peer": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/minizlib": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz",
+ "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "minipass": "^3.0.0",
+ "yallist": "^4.0.0"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/minizlib/node_modules/minipass": {
+ "version": "3.3.6",
+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
+ "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "yallist": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/mkdirp": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
+ "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
+ "optional": true,
+ "peer": true,
+ "bin": {
+ "mkdirp": "bin/cmd.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/mkdirp-classic": {
+ "version": "0.5.3",
+ "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
+ "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==",
+ "optional": true,
+ "peer": true
+ },
+ "node_modules/ml-array-mean": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/ml-array-mean/-/ml-array-mean-1.1.6.tgz",
+ "integrity": "sha512-MIdf7Zc8HznwIisyiJGRH9tRigg3Yf4FldW8DxKxpCCv/g5CafTw0RRu51nojVEOXuCQC7DRVVu5c7XXO/5joQ==",
+ "dependencies": {
+ "ml-array-sum": "^1.1.6"
+ }
+ },
+ "node_modules/ml-array-sum": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/ml-array-sum/-/ml-array-sum-1.1.6.tgz",
+ "integrity": "sha512-29mAh2GwH7ZmiRnup4UyibQZB9+ZLyMShvt4cH4eTK+cL2oEMIZFnSyB3SS8MlsTh6q/w/yh48KmqLxmovN4Dw==",
+ "dependencies": {
+ "is-any-array": "^2.0.0"
+ }
+ },
+ "node_modules/ml-distance": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/ml-distance/-/ml-distance-4.0.1.tgz",
+ "integrity": "sha512-feZ5ziXs01zhyFUUUeZV5hwc0f5JW0Sh0ckU1koZe/wdVkJdGxcP06KNQuF0WBTj8FttQUzcvQcpcrOp/XrlEw==",
+ "dependencies": {
+ "ml-array-mean": "^1.1.6",
+ "ml-distance-euclidean": "^2.0.0",
+ "ml-tree-similarity": "^1.0.0"
+ }
+ },
+ "node_modules/ml-distance-euclidean": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ml-distance-euclidean/-/ml-distance-euclidean-2.0.0.tgz",
+ "integrity": "sha512-yC9/2o8QF0A3m/0IXqCTXCzz2pNEzvmcE/9HFKOZGnTjatvBbsn4lWYJkxENkA4Ug2fnYl7PXQxnPi21sgMy/Q=="
+ },
+ "node_modules/ml-tree-similarity": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/ml-tree-similarity/-/ml-tree-similarity-1.0.0.tgz",
+ "integrity": "sha512-XJUyYqjSuUQkNQHMscr6tcjldsOoAekxADTplt40QKfwW6nd++1wHWV9AArl0Zvw/TIHgNaZZNvr8QGvE8wLRg==",
+ "dependencies": {
+ "binary-search": "^1.3.5",
+ "num-sort": "^2.0.0"
+ }
+ },
"node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
- "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
- "dev": true
+ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
+ },
+ "node_modules/napi-build-utils": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz",
+ "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==",
+ "optional": true,
+ "peer": true
},
"node_modules/natural-compare": {
"version": "1.4.0",
@@ -1572,6 +3178,26 @@
"integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==",
"dev": true
},
+ "node_modules/node-abi": {
+ "version": "3.51.0",
+ "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.51.0.tgz",
+ "integrity": "sha512-SQkEP4hmNWjlniS5zdnfIXTk1x7Ome85RDzHlTbBtzE97Gfwz/Ipw4v/Ryk20DWIy3yCNVLVlGKApCnmvYoJbA==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "semver": "^7.3.5"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/node-addon-api": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.0.0.tgz",
+ "integrity": "sha512-vgbBJTS4m5/KkE16t5Ly0WW9hz46swAstv0hYYwMtbG7AznRhNyfLRe8HZAiWIpcHzoO7HxhLuBQj9rJ/Ho0ZA==",
+ "optional": true,
+ "peer": true
+ },
"node_modules/node-domexception": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz",
@@ -1590,6 +3216,11 @@
"node": ">=10.5.0"
}
},
+ "node_modules/node-ensure": {
+ "version": "0.0.0",
+ "resolved": "https://registry.npmjs.org/node-ensure/-/node-ensure-0.0.0.tgz",
+ "integrity": "sha512-DRI60hzo2oKN1ma0ckc6nQWlHU69RH6xN0sjQTjMpChPfTYvKZdcQFfdYK2RWbJcKyUizSIy/l8OTGxMAM1QDw=="
+ },
"node_modules/node-fetch": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz",
@@ -1607,6 +3238,17 @@
"url": "https://opencollective.com/node-fetch"
}
},
+ "node_modules/num-sort": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/num-sort/-/num-sort-2.1.0.tgz",
+ "integrity": "sha512-1MQz1Ed8z2yckoBeSfkQHHO9K1yDRxxtotKSJ9yvcTUUxSvfvzEq5GwBrjjHEpMlq/k5gvXdmJ1SbYxWtpNoVg==",
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/object-hash": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz",
@@ -1619,11 +3261,62 @@
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
- "dev": true,
+ "devOptional": true,
+ "dependencies": {
+ "wrappy": "1"
+ }
+ },
+ "node_modules/openai": {
+ "version": "4.17.4",
+ "resolved": "https://registry.npmjs.org/openai/-/openai-4.17.4.tgz",
+ "integrity": "sha512-ThRFkl6snLbcAKS58St7N3CaKuI5WdYUvIjPvf4s+8SdymgNtOfzmZcZXVcCefx04oKFnvZJvIcTh3eAFUUhAQ==",
+ "dependencies": {
+ "@types/node": "^18.11.18",
+ "@types/node-fetch": "^2.6.4",
+ "abort-controller": "^3.0.0",
+ "agentkeepalive": "^4.2.1",
+ "digest-fetch": "^1.3.0",
+ "form-data-encoder": "1.7.2",
+ "formdata-node": "^4.3.2",
+ "node-fetch": "^2.6.7",
+ "web-streams-polyfill": "^3.2.1"
+ },
+ "bin": {
+ "openai": "bin/cli"
+ }
+ },
+ "node_modules/openai/node_modules/@types/node": {
+ "version": "18.18.9",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.9.tgz",
+ "integrity": "sha512-0f5klcuImLnG4Qreu9hPj/rEfFq6YRc5n2mAjSsH+ec/mJL+3voBH0+8T7o8RpFjH7ovc+TRsL/c7OYIQsPTfQ==",
"dependencies": {
- "wrappy": "1"
+ "undici-types": "~5.26.4"
+ }
+ },
+ "node_modules/openai/node_modules/node-fetch": {
+ "version": "2.7.0",
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
+ "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
+ "dependencies": {
+ "whatwg-url": "^5.0.0"
+ },
+ "engines": {
+ "node": "4.x || >=6.0.0"
+ },
+ "peerDependencies": {
+ "encoding": "^0.1.0"
+ },
+ "peerDependenciesMeta": {
+ "encoding": {
+ "optional": true
+ }
}
},
+ "node_modules/openapi-types": {
+ "version": "12.1.3",
+ "resolved": "https://registry.npmjs.org/openapi-types/-/openapi-types-12.1.3.tgz",
+ "integrity": "sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw=="
+ },
"node_modules/optionator": {
"version": "0.9.3",
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz",
@@ -1641,6 +3334,59 @@
"node": ">= 0.8.0"
}
},
+ "node_modules/p-finally": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
+ "integrity": "sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==",
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/p-queue": {
+ "version": "6.6.2",
+ "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-6.6.2.tgz",
+ "integrity": "sha512-RwFpb72c/BhQLEXIZ5K2e+AhgNVmIejGlTgiB9MzZ0e93GRvqZ7uSi0dvRF7/XIXDeNkra2fNHBxTyPDGySpjQ==",
+ "dependencies": {
+ "eventemitter3": "^4.0.4",
+ "p-timeout": "^3.2.0"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/p-retry": {
+ "version": "4.6.2",
+ "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-4.6.2.tgz",
+ "integrity": "sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ==",
+ "dependencies": {
+ "@types/retry": "0.12.0",
+ "retry": "^0.13.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/p-timeout": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-3.2.0.tgz",
+ "integrity": "sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg==",
+ "dependencies": {
+ "p-finally": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/pako": {
+ "version": "1.0.11",
+ "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz",
+ "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==",
+ "optional": true,
+ "peer": true
+ },
"node_modules/parent-module": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
@@ -1680,6 +3426,38 @@
"node": ">=8"
}
},
+ "node_modules/pdf-parse": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/pdf-parse/-/pdf-parse-1.1.1.tgz",
+ "integrity": "sha512-v6ZJ/efsBpGrGGknjtq9J/oC8tZWq0KWL5vQrk2GlzLEQPUDB1ex+13Rmidl1neNN358Jn9EHZw5y07FFtaC7A==",
+ "dependencies": {
+ "debug": "^3.1.0",
+ "node-ensure": "^0.0.0"
+ },
+ "engines": {
+ "node": ">=6.8.1"
+ }
+ },
+ "node_modules/pdf-parse/node_modules/debug": {
+ "version": "3.2.7",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
+ "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
+ "dependencies": {
+ "ms": "^2.1.1"
+ }
+ },
+ "node_modules/peek-stream": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/peek-stream/-/peek-stream-1.1.3.tgz",
+ "integrity": "sha512-FhJ+YbOSBb9/rIl2ZeE/QHEsWn7PqNYt8ARAY3kIgNGOk13g9FGyIY6JIl/xB/3TFRVoTv5as0l11weORrTekA==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "buffer-from": "^1.0.0",
+ "duplexify": "^3.5.0",
+ "through2": "^2.0.3"
+ }
+ },
"node_modules/picomatch": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
@@ -1692,6 +3470,44 @@
"url": "https://github.com/sponsors/jonschlinkert"
}
},
+ "node_modules/prebuild-install": {
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.1.tgz",
+ "integrity": "sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "detect-libc": "^2.0.0",
+ "expand-template": "^2.0.3",
+ "github-from-package": "0.0.0",
+ "minimist": "^1.2.3",
+ "mkdirp-classic": "^0.5.3",
+ "napi-build-utils": "^1.0.1",
+ "node-abi": "^3.3.0",
+ "pump": "^3.0.0",
+ "rc": "^1.2.7",
+ "simple-get": "^4.0.0",
+ "tar-fs": "^2.0.0",
+ "tunnel-agent": "^0.6.0"
+ },
+ "bin": {
+ "prebuild-install": "bin.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/prebuild-install/node_modules/pump": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
+ "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "end-of-stream": "^1.1.0",
+ "once": "^1.3.1"
+ }
+ },
"node_modules/prelude-ls": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
@@ -1716,6 +3532,23 @@
"url": "https://github.com/prettier/prettier?sponsor=1"
}
},
+ "node_modules/process": {
+ "version": "0.11.10",
+ "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
+ "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==",
+ "optional": true,
+ "peer": true,
+ "engines": {
+ "node": ">= 0.6.0"
+ }
+ },
+ "node_modules/process-nextick-args": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
+ "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==",
+ "optional": true,
+ "peer": true
+ },
"node_modules/progress": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz",
@@ -1725,10 +3558,40 @@
"node": ">=0.4.0"
}
},
+ "node_modules/proxy-from-env": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
+ "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
+ "optional": true,
+ "peer": true
+ },
+ "node_modules/pump": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz",
+ "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "end-of-stream": "^1.1.0",
+ "once": "^1.3.1"
+ }
+ },
+ "node_modules/pumpify": {
+ "version": "1.5.1",
+ "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.1.tgz",
+ "integrity": "sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "duplexify": "^3.6.0",
+ "inherits": "^2.0.3",
+ "pump": "^2.0.0"
+ }
+ },
"node_modules/punycode": {
- "version": "2.3.0",
- "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz",
- "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==",
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
+ "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
"dev": true,
"engines": {
"node": ">=6"
@@ -1754,30 +3617,81 @@
}
]
},
- "node_modules/react": {
- "version": "18.1.0",
- "resolved": "https://registry.npmjs.org/react/-/react-18.1.0.tgz",
- "integrity": "sha512-4oL8ivCz5ZEPyclFQXaNksK3adutVS8l2xzZU0cqEFrE9Sb7fC0EFK5uEk74wIreL1DERyjvsU915j1pcT2uEQ==",
+ "node_modules/queue-tick": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.1.tgz",
+ "integrity": "sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==",
+ "optional": true,
+ "peer": true
+ },
+ "node_modules/rc": {
+ "version": "1.2.8",
+ "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
+ "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==",
+ "optional": true,
+ "peer": true,
"dependencies": {
- "loose-envify": "^1.1.0"
+ "deep-extend": "^0.6.0",
+ "ini": "~1.3.0",
+ "minimist": "^1.2.0",
+ "strip-json-comments": "~2.0.1"
},
+ "bin": {
+ "rc": "cli.js"
+ }
+ },
+ "node_modules/rc/node_modules/strip-json-comments": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
+ "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==",
+ "optional": true,
+ "peer": true,
"engines": {
"node": ">=0.10.0"
}
},
- "node_modules/react-reconciler": {
- "version": "0.28.0",
- "resolved": "https://registry.npmjs.org/react-reconciler/-/react-reconciler-0.28.0.tgz",
- "integrity": "sha512-sGIHDOpgVjRYgsi8NgosDnbkDvvkYFFSF900ZUhUw0+lSBEA5n76TcKFaVkfYMIuYm+7W6mT8Q673DLBfuTxcQ==",
+ "node_modules/react": {
+ "version": "18.2.0",
+ "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz",
+ "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==",
"dependencies": {
- "loose-envify": "^1.1.0",
- "scheduler": "^0.22.0"
+ "loose-envify": "^1.1.0"
},
"engines": {
"node": ">=0.10.0"
- },
- "peerDependencies": {
- "react": "^18.1.0"
+ }
+ },
+ "node_modules/readable-stream": {
+ "version": "2.3.8",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",
+ "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "core-util-is": "~1.0.0",
+ "inherits": "~2.0.3",
+ "isarray": "~1.0.0",
+ "process-nextick-args": "~2.0.0",
+ "safe-buffer": "~5.1.1",
+ "string_decoder": "~1.1.1",
+ "util-deprecate": "~1.0.1"
+ }
+ },
+ "node_modules/readable-stream/node_modules/safe-buffer": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
+ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
+ "optional": true,
+ "peer": true
+ },
+ "node_modules/readable-stream/node_modules/string_decoder": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
+ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "safe-buffer": "~5.1.0"
}
},
"node_modules/regexpp": {
@@ -1810,6 +3724,14 @@
"node": ">=4"
}
},
+ "node_modules/retry": {
+ "version": "0.13.1",
+ "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz",
+ "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==",
+ "engines": {
+ "node": ">= 4"
+ }
+ },
"node_modules/reusify": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz",
@@ -1858,19 +3780,32 @@
"queue-microtask": "^1.2.2"
}
},
- "node_modules/scheduler": {
- "version": "0.22.0",
- "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.22.0.tgz",
- "integrity": "sha512-6QAm1BgQI88NPYymgGQLCZgvep4FyePDWFpXVK+zNSUgHwlqpJy8VEh8Et0KxTACS4VWwMousBElAZOH9nkkoQ==",
- "dependencies": {
- "loose-envify": "^1.1.0"
- }
+ "node_modules/safe-buffer": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "optional": true,
+ "peer": true
},
"node_modules/semver": {
"version": "7.5.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
- "dev": true,
+ "devOptional": true,
"dependencies": {
"lru-cache": "^6.0.0"
},
@@ -1913,6 +3848,53 @@
"url": "https://github.com/sponsors/isaacs"
}
},
+ "node_modules/simple-concat": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz",
+ "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "optional": true,
+ "peer": true
+ },
+ "node_modules/simple-get": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz",
+ "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "decompress-response": "^6.0.0",
+ "once": "^1.3.1",
+ "simple-concat": "^1.0.0"
+ }
+ },
"node_modules/slash": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
@@ -1945,6 +3927,34 @@
"integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==",
"dev": true
},
+ "node_modules/stream-shift": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.1.tgz",
+ "integrity": "sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ==",
+ "optional": true,
+ "peer": true
+ },
+ "node_modules/streamx": {
+ "version": "2.15.5",
+ "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.15.5.tgz",
+ "integrity": "sha512-9thPGMkKC2GctCzyCUjME3yR03x2xNo0GPKGkRw2UMYN+gqWa9uqpyNWhmsNCutU5zHmkUum0LsCRQTXUgUCAg==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "fast-fifo": "^1.1.0",
+ "queue-tick": "^1.0.1"
+ }
+ },
+ "node_modules/string_decoder": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
+ "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "safe-buffer": "~5.2.0"
+ }
+ },
"node_modules/string-width": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
@@ -2033,12 +4043,116 @@
"integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
"dev": true
},
+ "node_modules/tar": {
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.0.tgz",
+ "integrity": "sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "chownr": "^2.0.0",
+ "fs-minipass": "^2.0.0",
+ "minipass": "^5.0.0",
+ "minizlib": "^2.1.1",
+ "mkdirp": "^1.0.3",
+ "yallist": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/tar-fs": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz",
+ "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "chownr": "^1.1.1",
+ "mkdirp-classic": "^0.5.2",
+ "pump": "^3.0.0",
+ "tar-stream": "^2.1.4"
+ }
+ },
+ "node_modules/tar-fs/node_modules/chownr": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz",
+ "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==",
+ "optional": true,
+ "peer": true
+ },
+ "node_modules/tar-fs/node_modules/pump": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
+ "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "end-of-stream": "^1.1.0",
+ "once": "^1.3.1"
+ }
+ },
+ "node_modules/tar-fs/node_modules/readable-stream": {
+ "version": "3.6.2",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
+ "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "inherits": "^2.0.3",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/tar-fs/node_modules/tar-stream": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz",
+ "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "bl": "^4.0.3",
+ "end-of-stream": "^1.4.1",
+ "fs-constants": "^1.0.0",
+ "inherits": "^2.0.3",
+ "readable-stream": "^3.1.1"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/tar-stream": {
+ "version": "3.1.6",
+ "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.6.tgz",
+ "integrity": "sha512-B/UyjYwPpMBv+PaFSWAmtYjwdrlEaZQEhMIBFNC5oEG8lpiW8XjcSdmEaClj28ArfKScKHs2nshz3k2le6crsg==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "b4a": "^1.6.4",
+ "fast-fifo": "^1.2.0",
+ "streamx": "^2.15.0"
+ }
+ },
"node_modules/text-table": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
"integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==",
"dev": true
},
+ "node_modules/through2": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz",
+ "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "readable-stream": "~2.3.6",
+ "xtend": "~4.0.1"
+ }
+ },
"node_modules/title-case": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/title-case/-/title-case-3.0.3.tgz",
@@ -2060,6 +4174,11 @@
"node": ">=8.0"
}
},
+ "node_modules/tr46": {
+ "version": "0.0.3",
+ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
+ "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
+ },
"node_modules/tslib": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
@@ -2087,6 +4206,19 @@
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
"dev": true
},
+ "node_modules/tunnel-agent": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
+ "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==",
+ "optional": true,
+ "peer": true,
+ "dependencies": {
+ "safe-buffer": "^5.0.1"
+ },
+ "engines": {
+ "node": "*"
+ }
+ },
"node_modules/type-check": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
@@ -2124,6 +4256,11 @@
"node": ">=4.2.0"
}
},
+ "node_modules/undici-types": {
+ "version": "5.26.5",
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
+ "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="
+ },
"node_modules/uri-js": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
@@ -2133,12 +4270,53 @@
"punycode": "^2.1.0"
}
},
+ "node_modules/util-deprecate": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
+ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
+ "optional": true,
+ "peer": true
+ },
+ "node_modules/uuid": {
+ "version": "9.0.1",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz",
+ "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==",
+ "funding": [
+ "https://github.com/sponsors/broofa",
+ "https://github.com/sponsors/ctavan"
+ ],
+ "bin": {
+ "uuid": "dist/bin/uuid"
+ }
+ },
"node_modules/v8-compile-cache": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.4.0.tgz",
"integrity": "sha512-ocyWc3bAHBB/guyqJQVI5o4BZkPhznPYUG2ea80Gond/BgNWpap8TOmLSeeQG7bnh2KMISxskdADG59j7zruhw==",
"dev": true
},
+ "node_modules/web-streams-polyfill": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz",
+ "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==",
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/webidl-conversions": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
+ "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
+ },
+ "node_modules/whatwg-url": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
+ "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
+ "dependencies": {
+ "tr46": "~0.0.3",
+ "webidl-conversions": "^3.0.0"
+ }
+ },
"node_modules/which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
@@ -2158,13 +4336,47 @@
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
- "dev": true
+ "devOptional": true
+ },
+ "node_modules/xtend": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
+ "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==",
+ "optional": true,
+ "peer": true,
+ "engines": {
+ "node": ">=0.4"
+ }
},
"node_modules/yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
- "dev": true
+ "devOptional": true
+ },
+ "node_modules/yaml": {
+ "version": "2.3.4",
+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz",
+ "integrity": "sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==",
+ "engines": {
+ "node": ">= 14"
+ }
+ },
+ "node_modules/zod": {
+ "version": "3.22.4",
+ "resolved": "https://registry.npmjs.org/zod/-/zod-3.22.4.tgz",
+ "integrity": "sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==",
+ "funding": {
+ "url": "https://github.com/sponsors/colinhacks"
+ }
+ },
+ "node_modules/zod-to-json-schema": {
+ "version": "3.21.4",
+ "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.21.4.tgz",
+ "integrity": "sha512-fjUZh4nQ1s6HMccgIeE0VP4QG/YRGPmyjO9sAh890aQKPEk3nqbfUXhMFaC+Dr5KvYBm8BCyvfpZf2jY9aGSsw==",
+ "peerDependencies": {
+ "zod": "^3.21.4"
+ }
}
}
}
diff --git a/extensions/raycast-ollama/package.json b/extensions/raycast-ollama/package.json
index 25082566db3..3893b03ec69 100644
--- a/extensions/raycast-ollama/package.json
+++ b/extensions/raycast-ollama/package.json
@@ -182,14 +182,18 @@
"dependencies": {
"@raycast/api": "^1.55.2",
"@raycast/utils": "^1.9.0",
- "node-fetch": "^3.3.2"
+ "langchain": "^0.0.183",
+ "mime-types": "^2.1.35",
+ "node-fetch": "^3.3.2",
+ "pdf-parse": "^1.1.1"
},
"devDependencies": {
"@raycast/eslint-config": "1.0.5",
- "@types/node": "18.8.3",
- "@types/react": "18.0.9",
+ "@types/mime-types": "^2.1.4",
+ "@types/node": "18.18.4",
+ "@types/react": "18.2.27",
"eslint": "^7.32.0",
- "prettier": "^2.5.1",
+ "prettier": "^2.8.8",
"typescript": "^4.4.3"
},
"scripts": {
diff --git a/extensions/raycast-ollama/src/api/errors.ts b/extensions/raycast-ollama/src/api/errors.ts
index c3ce16413e5..f65c248d0d0 100644
--- a/extensions/raycast-ollama/src/api/errors.ts
+++ b/extensions/raycast-ollama/src/api/errors.ts
@@ -1,6 +1,9 @@
export const ErrorRaycastApiNoTextSelectedOrCopied = new Error(
"You Need to Select a Text or Copied on Clipboard for This Command."
);
+export const ErrorRaycastModelNotConfiguredOnLocalStorage = new Error(
+ "Prefered model is not configured on LocalStorage."
+);
export const ErrorRaycastApiNoTextSelected = new Error("You Need to Select a Text for This Command.");
export const ErrorRaycastApiNoTextCopied = new Error("You Need to Copy Text on Clipboard for This Command.");
export const ErrorOllamaNotInstalledOrRunning = new Error("Verify Ollama is Installed and Currently Running.");
diff --git a/extensions/raycast-ollama/src/api/langchain.ts b/extensions/raycast-ollama/src/api/langchain.ts
new file mode 100644
index 00000000000..8f94be77add
--- /dev/null
+++ b/extensions/raycast-ollama/src/api/langchain.ts
@@ -0,0 +1,316 @@
+import { LocalStorage } from "@raycast/api";
+import { MemoryVectorStore } from "langchain/vectorstores/memory";
+import { VectorStore } from "langchain/vectorstores/base";
+import { OllamaEmbeddings } from "langchain/embeddings/ollama";
+import { TextLoader } from "langchain/document_loaders/fs/text";
+import { PDFLoader } from "langchain/document_loaders/fs/pdf";
+import { RecursiveCharacterTextSplitter } from "langchain/text_splitter";
+import { Document } from "langchain/document";
+import { OllamaApiGenerate, OllamaApiGenerateNoStream, parseOllamaUrlForLangchain } from "./ollama";
+import { DocumentLoaderFiles, OllamaApiGenerateRequestBody, PromptTags } from "./types";
+import fs from "fs";
+import mime from "mime-types";
+import "./polyfill/node-fetch";
+import { EventEmitter } from "stream";
+
+const ErrorDocumentLoaderFilesEmpty = new Error("Before Using /edit Tag Select File to Load.");
+
+const OllamaApiUrl = parseOllamaUrlForLangchain();
+
+/**
+ * Get files path from LocalStorage.
+ * @returns {Promise} Array of file path.
+ */
+async function GetFilesPathFromLocalStorage(): Promise {
+ const FilesJSON = await LocalStorage.getItem("embedding_files");
+ if (FilesJSON) {
+ const Files: DocumentLoaderFiles[] = JSON.parse(FilesJSON as string);
+ return Files.map((f) => {
+ return f.path;
+ });
+ } else {
+ throw ErrorDocumentLoaderFilesEmpty;
+ }
+}
+
+/**
+ * Get files from LocalStorage.
+ * @returns {Promise} Array of files.
+ */
+async function GetFilesFromLocalStorage(): Promise {
+ const FilesJSON = await LocalStorage.getItem("embedding_files");
+ if (FilesJSON) {
+ const Files: DocumentLoaderFiles[] = JSON.parse(FilesJSON as string);
+ return Files;
+ } else {
+ throw ErrorDocumentLoaderFilesEmpty;
+ }
+}
+
+/**
+ * Verify if cache can be used for DocumentLoader().
+ * @param {DocumentLoaderFiles[]}
+ * @returns
+ */
+async function UseCacheDocumentLoader(): Promise {
+ let files = await GetFilesFromLocalStorage();
+
+ let UseCache = true;
+
+ files = files.map((f) => {
+ const mtime = fs.statSync(f.path).mtime;
+ if (!f.mtime || (f.mtime && mtime > f.mtime)) {
+ UseCache = false;
+ }
+ return {
+ path: f.path,
+ mtime: mtime,
+ } as DocumentLoaderFiles;
+ });
+
+ LocalStorage.setItem("embedding_files", JSON.stringify(files));
+
+ return UseCache;
+}
+
+/**
+ * Function for verify is cache can be used.
+ * @param {PromptTags[]} tags - list of used tags
+ * @returns {boolean} If Cache can be used it return true otherwise false.
+ */
+export async function UseCache(tags: PromptTags[]): Promise {
+ const UseCacheMap = new Map([[PromptTags.FILE, UseCacheDocumentLoader]]);
+
+ let UseCache = true;
+
+ const cachep: Promise[] = [];
+
+ tags.forEach((tag) => {
+ if (UseCacheMap.has(tag)) {
+ const UseCacheFunc = UseCacheMap.get(tag);
+ if (UseCacheFunc) cachep.push(UseCacheFunc());
+ }
+ });
+
+ await Promise.all(cachep).then((c) => {
+ c.forEach((data) => {
+ if (!data) UseCache = false;
+ });
+ });
+
+ return UseCache;
+}
+
+/**
+ * Load documents contents from file.
+ * @param {number} chunckSize - Number of character for each chunk.
+ * @param {number} chunckOverlap - Number of character overlapping between nearby chunk.
+ * @returns {Document>[]} Array of documents.
+ */
+async function DocumentLoader(chunckSize = 1000, chunckOverlap = 200): Promise>[]> {
+ const path = await GetFilesPathFromLocalStorage();
+
+ const docsp: Promise>[]>[] = [];
+ let docs: Document>[] = [];
+
+ path.forEach((p) => {
+ const fmime = mime.lookup(p) as string;
+
+ if (fmime === "application/pdf") {
+ const l = new PDFLoader(p);
+ docsp.push(l.load());
+ }
+
+ if (fmime.match("text/")) {
+ const l = new TextLoader(p);
+ docsp.push(l.load());
+ }
+ });
+
+ await Promise.all(docsp).then((d) => {
+ d.forEach((data) => {
+ docs.push(...data);
+ });
+ });
+
+ docs = await DocumentSplitter(docs, chunckSize, chunckOverlap);
+
+ return docs;
+}
+
+/**
+ * Split documents.
+ * @param {Document>[]} docs.
+ * @param {number} chunckSize - Number of character for each chunk.
+ * @param {number} chunckOverlap - Number of character overlapping between nearby chunk.
+ * @returns {Document>[]} splitted documents.
+ */
+async function DocumentSplitter(
+ docs: Document>[],
+ chunckSize = 1000,
+ chunckOverlap = 200
+): Promise>[]> {
+ const splitter = new RecursiveCharacterTextSplitter({
+ chunkSize: chunckSize,
+ chunkOverlap: chunckOverlap,
+ });
+ return await splitter.splitDocuments(docs);
+}
+
+/**
+ * Return Document based on chose tags.
+ * Memory Vector Store is used only for large amount of data.
+ * @param {string} prompt.
+ * @param {string} model - Model used for embedding.
+ * @param {PromptTags[]} tags.
+ * @param {number} DocsNumber - Number of documents to return.
+ * @param {number} SplitterChunckSize - Number of character for each chunk.
+ * @returns {Promise>[] | undefined>} Return knowledge to inject on prompt.
+ */
+export async function GetDocument(
+ prompt: string,
+ model: string,
+ tags: PromptTags[],
+ DocsNumber = 2,
+ SplitterChunckSize = 1000
+): Promise>[] | undefined> {
+ const LoaderMap = new Map([[PromptTags.FILE, DocumentLoader]]);
+
+ let store: VectorStore | undefined;
+ let docs: Document>[];
+
+ const docsp = tags.map((tag) => {
+ const Loader = LoaderMap.get(tag);
+ if (Loader) {
+ return Loader(SplitterChunckSize);
+ }
+ });
+ docs = await Promise.all(docsp).then((d) => {
+ const output: Document>[] = [];
+ d.forEach((data) => {
+ if (data) output.push(...data);
+ });
+ return output;
+ });
+
+ if (docs.length > DocsNumber) {
+ const OllamaEmbeddingSettings = {
+ baseUrl: OllamaApiUrl,
+ model: model,
+ };
+ store = await MemoryVectorStore.fromDocuments(docs, new OllamaEmbeddings(OllamaEmbeddingSettings));
+ docs = await store.similaritySearch(prompt, DocsNumber);
+ }
+
+ return docs;
+}
+
+/**
+ * Parse prompt for tags.
+ * @param {string} prompt.
+ * @returns {[string, PromptTags[]]} Return prompt without tags and tags list.
+ */
+export function GetTags(prompt: string): [string, PromptTags[]] {
+ let oPrompt = prompt;
+ const oTags: PromptTags[] = [];
+
+ const tags: string[] = Object.values(PromptTags);
+ tags.forEach((tag) => {
+ if (prompt.toLocaleLowerCase().includes(tag)) {
+ oPrompt = oPrompt.replace(tag, "");
+ oTags.push(tag as PromptTags);
+ }
+ });
+
+ return [oPrompt, oTags];
+}
+
+/**
+ * LLM Chain.
+ * @param {string} prompt.
+ * @param {string} model.
+ * @returns {Promise} Response from the Ollama API with an EventEmitter with two event: `data` where all generated text is passed on `string` format and `done` when inference is finished returning a `OllamaApiGenerateResponse` object contains all metadata of inference.
+ */
+export async function LLMChain(
+ prompt: string,
+ model: string,
+ context: number[] | undefined = undefined
+): Promise {
+ const body: OllamaApiGenerateRequestBody = {
+ model: model,
+ prompt: prompt,
+ context: context,
+ };
+ return OllamaApiGenerate(body);
+}
+
+/**
+ * loadQARefineChain.
+ * @param {string} prompt.
+ * @param {string} model.
+ * @param {Document>[]} docs.
+ * @param {number[] | undefined} context.
+ * @returns {Promise} Response from the Ollama API with an EventEmitter with two event: `data` where all generated text is passed on `string` format and `done` when inference is finished returning a `OllamaApiGenerateResponse` object contains all metadata of inference.
+ */
+export async function loadQARefineChain(
+ prompt: string,
+ model: string,
+ docs: Document>[],
+ context: number[] | undefined = undefined
+): Promise {
+ let LastResponse: string | undefined;
+
+ let i = 0;
+ for (const doc of docs) {
+ if (LastResponse) {
+ const SystemPrompt = `The original question is as follows: ${prompt}\nWe have provided an existing answer: ${LastResponse}\nWe have the opportunity to refine the existing answer (only if needed) with some more context below.`;
+ const body: OllamaApiGenerateRequestBody = {
+ model: model,
+ system: SystemPrompt,
+ prompt: `CONTEXT: ${doc.pageContent}`,
+ };
+ if (i < docs.length - 1) {
+ const Response = await OllamaApiGenerateNoStream(body);
+ LastResponse = Response.response;
+ } else {
+ body.context = context;
+ return OllamaApiGenerate(body);
+ }
+ } else {
+ const SystemPrompt = `Given the context information and no prior knowledge, answer the question: ${prompt}`;
+ const Response = await OllamaApiGenerateNoStream({
+ model: model,
+ system: SystemPrompt,
+ prompt: `CONTEXT: ${doc.pageContent}`,
+ });
+ LastResponse = Response.response;
+ }
+ i += 1;
+ }
+}
+
+/**
+ * loadQAStuffChain Chain.
+ * @param {string} prompt.
+ * @param {string} model.
+ * @param {Document>[]} docs.
+ * @param {number[] | undefined} context.
+ * @returns {Promise} Response from the Ollama API with an EventEmitter with two event: `data` where all generated text is passed on `string` format and `done` when inference is finished returning a `OllamaApiGenerateResponse` object contains all metadata of inference.
+ */
+export async function loadQAStuffChain(
+ prompt: string,
+ model: string,
+ docs: Document>[],
+ context: number[] | undefined = undefined
+): Promise {
+ let docsContents = "";
+ docs.forEach((doc) => {
+ docsContents += doc.pageContent + "\n\n";
+ });
+ const body: OllamaApiGenerateRequestBody = {
+ model: model,
+ prompt: `${prompt}\nCONTEXT: ${docsContents}`,
+ context: context,
+ };
+ return OllamaApiGenerate(body);
+}
diff --git a/extensions/raycast-ollama/src/api/main.tsx b/extensions/raycast-ollama/src/api/main.tsx
deleted file mode 100644
index 2cff1bc5109..00000000000
--- a/extensions/raycast-ollama/src/api/main.tsx
+++ /dev/null
@@ -1,654 +0,0 @@
-import { OllamaApiGenerateRequestBody, OllamaApiGenerateResponse } from "./types";
-import {
- ErrorOllamaCustomModel,
- ErrorOllamaModelNotInstalled,
- ErrorRaycastApiNoTextSelectedOrCopied,
- ErrorRaycastApiNoTextSelected,
- ErrorRaycastApiNoTextCopied,
-} from "./errors";
-import { OllamaApiGenerate, OllamaApiTags } from "./ollama";
-import * as React from "react";
-import { Action, ActionPanel, Detail, Form, Icon, List, LocalStorage, Toast, showToast } from "@raycast/api";
-import { getSelectedText, Clipboard, getPreferenceValues } from "@raycast/api";
-
-const preferences = getPreferenceValues();
-
-/**
- * Return JSX element with generated text and relative metadata.
- * @param {string} command - Command name.
- * @param {string | undefined} systemPrompt - System Prompt.
- * @param {string | undefined} model - Model used for inference.
- * @returns {JSX.Element} Raycast Detail View.
- */
-export function ResultView(
- command = "",
- systemPrompt: string | undefined = undefined,
- model: string | undefined = undefined
-): JSX.Element {
- // Main
- const [modelGenerate, setModelGenerate]: [
- string | undefined,
- React.Dispatch>
- ] = React.useState();
- const query: React.MutableRefObject = React.useRef("");
- const [loading, setLoading]: [boolean, React.Dispatch>] = React.useState(false);
- const [answer, setAnswer]: [string, React.Dispatch>] = React.useState("");
- const [answerMetadata, setAnswerMetadata]: [
- OllamaApiGenerateResponse,
- React.Dispatch>
- ] = React.useState({} as OllamaApiGenerateResponse);
- async function HandleError(err: Error) {
- if (err instanceof ErrorOllamaModelNotInstalled) {
- await showToast({ style: Toast.Style.Failure, title: err.message, message: err.suggest });
- setLoading(false);
- setShowSelectModelForm(true);
- return;
- } else if (err instanceof ErrorOllamaCustomModel) {
- await showToast({
- style: Toast.Style.Failure,
- title: err.message,
- message: `Model: ${err.model}, File: ${err.file}`,
- });
- setLoading(false);
- return;
- } else {
- await showToast({ style: Toast.Style.Failure, title: err.message });
- setLoading(false);
- }
- }
- async function Inference(): Promise {
- await showToast({ style: Toast.Style.Animated, title: "🧠Performing Inference." });
- setLoading(true);
- setAnswer("");
- const body = {
- model: modelGenerate,
- prompt: query.current,
- } as OllamaApiGenerateRequestBody;
- if (systemPrompt) body.system = systemPrompt;
- OllamaApiGenerate(body)
- .then(async (emiter) => {
- emiter.on("data", (data) => {
- setAnswer((prevState) => prevState + data);
- });
-
- emiter.on("done", async (data) => {
- await showToast({ style: Toast.Style.Success, title: "🧠Inference Done." });
- setAnswerMetadata(data);
- setLoading(false);
- });
- })
- .catch(async (err) => {
- await HandleError(err);
- });
- }
- async function GetModels(): Promise {
- const generate = await LocalStorage.getItem(`${command}_model_generate`);
- if (generate) {
- setModelGenerate(generate as string);
- } else {
- setShowSelectModelForm(true);
- }
- }
- React.useEffect(() => {
- if (modelGenerate)
- switch (preferences.ollamaResultViewInput) {
- case "SelectedText":
- getSelectedText()
- .then((text) => {
- query.current = text;
- Inference();
- })
- .catch(async () => {
- if (preferences.ollamaResultViewInputFallback) {
- Clipboard.readText()
- .then((text) => {
- if (text === undefined) throw "Empty Clipboard";
- query.current = text;
- Inference();
- })
- .catch(async () => {
- await showToast({
- style: Toast.Style.Failure,
- title: ErrorRaycastApiNoTextSelectedOrCopied.message,
- });
- });
- } else {
- await showToast({ style: Toast.Style.Failure, title: ErrorRaycastApiNoTextSelected.message });
- }
- });
- break;
- case "Clipboard":
- Clipboard.readText()
- .then((text) => {
- if (text === undefined) throw "Empty Clipboard";
- query.current = text;
- Inference();
- })
- .catch(async () => {
- if (preferences.ollamaResultViewInputFallback) {
- getSelectedText()
- .then((text) => {
- query.current = text;
- Inference();
- })
- .catch(async () => {
- await showToast({
- style: Toast.Style.Failure,
- title: ErrorRaycastApiNoTextSelectedOrCopied.message,
- });
- });
- } else {
- await showToast({ style: Toast.Style.Failure, title: ErrorRaycastApiNoTextCopied.message });
- }
- });
- break;
- }
- }, [modelGenerate]);
- React.useEffect(() => {
- if (model) {
- setModelGenerate(model);
- } else {
- GetModels();
- }
- }, []);
-
- // Form: Select Model
- const [showSelectModelForm, setShowSelectModelForm]: [boolean, React.Dispatch>] =
- React.useState(false);
- const [installedModels, setInstalledModels]: [string[], React.Dispatch>] =
- React.useState([] as string[]);
- async function setLocalStorageModels(generate: string) {
- LocalStorage.setItem(`${command}_model_generate`, generate);
- setModelGenerate(generate);
- setShowSelectModelForm(false);
- }
- async function getInstalledModels() {
- const installedModels: string[] | undefined = await OllamaApiTags()
- .then((response): string[] => {
- const installedModels: string[] = [];
- response.models.map((model) => {
- installedModels.push(model.name);
- });
- return installedModels;
- })
- .catch(async (err): Promise => {
- await showToast({ style: Toast.Style.Failure, title: err.message });
- return undefined;
- });
- if (installedModels) setInstalledModels([...installedModels]);
- }
- React.useEffect(() => {
- if (showSelectModelForm && installedModels.length === 0) getInstalledModels();
- }, [showSelectModelForm]);
- const FormSetModel: JSX.Element = (
-
- );
-
- if (showSelectModelForm) return FormSetModel;
-
- return (
-
-
-
- setShowSelectModelForm(true)}
- shortcut={{ modifiers: ["cmd"], key: "m" }}
- />
-
- )
- }
- metadata={
- !loading &&
- preferences.ollamaShowMetadata && (
-
-
-
- {answerMetadata.eval_count && answerMetadata.eval_duration ? (
-
- ) : null}
- {answerMetadata.total_duration ? (
-
- ) : null}
- {answerMetadata.load_duration ? (
-
- ) : null}
- {answerMetadata.prompt_eval_count ? (
-
- ) : null}
- {answerMetadata.prompt_eval_duration ? (
-
- ) : null}
- {answerMetadata.eval_count ? (
-
- ) : null}
- {answerMetadata.eval_duration ? (
-
- ) : null}
-
- )
- }
- />
- );
-}
-
-/**
- * Return JSX element with generated text on list view.
- * @returns {JSX.Element} Raycast List View.
- */
-export function ListView(): JSX.Element {
- // Main
- const modelGenerate: React.MutableRefObject = React.useRef();
- const [loading, setLoading]: [boolean, React.Dispatch>] = React.useState(false);
- const [query, setQuery]: [string, React.Dispatch>] = React.useState("");
- const [chatName, setChatName]: [string, React.Dispatch>] = React.useState("Current");
- const [selectedAnswer, setSelectedAnswer]: [string, React.Dispatch>] =
- React.useState("0");
- const [answerListHistory, setAnswerListHistory]: [
- Map,
- React.Dispatch>>
- ] = React.useState(new Map());
- const [clipboardConversation, setClipboardConversation]: [string, React.Dispatch>] =
- React.useState("");
- async function HandleError(err: Error) {
- if (err instanceof ErrorOllamaModelNotInstalled) {
- await showToast({ style: Toast.Style.Failure, title: err.message, message: err.suggest });
- setLoading(false);
- setShowSelectModelForm(true);
- return;
- } else if (err instanceof ErrorOllamaCustomModel) {
- await showToast({
- style: Toast.Style.Failure,
- title: err.message,
- message: `Model: ${err.model}, File: ${err.file}`,
- });
- setLoading(false);
- return;
- } else {
- await showToast({ style: Toast.Style.Failure, title: err.message });
- setLoading(false);
- }
- }
- async function Inference(): Promise {
- await showToast({ style: Toast.Style.Animated, title: "🧠Performing Inference." });
- setLoading(true);
- const body = {
- model: modelGenerate.current,
- prompt: query,
- } as OllamaApiGenerateRequestBody;
- if (answerListHistory.has(chatName)) {
- const l = answerListHistory.get(chatName)?.length;
- if (l && l > 0) {
- body.context = answerListHistory.get(chatName)?.[l - 1][2].context;
- }
- }
- setQuery("");
- OllamaApiGenerate(body)
- .then(async (emiter) => {
- setAnswerListHistory((prevState) => {
- let prevData = prevState.get(chatName);
- if (prevData?.length === undefined) {
- prevData = [[query, "", {} as OllamaApiGenerateResponse]];
- } else {
- prevData.push([query, "", {} as OllamaApiGenerateResponse]);
- }
- prevState.set(chatName, prevData);
- setSelectedAnswer((prevData.length - 1).toString());
- return new Map(prevState);
- });
-
- emiter.on("data", (data) => {
- setAnswerListHistory((prevState) => {
- const prevData = prevState.get(chatName);
- if (prevData) {
- if (prevData?.length) prevData[prevData.length - 1][1] += data;
- prevState.set(chatName, prevData);
- }
- return new Map(prevState);
- });
- });
-
- emiter.on("done", async (data) => {
- await showToast({ style: Toast.Style.Success, title: "🧠Inference Done." });
- setAnswerListHistory((prevState) => {
- const prevData = prevState.get(chatName);
- if (prevData) {
- if (prevData?.length) prevData[prevData.length - 1][2] = data;
- prevState.set(chatName, prevData);
- }
- return new Map(prevState);
- });
- setLoading(false);
- });
- })
- .catch(async (err) => {
- await HandleError(err);
- });
- }
- async function SaveAnswerListHistory(): Promise {
- const currentData = answerListHistory.get(chatName);
- if (currentData && currentData[currentData.length - 1][2].context) {
- await LocalStorage.setItem("answerListHistory", JSON.stringify([...answerListHistory]));
- }
- }
- async function GetAnswerList(): Promise {
- await LocalStorage.getItem("chatName").then((data) => {
- if (data) setChatName(data as string);
- });
- await LocalStorage.getItem("answerListHistory").then((data) => {
- if (data) {
- const dataMap: Map = new Map(JSON.parse(data as string));
- setAnswerListHistory(dataMap);
- }
- });
- }
- async function GetModels(): Promise {
- const generate = await LocalStorage.getItem("chat_model_generate");
- if (generate) {
- modelGenerate.current = generate as string;
- } else {
- setShowSelectModelForm(true);
- }
- }
- async function ClearAnswerList(): Promise {
- setAnswerListHistory((prevState) => {
- if (chatName === "Current") {
- prevState.set("Current", undefined);
- } else {
- prevState.delete(chatName);
- }
- return new Map(prevState);
- });
- if (answerListHistory.size === 0) {
- await LocalStorage.removeItem("answerListHistory");
- }
- setChatName("Current");
- await LocalStorage.setItem("chatName", "Current");
- await LocalStorage.setItem("answerListHistory", JSON.stringify([...answerListHistory]));
- }
- async function ChangeChat(name: string): Promise {
- setChatName(name);
- setClipboardConversationByName(name);
- await LocalStorage.setItem("chatName", name);
- }
- function setClipboardConversationByName(name: string) {
- let clipboard = "";
- const data = answerListHistory.get(name);
- if (data) {
- data.map((value) => (clipboard += `Question:\n${value[0]}\n\nAnswer:${value[1]}\n\n`));
- }
- setClipboardConversation(clipboard);
- }
- function ActionOllama(item?: [string, string, OllamaApiGenerateResponse]): JSX.Element {
- return (
-
-
- {query && }
- {item?.[0] && (
-
- )}
- {item?.[1] && (
-
- )}
- {item && }
- {chatName === "Current" && item && (
- setShowFormSaveChat(true)}
- shortcut={{ modifiers: ["cmd"], key: "s" }}
- />
- )}
- {item && (
-
- )}
- setShowSelectModelForm(true)}
- shortcut={{ modifiers: ["cmd"], key: "m" }}
- />
-
-
- );
- }
- React.useEffect(() => {
- SaveAnswerListHistory();
- setClipboardConversationByName(chatName);
- }, [answerListHistory]);
- React.useEffect(() => {
- GetAnswerList();
- GetModels();
- }, []);
-
- // Form: Save Chat
- const [showFormSaveChat, setShowFormSaveChat]: [boolean, React.Dispatch>] =
- React.useState(false);
- async function SaveChatToHistory(): Promise {
- setAnswerListHistory((prevState) => {
- const chat = prevState.get("Current");
- if (chat) {
- prevState.set(chatName, chat);
- prevState.set("Current", undefined);
- }
- return new Map(prevState);
- });
- setChatName("Current");
- await LocalStorage.setItem("chatName", "Current");
- await LocalStorage.setItem("answerListHistory", JSON.stringify([...answerListHistory]));
- setShowFormSaveChat(false);
- }
- const FormSaveChat: JSX.Element = (
-
-
- );
-
- // Form: Select Model
- const [showSelectModelForm, setShowSelectModelForm]: [boolean, React.Dispatch>] =
- React.useState(false);
- const [installedModels, setInstalledModels]: [string[], React.Dispatch>] =
- React.useState([] as string[]);
- async function setLocalStorageModels(generate: string) {
- LocalStorage.setItem(`chat_model_generate`, generate);
- modelGenerate.current = generate;
- setShowSelectModelForm(false);
- }
- async function getInstalledModels() {
- const installedModels: string[] | undefined = await OllamaApiTags()
- .then((response): string[] => {
- const installedModels: string[] = [];
- response.models.map((model) => {
- installedModels.push(model.name);
- });
- return installedModels;
- })
- .catch(async (err): Promise => {
- await showToast({ style: Toast.Style.Failure, title: err.message });
- return undefined;
- });
- if (installedModels) setInstalledModels([...installedModels]);
- }
- React.useEffect(() => {
- if (showSelectModelForm && installedModels.length === 0) getInstalledModels();
- }, [showSelectModelForm]);
- const FormSetModel: JSX.Element = (
-
- );
-
- if (showSelectModelForm) return FormSetModel;
-
- if (showFormSaveChat) return FormSaveChat;
-
- return (
- 0
- }
- searchBarAccessory={
-
- {!loading &&
- Array.from(answerListHistory.keys()).map((key) => )}
-
- }
- >
- {(() => {
- if (
- answerListHistory.get(chatName)?.length != undefined &&
- (answerListHistory.get(chatName)?.length as number) > 0
- ) {
- return answerListHistory.get(chatName)?.map((item, index) => (
-
-
-
- {item[2].eval_count && item[2].eval_duration ? (
-
- ) : null}
- {item[2].total_duration ? (
-
- ) : null}
- {item[2].load_duration ? (
-
- ) : null}
- {item[2].prompt_eval_count ? (
-
- ) : null}
- {item[2].prompt_eval_duration ? (
-
- ) : null}
- {item[2].eval_count ? (
-
- ) : null}
- {item[2].eval_duration ? (
-
- ) : null}
-
- )
- }
- />
- }
- />
- ));
- }
- return ;
- })()}
-
- );
-}
diff --git a/extensions/raycast-ollama/src/api/ollama.ts b/extensions/raycast-ollama/src/api/ollama.ts
index 1e743d3b83b..c1c9be2a5f0 100644
--- a/extensions/raycast-ollama/src/api/ollama.ts
+++ b/extensions/raycast-ollama/src/api/ollama.ts
@@ -4,6 +4,8 @@ import {
OllamaApiEmbeddingsResponse,
OllamaApiTagsResponse,
OllamaApiPullResponse,
+ OllamaApiShowResponse,
+ OllamaApiShowModelfile,
} from "./types";
import {
ErrorOllamaCustomModel,
@@ -29,6 +31,17 @@ function parseOllamaHostUrl(): string {
return url;
}
+/**
+ * Parse Ollama Host URL from preferences for langchain.
+ * @returns {string} Parsed Ollama Host route for langchain.
+ */
+export function parseOllamaUrlForLangchain(): string {
+ let url: string;
+ url = (preferences.ollamaHost as string).replace("localhost", "127.0.0.1");
+ if (url[url.length - 1] === "/") url = url.substring(0, url.length - 1);
+ return url;
+}
+
/**
* Get available models on ollama registry.
* @returns {Promise} List of models.
@@ -80,6 +93,150 @@ export async function OllamaApiTags(): Promise {
return data;
}
+/**
+ * Show model details.
+ * @param {string} model Model name.
+ * @returns {Promise} Model details.
+ */
+export async function OllamaApiShow(model: string): Promise {
+ const host = parseOllamaHostUrl();
+ const url = `${host}api/show`;
+
+ const body = {
+ name: model,
+ };
+
+ const data = await fetch(url, {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify(body),
+ })
+ .then((response) => {
+ if (!response.ok) {
+ throw new ErrorOllamaModelNotInstalled(MessageOllamaModelNotInstalled.message, model);
+ }
+ return response.json();
+ })
+ .then((output): OllamaApiShowResponse => {
+ return output as OllamaApiShowResponse;
+ })
+ .catch((err) => {
+ if (err instanceof ErrorOllamaModelNotInstalled) {
+ throw err;
+ }
+ console.error(err);
+ throw ErrorOllamaNotInstalledOrRunning;
+ });
+
+ return data;
+}
+
+/**
+ * Return OllamaApiShowResponse Modelfile parameters.
+ * @param {OllamaApiShowResponse} show - Ollama Api Show Response.
+ * @returns {OllamaApiShowModelfile} Modelfile parameters.
+ */
+export function OllamaApiShowParseModelfile(show: OllamaApiShowResponse): OllamaApiShowModelfile {
+ const modelfile = show.modelfile;
+ const template = show.template;
+ const parameters = show.parameters.split("\n");
+
+ const from = modelfile.match(/^FROM[ ]+([a-zA-Z0-9:./]+)\n/m)?.[1];
+
+ const parameterMirostat = parameters
+ .filter((param) => param.search(/^mirostat[ ]+(.*)/m) !== -1)
+ .map((param) => param.match(/^mirostat[ ]+(.*)/m)?.[1])?.[0];
+ const parameterMirostatEta = parameters
+ .filter((param) => param.search(/^mirostat_eta[ ]+(.*)/m) !== -1)
+ .map((param) => param.match(/^mirostat_eta[ ]+(.*)/m)?.[1])?.[0];
+ const parameterMirostatTau = parameters
+ .filter((param) => param.search(/^mirostat_tau[ ]+(.*)/m) !== -1)
+ .map((param) => param.match(/^mirostat_tau[ ]+(.*)/m)?.[1])?.[0];
+ const parameterNumCtx = parameters
+ .filter((param) => param.search(/^num_ctx[ ]+(.*)/m) !== -1)
+ .map((param) => param.match(/^num_ctx[ ]+(.*)/m)?.[1])?.[0];
+ const parameterNumGqa = parameters
+ .filter((param) => param.search(/^num_gqa[ ]+(.*)/m) !== -1)
+ .map((param) => param.match(/^num_gqa[ ]+(.*)/m)?.[1])?.[0];
+ const parameterNumGpu = parameters
+ .filter((param) => param.search(/^num_gpu[ ]+(.*)/m) !== -1)
+ .map((param) => param.match(/^num_gpu[ ]+(.*)/m)?.[1])?.[0];
+ const parameterNumThread = parameters
+ .filter((param) => param.search(/^num_thread[ ]+(.*)/m) !== -1)
+ .map((param) => param.match(/^num_thread[ ]+(.*)/m)?.[1])?.[0];
+ const parameterRepeatLastN = parameters
+ .filter((param) => param.search(/^repeat_last_n[ ]+(.*)/m) !== -1)
+ .map((param) => param.match(/^repeat_last_n[ ]+(.*)/m)?.[1])?.[0];
+ const parameterRepeatPenalty = parameters
+ .filter((param) => param.search(/^repeat_penalty[ ]+(.*)/m) !== -1)
+ .map((param) => param.match(/^repeat_penalty[ ]+(.*)/m)?.[1])?.[0];
+ const parameterTemperature = parameters
+ .filter((param) => param.search(/^temperature[ ]+(.*)/m) !== -1)
+ .map((param) => param.match(/^temperature[ ]+(.*)/m)?.[1])?.[0];
+ const parameterSeed = parameters
+ .filter((param) => param.search(/^seed[ ]+(.*)/m) !== -1)
+ .map((param) => param.match(/^seed[ ]+(.*)/m)?.[1])?.[0];
+ const parameterStop = parameters
+ .filter((param) => param.search(/^stop[ ]+(.*)/m) !== -1)
+ .map((param) => param.match(/^stop[ ]+(.*)/m)?.[1]);
+ const parameterTfsZ = parameters
+ .filter((param) => param.search(/^tfs_z[ ]+(.*)/m) !== -1)
+ .map((param) => param.match(/^tfs_z[ ]+(.*)/m)?.[1])?.[0];
+ const parameterNumPredict = parameters
+ .filter((param) => param.search(/^num_predict[ ]+(.*)/m) !== -1)
+ .map((param) => param.match(/^num_predict[ ]+(.*)/m)?.[1])?.[0];
+ const parameterTopK = parameters
+ .filter((param) => param.search(/^top_k[ ]+(.*)/m) !== -1)
+ .map((param) => param.match(/^top_k[ ]+(.*)/m)?.[1])?.[0];
+ const parameterTopP = parameters
+ .filter((param) => param.search(/^top_p[ ]+(.*)/m) !== -1)
+ .map((param) => param.match(/^top_p[ ]+(.*)/m)?.[1])?.[0];
+
+ let system: string | undefined;
+ const systemIndexStart = modelfile.search(/^SYSTEM[ ]+(.*)/m);
+ if (systemIndexStart !== -1) {
+ system = modelfile.substring(systemIndexStart).split('"""')?.[1];
+ }
+
+ const adapter = parameters
+ .filter((param) => param.search(/^ADAPTER[ ]+(.*)/m) !== -1)
+ .map((param) => param.match(/^ADAPTER[ ]+(.*)/m)?.[1])?.[0];
+
+ let license: string | undefined;
+ const licenseIndexStart = modelfile.search(/^SYSTEM[ ]+(.*)/m);
+ if (licenseIndexStart !== -1) {
+ system = modelfile.substring(licenseIndexStart).split('"""')?.[1];
+ }
+
+ return {
+ from: from ?? "",
+ parameter: {
+ mirostat: parameterMirostat ? Number(parameterMirostat) : 0,
+ mirostat_eta: parameterMirostatEta ? Number(parameterMirostatEta) : 0.1,
+ mirostat_tau: parameterMirostatTau ? Number(parameterMirostatTau) : 5.0,
+ num_ctx: parameterNumCtx ? Number(parameterNumCtx) : 2048,
+ num_gqa: parameterNumGqa ? Number(parameterNumGqa) : undefined,
+ num_gpu: parameterNumGpu ? Number(parameterNumGpu) : 1,
+ num_thread: parameterNumThread ? Number(parameterNumThread) : undefined,
+ repeat_last_n: parameterRepeatLastN ? Number(parameterRepeatLastN) : 64,
+ repeat_penalty: parameterRepeatPenalty ? Number(parameterRepeatPenalty) : 1.1,
+ temperature: parameterTemperature ? Number(parameterTemperature) : 0.8,
+ seed: parameterSeed ? Number(parameterSeed) : 0,
+ stop: parameterStop,
+ tfs_z: parameterTfsZ ? Number(parameterTfsZ) : 1,
+ num_predict: parameterNumPredict ? Number(parameterNumPredict) : 128,
+ top_k: parameterTopK ? Number(parameterTopK) : 40,
+ top_p: parameterTopP ? Number(parameterTopP) : 0.9,
+ },
+ template: template,
+ system: system,
+ adapter: adapter,
+ license: license,
+ };
+}
+
/**
* Delete model.
* @param {string} model Model name.
@@ -171,7 +328,7 @@ export async function OllamaApiPull(model: string): Promise {
/**
* Perform text generation with the selected model.
* @param {OllamaApiGenerateRequestBody} body - Ollama Generate Body Request.
- * @returns {Promise} Response from the Ollama API with an EventEmitter with two event: `data` where all generated text is passed on `string` format and `done` when inference is finished returning a `OllamaApiGenerateResponse` object contains all metadata of inference..
+ * @returns {Promise} Response from the Ollama API with an EventEmitter with two event: `data` where all generated text is passed on `string` format and `done` when inference is finished returning a `OllamaApiGenerateResponse` object contains all metadata of inference.
*/
export async function OllamaApiGenerate(body: OllamaApiGenerateRequestBody): Promise {
const host = parseOllamaHostUrl();
@@ -228,6 +385,46 @@ export async function OllamaApiGenerate(body: OllamaApiGenerateRequestBody): Pro
return emitter;
}
+/**
+ * Perform text generation with the selected model without stream.
+ * @param {OllamaApiGenerateRequestBody} body - Ollama Generate Body Request.
+ * @returns {Promise} Response from the Ollama API with an EventEmitter with two event: `data` where all generated text is passed on `string` format and `done` when inference is finished returning a `OllamaApiGenerateResponse` object contains all metadata of inference.
+ */
+export async function OllamaApiGenerateNoStream(
+ body: OllamaApiGenerateRequestBody
+): Promise {
+ const host = parseOllamaHostUrl();
+ const url = `${host}api/generate`;
+
+ body.stream = false;
+
+ const response: OllamaApiGenerateResponse | undefined = await fetch(url, {
+ method: "POST",
+ body: JSON.stringify(body),
+ })
+ .then((response) => {
+ if (response.ok) {
+ return response.json();
+ }
+
+ if (response.status === 400) {
+ throw new ErrorOllamaModelNotInstalled(MessageOllamaModelNotInstalled.message, body.model);
+ }
+ })
+ .then((json) => {
+ return json as OllamaApiGenerateResponse;
+ })
+ .catch((err) => {
+ if (err instanceof ErrorOllamaModelNotInstalled) {
+ throw err;
+ }
+ console.error(err);
+ throw ErrorOllamaNotInstalledOrRunning;
+ });
+
+ return response;
+}
+
/**
* Perform text embeddings with the selected model.
* @param {string} prompt - text used for embeddings.
diff --git a/extensions/raycast-ollama/src/api/polyfill/node-fetch.js b/extensions/raycast-ollama/src/api/polyfill/node-fetch.js
new file mode 100644
index 00000000000..d1720eb9e9f
--- /dev/null
+++ b/extensions/raycast-ollama/src/api/polyfill/node-fetch.js
@@ -0,0 +1,19 @@
+import fetch, {
+ Blob,
+ blobFrom,
+ blobFromSync,
+ File,
+ fileFrom,
+ fileFromSync,
+ FormData,
+ Headers,
+ Request,
+ Response,
+} from "node-fetch";
+
+if (!globalThis.fetch) {
+ globalThis.fetch = fetch;
+ globalThis.Headers = Headers;
+ globalThis.Request = Request;
+ globalThis.Response = Response;
+}
diff --git a/extensions/raycast-ollama/src/api/types.ts b/extensions/raycast-ollama/src/api/types.ts
index 4c569f4794a..fb9af89d3ac 100644
--- a/extensions/raycast-ollama/src/api/types.ts
+++ b/extensions/raycast-ollama/src/api/types.ts
@@ -2,6 +2,40 @@ export interface OllamaApiTagsResponse {
models: OllamaApiTagsResponseModel[];
}
+export interface OllamaApiShowResponse {
+ modelfile: string;
+ parameters: string;
+ template: string;
+}
+
+export interface OllamaApiShowModelfile {
+ from: string;
+ parameter: OllamaApiShowModelfileParameter;
+ template: string;
+ system?: string;
+ adapter?: string;
+ license?: string;
+}
+
+export interface OllamaApiShowModelfileParameter {
+ mirostat: number;
+ mirostat_eta: number;
+ mirostat_tau: number;
+ num_ctx: number;
+ num_gqa?: number;
+ num_gpu: number;
+ num_thread?: number;
+ repeat_last_n: number;
+ repeat_penalty: number;
+ temperature: number;
+ seed: number;
+ stop: (string | undefined)[];
+ tfs_z: number;
+ num_predict: number;
+ top_k: number;
+ top_p: number;
+}
+
export interface OllamaApiTagsResponseModel {
name: string;
modified_at: string;
@@ -9,6 +43,14 @@ export interface OllamaApiTagsResponseModel {
download?: number;
}
+export interface OllamaApiTagsExtended {
+ models: OllamaApiTagsModelExtended[];
+}
+
+export interface OllamaApiTagsModelExtended extends OllamaApiTagsResponseModel {
+ modelfile?: OllamaApiShowModelfile;
+}
+
export interface OllamaApiPullResponse {
status: string;
digest?: string;
@@ -20,10 +62,13 @@ export interface OllamaApiPullResponse {
export interface OllamaApiGenerateRequestBody {
model: string;
prompt: string;
+ format?: string;
+ options?: OllamaApiGenerateOptionsRequestBody;
system?: string;
template?: string;
context?: number[];
- options?: OllamaApiGenerateOptionsRequestBody;
+ stream?: boolean;
+ raw?: boolean;
}
export interface OllamaApiGenerateOptionsRequestBody {
@@ -138,3 +183,26 @@ export interface RaycastArgumentsOllamaCommandCustom {
launchType: string;
launchContext?: string;
}
+
+export interface DocumentLoaderFiles {
+ path: string;
+ mtime?: Date;
+}
+
+export interface ChainPreferences {
+ type: Chains;
+ parameter?: ChainPreferencesParameter;
+}
+
+export interface ChainPreferencesParameter {
+ docsNumber?: number;
+}
+
+export enum Chains {
+ STUFF = "Stuff",
+ REFINE = "Refine",
+}
+
+export enum PromptTags {
+ FILE = "/file",
+}
diff --git a/extensions/raycast-ollama/src/api/ui/AnswerView.tsx b/extensions/raycast-ollama/src/api/ui/AnswerView.tsx
new file mode 100644
index 00000000000..38764bf0e33
--- /dev/null
+++ b/extensions/raycast-ollama/src/api/ui/AnswerView.tsx
@@ -0,0 +1,296 @@
+import { OllamaApiGenerateRequestBody, OllamaApiGenerateResponse } from "../types";
+import {
+ ErrorOllamaCustomModel,
+ ErrorOllamaModelNotInstalled,
+ ErrorRaycastApiNoTextSelectedOrCopied,
+ ErrorRaycastApiNoTextSelected,
+ ErrorRaycastApiNoTextCopied,
+ ErrorRaycastModelNotConfiguredOnLocalStorage,
+} from "../errors";
+import { OllamaApiGenerate } from "../ollama";
+import { SetModelView } from "./SetModelView";
+import * as React from "react";
+import { Action, ActionPanel, Detail, Icon, LocalStorage, Toast, showToast } from "@raycast/api";
+import { getSelectedText, Clipboard, getPreferenceValues } from "@raycast/api";
+import { usePromise } from "@raycast/utils";
+
+const preferences = getPreferenceValues();
+
+const defaultPrompt = new Map([
+ [
+ "casual",
+ "Act as a writer. Make the following text more casual while keeping the core idea.\n\nOutput only with the modified text.\n",
+ ],
+ [
+ "codeexplain",
+ "Act as a developer. Explain the following code block step by step.\n\nOutput only with the commented code.\n",
+ ],
+ [
+ "confident",
+ "Act as a writer. Make the following text more confident while keeping the core idea.\n\nOutput only with the modified text.\n",
+ ],
+ [
+ "explain",
+ "Act as a writer. Explain the following text in simple and concise terms.\n\nOutput only with the modified text.\n",
+ ],
+ [
+ "fix",
+ "Act as a writer. Fix the following text from spelling and grammar error.\n\nOutput only with the fixed text.\n",
+ ],
+ [
+ "friendly",
+ "Act as a writer. Make the following text more friendly while keeping the core idea.\n\nOutput only with the modified text.\n",
+ ],
+ [
+ "improve",
+ "Act as a writer. Improve the writing of the following text while keeping the core idea.\n\nOutput only with the modified text.\n",
+ ],
+ [
+ "longher",
+ "Act as a writer. Make the following text longer and more rich while keeping the core idea.\n\nOutput only with the modified text.\n",
+ ],
+ [
+ "professional",
+ "Act as a writer. Make the following text more professional while keeping the core idea.\n\nOutput only with the modified text.\n",
+ ],
+ [
+ "shorter",
+ "Act as a writer. Make the following text shorter while keeping the core idea.\n\nOutput only with the modified text.\n",
+ ],
+ ["translate", "Act as a translator. Translate the following text.\n\nOutput only with the translated text.\n"],
+ [
+ "tweet",
+ "You are a content marketer who needs to come up with a short but succinct tweet. Make sure to include the appropriate hashtags and links. All answers should be in the form of a tweet which has a max size of 280 characters. Every instruction will be the topic to create a tweet about.\n\nOutput only with the modified text.\n",
+ ],
+]);
+
+/**
+ * Return JSX element with generated text and relative metadata.
+ * @param {string} command - Command name.
+ * @param {string | undefined} systemPrompt - System Prompt.
+ * @param {string | undefined} model - Model used for inference.
+ * @returns {JSX.Element} Raycast Answer View.
+ */
+export function AnswerView(
+ command: string | undefined = undefined,
+ model: string | undefined = undefined
+): JSX.Element {
+ // Main
+ const query: React.MutableRefObject = React.useRef("");
+ const { data: ModelGenerate, revalidate: RevalidateModelGenerate } = usePromise(GetModel, [], {
+ onError: () => {
+ setShowSelectModelForm(true);
+ },
+ });
+ const [loading, setLoading]: [boolean, React.Dispatch>] = React.useState(false);
+ const [answer, setAnswer]: [string, React.Dispatch>] = React.useState("");
+ const [answerMetadata, setAnswerMetadata]: [
+ OllamaApiGenerateResponse,
+ React.Dispatch>
+ ] = React.useState({} as OllamaApiGenerateResponse);
+
+ /**
+ * Handle Error from Ollama API.
+ * @param {Error} err - Error object.
+ * @returns {Promise}
+ */
+ async function HandleError(err: Error): Promise {
+ if (err instanceof ErrorOllamaModelNotInstalled) {
+ await showToast({ style: Toast.Style.Failure, title: err.message, message: err.suggest });
+ setLoading(false);
+ setShowSelectModelForm(true);
+ return;
+ } else if (err instanceof ErrorOllamaCustomModel) {
+ await showToast({
+ style: Toast.Style.Failure,
+ title: err.message,
+ message: `Model: ${err.model}, File: ${err.file}`,
+ });
+ setLoading(false);
+ return;
+ } else {
+ await showToast({ style: Toast.Style.Failure, title: err.message });
+ setLoading(false);
+ }
+ }
+
+ /**
+ * Start Inference with Ollama API.
+ * @returns {Promise}
+ */
+ async function Inference(): Promise {
+ await showToast({ style: Toast.Style.Animated, title: "🧠Performing Inference." });
+ setLoading(true);
+ setAnswer("");
+ const body = {
+ model: ModelGenerate,
+ prompt: query.current,
+ } as OllamaApiGenerateRequestBody;
+ if (command) body.system = defaultPrompt.get(command);
+ OllamaApiGenerate(body)
+ .then(async (emiter) => {
+ emiter.on("data", (data) => {
+ setAnswer((prevState) => prevState + data);
+ });
+
+ emiter.on("done", async (data) => {
+ await showToast({ style: Toast.Style.Success, title: "🧠Inference Done." });
+ setAnswerMetadata(data);
+ setLoading(false);
+ });
+ })
+ .catch(async (err) => {
+ await HandleError(err);
+ });
+ }
+
+ /**
+ * Get Model from LocalStorage.
+ * @returns {Promise} Model.
+ */
+ async function GetModel(): Promise {
+ if (model) {
+ return model;
+ } else {
+ const m = await LocalStorage.getItem(`${command}_model_generate`);
+ if (m) {
+ return m as string;
+ } else {
+ throw ErrorRaycastModelNotConfiguredOnLocalStorage;
+ }
+ }
+ }
+
+ // When Model is set or changed start inference.
+ React.useEffect(() => {
+ if (ModelGenerate)
+ switch (preferences.ollamaResultViewInput) {
+ case "SelectedText":
+ getSelectedText()
+ .then((text) => {
+ query.current = text;
+ Inference();
+ })
+ .catch(async () => {
+ if (preferences.ollamaResultViewInputFallback) {
+ Clipboard.readText()
+ .then((text) => {
+ if (text === undefined) throw "Empty Clipboard";
+ query.current = text;
+ Inference();
+ })
+ .catch(async () => {
+ await showToast({
+ style: Toast.Style.Failure,
+ title: ErrorRaycastApiNoTextSelectedOrCopied.message,
+ });
+ });
+ } else {
+ await showToast({ style: Toast.Style.Failure, title: ErrorRaycastApiNoTextSelected.message });
+ }
+ });
+ break;
+ case "Clipboard":
+ Clipboard.readText()
+ .then((text) => {
+ if (text === undefined) throw "Empty Clipboard";
+ query.current = text;
+ Inference();
+ })
+ .catch(async () => {
+ if (preferences.ollamaResultViewInputFallback) {
+ getSelectedText()
+ .then((text) => {
+ query.current = text;
+ Inference();
+ })
+ .catch(async () => {
+ await showToast({
+ style: Toast.Style.Failure,
+ title: ErrorRaycastApiNoTextSelectedOrCopied.message,
+ });
+ });
+ } else {
+ await showToast({ style: Toast.Style.Failure, title: ErrorRaycastApiNoTextCopied.message });
+ }
+ });
+ break;
+ }
+ }, [ModelGenerate]);
+
+ const [showSelectModelForm, setShowSelectModelForm]: [boolean, React.Dispatch>] =
+ React.useState(false);
+
+ // Revalidate ModelGenerate when model is changed with SwtModelView Form
+ React.useEffect(() => {
+ if (!showSelectModelForm) RevalidateModelGenerate();
+ }, [showSelectModelForm]);
+
+ if (showSelectModelForm && command) return ;
+
+ return (
+
+
+
+ setShowSelectModelForm(true)}
+ shortcut={{ modifiers: ["cmd"], key: "m" }}
+ />
+
+ )
+ }
+ metadata={
+ !loading &&
+ preferences.ollamaShowMetadata && (
+
+
+
+ {answerMetadata.eval_count && answerMetadata.eval_duration ? (
+
+ ) : null}
+ {answerMetadata.total_duration ? (
+
+ ) : null}
+ {answerMetadata.load_duration ? (
+
+ ) : null}
+ {answerMetadata.prompt_eval_count ? (
+
+ ) : null}
+ {answerMetadata.prompt_eval_duration ? (
+
+ ) : null}
+ {answerMetadata.eval_count ? (
+
+ ) : null}
+ {answerMetadata.eval_duration ? (
+
+ ) : null}
+
+ )
+ }
+ />
+ );
+}
diff --git a/extensions/raycast-ollama/src/api/ui/ChainView.tsx b/extensions/raycast-ollama/src/api/ui/ChainView.tsx
new file mode 100644
index 00000000000..8e7dd175e74
--- /dev/null
+++ b/extensions/raycast-ollama/src/api/ui/ChainView.tsx
@@ -0,0 +1,139 @@
+import { Action, ActionPanel, Form, LocalStorage } from "@raycast/api";
+import { usePromise } from "@raycast/utils";
+import React from "react";
+import { Chains, ChainPreferences } from "../types";
+
+interface SubmitFormData {
+ ChainType: string;
+ ChainParameterDocsNumber?: string;
+}
+
+interface props {
+ ShowChainView: React.Dispatch>;
+}
+
+/**
+ * Return JSX Element for Chain View
+ * @param {props} props
+ * @returns
+ */
+export function ChainView(props: props): JSX.Element {
+ const { data: ChainPreferences } = usePromise(GetChainPreferences);
+ const [ChainType, setChainType] = React.useState(Chains.STUFF as string);
+ const [Error, setError]: [string | undefined, React.Dispatch>] =
+ React.useState();
+ const ChainInfo = new Map([
+ [
+ Chains.STUFF,
+ 'The stuff documents chain ("stuff" as in "to stuff" or "to fill") is the most straightforward of the document chains. It takes a list of documents, inserts them all into a prompt and passes that prompt to an LLM.\n\nThis chain is well-suited for applications where documents are small and only a few are passed in for most calls.',
+ ],
+ [
+ Chains.REFINE,
+ "The refine documents chain constructs a response by looping over the input documents and iteratively updating its answer. For each document, it passes all non-document inputs, the current document, and the latest intermediate answer to an LLM chain to get a new answer.\n\nSince the Refine chain only passes a single document to the LLM at a time, it is well-suited for tasks that require analyzing more documents than can fit in the model's context. The obvious tradeoff is that this chain will make far more LLM calls than, for example, the Stuff documents chain. There are also certain tasks which are difficult to accomplish iteratively. For example, the Refine chain can perform poorly when documents frequently cross-reference one another or when a task requires detailed information from many documents.",
+ ],
+ ]);
+
+ const InfoChainParameterDocsNumber =
+ "For fitting the context window document are spitted in chunks. This value indicate how many chunks will be passed to the LLM. High value can produce better response but increase inference time.";
+
+ /**
+ * Get Chain Preferences.
+ * @returns {Promise} Chain Settings.
+ */
+ async function GetChainPreferences(): Promise {
+ const json = await LocalStorage.getItem(`chain_settings`);
+ if (json) {
+ const chain: ChainPreferences = JSON.parse(json as string);
+ if (chain.type) setChainType(chain.type);
+ return chain;
+ }
+ }
+
+ /**
+ * Validate Chain Parameter Docs Number.
+ * @param {string} value.
+ */
+ function ValidateChainParameterDocsNumber(value: string) {
+ const error = "Must be a number";
+ if (value === "" || !Number(value)) {
+ setError(error);
+ } else {
+ setError(undefined);
+ }
+ }
+
+ /**
+ * Validate Form.
+ */
+ function ValidateForm() {
+ if (Error && ChainType === Chains.STUFF) setError(undefined);
+ }
+
+ /**
+ * Save to LocalStorage.
+ * @param {SubmitFormData} value.
+ */
+ function SaveToLocalStorageAndQuit(value: SubmitFormData) {
+ let data: ChainPreferences | undefined;
+ if (ChainType === Chains.STUFF) {
+ data = {
+ type: Chains.STUFF,
+ };
+ } else if (ChainType === Chains.REFINE) {
+ data = {
+ type: Chains.REFINE,
+ parameter: {
+ docsNumber: Number(Number(value.ChainParameterDocsNumber).toFixed(0)),
+ },
+ };
+ }
+ if (data) LocalStorage.setItem(`chain_settings`, JSON.stringify(data));
+ props.ShowChainView(false);
+ }
+
+ React.useEffect(() => {
+ if (ChainPreferences?.type) setChainType(ChainPreferences.type as string);
+ }, [ChainPreferences]);
+
+ React.useEffect(() => {
+ ValidateForm();
+ }, [ChainType]);
+
+ return (
+
+ );
+}
diff --git a/extensions/raycast-ollama/src/api/ui/ChatView.tsx b/extensions/raycast-ollama/src/api/ui/ChatView.tsx
new file mode 100644
index 00000000000..d20fd802ed8
--- /dev/null
+++ b/extensions/raycast-ollama/src/api/ui/ChatView.tsx
@@ -0,0 +1,502 @@
+import { ChainPreferences, Chains, OllamaApiGenerateResponse, OllamaApiShowModelfile } from "../types";
+import {
+ ErrorOllamaCustomModel,
+ ErrorOllamaModelNotInstalled,
+ ErrorRaycastModelNotConfiguredOnLocalStorage,
+} from "../errors";
+import { OllamaApiShow, OllamaApiShowParseModelfile } from "../ollama";
+import { SetModelView } from "./SetModelView";
+import * as React from "react";
+import { Action, ActionPanel, Detail, Icon, List, LocalStorage, Toast, showToast } from "@raycast/api";
+import { usePromise } from "@raycast/utils";
+import { getPreferenceValues } from "@raycast/api";
+import { SaveChatView } from "./SaveChatView";
+import { ChainView } from "./ChainView";
+import { DocumentLoaderFileView } from "./DocumentLoaderFileView";
+import { GetDocument, GetTags, LLMChain, loadQARefineChain, loadQAStuffChain } from "../langchain";
+import { Document } from "langchain/document";
+import { EventEmitter } from "stream";
+
+const preferences = getPreferenceValues();
+
+/**
+ * Return JSX element for chat view.
+ * @returns {JSX.Element} Raycast Chat View.
+ */
+export function ChatView(): JSX.Element {
+ const { data: ModelGenerate, revalidate: RevalidateModelGenerate } = usePromise(GetModel, [], {
+ onData: () => {
+ RevalidateModelGenerateModelfile();
+ },
+ onError: () => {
+ setShowSelectModelForm(true);
+ },
+ });
+ const { data: ModelGenerateModelfile, revalidate: RevalidateModelGenerateModelfile } = usePromise(GetModelModfile);
+ const { data: ModelEmbedding, revalidate: RevalidateModelEmbedding } = usePromise(GetModelEmbedding);
+ const { data: ChainPreferences, revalidate: RevalidateChainPreferences } = usePromise(GetChainPreferences);
+ const { data: ChatName = "Current", revalidate: RevalidateChatName } = usePromise(GetChatName);
+ const [loading, setLoading]: [boolean, React.Dispatch>] = React.useState(false);
+ const [query, setQuery]: [string, React.Dispatch>] = React.useState("");
+ const [selectedAnswer, setSelectedAnswer]: [string, React.Dispatch>] =
+ React.useState("0");
+ const [answerListHistory, setAnswerListHistory]: [
+ Map,
+ React.Dispatch>>
+ ] = React.useState(new Map());
+ const [clipboardConversation, setClipboardConversation]: [string, React.Dispatch>] =
+ React.useState("");
+
+ /**
+ * Handle Error from Ollama API.
+ * @param {Error} err - Error object.
+ * @returns {Promise}
+ */
+ async function HandleError(err: Error) {
+ if (err instanceof ErrorOllamaModelNotInstalled) {
+ await showToast({ style: Toast.Style.Failure, title: err.message, message: err.suggest });
+ setLoading(false);
+ setShowSelectModelForm(true);
+ return;
+ } else if (err instanceof ErrorOllamaCustomModel) {
+ await showToast({
+ style: Toast.Style.Failure,
+ title: err.message,
+ message: `Model: ${err.model}, File: ${err.file}`,
+ });
+ setLoading(false);
+ return;
+ } else {
+ await showToast({ style: Toast.Style.Failure, title: err.message });
+ setLoading(false);
+ }
+ }
+
+ /**
+ * Get Model from LocalStorage.
+ * @returns {Promise} Model.
+ */
+ async function GetModel(): Promise {
+ const m = await LocalStorage.getItem(`chat_model_generate`);
+ if (m) {
+ return m as string;
+ } else {
+ throw ErrorRaycastModelNotConfiguredOnLocalStorage;
+ }
+ }
+
+ /**
+ * Get Model Modelfile parameters.
+ * @returns {OllamaApiShowModelfile | undefined} Modelfile parameters.
+ */
+ async function GetModelModfile(): Promise {
+ const model = await LocalStorage.getItem(`chat_model_generate`);
+ if (model) {
+ return await OllamaApiShow(model as string)
+ .then(async (data) => await OllamaApiShowParseModelfile(data))
+ .catch(() => undefined);
+ } else {
+ return undefined;
+ }
+ }
+
+ /**
+ * Get Model for Embedding from LocalStorage.
+ * @returns {Promise} Model.
+ */
+ async function GetModelEmbedding(): Promise {
+ return await LocalStorage.getItem(`chat_model_embedding`);
+ }
+
+ /**
+ * Get Chain Preferences.
+ * @returns {Promise} Chain Settings.
+ */
+ async function GetChainPreferences(): Promise {
+ const json = await LocalStorage.getItem(`chain_settings`);
+ if (json) {
+ return JSON.parse(json as string) as ChainPreferences;
+ }
+ }
+
+ /**
+ * Start Inference with Ollama API.
+ * @returns {Promise}
+ */
+ async function Inference(): Promise {
+ try {
+ const [prompt, tags] = GetTags(query);
+
+ setLoading(true);
+ setQuery("");
+
+ let docs: Document>[] | undefined = undefined;
+
+ if (tags.length > 0) {
+ await showToast({ style: Toast.Style.Animated, title: "📄 Loading Documents." });
+
+ let model = ModelGenerate;
+ if (ModelEmbedding) model = ModelEmbedding;
+
+ let DocsNumber: number | undefined;
+ if (ModelGenerateModelfile)
+ if (ChainPreferences === undefined || ChainPreferences.type === Chains.STUFF) {
+ DocsNumber = Math.trunc(
+ ((ModelGenerateModelfile.parameter.num_ctx * 4 - prompt.length - ModelGenerateModelfile.template.length) /
+ 1000) *
+ 0.5
+ );
+ if (model) docs = await GetDocument(prompt, model, tags, DocsNumber);
+ } else if (ChainPreferences.type === Chains.REFINE && ChainPreferences.parameter?.docsNumber) {
+ DocsNumber = ChainPreferences.parameter.docsNumber;
+ if (model)
+ docs = await GetDocument(prompt, model, tags, DocsNumber, ModelGenerateModelfile.parameter.num_ctx * 3.5);
+ }
+ }
+
+ let context: number[] | undefined;
+ if (answerListHistory.has(ChatName)) {
+ const l = answerListHistory.get(ChatName)?.length;
+ if (l && l > 0) {
+ context = answerListHistory.get(ChatName)?.[l - 1][2].context;
+ }
+ }
+
+ let stream: EventEmitter | undefined;
+ if (docs) {
+ if (ChainPreferences === undefined || ChainPreferences.type === Chains.STUFF) {
+ await showToast({ style: Toast.Style.Animated, title: "🧠Inference with Documents." });
+ if (ModelGenerate) stream = await loadQAStuffChain(prompt, ModelGenerate, docs, context);
+ } else if (ChainPreferences.type === Chains.REFINE) {
+ await showToast({ style: Toast.Style.Animated, title: "🧠Inference with Documents." });
+ if (ModelGenerate) stream = await loadQARefineChain(prompt, ModelGenerate, docs, context);
+ }
+ } else {
+ await showToast({ style: Toast.Style.Animated, title: "🧠Inference." });
+ if (ModelGenerate) stream = await LLMChain(prompt, ModelGenerate, context);
+ }
+
+ if (stream) {
+ setAnswerListHistory((prevState) => {
+ let prevData = prevState.get(ChatName);
+ if (prevData?.length === undefined) {
+ prevData = [[query, "", {} as OllamaApiGenerateResponse]];
+ } else {
+ prevData.push([query, "", {} as OllamaApiGenerateResponse]);
+ }
+ prevState.set(ChatName, prevData);
+ setSelectedAnswer((prevData.length - 1).toString());
+ return new Map(prevState);
+ });
+
+ stream.on("data", (data) => {
+ setAnswerListHistory((prevState) => {
+ const prevData = prevState.get(ChatName);
+ if (prevData) {
+ if (prevData?.length) prevData[prevData.length - 1][1] += data;
+ prevState.set(ChatName, prevData);
+ }
+ return new Map(prevState);
+ });
+ });
+
+ stream.on("done", async (data) => {
+ await showToast({ style: Toast.Style.Success, title: "🧠Inference Done." });
+ setAnswerListHistory((prevState) => {
+ const prevData = prevState.get(ChatName);
+ if (prevData) {
+ if (prevData?.length) prevData[prevData.length - 1][2] = data;
+ prevState.set(ChatName, prevData);
+ }
+ return new Map(prevState);
+ });
+ setLoading(false);
+ });
+ } else {
+ await showToast({ style: Toast.Style.Success, title: "🧠Inference Done." });
+ setLoading(false);
+ }
+ } catch (err) {
+ await HandleError(err as Error);
+ }
+ }
+
+ /**
+ * Save Answer List History to LocalStorage
+ */
+ async function SaveAnswerListHistory(): Promise {
+ const currentData = answerListHistory.get(ChatName);
+ if (currentData && currentData[currentData.length - 1][2].context) {
+ await LocalStorage.setItem("answerListHistory", JSON.stringify([...answerListHistory]));
+ }
+ }
+
+ /**
+ * Get Last Chat used from LocalStorage.
+ * @returns {Promise} Chat Name
+ */
+ async function GetChatName(): Promise {
+ const name = await LocalStorage.getItem("chatName");
+ if (name) {
+ return name as string;
+ } else {
+ return "Current";
+ }
+ }
+
+ /**
+ * Get Answer List History from LocalStorage.
+ * @returns {Promise