mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-19 20:50:09 +01:00
Merge branch 'master' of github.com:Mintplex-Labs/anything-llm into render
This commit is contained in:
commit
45505630a6
@ -1,3 +1,4 @@
|
|||||||
|
**/server/utils/agents/aibitat/example/**
|
||||||
**/server/storage/documents/**
|
**/server/storage/documents/**
|
||||||
**/server/storage/vector-cache/**
|
**/server/storage/vector-cache/**
|
||||||
**/server/storage/*.db
|
**/server/storage/*.db
|
||||||
|
1
.github/workflows/build-and-push-image.yaml
vendored
1
.github/workflows/build-and-push-image.yaml
vendored
@ -21,6 +21,7 @@ on:
|
|||||||
- '**/.env.example'
|
- '**/.env.example'
|
||||||
- '.github/ISSUE_TEMPLATE/**/*'
|
- '.github/ISSUE_TEMPLATE/**/*'
|
||||||
- 'embed/**/*' # Embed should be published to frontend (yarn build:publish) if any changes are introduced
|
- 'embed/**/*' # Embed should be published to frontend (yarn build:publish) if any changes are introduced
|
||||||
|
- 'server/utils/agents/aibitat/example/**/*' # Do not push new image for local dev testing of new aibitat images.
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
push_multi_platform_to_registries:
|
push_multi_platform_to_registries:
|
||||||
|
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@ -1,9 +1,12 @@
|
|||||||
{
|
{
|
||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
|
"AIbitat",
|
||||||
"adoc",
|
"adoc",
|
||||||
|
"aibitat",
|
||||||
"anythingllm",
|
"anythingllm",
|
||||||
"Astra",
|
"Astra",
|
||||||
"comkey",
|
"comkey",
|
||||||
|
"Deduplicator",
|
||||||
"Dockerized",
|
"Dockerized",
|
||||||
"Embeddable",
|
"Embeddable",
|
||||||
"epub",
|
"epub",
|
||||||
@ -19,6 +22,7 @@
|
|||||||
"opendocument",
|
"opendocument",
|
||||||
"openrouter",
|
"openrouter",
|
||||||
"Qdrant",
|
"Qdrant",
|
||||||
|
"Serper",
|
||||||
"vectordbs",
|
"vectordbs",
|
||||||
"Weaviate",
|
"Weaviate",
|
||||||
"Zilliz"
|
"Zilliz"
|
||||||
|
11
README.md
11
README.md
@ -58,15 +58,16 @@ Some cool features of AnythingLLM
|
|||||||
- Extremely efficient cost-saving measures for managing very large documents. You'll never pay to embed a massive document or transcript more than once. 90% more cost effective than other document chatbot solutions.
|
- Extremely efficient cost-saving measures for managing very large documents. You'll never pay to embed a massive document or transcript more than once. 90% more cost effective than other document chatbot solutions.
|
||||||
- Full Developer API for custom integrations!
|
- Full Developer API for custom integrations!
|
||||||
|
|
||||||
### Supported LLMs, Embedders, and Vector Databases
|
### Supported LLMs, Embedders, Transcriptions models, and Vector Databases
|
||||||
|
|
||||||
**Supported LLMs:**
|
**Supported LLMs:**
|
||||||
|
|
||||||
- [Any open-source llama.cpp compatible model](/server/storage/models/README.md#text-generation-llm-selection)
|
- [Any open-source llama.cpp compatible model](/server/storage/models/README.md#text-generation-llm-selection)
|
||||||
- [OpenAI](https://openai.com)
|
- [OpenAI](https://openai.com)
|
||||||
- [Azure OpenAI](https://azure.microsoft.com/en-us/products/ai-services/openai-service)
|
- [Azure OpenAI](https://azure.microsoft.com/en-us/products/ai-services/openai-service)
|
||||||
- [Anthropic ClaudeV2](https://www.anthropic.com/)
|
- [Anthropic](https://www.anthropic.com/)
|
||||||
- [Google Gemini Pro](https://ai.google.dev/)
|
- [Google Gemini Pro](https://ai.google.dev/)
|
||||||
|
- [Hugging Face (chat models)](https://huggingface.co/)
|
||||||
- [Ollama (chat models)](https://ollama.ai/)
|
- [Ollama (chat models)](https://ollama.ai/)
|
||||||
- [LM Studio (all models)](https://lmstudio.ai)
|
- [LM Studio (all models)](https://lmstudio.ai)
|
||||||
- [LocalAi (all models)](https://localai.io/)
|
- [LocalAi (all models)](https://localai.io/)
|
||||||
@ -74,6 +75,7 @@ Some cool features of AnythingLLM
|
|||||||
- [Perplexity (chat models)](https://www.perplexity.ai/)
|
- [Perplexity (chat models)](https://www.perplexity.ai/)
|
||||||
- [OpenRouter (chat models)](https://openrouter.ai/)
|
- [OpenRouter (chat models)](https://openrouter.ai/)
|
||||||
- [Mistral](https://mistral.ai/)
|
- [Mistral](https://mistral.ai/)
|
||||||
|
- [Groq](https://groq.com/)
|
||||||
|
|
||||||
**Supported Embedding models:**
|
**Supported Embedding models:**
|
||||||
|
|
||||||
@ -84,6 +86,11 @@ Some cool features of AnythingLLM
|
|||||||
- [LocalAi (all)](https://localai.io/)
|
- [LocalAi (all)](https://localai.io/)
|
||||||
- [Ollama (all)](https://ollama.ai/)
|
- [Ollama (all)](https://ollama.ai/)
|
||||||
|
|
||||||
|
**Supported Transcription models:**
|
||||||
|
|
||||||
|
- [AnythingLLM Built-in](https://github.com/Mintplex-Labs/anything-llm/tree/master/server/storage/models#audiovideo-transcription) (default)
|
||||||
|
- [OpenAI](https://openai.com/)
|
||||||
|
|
||||||
**Supported Vector Databases:**
|
**Supported Vector Databases:**
|
||||||
|
|
||||||
- [LanceDB](https://github.com/lancedb/lancedb) (default)
|
- [LanceDB](https://github.com/lancedb/lancedb) (default)
|
||||||
|
@ -36,6 +36,7 @@ These instructions are for CLI configuration and assume you are logged in to EC2
|
|||||||
These instructions are for CLI configuration and assume you are logged in to EC2 instance as the ec2-user.
|
These instructions are for CLI configuration and assume you are logged in to EC2 instance as the ec2-user.
|
||||||
1. $sudo vi /etc/nginx/nginx.conf
|
1. $sudo vi /etc/nginx/nginx.conf
|
||||||
2. In the nginx.conf file, comment out the default server block configuration for http/port 80. It should look something like the following:
|
2. In the nginx.conf file, comment out the default server block configuration for http/port 80. It should look something like the following:
|
||||||
|
```
|
||||||
# server {
|
# server {
|
||||||
# listen 80;
|
# listen 80;
|
||||||
# listen [::]:80;
|
# listen [::]:80;
|
||||||
@ -53,13 +54,23 @@ These instructions are for CLI configuration and assume you are logged in to EC2
|
|||||||
# location = /50x.html {
|
# location = /50x.html {
|
||||||
# }
|
# }
|
||||||
# }
|
# }
|
||||||
|
```
|
||||||
3. Enter ':wq' to save the changes to the nginx default config
|
3. Enter ':wq' to save the changes to the nginx default config
|
||||||
|
|
||||||
## Step 7: Create simple http proxy configuration for AnythingLLM
|
## Step 7: Create simple http proxy configuration for AnythingLLM
|
||||||
These instructions are for CLI configuration and assume you are logged in to EC2 instance as the ec2-user.
|
These instructions are for CLI configuration and assume you are logged in to EC2 instance as the ec2-user.
|
||||||
1. $sudo vi /etc/nginx/conf.d/anything.conf
|
1. $sudo vi /etc/nginx/conf.d/anything.conf
|
||||||
2. Add the following configuration ensuring that you add your FQDN:.
|
2. Add the following configuration ensuring that you add your FQDN:.
|
||||||
|
|
||||||
|
```
|
||||||
server {
|
server {
|
||||||
|
# Enable websocket connections for agent protocol.
|
||||||
|
location ~* ^/api/agent-invocation/(.*) {
|
||||||
|
proxy_pass http://0.0.0.0:3001;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "Upgrade";
|
||||||
|
}
|
||||||
|
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name [insert FQDN here];
|
server_name [insert FQDN here];
|
||||||
@ -70,9 +81,16 @@ server {
|
|||||||
proxy_read_timeout 605;
|
proxy_read_timeout 605;
|
||||||
send_timeout 605;
|
send_timeout 605;
|
||||||
keepalive_timeout 605;
|
keepalive_timeout 605;
|
||||||
|
|
||||||
|
# Enable readable HTTP Streaming for LLM streamed responses
|
||||||
|
proxy_buffering off;
|
||||||
|
proxy_cache off;
|
||||||
|
|
||||||
|
# Proxy your locally running service
|
||||||
proxy_pass http://0.0.0.0:3001;
|
proxy_pass http://0.0.0.0:3001;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
```
|
||||||
3. Enter ':wq' to save the changes to the anything config file
|
3. Enter ':wq' to save the changes to the anything config file
|
||||||
|
|
||||||
## Step 8: Test nginx http proxy config and restart nginx service
|
## Step 8: Test nginx http proxy config and restart nginx service
|
||||||
|
@ -9,7 +9,7 @@ const path = require("path");
|
|||||||
const { ACCEPTED_MIMES } = require("./utils/constants");
|
const { ACCEPTED_MIMES } = require("./utils/constants");
|
||||||
const { reqBody } = require("./utils/http");
|
const { reqBody } = require("./utils/http");
|
||||||
const { processSingleFile } = require("./processSingleFile");
|
const { processSingleFile } = require("./processSingleFile");
|
||||||
const { processLink } = require("./processLink");
|
const { processLink, getLinkText } = require("./processLink");
|
||||||
const { wipeCollectorStorage } = require("./utils/files");
|
const { wipeCollectorStorage } = require("./utils/files");
|
||||||
const extensions = require("./extensions");
|
const extensions = require("./extensions");
|
||||||
const { processRawText } = require("./processRawText");
|
const { processRawText } = require("./processRawText");
|
||||||
@ -76,6 +76,26 @@ app.post(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
app.post(
|
||||||
|
"/util/get-link",
|
||||||
|
[verifyPayloadIntegrity],
|
||||||
|
async function (request, response) {
|
||||||
|
const { link } = reqBody(request);
|
||||||
|
try {
|
||||||
|
const { success, content = null } = await getLinkText(link);
|
||||||
|
response.status(200).json({ url: link, success, content });
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
response.status(200).json({
|
||||||
|
url: link,
|
||||||
|
success: false,
|
||||||
|
content: null,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
app.post(
|
app.post(
|
||||||
"/process-raw-text",
|
"/process-raw-text",
|
||||||
[verifyPayloadIntegrity],
|
[verifyPayloadIntegrity],
|
||||||
|
@ -6,7 +6,7 @@ const { writeToServerDocuments } = require("../../utils/files");
|
|||||||
const { tokenizeString } = require("../../utils/tokenizer");
|
const { tokenizeString } = require("../../utils/tokenizer");
|
||||||
const { default: slugify } = require("slugify");
|
const { default: slugify } = require("slugify");
|
||||||
|
|
||||||
async function scrapeGenericUrl(link) {
|
async function scrapeGenericUrl(link, textOnly = false) {
|
||||||
console.log(`-- Working URL ${link} --`);
|
console.log(`-- Working URL ${link} --`);
|
||||||
const content = await getPageContent(link);
|
const content = await getPageContent(link);
|
||||||
|
|
||||||
@ -19,6 +19,13 @@ async function scrapeGenericUrl(link) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (textOnly) {
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
content,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const url = new URL(link);
|
const url = new URL(link);
|
||||||
const filename = (url.host + "-" + url.pathname).replace(".", "_");
|
const filename = (url.host + "-" + url.pathname).replace(".", "_");
|
||||||
|
|
||||||
@ -69,8 +76,26 @@ async function getPageContent(link) {
|
|||||||
|
|
||||||
return pageContents.join(" ");
|
return pageContents.join(" ");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("getPageContent failed!", error);
|
console.error(
|
||||||
|
"getPageContent failed to be fetched by puppeteer - falling back to fetch!",
|
||||||
|
error
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const pageText = await fetch(link, {
|
||||||
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "text/plain",
|
||||||
|
"User-Agent":
|
||||||
|
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36,gzip(gfe)",
|
||||||
|
},
|
||||||
|
}).then((res) => res.text());
|
||||||
|
return pageText;
|
||||||
|
} catch (error) {
|
||||||
|
console.error("getPageContent failed to be fetched by any method.", error);
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,12 @@ async function processLink(link) {
|
|||||||
return await scrapeGenericUrl(link);
|
return await scrapeGenericUrl(link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getLinkText(link) {
|
||||||
|
if (!validURL(link)) return { success: false, reason: "Not a valid URL." };
|
||||||
|
return await scrapeGenericUrl(link, true);
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
processLink,
|
processLink,
|
||||||
|
getLinkText,
|
||||||
};
|
};
|
||||||
|
@ -168,3 +168,16 @@ GID='1000'
|
|||||||
#ENABLE_HTTPS="true"
|
#ENABLE_HTTPS="true"
|
||||||
#HTTPS_CERT_PATH="sslcert/cert.pem"
|
#HTTPS_CERT_PATH="sslcert/cert.pem"
|
||||||
#HTTPS_KEY_PATH="sslcert/key.pem"
|
#HTTPS_KEY_PATH="sslcert/key.pem"
|
||||||
|
|
||||||
|
###########################################
|
||||||
|
######## AGENT SERVICE KEYS ###############
|
||||||
|
###########################################
|
||||||
|
|
||||||
|
#------ SEARCH ENGINES -------
|
||||||
|
#=============================
|
||||||
|
#------ Google Search -------- https://programmablesearchengine.google.com/controlpanel/create
|
||||||
|
# AGENT_GSE_KEY=
|
||||||
|
# AGENT_GSE_CTX=
|
||||||
|
|
||||||
|
#------ Serper.dev ----------- https://serper.dev/
|
||||||
|
# AGENT_SERPER_DEV_KEY=
|
@ -32,22 +32,26 @@ export default function OpenAiOptions({ settings }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function OpenAIModelSelection({ apiKey, settings }) {
|
function OpenAIModelSelection({ apiKey, settings }) {
|
||||||
const [customModels, setCustomModels] = useState([]);
|
const [groupedModels, setGroupedModels] = useState({});
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function findCustomModels() {
|
async function findCustomModels() {
|
||||||
if (!apiKey) {
|
|
||||||
setCustomModels([]);
|
|
||||||
setLoading(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const { models } = await System.customModels(
|
const { models } = await System.customModels(
|
||||||
"openai",
|
"openai",
|
||||||
typeof apiKey === "boolean" ? null : apiKey
|
typeof apiKey === "boolean" ? null : apiKey
|
||||||
);
|
);
|
||||||
setCustomModels(models || []);
|
|
||||||
|
if (models?.length > 0) {
|
||||||
|
const modelsByOrganization = models.reduce((acc, model) => {
|
||||||
|
acc[model.organization] = acc[model.organization] || [];
|
||||||
|
acc[model.organization].push(model);
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
setGroupedModels(modelsByOrganization);
|
||||||
|
}
|
||||||
|
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
findCustomModels();
|
findCustomModels();
|
||||||
@ -82,41 +86,21 @@ function OpenAIModelSelection({ apiKey, settings }) {
|
|||||||
required={true}
|
required={true}
|
||||||
className="bg-zinc-900 border-gray-500 text-white text-sm rounded-lg block w-full p-2.5"
|
className="bg-zinc-900 border-gray-500 text-white text-sm rounded-lg block w-full p-2.5"
|
||||||
>
|
>
|
||||||
<optgroup label="General LLM models">
|
{Object.keys(groupedModels)
|
||||||
{[
|
.sort()
|
||||||
"gpt-3.5-turbo",
|
.map((organization) => (
|
||||||
"gpt-3.5-turbo-1106",
|
<optgroup key={organization} label={organization}>
|
||||||
"gpt-4",
|
{groupedModels[organization].map((model) => (
|
||||||
"gpt-4-turbo-preview",
|
|
||||||
"gpt-4-1106-preview",
|
|
||||||
"gpt-4-32k",
|
|
||||||
].map((model) => {
|
|
||||||
return (
|
|
||||||
<option
|
|
||||||
key={model}
|
|
||||||
value={model}
|
|
||||||
selected={settings?.OpenAiModelPref === model}
|
|
||||||
>
|
|
||||||
{model}
|
|
||||||
</option>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</optgroup>
|
|
||||||
{customModels.length > 0 && (
|
|
||||||
<optgroup label="Your fine-tuned models">
|
|
||||||
{customModels.map((model) => {
|
|
||||||
return (
|
|
||||||
<option
|
<option
|
||||||
key={model.id}
|
key={model.id}
|
||||||
value={model.id}
|
value={model.id}
|
||||||
selected={settings?.OpenAiModelPref === model.id}
|
selected={settings?.OpenAiModelPref === model.id}
|
||||||
>
|
>
|
||||||
{model.id}
|
{model.name}
|
||||||
</option>
|
</option>
|
||||||
);
|
))}
|
||||||
})}
|
|
||||||
</optgroup>
|
</optgroup>
|
||||||
)}
|
))}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -99,6 +99,10 @@ export default function ChatHistory({ history = [], workspace, sendCommand }) {
|
|||||||
const isLastBotReply =
|
const isLastBotReply =
|
||||||
index === history.length - 1 && props.role === "assistant";
|
index === history.length - 1 && props.role === "assistant";
|
||||||
|
|
||||||
|
if (props?.type === "statusResponse" && !!props.content) {
|
||||||
|
return <StatusResponse key={props.uuid} props={props} />;
|
||||||
|
}
|
||||||
|
|
||||||
if (isLastBotReply && props.animate) {
|
if (isLastBotReply && props.animate) {
|
||||||
return (
|
return (
|
||||||
<PromptReply
|
<PromptReply
|
||||||
@ -147,6 +151,22 @@ export default function ChatHistory({ history = [], workspace, sendCommand }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function StatusResponse({ props }) {
|
||||||
|
return (
|
||||||
|
<div className="flex justify-center items-end w-full">
|
||||||
|
<div className="py-2 px-4 w-full flex gap-x-5 md:max-w-[800px] flex-col">
|
||||||
|
<div className="flex gap-x-5">
|
||||||
|
<span
|
||||||
|
className={`text-xs inline-block p-2 rounded-lg text-white/60 font-mono whitespace-pre-line`}
|
||||||
|
>
|
||||||
|
{props.content}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function WorkspaceChatSuggestions({ suggestions = [], sendSuggestion }) {
|
function WorkspaceChatSuggestions({ suggestions = [], sendSuggestion }) {
|
||||||
if (suggestions.length === 0) return null;
|
if (suggestions.length === 0) return null;
|
||||||
return (
|
return (
|
||||||
|
@ -0,0 +1,189 @@
|
|||||||
|
import { useEffect, useRef, useState } from "react";
|
||||||
|
import { Tooltip } from "react-tooltip";
|
||||||
|
import { At, Flask, X } from "@phosphor-icons/react";
|
||||||
|
import ModalWrapper from "@/components/ModalWrapper";
|
||||||
|
import { useModal } from "@/hooks/useModal";
|
||||||
|
import { useIsAgentSessionActive } from "@/utils/chat/agent";
|
||||||
|
|
||||||
|
export default function AvailableAgentsButton({ showing, setShowAgents }) {
|
||||||
|
const agentSessionActive = useIsAgentSessionActive();
|
||||||
|
if (agentSessionActive) return null;
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
id="agent-list-btn"
|
||||||
|
data-tooltip-id="tooltip-agent-list-btn"
|
||||||
|
data-tooltip-content="View all available agents you can use for chatting."
|
||||||
|
aria-label="View all available agents you can use for chatting."
|
||||||
|
onClick={() => setShowAgents(!showing)}
|
||||||
|
className={`flex justify-center items-center opacity-60 hover:opacity-100 cursor-pointer ${
|
||||||
|
showing ? "!opacity-100" : ""
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
<At className="w-6 h-6 pointer-events-none text-white" />
|
||||||
|
<Tooltip
|
||||||
|
id="tooltip-agent-list-btn"
|
||||||
|
place="top"
|
||||||
|
delayShow={300}
|
||||||
|
className="tooltip !text-xs z-99"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function AbilityTag({ text }) {
|
||||||
|
return (
|
||||||
|
<div className="px-2 bg-white/20 text-white/60 text-black text-xs w-fit rounded-sm">
|
||||||
|
<p>{text}</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function AvailableAgents({
|
||||||
|
showing,
|
||||||
|
setShowing,
|
||||||
|
sendCommand,
|
||||||
|
promptRef,
|
||||||
|
}) {
|
||||||
|
const formRef = useRef(null);
|
||||||
|
const agentSessionActive = useIsAgentSessionActive();
|
||||||
|
useEffect(() => {
|
||||||
|
function listenForOutsideClick() {
|
||||||
|
if (!showing || !formRef.current) return false;
|
||||||
|
document.addEventListener("click", closeIfOutside);
|
||||||
|
}
|
||||||
|
listenForOutsideClick();
|
||||||
|
}, [showing, formRef.current]);
|
||||||
|
|
||||||
|
const closeIfOutside = ({ target }) => {
|
||||||
|
if (target.id === "agent-list-btn") return;
|
||||||
|
const isOutside = !formRef?.current?.contains(target);
|
||||||
|
if (!isOutside) return;
|
||||||
|
setShowing(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (agentSessionActive) return null;
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div hidden={!showing}>
|
||||||
|
<div className="w-full flex justify-center absolute bottom-[130px] md:bottom-[150px] left-0 z-10 px-4">
|
||||||
|
<div
|
||||||
|
ref={formRef}
|
||||||
|
className="w-[600px] p-2 bg-zinc-800 rounded-2xl shadow flex-col justify-center items-start gap-2.5 inline-flex"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
onClick={() => {
|
||||||
|
setShowing(false);
|
||||||
|
sendCommand("@agent ", false);
|
||||||
|
promptRef?.current?.focus();
|
||||||
|
}}
|
||||||
|
className="w-full hover:cursor-pointer hover:bg-zinc-700 px-2 py-2 rounded-xl flex flex-col justify-start group"
|
||||||
|
>
|
||||||
|
<div className="w-full flex-col text-left flex pointer-events-none">
|
||||||
|
<div className="text-white text-sm">
|
||||||
|
<b>@agent</b> - the default agent for this workspace.
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-wrap gap-2 mt-2">
|
||||||
|
<AbilityTag text="rag-search" />
|
||||||
|
<AbilityTag text="web-scraping" />
|
||||||
|
<AbilityTag text="web-browsing" />
|
||||||
|
<AbilityTag text="save-file-to-browser" />
|
||||||
|
<AbilityTag text="list-documents" />
|
||||||
|
<AbilityTag text="summarize-document" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
disabled={true}
|
||||||
|
className="w-full rounded-xl flex flex-col justify-start group"
|
||||||
|
>
|
||||||
|
<div className="w-full flex-col text-center flex pointer-events-none">
|
||||||
|
<div className="text-white text-xs text-white/50 italic">
|
||||||
|
custom agents are coming soon!
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{showing && <FirstTimeAgentUser />}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useAvailableAgents() {
|
||||||
|
const [showAgents, setShowAgents] = useState(false);
|
||||||
|
return { showAgents, setShowAgents };
|
||||||
|
}
|
||||||
|
|
||||||
|
const SEEN_FT_AGENT_MODAL = "anythingllm_seen_first_time_agent_modal";
|
||||||
|
function FirstTimeAgentUser() {
|
||||||
|
const { isOpen, openModal, closeModal } = useModal();
|
||||||
|
useEffect(() => {
|
||||||
|
function firstTimeShow() {
|
||||||
|
if (!window) return;
|
||||||
|
if (!window.localStorage.getItem(SEEN_FT_AGENT_MODAL)) openModal();
|
||||||
|
}
|
||||||
|
firstTimeShow();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const dismiss = () => {
|
||||||
|
closeModal();
|
||||||
|
window.localStorage.setItem(SEEN_FT_AGENT_MODAL, 1);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ModalWrapper isOpen={isOpen}>
|
||||||
|
<div className="relative w-[500px] max-w-2xl max-h-full">
|
||||||
|
<div className="relative bg-main-gradient rounded-lg shadow">
|
||||||
|
<div className="flex items-center gap-x-1 justify-between p-4 border-b rounded-t border-gray-600">
|
||||||
|
<Flask className="text-green-400" size={24} weight="fill" />
|
||||||
|
<h3 className="text-xl font-semibold text-white">
|
||||||
|
You just discovered Agents!
|
||||||
|
</h3>
|
||||||
|
<button
|
||||||
|
onClick={dismiss}
|
||||||
|
type="button"
|
||||||
|
className="transition-all duration-300 text-gray-400 bg-transparent hover:border-white/60 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center bg-sidebar-button hover:bg-menu-item-selected-gradient hover:border-slate-100 hover:border-opacity-50 border-transparent border"
|
||||||
|
data-modal-hide="staticModal"
|
||||||
|
>
|
||||||
|
<X className="text-gray-300 text-lg" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div className="p-6 space-y-6 flex h-full w-full">
|
||||||
|
<div className="w-full flex flex-col gap-y-4">
|
||||||
|
<p className="text-white/80 text-xs md:text-sm">
|
||||||
|
Agents are your LLM, but with special abilities that{" "}
|
||||||
|
<u>do something beyond chatting with your documents</u>.
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
Now you can use agents for real-time web search and scraping,
|
||||||
|
saving documents to your browser, summarizing documents, and
|
||||||
|
more.
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
Currently, agents only work with OpenAI as your agent LLM. All
|
||||||
|
LLM providers will be supported in the future.
|
||||||
|
</p>
|
||||||
|
<p className="text-green-300/60 text-xs md:text-sm">
|
||||||
|
This feature is currently early access and fully custom agents
|
||||||
|
with custom integrations & code execution will be in a future
|
||||||
|
update.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="flex w-full justify-between items-center p-6 space-x-2 border-t rounded-b border-gray-600">
|
||||||
|
<div />
|
||||||
|
<button
|
||||||
|
onClick={dismiss}
|
||||||
|
type="button"
|
||||||
|
className="px-4 py-2 rounded-lg text-white hover:bg-stone-900 transition-all duration-300"
|
||||||
|
>
|
||||||
|
Continue
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ModalWrapper>
|
||||||
|
);
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
import { useIsAgentSessionActive } from "@/utils/chat/agent";
|
||||||
|
|
||||||
|
export default function EndAgentSession({ setShowing, sendCommand }) {
|
||||||
|
const isActiveAgentSession = useIsAgentSessionActive();
|
||||||
|
if (!isActiveAgentSession) return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
onClick={() => {
|
||||||
|
setShowing(false);
|
||||||
|
sendCommand("/exit", true);
|
||||||
|
}}
|
||||||
|
className="w-full hover:cursor-pointer hover:bg-zinc-700 px-2 py-2 rounded-xl flex flex-col justify-start"
|
||||||
|
>
|
||||||
|
<div className="w-full flex-col text-left flex pointer-events-none">
|
||||||
|
<div className="text-white text-sm font-bold">/exit</div>
|
||||||
|
<div className="text-white text-opacity-60 text-sm">
|
||||||
|
Halt the current agent session.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
}
|
@ -1,6 +1,8 @@
|
|||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
import SlashCommandIcon from "./icons/slash-commands-icon.svg";
|
import SlashCommandIcon from "./icons/slash-commands-icon.svg";
|
||||||
import { Tooltip } from "react-tooltip";
|
import { Tooltip } from "react-tooltip";
|
||||||
|
import ResetCommand from "./reset";
|
||||||
|
import EndAgentSession from "./endAgentSession";
|
||||||
|
|
||||||
export default function SlashCommandsButton({ showing, setShowSlashCommand }) {
|
export default function SlashCommandsButton({ showing, setShowSlashCommand }) {
|
||||||
return (
|
return (
|
||||||
@ -38,7 +40,6 @@ export function SlashCommands({ showing, setShowing, sendCommand }) {
|
|||||||
listenForOutsideClick();
|
listenForOutsideClick();
|
||||||
}, [showing, cmdRef.current]);
|
}, [showing, cmdRef.current]);
|
||||||
|
|
||||||
if (!showing) return null;
|
|
||||||
const closeIfOutside = ({ target }) => {
|
const closeIfOutside = ({ target }) => {
|
||||||
if (target.id === "slash-cmd-btn") return;
|
if (target.id === "slash-cmd-btn") return;
|
||||||
const isOutside = !cmdRef?.current?.contains(target);
|
const isOutside = !cmdRef?.current?.contains(target);
|
||||||
@ -47,26 +48,16 @@ export function SlashCommands({ showing, setShowing, sendCommand }) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<div hidden={!showing}>
|
||||||
<div className="w-full flex justify-center absolute bottom-[130px] md:bottom-[150px] left-0 z-10 px-4">
|
<div className="w-full flex justify-center absolute bottom-[130px] md:bottom-[150px] left-0 z-10 px-4">
|
||||||
<div
|
<div
|
||||||
ref={cmdRef}
|
ref={cmdRef}
|
||||||
className="w-[600px] p-2 bg-zinc-800 rounded-2xl shadow flex-col justify-center items-start gap-2.5 inline-flex"
|
className="w-[600px] p-2 bg-zinc-800 rounded-2xl shadow flex-col justify-center items-start gap-2.5 inline-flex"
|
||||||
>
|
>
|
||||||
<button
|
<ResetCommand sendCommand={sendCommand} setShowing={setShowing} />
|
||||||
onClick={() => {
|
<EndAgentSession sendCommand={sendCommand} setShowing={setShowing} />
|
||||||
setShowing(false);
|
|
||||||
sendCommand("/reset", true);
|
|
||||||
}}
|
|
||||||
className="w-full hover:cursor-pointer hover:bg-zinc-700 px-2 py-2 rounded-xl flex flex-col justify-start"
|
|
||||||
>
|
|
||||||
<div className="w-full flex-col text-left flex pointer-events-none">
|
|
||||||
<div className="text-white text-sm font-bold">/reset</div>
|
|
||||||
<div className="text-white text-opacity-60 text-sm">
|
|
||||||
Clear your chat history and begin a new chat
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
import { useIsAgentSessionActive } from "@/utils/chat/agent";
|
||||||
|
|
||||||
|
export default function ResetCommand({ setShowing, sendCommand }) {
|
||||||
|
const isActiveAgentSession = useIsAgentSessionActive();
|
||||||
|
if (isActiveAgentSession) return null; // cannot reset during active agent chat
|
||||||
|
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
onClick={() => {
|
||||||
|
setShowing(false);
|
||||||
|
sendCommand("/reset", true);
|
||||||
|
}}
|
||||||
|
className="w-full hover:cursor-pointer hover:bg-zinc-700 px-2 py-2 rounded-xl flex flex-col justify-start"
|
||||||
|
>
|
||||||
|
<div className="w-full flex-col text-left flex pointer-events-none">
|
||||||
|
<div className="text-white text-sm font-bold">/reset</div>
|
||||||
|
<div className="text-white text-opacity-60 text-sm">
|
||||||
|
Clear your chat history and begin a new chat
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
}
|
@ -28,7 +28,7 @@ export default function StopGenerationButton() {
|
|||||||
cx="10"
|
cx="10"
|
||||||
cy="10.562"
|
cy="10.562"
|
||||||
r="9"
|
r="9"
|
||||||
stroke-width="2"
|
strokeWidth="2"
|
||||||
/>
|
/>
|
||||||
<rect
|
<rect
|
||||||
className="group-hover:fill-[#46C8FF] fill-white"
|
className="group-hover:fill-[#46C8FF] fill-white"
|
||||||
|
@ -7,6 +7,10 @@ import { isMobile } from "react-device-detect";
|
|||||||
import debounce from "lodash.debounce";
|
import debounce from "lodash.debounce";
|
||||||
import { PaperPlaneRight } from "@phosphor-icons/react";
|
import { PaperPlaneRight } from "@phosphor-icons/react";
|
||||||
import StopGenerationButton from "./StopGenerationButton";
|
import StopGenerationButton from "./StopGenerationButton";
|
||||||
|
import AvailableAgentsButton, {
|
||||||
|
AvailableAgents,
|
||||||
|
useAvailableAgents,
|
||||||
|
} from "./AgentMenu";
|
||||||
export default function PromptInput({
|
export default function PromptInput({
|
||||||
message,
|
message,
|
||||||
submit,
|
submit,
|
||||||
@ -15,6 +19,7 @@ export default function PromptInput({
|
|||||||
buttonDisabled,
|
buttonDisabled,
|
||||||
sendCommand,
|
sendCommand,
|
||||||
}) {
|
}) {
|
||||||
|
const { showAgents, setShowAgents } = useAvailableAgents();
|
||||||
const { showSlashCommand, setShowSlashCommand } = useSlashCommands();
|
const { showSlashCommand, setShowSlashCommand } = useSlashCommands();
|
||||||
const formRef = useRef(null);
|
const formRef = useRef(null);
|
||||||
const textareaRef = useRef(null);
|
const textareaRef = useRef(null);
|
||||||
@ -45,6 +50,12 @@ export default function PromptInput({
|
|||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const checkForAt = (e) => {
|
||||||
|
const input = e.target.value;
|
||||||
|
if (input === "@") return setShowAgents(true);
|
||||||
|
if (showAgents) return setShowAgents(false);
|
||||||
|
};
|
||||||
|
|
||||||
const captureEnter = (event) => {
|
const captureEnter = (event) => {
|
||||||
if (event.keyCode == 13) {
|
if (event.keyCode == 13) {
|
||||||
if (!event.shiftKey) {
|
if (!event.shiftKey) {
|
||||||
@ -61,6 +72,7 @@ export default function PromptInput({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const watchForSlash = debounce(checkForSlash, 300);
|
const watchForSlash = debounce(checkForSlash, 300);
|
||||||
|
const watchForAt = debounce(checkForAt, 300);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full fixed md:absolute bottom-0 left-0 z-10 md:z-0 flex justify-center items-center">
|
<div className="w-full fixed md:absolute bottom-0 left-0 z-10 md:z-0 flex justify-center items-center">
|
||||||
@ -69,6 +81,12 @@ export default function PromptInput({
|
|||||||
setShowing={setShowSlashCommand}
|
setShowing={setShowSlashCommand}
|
||||||
sendCommand={sendCommand}
|
sendCommand={sendCommand}
|
||||||
/>
|
/>
|
||||||
|
<AvailableAgents
|
||||||
|
showing={showAgents}
|
||||||
|
setShowing={setShowAgents}
|
||||||
|
sendCommand={sendCommand}
|
||||||
|
promptRef={textareaRef}
|
||||||
|
/>
|
||||||
<form
|
<form
|
||||||
onSubmit={handleSubmit}
|
onSubmit={handleSubmit}
|
||||||
className="flex flex-col gap-y-1 rounded-t-lg md:w-3/4 w-full mx-auto max-w-xl"
|
className="flex flex-col gap-y-1 rounded-t-lg md:w-3/4 w-full mx-auto max-w-xl"
|
||||||
@ -81,6 +99,7 @@ export default function PromptInput({
|
|||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
onChange(e);
|
onChange(e);
|
||||||
watchForSlash(e);
|
watchForSlash(e);
|
||||||
|
watchForAt(e);
|
||||||
adjustTextArea(e);
|
adjustTextArea(e);
|
||||||
}}
|
}}
|
||||||
onKeyDown={captureEnter}
|
onKeyDown={captureEnter}
|
||||||
@ -114,6 +133,10 @@ export default function PromptInput({
|
|||||||
showing={showSlashCommand}
|
showing={showSlashCommand}
|
||||||
setShowSlashCommand={setShowSlashCommand}
|
setShowSlashCommand={setShowSlashCommand}
|
||||||
/>
|
/>
|
||||||
|
<AvailableAgentsButton
|
||||||
|
showing={showAgents}
|
||||||
|
setShowAgents={setShowAgents}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -2,16 +2,24 @@ import { useState, useEffect } from "react";
|
|||||||
import ChatHistory from "./ChatHistory";
|
import ChatHistory from "./ChatHistory";
|
||||||
import PromptInput from "./PromptInput";
|
import PromptInput from "./PromptInput";
|
||||||
import Workspace from "@/models/workspace";
|
import Workspace from "@/models/workspace";
|
||||||
import handleChat from "@/utils/chat";
|
import handleChat, { ABORT_STREAM_EVENT } from "@/utils/chat";
|
||||||
import { isMobile } from "react-device-detect";
|
import { isMobile } from "react-device-detect";
|
||||||
import { SidebarMobileHeader } from "../../Sidebar";
|
import { SidebarMobileHeader } from "../../Sidebar";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
|
import { v4 } from "uuid";
|
||||||
|
import handleSocketResponse, {
|
||||||
|
websocketURI,
|
||||||
|
AGENT_SESSION_END,
|
||||||
|
AGENT_SESSION_START,
|
||||||
|
} from "@/utils/chat/agent";
|
||||||
|
|
||||||
export default function ChatContainer({ workspace, knownHistory = [] }) {
|
export default function ChatContainer({ workspace, knownHistory = [] }) {
|
||||||
const { threadSlug = null } = useParams();
|
const { threadSlug = null } = useParams();
|
||||||
const [message, setMessage] = useState("");
|
const [message, setMessage] = useState("");
|
||||||
const [loadingResponse, setLoadingResponse] = useState(false);
|
const [loadingResponse, setLoadingResponse] = useState(false);
|
||||||
const [chatHistory, setChatHistory] = useState(knownHistory);
|
const [chatHistory, setChatHistory] = useState(knownHistory);
|
||||||
|
const [socketId, setSocketId] = useState(null);
|
||||||
|
const [websocket, setWebsocket] = useState(null);
|
||||||
const handleMessageChange = (event) => {
|
const handleMessageChange = (event) => {
|
||||||
setMessage(event.target.value);
|
setMessage(event.target.value);
|
||||||
};
|
};
|
||||||
@ -68,6 +76,19 @@ export default function ChatContainer({ workspace, knownHistory = [] }) {
|
|||||||
const remHistory = chatHistory.length > 0 ? chatHistory.slice(0, -1) : [];
|
const remHistory = chatHistory.length > 0 ? chatHistory.slice(0, -1) : [];
|
||||||
var _chatHistory = [...remHistory];
|
var _chatHistory = [...remHistory];
|
||||||
|
|
||||||
|
// Override hook for new messages to now go to agents until the connection closes
|
||||||
|
if (!!websocket) {
|
||||||
|
if (!promptMessage || !promptMessage?.userMessage) return false;
|
||||||
|
websocket.send(
|
||||||
|
JSON.stringify({
|
||||||
|
type: "awaitingFeedback",
|
||||||
|
feedback: promptMessage?.userMessage,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Simplify this
|
||||||
if (!promptMessage || !promptMessage?.userMessage) return false;
|
if (!promptMessage || !promptMessage?.userMessage) return false;
|
||||||
if (!!threadSlug) {
|
if (!!threadSlug) {
|
||||||
await Workspace.threads.streamChat(
|
await Workspace.threads.streamChat(
|
||||||
@ -79,7 +100,8 @@ export default function ChatContainer({ workspace, knownHistory = [] }) {
|
|||||||
setLoadingResponse,
|
setLoadingResponse,
|
||||||
setChatHistory,
|
setChatHistory,
|
||||||
remHistory,
|
remHistory,
|
||||||
_chatHistory
|
_chatHistory,
|
||||||
|
setSocketId
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -92,7 +114,8 @@ export default function ChatContainer({ workspace, knownHistory = [] }) {
|
|||||||
setLoadingResponse,
|
setLoadingResponse,
|
||||||
setChatHistory,
|
setChatHistory,
|
||||||
remHistory,
|
remHistory,
|
||||||
_chatHistory
|
_chatHistory,
|
||||||
|
setSocketId
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -101,6 +124,77 @@ export default function ChatContainer({ workspace, knownHistory = [] }) {
|
|||||||
loadingResponse === true && fetchReply();
|
loadingResponse === true && fetchReply();
|
||||||
}, [loadingResponse, chatHistory, workspace]);
|
}, [loadingResponse, chatHistory, workspace]);
|
||||||
|
|
||||||
|
// TODO: Simplify this WSS stuff
|
||||||
|
useEffect(() => {
|
||||||
|
function handleWSS() {
|
||||||
|
try {
|
||||||
|
if (!socketId || !!websocket) return;
|
||||||
|
const socket = new WebSocket(
|
||||||
|
`${websocketURI()}/api/agent-invocation/${socketId}`
|
||||||
|
);
|
||||||
|
|
||||||
|
window.addEventListener(ABORT_STREAM_EVENT, () => {
|
||||||
|
window.dispatchEvent(new CustomEvent(AGENT_SESSION_END));
|
||||||
|
websocket.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.addEventListener("message", (event) => {
|
||||||
|
setLoadingResponse(true);
|
||||||
|
try {
|
||||||
|
handleSocketResponse(event, setChatHistory);
|
||||||
|
} catch (e) {
|
||||||
|
console.error("Failed to parse data");
|
||||||
|
window.dispatchEvent(new CustomEvent(AGENT_SESSION_END));
|
||||||
|
socket.close();
|
||||||
|
}
|
||||||
|
setLoadingResponse(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.addEventListener("close", (_event) => {
|
||||||
|
window.dispatchEvent(new CustomEvent(AGENT_SESSION_END));
|
||||||
|
setChatHistory((prev) => [
|
||||||
|
...prev.filter((msg) => !!msg.content),
|
||||||
|
{
|
||||||
|
uuid: v4(),
|
||||||
|
type: "statusResponse",
|
||||||
|
content: "Agent session complete.",
|
||||||
|
role: "assistant",
|
||||||
|
sources: [],
|
||||||
|
closed: true,
|
||||||
|
error: null,
|
||||||
|
animate: false,
|
||||||
|
pending: false,
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
setLoadingResponse(false);
|
||||||
|
setWebsocket(null);
|
||||||
|
setSocketId(null);
|
||||||
|
});
|
||||||
|
setWebsocket(socket);
|
||||||
|
window.dispatchEvent(new CustomEvent(AGENT_SESSION_START));
|
||||||
|
} catch (e) {
|
||||||
|
setChatHistory((prev) => [
|
||||||
|
...prev.filter((msg) => !!msg.content),
|
||||||
|
{
|
||||||
|
uuid: v4(),
|
||||||
|
type: "abort",
|
||||||
|
content: e.message,
|
||||||
|
role: "assistant",
|
||||||
|
sources: [],
|
||||||
|
closed: true,
|
||||||
|
error: e.message,
|
||||||
|
animate: false,
|
||||||
|
pending: false,
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
setLoadingResponse(false);
|
||||||
|
setWebsocket(null);
|
||||||
|
setSocketId(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
handleWSS();
|
||||||
|
}, [socketId]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
style={{ height: isMobile ? "100%" : "calc(100% - 32px)" }}
|
style={{ height: isMobile ? "100%" : "calc(100% - 32px)" }}
|
||||||
|
@ -4,14 +4,7 @@ import { useEffect, useState } from "react";
|
|||||||
// Providers which cannot use this feature for workspace<>model selection
|
// Providers which cannot use this feature for workspace<>model selection
|
||||||
export const DISABLED_PROVIDERS = ["azure", "lmstudio", "native"];
|
export const DISABLED_PROVIDERS = ["azure", "lmstudio", "native"];
|
||||||
const PROVIDER_DEFAULT_MODELS = {
|
const PROVIDER_DEFAULT_MODELS = {
|
||||||
openai: [
|
openai: [],
|
||||||
"gpt-3.5-turbo",
|
|
||||||
"gpt-3.5-turbo-1106",
|
|
||||||
"gpt-4",
|
|
||||||
"gpt-4-turbo-preview",
|
|
||||||
"gpt-4-1106-preview",
|
|
||||||
"gpt-4-32k",
|
|
||||||
],
|
|
||||||
gemini: ["gemini-pro"],
|
gemini: ["gemini-pro"],
|
||||||
anthropic: [
|
anthropic: [
|
||||||
"claude-instant-1.2",
|
"claude-instant-1.2",
|
||||||
@ -41,6 +34,7 @@ function groupModels(models) {
|
|||||||
}, {});
|
}, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const groupedProviders = ["togetherai", "openai"];
|
||||||
export default function useGetProviderModels(provider = null) {
|
export default function useGetProviderModels(provider = null) {
|
||||||
const [defaultModels, setDefaultModels] = useState([]);
|
const [defaultModels, setDefaultModels] = useState([]);
|
||||||
const [customModels, setCustomModels] = useState([]);
|
const [customModels, setCustomModels] = useState([]);
|
||||||
@ -50,9 +44,16 @@ export default function useGetProviderModels(provider = null) {
|
|||||||
async function fetchProviderModels() {
|
async function fetchProviderModels() {
|
||||||
if (!provider) return;
|
if (!provider) return;
|
||||||
const { models = [] } = await System.customModels(provider);
|
const { models = [] } = await System.customModels(provider);
|
||||||
if (PROVIDER_DEFAULT_MODELS.hasOwnProperty(provider))
|
if (
|
||||||
|
PROVIDER_DEFAULT_MODELS.hasOwnProperty(provider) &&
|
||||||
|
!groupedProviders.includes(provider)
|
||||||
|
) {
|
||||||
setDefaultModels(PROVIDER_DEFAULT_MODELS[provider]);
|
setDefaultModels(PROVIDER_DEFAULT_MODELS[provider]);
|
||||||
provider === "togetherai"
|
} else {
|
||||||
|
setDefaultModels([]);
|
||||||
|
}
|
||||||
|
|
||||||
|
groupedProviders.includes(provider)
|
||||||
? setCustomModels(groupModels(models))
|
? setCustomModels(groupModels(models))
|
||||||
: setCustomModels(models);
|
: setCustomModels(models);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
@ -553,6 +553,14 @@ dialog::backdrop {
|
|||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.markdown ol li a {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.markdown ol li p a {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
.markdown ul {
|
.markdown ul {
|
||||||
list-style: revert-layer;
|
list-style: revert-layer;
|
||||||
/* color: #cfcfcfcf; */
|
/* color: #cfcfcfcf; */
|
||||||
@ -575,6 +583,10 @@ dialog::backdrop {
|
|||||||
line-height: 1.4rem;
|
line-height: 1.4rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.markdownul li a {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
.markdown ul li > ul {
|
.markdown ul li > ul {
|
||||||
padding-left: 20px;
|
padding-left: 20px;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
@ -585,6 +597,11 @@ dialog::backdrop {
|
|||||||
margin: 0.35rem;
|
margin: 0.35rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.markdown > p > a,
|
||||||
|
.markdown p a {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
.markdown {
|
.markdown {
|
||||||
text-wrap: wrap;
|
text-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,151 @@
|
|||||||
|
// This component differs from the main LLMItem in that it shows if a provider is
|
||||||
|
// "ready for use" and if not - will then highjack the click handler to show a modal
|
||||||
|
// of the provider options that must be saved to continue.
|
||||||
|
import { createPortal } from "react-dom";
|
||||||
|
import ModalWrapper from "@/components/ModalWrapper";
|
||||||
|
import { useModal } from "@/hooks/useModal";
|
||||||
|
import { X } from "@phosphor-icons/react";
|
||||||
|
import System from "@/models/system";
|
||||||
|
import showToast from "@/utils/toast";
|
||||||
|
|
||||||
|
export default function WorkspaceLLM({
|
||||||
|
llm,
|
||||||
|
availableLLMs,
|
||||||
|
settings,
|
||||||
|
checked,
|
||||||
|
onClick,
|
||||||
|
}) {
|
||||||
|
const { isOpen, openModal, closeModal } = useModal();
|
||||||
|
const { name, value, logo, description } = llm;
|
||||||
|
|
||||||
|
function handleProviderSelection() {
|
||||||
|
// Determine if provider needs additional setup because its minimum required keys are
|
||||||
|
// not yet set in settings.
|
||||||
|
const requiresAdditionalSetup = (llm.requiredConfig || []).some(
|
||||||
|
(key) => !settings[key]
|
||||||
|
);
|
||||||
|
if (requiresAdditionalSetup) {
|
||||||
|
openModal();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
onClick(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div
|
||||||
|
onClick={handleProviderSelection}
|
||||||
|
className={`w-full p-2 rounded-md hover:cursor-pointer hover:bg-white/10 ${
|
||||||
|
checked ? "bg-white/10" : ""
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
value={value}
|
||||||
|
className="peer hidden"
|
||||||
|
checked={checked}
|
||||||
|
readOnly={true}
|
||||||
|
formNoValidate={true}
|
||||||
|
/>
|
||||||
|
<div className="flex gap-x-4 items-center">
|
||||||
|
<img
|
||||||
|
src={logo}
|
||||||
|
alt={`${name} logo`}
|
||||||
|
className="w-10 h-10 rounded-md"
|
||||||
|
/>
|
||||||
|
<div className="flex flex-col">
|
||||||
|
<div className="text-sm font-semibold text-white">{name}</div>
|
||||||
|
<div className="mt-1 text-xs text-[#D2D5DB]">{description}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<SetupProvider
|
||||||
|
availableLLMs={availableLLMs}
|
||||||
|
isOpen={isOpen}
|
||||||
|
provider={value}
|
||||||
|
closeModal={closeModal}
|
||||||
|
postSubmit={onClick}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function SetupProvider({
|
||||||
|
availableLLMs,
|
||||||
|
isOpen,
|
||||||
|
provider,
|
||||||
|
closeModal,
|
||||||
|
postSubmit,
|
||||||
|
}) {
|
||||||
|
if (!isOpen) return null;
|
||||||
|
const LLMOption = availableLLMs.find((llm) => llm.value === provider);
|
||||||
|
if (!LLMOption) return null;
|
||||||
|
|
||||||
|
async function handleUpdate(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
const data = {};
|
||||||
|
const form = new FormData(e.target);
|
||||||
|
for (var [key, value] of form.entries()) data[key] = value;
|
||||||
|
const { error } = await System.updateSystem(data);
|
||||||
|
if (error) {
|
||||||
|
showToast(`Failed to save ${LLMOption.name} settings: ${error}`, "error");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
closeModal();
|
||||||
|
postSubmit();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cannot do nested forms, it will cause all sorts of issues, so we portal this out
|
||||||
|
// to the parent container form so we don't have nested forms.
|
||||||
|
return createPortal(
|
||||||
|
<ModalWrapper isOpen={isOpen}>
|
||||||
|
<div className="relative w-fit max-w-1/2 max-h-full">
|
||||||
|
<div className="relative bg-main-gradient rounded-xl shadow-[0_4px_14px_rgba(0,0,0,0.25)]">
|
||||||
|
<div className="flex items-start justify-between p-4 border-b rounded-t border-gray-500/50">
|
||||||
|
<h3 className="text-xl font-semibold text-white">
|
||||||
|
Setup {LLMOption.name}
|
||||||
|
</h3>
|
||||||
|
<button
|
||||||
|
onClick={closeModal}
|
||||||
|
type="button"
|
||||||
|
className="border-none transition-all duration-300 text-gray-400 bg-transparent hover:border-white/60 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center bg-sidebar-button hover:bg-menu-item-selected-gradient hover:border-slate-100 hover:border-opacity-50 border-transparent border"
|
||||||
|
data-modal-hide="staticModal"
|
||||||
|
>
|
||||||
|
<X className="text-gray-300 text-lg" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form id="provider-form" onSubmit={handleUpdate}>
|
||||||
|
<div className="py-[17px] px-[20px] flex flex-col gap-y-6">
|
||||||
|
<p className="text-sm text-white">
|
||||||
|
To use {LLMOption.name} as this workspace's LLM you need to set
|
||||||
|
it up first.
|
||||||
|
</p>
|
||||||
|
<div>{LLMOption.options({ credentialsOnly: true })}</div>
|
||||||
|
</div>
|
||||||
|
<div className="flex w-full justify-between items-center p-3 space-x-2 border-t rounded-b border-gray-500/50">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={closeModal}
|
||||||
|
className="border-none text-xs px-2 py-1 font-semibold rounded-lg bg-white hover:bg-transparent border-2 border-transparent hover:border-white hover:text-white h-[32px] w-fit -mr-8 whitespace-nowrap shadow-[0_4px_14px_rgba(0,0,0,0.25)]"
|
||||||
|
>
|
||||||
|
Cancel
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
form="provider-form"
|
||||||
|
className="border-none text-xs px-2 py-1 font-semibold rounded-lg bg-[#46C8FF] hover:bg-[#2C2F36] border-2 border-transparent hover:border-[#46C8FF] hover:text-white h-[32px] w-fit -mr-8 whitespace-nowrap shadow-[0_4px_14px_rgba(0,0,0,0.25)]"
|
||||||
|
>
|
||||||
|
Save {LLMOption.name} settings
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ModalWrapper>,
|
||||||
|
document.getElementById("workspace-agent-settings-container")
|
||||||
|
);
|
||||||
|
}
|
@ -0,0 +1,163 @@
|
|||||||
|
import React, { useEffect, useRef, useState } from "react";
|
||||||
|
import AnythingLLMIcon from "@/media/logo/anything-llm-icon.png";
|
||||||
|
import AgentLLMItem from "./AgentLLMItem";
|
||||||
|
import { AVAILABLE_LLM_PROVIDERS } from "@/pages/GeneralSettings/LLMPreference";
|
||||||
|
import { CaretUpDown, MagnifyingGlass, X } from "@phosphor-icons/react";
|
||||||
|
import AgentModelSelection from "../AgentModelSelection";
|
||||||
|
|
||||||
|
const ENABLED_PROVIDERS = ["openai", "anthropic"];
|
||||||
|
|
||||||
|
const LLM_DEFAULT = {
|
||||||
|
name: "Please make a selection",
|
||||||
|
value: "none",
|
||||||
|
logo: AnythingLLMIcon,
|
||||||
|
options: () => <React.Fragment />,
|
||||||
|
description: "Agents will not work until a valid selection is made.",
|
||||||
|
requiredConfig: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
const LLMS = [
|
||||||
|
LLM_DEFAULT,
|
||||||
|
...AVAILABLE_LLM_PROVIDERS.filter((llm) =>
|
||||||
|
ENABLED_PROVIDERS.includes(llm.value)
|
||||||
|
),
|
||||||
|
];
|
||||||
|
|
||||||
|
export default function AgentLLMSelection({
|
||||||
|
settings,
|
||||||
|
workspace,
|
||||||
|
setHasChanges,
|
||||||
|
}) {
|
||||||
|
const [filteredLLMs, setFilteredLLMs] = useState([]);
|
||||||
|
const [selectedLLM, setSelectedLLM] = useState(
|
||||||
|
workspace?.agentProvider ?? "none"
|
||||||
|
);
|
||||||
|
const [searchQuery, setSearchQuery] = useState("");
|
||||||
|
const [searchMenuOpen, setSearchMenuOpen] = useState(false);
|
||||||
|
const searchInputRef = useRef(null);
|
||||||
|
|
||||||
|
function updateLLMChoice(selection) {
|
||||||
|
setSearchQuery("");
|
||||||
|
setSelectedLLM(selection);
|
||||||
|
setSearchMenuOpen(false);
|
||||||
|
setHasChanges(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleXButton() {
|
||||||
|
if (searchQuery.length > 0) {
|
||||||
|
setSearchQuery("");
|
||||||
|
if (searchInputRef.current) searchInputRef.current.value = "";
|
||||||
|
} else {
|
||||||
|
setSearchMenuOpen(!searchMenuOpen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const filtered = LLMS.filter((llm) =>
|
||||||
|
llm.name.toLowerCase().includes(searchQuery.toLowerCase())
|
||||||
|
);
|
||||||
|
setFilteredLLMs(filtered);
|
||||||
|
}, [searchQuery, selectedLLM]);
|
||||||
|
|
||||||
|
const selectedLLMObject = LLMS.find((llm) => llm.value === selectedLLM);
|
||||||
|
return (
|
||||||
|
<div className="border-b border-white/40 pb-8">
|
||||||
|
<div className="flex flex-col">
|
||||||
|
<label htmlFor="name" className="block input-label">
|
||||||
|
Workspace Agent LLM Provider
|
||||||
|
</label>
|
||||||
|
<p className="text-white text-opacity-60 text-xs font-medium py-1.5">
|
||||||
|
The specific LLM provider & model that will be used for this
|
||||||
|
workspace's @agent agent.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="relative">
|
||||||
|
<input type="hidden" name="agentProvider" value={selectedLLM} />
|
||||||
|
{searchMenuOpen && (
|
||||||
|
<div
|
||||||
|
className="fixed top-0 left-0 w-full h-full bg-black bg-opacity-70 backdrop-blur-sm z-10"
|
||||||
|
onClick={() => setSearchMenuOpen(false)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{searchMenuOpen ? (
|
||||||
|
<div className="absolute top-0 left-0 w-full max-w-[640px] max-h-[310px] overflow-auto white-scrollbar min-h-[64px] bg-[#18181B] rounded-lg flex flex-col justify-between cursor-pointer border-2 border-[#46C8FF] z-20">
|
||||||
|
<div className="w-full flex flex-col gap-y-1">
|
||||||
|
<div className="flex items-center sticky top-0 border-b border-[#9CA3AF] mx-4 bg-[#18181B]">
|
||||||
|
<MagnifyingGlass
|
||||||
|
size={20}
|
||||||
|
weight="bold"
|
||||||
|
className="absolute left-4 z-30 text-white -ml-4 my-2"
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
name="llm-search"
|
||||||
|
autoComplete="off"
|
||||||
|
placeholder="Search available LLM providers"
|
||||||
|
className="border-none -ml-4 my-2 bg-transparent z-20 pl-12 h-[38px] w-full px-4 py-1 text-sm outline-none focus:border-white text-white placeholder:text-white placeholder:font-medium"
|
||||||
|
onChange={(e) => setSearchQuery(e.target.value)}
|
||||||
|
ref={searchInputRef}
|
||||||
|
onKeyDown={(e) => {
|
||||||
|
if (e.key === "Enter") e.preventDefault();
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<X
|
||||||
|
size={20}
|
||||||
|
weight="bold"
|
||||||
|
className="cursor-pointer text-white hover:text-[#9CA3AF]"
|
||||||
|
onClick={handleXButton}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="flex-1 pl-4 pr-2 flex flex-col gap-y-1 overflow-y-auto white-scrollbar pb-4">
|
||||||
|
{filteredLLMs.map((llm) => {
|
||||||
|
return (
|
||||||
|
<AgentLLMItem
|
||||||
|
llm={llm}
|
||||||
|
key={llm.name}
|
||||||
|
availableLLMs={LLMS}
|
||||||
|
settings={settings}
|
||||||
|
checked={selectedLLM === llm.value}
|
||||||
|
onClick={() => updateLLMChoice(llm.value)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<button
|
||||||
|
className="w-full max-w-[640px] h-[64px] bg-[#18181B] rounded-lg flex items-center p-[14px] justify-between cursor-pointer border-2 border-transparent hover:border-[#46C8FF] transition-all duration-300"
|
||||||
|
type="button"
|
||||||
|
onClick={() => setSearchMenuOpen(true)}
|
||||||
|
>
|
||||||
|
<div className="flex gap-x-4 items-center">
|
||||||
|
<img
|
||||||
|
src={selectedLLMObject.logo}
|
||||||
|
alt={`${selectedLLMObject.name} logo`}
|
||||||
|
className="w-10 h-10 rounded-md"
|
||||||
|
/>
|
||||||
|
<div className="flex flex-col text-left">
|
||||||
|
<div className="text-sm font-semibold text-white">
|
||||||
|
{selectedLLMObject.name}
|
||||||
|
</div>
|
||||||
|
<div className="mt-1 text-xs text-[#D2D5DB]">
|
||||||
|
{selectedLLMObject.description}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<CaretUpDown size={24} weight="bold" className="text-white" />
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
{selectedLLM !== "none" && (
|
||||||
|
<div className="mt-4 flex flex-col gap-y-1">
|
||||||
|
<AgentModelSelection
|
||||||
|
provider={selectedLLM}
|
||||||
|
workspace={workspace}
|
||||||
|
setHasChanges={setHasChanges}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
@ -0,0 +1,112 @@
|
|||||||
|
import useGetProviderModels, {
|
||||||
|
DISABLED_PROVIDERS,
|
||||||
|
} from "@/hooks/useGetProvidersModels";
|
||||||
|
|
||||||
|
export default function AgentModelSelection({
|
||||||
|
provider,
|
||||||
|
workspace,
|
||||||
|
setHasChanges,
|
||||||
|
}) {
|
||||||
|
const { defaultModels, customModels, loading } =
|
||||||
|
useGetProviderModels(provider);
|
||||||
|
if (DISABLED_PROVIDERS.includes(provider)) return null;
|
||||||
|
|
||||||
|
if (loading) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div className="flex flex-col">
|
||||||
|
<label htmlFor="name" className="block input-label">
|
||||||
|
Workspace Agent Chat model
|
||||||
|
</label>
|
||||||
|
<p className="text-white text-opacity-60 text-xs font-medium py-1.5">
|
||||||
|
The specific chat model that will be used for this workspace's
|
||||||
|
@agent agent.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<select
|
||||||
|
name="agentModel"
|
||||||
|
required={true}
|
||||||
|
disabled={true}
|
||||||
|
className="bg-zinc-900 text-white text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5"
|
||||||
|
>
|
||||||
|
<option disabled={true} selected={true}>
|
||||||
|
-- waiting for models --
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div className="flex flex-col">
|
||||||
|
<label htmlFor="name" className="block input-label">
|
||||||
|
Workspace Agent model
|
||||||
|
</label>
|
||||||
|
<p className="text-white text-opacity-60 text-xs font-medium py-1.5">
|
||||||
|
The specific LLM model that will be used for this workspace's @agent
|
||||||
|
agent.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<select
|
||||||
|
name="agentModel"
|
||||||
|
required={true}
|
||||||
|
onChange={() => {
|
||||||
|
setHasChanges(true);
|
||||||
|
}}
|
||||||
|
className="bg-zinc-900 text-white text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5"
|
||||||
|
>
|
||||||
|
{defaultModels.length > 0 && (
|
||||||
|
<optgroup label="General models">
|
||||||
|
{defaultModels.map((model) => {
|
||||||
|
return (
|
||||||
|
<option
|
||||||
|
key={model}
|
||||||
|
value={model}
|
||||||
|
selected={workspace?.agentModel === model}
|
||||||
|
>
|
||||||
|
{model}
|
||||||
|
</option>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</optgroup>
|
||||||
|
)}
|
||||||
|
{Array.isArray(customModels) && customModels.length > 0 && (
|
||||||
|
<optgroup label="Custom models">
|
||||||
|
{customModels.map((model) => {
|
||||||
|
return (
|
||||||
|
<option
|
||||||
|
key={model.id}
|
||||||
|
value={model.id}
|
||||||
|
selected={workspace?.agentModel === model.id}
|
||||||
|
>
|
||||||
|
{model.id}
|
||||||
|
</option>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</optgroup>
|
||||||
|
)}
|
||||||
|
{/* For providers like TogetherAi where we partition model by creator entity. */}
|
||||||
|
{!Array.isArray(customModels) &&
|
||||||
|
Object.keys(customModels).length > 0 && (
|
||||||
|
<>
|
||||||
|
{Object.entries(customModels).map(([organization, models]) => (
|
||||||
|
<optgroup key={organization} label={organization}>
|
||||||
|
{models.map((model) => (
|
||||||
|
<option
|
||||||
|
key={model.id}
|
||||||
|
value={model.id}
|
||||||
|
selected={workspace?.chatModel === model.id}
|
||||||
|
>
|
||||||
|
{model.name}
|
||||||
|
</option>
|
||||||
|
))}
|
||||||
|
</optgroup>
|
||||||
|
))}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
import React from "react";
|
||||||
|
export default function GenericSkill({
|
||||||
|
title,
|
||||||
|
description,
|
||||||
|
skill,
|
||||||
|
toggleSkill,
|
||||||
|
enabled = false,
|
||||||
|
disabled = false,
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<div className="border-b border-white/40 pb-4">
|
||||||
|
<div className="flex flex-col">
|
||||||
|
<div className="flex w-full justify-between items-center">
|
||||||
|
<label htmlFor="name" className="block input-label">
|
||||||
|
{title}
|
||||||
|
</label>
|
||||||
|
<label
|
||||||
|
className={`border-none relative inline-flex items-center mt-2 ${
|
||||||
|
disabled ? "cursor-not-allowed" : "cursor-pointer"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
disabled={disabled}
|
||||||
|
className="peer sr-only"
|
||||||
|
checked={enabled}
|
||||||
|
onClick={() => toggleSkill(skill)}
|
||||||
|
/>
|
||||||
|
<div className="peer-disabled:opacity-50 pointer-events-none peer h-6 w-11 rounded-full bg-stone-400 after:absolute after:left-[2px] after:top-[2px] after:h-5 after:w-5 after:rounded-full after:shadow-xl after:border after:border-gray-600 after:bg-white after:box-shadow-md after:transition-all after:content-[''] peer-checked:bg-lime-300 peer-checked:after:translate-x-full peer-checked:after:border-white peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-800"></div>
|
||||||
|
<span className="ml-3 text-sm font-medium text-gray-900 dark:text-gray-300"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<p className="text-white text-opacity-60 text-xs font-medium py-1.5">
|
||||||
|
{description}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
export default function SearchProviderItem({ provider, checked, onClick }) {
|
||||||
|
const { name, value, logo, description } = provider;
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
onClick={onClick}
|
||||||
|
className={`w-full p-2 rounded-md hover:cursor-pointer hover:bg-white/10 ${
|
||||||
|
checked ? "bg-white/10" : ""
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
value={value}
|
||||||
|
className="peer hidden"
|
||||||
|
checked={checked}
|
||||||
|
readOnly={true}
|
||||||
|
formNoValidate={true}
|
||||||
|
/>
|
||||||
|
<div className="flex gap-x-4 items-center">
|
||||||
|
<img src={logo} alt={`${name} logo`} className="w-10 h-10 rounded-md" />
|
||||||
|
<div className="flex flex-col">
|
||||||
|
<div className="text-sm font-semibold text-white">{name}</div>
|
||||||
|
<div className="mt-1 text-xs text-[#D2D5DB]">{description}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
@ -0,0 +1,84 @@
|
|||||||
|
export function GoogleSearchOptions({ settings }) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<p className="text-sm text-white/60 my-2">
|
||||||
|
You can get a free search engine & API key{" "}
|
||||||
|
<a
|
||||||
|
href="https://programmablesearchengine.google.com/controlpanel/create"
|
||||||
|
target="_blank"
|
||||||
|
className="text-blue-300 underline"
|
||||||
|
>
|
||||||
|
from Google here.
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
<div className="flex gap-x-4">
|
||||||
|
<div className="flex flex-col w-60">
|
||||||
|
<label className="text-white text-sm font-semibold block mb-4">
|
||||||
|
Search engine ID
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
name="env::AgentGoogleSearchEngineId"
|
||||||
|
className="border-none bg-zinc-900 text-white placeholder:text-white/20 text-sm rounded-lg focus:border-white block w-full p-2.5"
|
||||||
|
placeholder="Google Search Engine Id"
|
||||||
|
defaultValue={settings?.AgentGoogleSearchEngineId}
|
||||||
|
required={true}
|
||||||
|
autoComplete="off"
|
||||||
|
spellCheck={false}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-col w-60">
|
||||||
|
<label className="text-white text-sm font-semibold block mb-4">
|
||||||
|
Programmatic Access API Key
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="password"
|
||||||
|
name="env::AgentGoogleSearchEngineKey"
|
||||||
|
className="border-none bg-zinc-900 text-white placeholder:text-white/20 text-sm rounded-lg focus:border-white block w-full p-2.5"
|
||||||
|
placeholder="Google Search Engine API Key"
|
||||||
|
defaultValue={
|
||||||
|
settings?.AgentGoogleSearchEngineKey ? "*".repeat(20) : ""
|
||||||
|
}
|
||||||
|
required={true}
|
||||||
|
autoComplete="off"
|
||||||
|
spellCheck={false}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SerperDotDevOptions({ settings }) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<p className="text-sm text-white/60 my-2">
|
||||||
|
You can get a free API key{" "}
|
||||||
|
<a
|
||||||
|
href="https://serper.dev"
|
||||||
|
target="_blank"
|
||||||
|
className="text-blue-300 underline"
|
||||||
|
>
|
||||||
|
from Serper.dev.
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
<div className="flex gap-x-4">
|
||||||
|
<div className="flex flex-col w-60">
|
||||||
|
<label className="text-white text-sm font-semibold block mb-4">
|
||||||
|
API Key
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="password"
|
||||||
|
name="env::AgentSerperApiKey"
|
||||||
|
className="border-none bg-zinc-900 text-white placeholder:text-white/20 text-sm rounded-lg focus:border-white block w-full p-2.5"
|
||||||
|
placeholder="Serper.dev API Key"
|
||||||
|
defaultValue={settings?.AgentSerperApiKey ? "*".repeat(20) : ""}
|
||||||
|
required={true}
|
||||||
|
autoComplete="off"
|
||||||
|
spellCheck={false}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
@ -0,0 +1,194 @@
|
|||||||
|
import React, { useEffect, useRef, useState } from "react";
|
||||||
|
import AnythingLLMIcon from "@/media/logo/anything-llm-icon.png";
|
||||||
|
import GoogleSearchIcon from "./icons/google.png";
|
||||||
|
import SerperDotDevIcon from "./icons/serper.png";
|
||||||
|
import { CaretUpDown, MagnifyingGlass, X } from "@phosphor-icons/react";
|
||||||
|
import SearchProviderItem from "./SearchProviderItem";
|
||||||
|
import {
|
||||||
|
SerperDotDevOptions,
|
||||||
|
GoogleSearchOptions,
|
||||||
|
} from "./SearchProviderOptions";
|
||||||
|
|
||||||
|
const SEARCH_PROVIDERS = [
|
||||||
|
{
|
||||||
|
name: "Please make a selection",
|
||||||
|
value: "none",
|
||||||
|
logo: AnythingLLMIcon,
|
||||||
|
options: () => <React.Fragment />,
|
||||||
|
description:
|
||||||
|
"Web search will be disabled until a provider and keys are provided.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Google Search Engine",
|
||||||
|
value: "google-search-engine",
|
||||||
|
logo: GoogleSearchIcon,
|
||||||
|
options: (settings) => <GoogleSearchOptions settings={settings} />,
|
||||||
|
description:
|
||||||
|
"Web search powered by a custom Google Search Engine. Free for 100 queries per day.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Serper.dev",
|
||||||
|
value: "serper-dot-dev",
|
||||||
|
logo: SerperDotDevIcon,
|
||||||
|
options: (settings) => <SerperDotDevOptions settings={settings} />,
|
||||||
|
description:
|
||||||
|
"Serper.dev web-search. Free account with a 2,500 calls, but then paid.",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export default function AgentWebSearchSelection({
|
||||||
|
skill,
|
||||||
|
settings,
|
||||||
|
toggleSkill,
|
||||||
|
enabled = false,
|
||||||
|
}) {
|
||||||
|
const searchInputRef = useRef(null);
|
||||||
|
const [filteredResults, setFilteredResults] = useState([]);
|
||||||
|
const [selectedProvider, setSelectedProvider] = useState("none");
|
||||||
|
const [searchQuery, setSearchQuery] = useState("");
|
||||||
|
const [searchMenuOpen, setSearchMenuOpen] = useState(false);
|
||||||
|
|
||||||
|
function updateChoice(selection) {
|
||||||
|
setSearchQuery("");
|
||||||
|
setSelectedProvider(selection);
|
||||||
|
setSearchMenuOpen(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleXButton() {
|
||||||
|
if (searchQuery.length > 0) {
|
||||||
|
setSearchQuery("");
|
||||||
|
if (searchInputRef.current) searchInputRef.current.value = "";
|
||||||
|
} else {
|
||||||
|
setSearchMenuOpen(!searchMenuOpen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const filtered = SEARCH_PROVIDERS.filter((provider) =>
|
||||||
|
provider.name.toLowerCase().includes(searchQuery.toLowerCase())
|
||||||
|
);
|
||||||
|
setFilteredResults(filtered);
|
||||||
|
}, [searchQuery, selectedProvider]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setSelectedProvider(settings?.preferences?.agent_search_provider ?? "none");
|
||||||
|
}, [settings?.preferences?.agent_search_provider]);
|
||||||
|
|
||||||
|
const selectedSearchProviderObject = SEARCH_PROVIDERS.find(
|
||||||
|
(provider) => provider.value === selectedProvider
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="border-b border-white/40 pb-4">
|
||||||
|
<div className="flex flex-col">
|
||||||
|
<div className="flex w-full justify-between items-center">
|
||||||
|
<label htmlFor="name" className="block input-label">
|
||||||
|
Live web search and browsing
|
||||||
|
</label>
|
||||||
|
<label className="border-none relative inline-flex cursor-pointer items-center mt-2">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
className="peer sr-only"
|
||||||
|
checked={enabled}
|
||||||
|
onClick={() => toggleSkill(skill)}
|
||||||
|
/>
|
||||||
|
<div className="pointer-events-none peer h-6 w-11 rounded-full bg-stone-400 after:absolute after:left-[2px] after:top-[2px] after:h-5 after:w-5 after:rounded-full after:shadow-xl after:border after:border-gray-600 after:bg-white after:box-shadow-md after:transition-all after:content-[''] peer-checked:bg-lime-300 peer-checked:after:translate-x-full peer-checked:after:border-white peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-800"></div>
|
||||||
|
<span className="ml-3 text-sm font-medium text-gray-900 dark:text-gray-300"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<p className="text-white text-opacity-60 text-xs font-medium py-1.5">
|
||||||
|
Enable your agent to search the web to answer your questions by
|
||||||
|
connecting to a web-search (SERP) provider.
|
||||||
|
<br />
|
||||||
|
Web search during agent sessions will not work until this is set up.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div hidden={!enabled}>
|
||||||
|
<div className="relative">
|
||||||
|
<input
|
||||||
|
type="hidden"
|
||||||
|
name="system::agent_search_provider"
|
||||||
|
value={selectedProvider}
|
||||||
|
/>
|
||||||
|
{searchMenuOpen && (
|
||||||
|
<div
|
||||||
|
className="fixed top-0 left-0 w-full h-full bg-black bg-opacity-70 backdrop-blur-sm z-10"
|
||||||
|
onClick={() => setSearchMenuOpen(false)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{searchMenuOpen ? (
|
||||||
|
<div className="absolute top-0 left-0 w-full max-w-[640px] max-h-[310px] overflow-auto white-scrollbar min-h-[64px] bg-[#18181B] rounded-lg flex flex-col justify-between cursor-pointer border-2 border-[#46C8FF] z-20">
|
||||||
|
<div className="w-full flex flex-col gap-y-1">
|
||||||
|
<div className="flex items-center sticky top-0 border-b border-[#9CA3AF] mx-4 bg-[#18181B]">
|
||||||
|
<MagnifyingGlass
|
||||||
|
size={20}
|
||||||
|
weight="bold"
|
||||||
|
className="absolute left-4 z-30 text-white -ml-4 my-2"
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
name="web-provider-search"
|
||||||
|
autoComplete="off"
|
||||||
|
placeholder="Search available web-search providers"
|
||||||
|
className="border-none -ml-4 my-2 bg-transparent z-20 pl-12 h-[38px] w-full px-4 py-1 text-sm outline-none focus:border-white text-white placeholder:text-white placeholder:font-medium"
|
||||||
|
onChange={(e) => setSearchQuery(e.target.value)}
|
||||||
|
ref={searchInputRef}
|
||||||
|
onKeyDown={(e) => {
|
||||||
|
if (e.key === "Enter") e.preventDefault();
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<X
|
||||||
|
size={20}
|
||||||
|
weight="bold"
|
||||||
|
className="cursor-pointer text-white hover:text-[#9CA3AF]"
|
||||||
|
onClick={handleXButton}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="flex-1 pl-4 pr-2 flex flex-col gap-y-1 overflow-y-auto white-scrollbar pb-4">
|
||||||
|
{filteredResults.map((provider) => {
|
||||||
|
return (
|
||||||
|
<SearchProviderItem
|
||||||
|
provider={provider}
|
||||||
|
key={provider.name}
|
||||||
|
checked={selectedProvider === provider.value}
|
||||||
|
onClick={() => updateChoice(provider.value)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<button
|
||||||
|
className="w-full max-w-[640px] h-[64px] bg-[#18181B] rounded-lg flex items-center p-[14px] justify-between cursor-pointer border-2 border-transparent hover:border-[#46C8FF] transition-all duration-300"
|
||||||
|
type="button"
|
||||||
|
onClick={() => setSearchMenuOpen(true)}
|
||||||
|
>
|
||||||
|
<div className="flex gap-x-4 items-center">
|
||||||
|
<img
|
||||||
|
src={selectedSearchProviderObject.logo}
|
||||||
|
alt={`${selectedSearchProviderObject.name} logo`}
|
||||||
|
className="w-10 h-10 rounded-md"
|
||||||
|
/>
|
||||||
|
<div className="flex flex-col text-left">
|
||||||
|
<div className="text-sm font-semibold text-white">
|
||||||
|
{selectedSearchProviderObject.name}
|
||||||
|
</div>
|
||||||
|
<div className="mt-1 text-xs text-[#D2D5DB]">
|
||||||
|
{selectedSearchProviderObject.description}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<CaretUpDown size={24} weight="bold" className="text-white" />
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
{selectedProvider !== "none" && (
|
||||||
|
<div className="mt-4 flex flex-col gap-y-1">
|
||||||
|
{selectedSearchProviderObject.options(settings)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
203
frontend/src/pages/WorkspaceSettings/AgentConfig/index.jsx
Normal file
203
frontend/src/pages/WorkspaceSettings/AgentConfig/index.jsx
Normal file
@ -0,0 +1,203 @@
|
|||||||
|
import System from "@/models/system";
|
||||||
|
import Workspace from "@/models/workspace";
|
||||||
|
import showToast from "@/utils/toast";
|
||||||
|
import { castToType } from "@/utils/types";
|
||||||
|
import { useEffect, useRef, useState } from "react";
|
||||||
|
import AgentLLMSelection from "./AgentLLMSelection";
|
||||||
|
import AgentWebSearchSelection from "./WebSearchSelection";
|
||||||
|
import GenericSkill from "./GenericSkill";
|
||||||
|
import Admin from "@/models/admin";
|
||||||
|
import * as Skeleton from "react-loading-skeleton";
|
||||||
|
import "react-loading-skeleton/dist/skeleton.css";
|
||||||
|
|
||||||
|
export default function WorkspaceAgentConfiguration({ workspace }) {
|
||||||
|
const [settings, setSettings] = useState({});
|
||||||
|
const [hasChanges, setHasChanges] = useState(false);
|
||||||
|
const [saving, setSaving] = useState(false);
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
const [agentSkills, setAgentSkills] = useState([]);
|
||||||
|
|
||||||
|
const formEl = useRef(null);
|
||||||
|
useEffect(() => {
|
||||||
|
async function fetchSettings() {
|
||||||
|
const _settings = await System.keys();
|
||||||
|
const _preferences = await Admin.systemPreferences();
|
||||||
|
setSettings({ ..._settings, preferences: _preferences.settings } ?? {});
|
||||||
|
setAgentSkills(_preferences.settings?.default_agent_skills ?? []);
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
fetchSettings();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleUpdate = async (e) => {
|
||||||
|
setSaving(true);
|
||||||
|
e.preventDefault();
|
||||||
|
const data = {
|
||||||
|
workspace: {},
|
||||||
|
system: {},
|
||||||
|
env: {},
|
||||||
|
};
|
||||||
|
|
||||||
|
const form = new FormData(formEl.current);
|
||||||
|
for (var [key, value] of form.entries()) {
|
||||||
|
if (key.startsWith("system::")) {
|
||||||
|
const [_, label] = key.split("system::");
|
||||||
|
data.system[label] = String(value);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key.startsWith("env::")) {
|
||||||
|
const [_, label] = key.split("env::");
|
||||||
|
data.env[label] = String(value);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
data.workspace[key] = castToType(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
const { workspace: updatedWorkspace, message } = await Workspace.update(
|
||||||
|
workspace.slug,
|
||||||
|
data.workspace
|
||||||
|
);
|
||||||
|
await Admin.updateSystemPreferences(data.system);
|
||||||
|
await System.updateSystem(data.env);
|
||||||
|
|
||||||
|
if (!!updatedWorkspace) {
|
||||||
|
showToast("Workspace updated!", "success", { clear: true });
|
||||||
|
} else {
|
||||||
|
showToast(`Error: ${message}`, "error", { clear: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
setSaving(false);
|
||||||
|
setHasChanges(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
function toggleAgentSkill(skillName = "") {
|
||||||
|
setAgentSkills((prev) => {
|
||||||
|
return prev.includes(skillName)
|
||||||
|
? prev.filter((name) => name !== skillName)
|
||||||
|
: [...prev, skillName];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!workspace || loading) return <LoadingSkeleton />;
|
||||||
|
return (
|
||||||
|
<div id="workspace-agent-settings-container">
|
||||||
|
<form
|
||||||
|
ref={formEl}
|
||||||
|
onSubmit={handleUpdate}
|
||||||
|
onChange={() => setHasChanges(true)}
|
||||||
|
id="agent-settings-form"
|
||||||
|
className="w-1/2 flex flex-col gap-y-6"
|
||||||
|
>
|
||||||
|
<AgentLLMSelection
|
||||||
|
settings={settings}
|
||||||
|
workspace={workspace}
|
||||||
|
setHasChanges={setHasChanges}
|
||||||
|
/>
|
||||||
|
<AvailableAgentSkills
|
||||||
|
skills={agentSkills}
|
||||||
|
toggleAgentSkill={toggleAgentSkill}
|
||||||
|
settings={settings}
|
||||||
|
/>
|
||||||
|
{hasChanges && (
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
form="agent-settings-form"
|
||||||
|
className="w-fit transition-all duration-300 border border-slate-200 px-5 py-2.5 rounded-lg text-white text-sm items-center flex gap-x-2 hover:bg-slate-200 hover:text-slate-800 focus:ring-gray-800"
|
||||||
|
>
|
||||||
|
{saving ? "Updating agent..." : "Update workspace agent"}
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
function LoadingSkeleton() {
|
||||||
|
return (
|
||||||
|
<div id="workspace-agent-settings-container">
|
||||||
|
<div className="w-1/2 flex flex-col gap-y-6">
|
||||||
|
<Skeleton.default
|
||||||
|
height={100}
|
||||||
|
width="100%"
|
||||||
|
count={2}
|
||||||
|
baseColor="#292524"
|
||||||
|
highlightColor="#4c4948"
|
||||||
|
enableAnimation={true}
|
||||||
|
containerClassName="flex flex-col gap-y-1"
|
||||||
|
/>
|
||||||
|
<div className="bg-white/10 h-[1px] w-full" />
|
||||||
|
<Skeleton.default
|
||||||
|
height={100}
|
||||||
|
width="100%"
|
||||||
|
count={2}
|
||||||
|
baseColor="#292524"
|
||||||
|
highlightColor="#4c4948"
|
||||||
|
enableAnimation={true}
|
||||||
|
containerClassName="flex flex-col gap-y-1 mt-4"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function AvailableAgentSkills({ skills, settings, toggleAgentSkill }) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div className="flex flex-col mb-8">
|
||||||
|
<div className="flex w-full justify-between items-center">
|
||||||
|
<label htmlFor="name" className="text-white text-md font-semibold">
|
||||||
|
Default agent skills
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<p className="text-white text-opacity-60 text-xs font-medium py-1.5">
|
||||||
|
Improve the natural abilities of the default agent with these
|
||||||
|
pre-built skills. This set up applies to all workspaces.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<input
|
||||||
|
name="system::default_agent_skills"
|
||||||
|
type="hidden"
|
||||||
|
value={skills.join(",")}
|
||||||
|
/>
|
||||||
|
<div className="flex flex-col gap-y-3">
|
||||||
|
<GenericSkill
|
||||||
|
title="RAG & long-term memory"
|
||||||
|
description='Allow the agent to leverage your local documents to answer a query or ask the agent to "remember" pieces of content for long-term memory retrieval.'
|
||||||
|
settings={settings}
|
||||||
|
enabled={true}
|
||||||
|
disabled={true}
|
||||||
|
/>
|
||||||
|
<GenericSkill
|
||||||
|
title="View and summarize documents"
|
||||||
|
description="Allow the agent to list and summarize the content of workspace files currently embedded."
|
||||||
|
settings={settings}
|
||||||
|
enabled={true}
|
||||||
|
disabled={true}
|
||||||
|
/>
|
||||||
|
<GenericSkill
|
||||||
|
title="Scrape websites"
|
||||||
|
description="Allow the agent to visit and scrape the content of websites."
|
||||||
|
settings={settings}
|
||||||
|
enabled={true}
|
||||||
|
disabled={true}
|
||||||
|
/>
|
||||||
|
<GenericSkill
|
||||||
|
title="Generate & save files to browser"
|
||||||
|
description="Enable the default agent to generate and write to files that save and can be downloaded in your browser."
|
||||||
|
skill="save-file-to-browser"
|
||||||
|
settings={settings}
|
||||||
|
toggleSkill={toggleAgentSkill}
|
||||||
|
enabled={skills.includes("save-file-to-browser")}
|
||||||
|
/>
|
||||||
|
<AgentWebSearchSelection
|
||||||
|
skill="web-browsing"
|
||||||
|
settings={settings}
|
||||||
|
toggleSkill={toggleAgentSkill}
|
||||||
|
enabled={skills.includes("web-browsing")}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -9,6 +9,7 @@ import {
|
|||||||
ArrowUUpLeft,
|
ArrowUUpLeft,
|
||||||
ChatText,
|
ChatText,
|
||||||
Database,
|
Database,
|
||||||
|
Robot,
|
||||||
User,
|
User,
|
||||||
Wrench,
|
Wrench,
|
||||||
} from "@phosphor-icons/react";
|
} from "@phosphor-icons/react";
|
||||||
@ -19,6 +20,7 @@ import GeneralAppearance from "./GeneralAppearance";
|
|||||||
import ChatSettings from "./ChatSettings";
|
import ChatSettings from "./ChatSettings";
|
||||||
import VectorDatabase from "./VectorDatabase";
|
import VectorDatabase from "./VectorDatabase";
|
||||||
import Members from "./Members";
|
import Members from "./Members";
|
||||||
|
import WorkspaceAgentConfiguration from "./AgentConfig";
|
||||||
import useUser from "@/hooks/useUser";
|
import useUser from "@/hooks/useUser";
|
||||||
|
|
||||||
const TABS = {
|
const TABS = {
|
||||||
@ -26,6 +28,7 @@ const TABS = {
|
|||||||
"chat-settings": ChatSettings,
|
"chat-settings": ChatSettings,
|
||||||
"vector-database": VectorDatabase,
|
"vector-database": VectorDatabase,
|
||||||
members: Members,
|
members: Members,
|
||||||
|
"agent-config": WorkspaceAgentConfiguration,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function WorkspaceSettings() {
|
export default function WorkspaceSettings() {
|
||||||
@ -102,6 +105,11 @@ function ShowWorkspaceChat() {
|
|||||||
to={paths.workspace.settings.members(slug)}
|
to={paths.workspace.settings.members(slug)}
|
||||||
visible={["admin", "manager"].includes(user?.role)}
|
visible={["admin", "manager"].includes(user?.role)}
|
||||||
/>
|
/>
|
||||||
|
<TabItem
|
||||||
|
title="Agent Configuration"
|
||||||
|
icon={<Robot className="h-6 w-6" />}
|
||||||
|
to={paths.workspace.settings.agentConfig(slug)}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="px-16 py-6">
|
<div className="px-16 py-6">
|
||||||
<TabContent slug={slug} workspace={workspace} />
|
<TabContent slug={slug} workspace={workspace} />
|
||||||
|
103
frontend/src/utils/chat/agent.js
Normal file
103
frontend/src/utils/chat/agent.js
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
import { v4 } from "uuid";
|
||||||
|
import { safeJsonParse } from "../request";
|
||||||
|
import { saveAs } from "file-saver";
|
||||||
|
import { API_BASE } from "../constants";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
|
export const AGENT_SESSION_START = "agentSessionStart";
|
||||||
|
export const AGENT_SESSION_END = "agentSessionEnd";
|
||||||
|
const handledEvents = [
|
||||||
|
"statusResponse",
|
||||||
|
"fileDownload",
|
||||||
|
"awaitingFeedback",
|
||||||
|
"wssFailure",
|
||||||
|
];
|
||||||
|
|
||||||
|
export function websocketURI() {
|
||||||
|
const wsProtocol = window.location.protocol === "https:" ? "wss:" : "ws:";
|
||||||
|
if (API_BASE === "/api") return `${wsProtocol}//${window.location.host}`;
|
||||||
|
return `${wsProtocol}//${new URL(import.meta.env.VITE_API_BASE).host}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function handleSocketResponse(event, setChatHistory) {
|
||||||
|
const data = safeJsonParse(event.data, null);
|
||||||
|
if (data === null) return;
|
||||||
|
|
||||||
|
// No message type is defined then this is a generic message
|
||||||
|
// that we need to print to the user as a system response
|
||||||
|
if (!data.hasOwnProperty("type")) {
|
||||||
|
return setChatHistory((prev) => {
|
||||||
|
return [
|
||||||
|
...prev.filter((msg) => !!msg.content),
|
||||||
|
{
|
||||||
|
uuid: v4(),
|
||||||
|
content: data.content,
|
||||||
|
role: "assistant",
|
||||||
|
sources: [],
|
||||||
|
closed: true,
|
||||||
|
error: null,
|
||||||
|
animate: false,
|
||||||
|
pending: false,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!handledEvents.includes(data.type) || !data.content) return;
|
||||||
|
|
||||||
|
if (data.type === "fileDownload") {
|
||||||
|
saveAs(data.content.b64Content, data.content.filename ?? "unknown.txt");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.type === "wssFailure") {
|
||||||
|
return setChatHistory((prev) => {
|
||||||
|
return [
|
||||||
|
...prev.filter((msg) => !!msg.content),
|
||||||
|
{
|
||||||
|
uuid: v4(),
|
||||||
|
content: data.content,
|
||||||
|
role: "assistant",
|
||||||
|
sources: [],
|
||||||
|
closed: true,
|
||||||
|
error: data.content,
|
||||||
|
animate: false,
|
||||||
|
pending: false,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return setChatHistory((prev) => {
|
||||||
|
return [
|
||||||
|
...prev.filter((msg) => !!msg.content),
|
||||||
|
{
|
||||||
|
uuid: v4(),
|
||||||
|
type: data.type,
|
||||||
|
content: data.content,
|
||||||
|
role: "assistant",
|
||||||
|
sources: [],
|
||||||
|
closed: true,
|
||||||
|
error: null,
|
||||||
|
animate: false,
|
||||||
|
pending: false,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useIsAgentSessionActive() {
|
||||||
|
const [activeSession, setActiveSession] = useState(false);
|
||||||
|
useEffect(() => {
|
||||||
|
function listenForAgentSession() {
|
||||||
|
if (!window) return;
|
||||||
|
window.addEventListener(AGENT_SESSION_START, () =>
|
||||||
|
setActiveSession(true)
|
||||||
|
);
|
||||||
|
window.addEventListener(AGENT_SESSION_END, () => setActiveSession(false));
|
||||||
|
}
|
||||||
|
listenForAgentSession();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return activeSession;
|
||||||
|
}
|
@ -6,7 +6,8 @@ export default function handleChat(
|
|||||||
setLoadingResponse,
|
setLoadingResponse,
|
||||||
setChatHistory,
|
setChatHistory,
|
||||||
remHistory,
|
remHistory,
|
||||||
_chatHistory
|
_chatHistory,
|
||||||
|
setWebsocket
|
||||||
) {
|
) {
|
||||||
const {
|
const {
|
||||||
uuid,
|
uuid,
|
||||||
@ -18,11 +19,12 @@ export default function handleChat(
|
|||||||
chatId = null,
|
chatId = null,
|
||||||
} = chatResult;
|
} = chatResult;
|
||||||
|
|
||||||
if (type === "abort") {
|
if (type === "abort" || type === "statusResponse") {
|
||||||
setLoadingResponse(false);
|
setLoadingResponse(false);
|
||||||
setChatHistory([
|
setChatHistory([
|
||||||
...remHistory,
|
...remHistory,
|
||||||
{
|
{
|
||||||
|
type,
|
||||||
uuid,
|
uuid,
|
||||||
content: textResponse,
|
content: textResponse,
|
||||||
role: "assistant",
|
role: "assistant",
|
||||||
@ -34,6 +36,7 @@ export default function handleChat(
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
_chatHistory.push({
|
_chatHistory.push({
|
||||||
|
type,
|
||||||
uuid,
|
uuid,
|
||||||
content: textResponse,
|
content: textResponse,
|
||||||
role: "assistant",
|
role: "assistant",
|
||||||
@ -99,6 +102,8 @@ export default function handleChat(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
setChatHistory([..._chatHistory]);
|
setChatHistory([..._chatHistory]);
|
||||||
|
} else if (type === "agentInitWebsocketConnection") {
|
||||||
|
setWebsocket(chatResult.websocketUUID);
|
||||||
} else if (type === "finalizeResponseStream") {
|
} else if (type === "finalizeResponseStream") {
|
||||||
const chatIdx = _chatHistory.findIndex((chat) => chat.uuid === uuid);
|
const chatIdx = _chatHistory.findIndex((chat) => chat.uuid === uuid);
|
||||||
if (chatIdx !== -1) {
|
if (chatIdx !== -1) {
|
||||||
|
@ -68,6 +68,9 @@ export default {
|
|||||||
members: (slug) => {
|
members: (slug) => {
|
||||||
return `/workspace/${slug}/settings/members`;
|
return `/workspace/${slug}/settings/members`;
|
||||||
},
|
},
|
||||||
|
agentConfig: (slug) => {
|
||||||
|
return `/workspace/${slug}/settings/agent-config`;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
thread: (wsSlug, threadSlug) => {
|
thread: (wsSlug, threadSlug) => {
|
||||||
return `/workspace/${wsSlug}/t/${threadSlug}`;
|
return `/workspace/${wsSlug}/t/${threadSlug}`;
|
||||||
|
@ -164,3 +164,16 @@ WHISPER_PROVIDER="local"
|
|||||||
#ENABLE_HTTPS="true"
|
#ENABLE_HTTPS="true"
|
||||||
#HTTPS_CERT_PATH="sslcert/cert.pem"
|
#HTTPS_CERT_PATH="sslcert/cert.pem"
|
||||||
#HTTPS_KEY_PATH="sslcert/key.pem"
|
#HTTPS_KEY_PATH="sslcert/key.pem"
|
||||||
|
|
||||||
|
###########################################
|
||||||
|
######## AGENT SERVICE KEYS ###############
|
||||||
|
###########################################
|
||||||
|
|
||||||
|
#------ SEARCH ENGINES -------
|
||||||
|
#=============================
|
||||||
|
#------ Google Search -------- https://programmablesearchengine.google.com/controlpanel/create
|
||||||
|
# AGENT_GSE_KEY=
|
||||||
|
# AGENT_GSE_CTX=
|
||||||
|
|
||||||
|
#------ Serper.dev ----------- https://serper.dev/
|
||||||
|
# AGENT_SERPER_DEV_KEY=
|
@ -17,7 +17,7 @@ const {
|
|||||||
canModifyAdmin,
|
canModifyAdmin,
|
||||||
validCanModify,
|
validCanModify,
|
||||||
} = require("../utils/helpers/admin");
|
} = require("../utils/helpers/admin");
|
||||||
const { reqBody, userFromSession } = require("../utils/http");
|
const { reqBody, userFromSession, safeJsonParse } = require("../utils/http");
|
||||||
const {
|
const {
|
||||||
strictMultiUserRoleValid,
|
strictMultiUserRoleValid,
|
||||||
flexUserRoleValid,
|
flexUserRoleValid,
|
||||||
@ -347,6 +347,15 @@ function adminEndpoints(app) {
|
|||||||
?.value || null,
|
?.value || null,
|
||||||
max_embed_chunk_size:
|
max_embed_chunk_size:
|
||||||
getEmbeddingEngineSelection()?.embeddingMaxChunkLength || 1000,
|
getEmbeddingEngineSelection()?.embeddingMaxChunkLength || 1000,
|
||||||
|
agent_search_provider:
|
||||||
|
(await SystemSettings.get({ label: "agent_search_provider" }))
|
||||||
|
?.value || null,
|
||||||
|
default_agent_skills:
|
||||||
|
safeJsonParse(
|
||||||
|
(await SystemSettings.get({ label: "default_agent_skills" }))
|
||||||
|
?.value,
|
||||||
|
[]
|
||||||
|
) || [],
|
||||||
};
|
};
|
||||||
response.status(200).json({ settings });
|
response.status(200).json({ settings });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
61
server/endpoints/agentWebsocket.js
Normal file
61
server/endpoints/agentWebsocket.js
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
const { Telemetry } = require("../models/telemetry");
|
||||||
|
const {
|
||||||
|
WorkspaceAgentInvocation,
|
||||||
|
} = require("../models/workspaceAgentInvocation");
|
||||||
|
const { AgentHandler } = require("../utils/agents");
|
||||||
|
const {
|
||||||
|
WEBSOCKET_BAIL_COMMANDS,
|
||||||
|
} = require("../utils/agents/aibitat/plugins/websocket");
|
||||||
|
const { safeJsonParse } = require("../utils/http");
|
||||||
|
|
||||||
|
// Setup listener for incoming messages to relay to socket so it can be handled by agent plugin.
|
||||||
|
function relayToSocket(message) {
|
||||||
|
if (this.handleFeedback) return this?.handleFeedback?.(message);
|
||||||
|
this.checkBailCommand(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
function agentWebsocket(app) {
|
||||||
|
if (!app) return;
|
||||||
|
|
||||||
|
app.ws("/agent-invocation/:uuid", async function (socket, request) {
|
||||||
|
try {
|
||||||
|
const agentHandler = await new AgentHandler({
|
||||||
|
uuid: String(request.params.uuid),
|
||||||
|
}).init();
|
||||||
|
|
||||||
|
if (!agentHandler.invocation) {
|
||||||
|
socket.close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
socket.on("message", relayToSocket);
|
||||||
|
socket.on("close", () => {
|
||||||
|
agentHandler.closeAlert();
|
||||||
|
WorkspaceAgentInvocation.close(String(request.params.uuid));
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.checkBailCommand = (data) => {
|
||||||
|
const content = safeJsonParse(data)?.feedback;
|
||||||
|
if (WEBSOCKET_BAIL_COMMANDS.includes(content)) {
|
||||||
|
agentHandler.log(
|
||||||
|
`User invoked bail command while processing. Closing session now.`
|
||||||
|
);
|
||||||
|
agentHandler.aibitat.abort();
|
||||||
|
socket.close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
await Telemetry.sendTelemetry("agent_chat_started");
|
||||||
|
await agentHandler.createAIbitat({ socket });
|
||||||
|
await agentHandler.startAgentCluster();
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e.message);
|
||||||
|
socket?.send(JSON.stringify({ type: "wssFailure", content: e.message }));
|
||||||
|
socket?.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { agentWebsocket };
|
@ -25,6 +25,7 @@ const { extensionEndpoints } = require("./endpoints/extensions");
|
|||||||
const { bootHTTP, bootSSL } = require("./utils/boot");
|
const { bootHTTP, bootSSL } = require("./utils/boot");
|
||||||
const { workspaceThreadEndpoints } = require("./endpoints/workspaceThreads");
|
const { workspaceThreadEndpoints } = require("./endpoints/workspaceThreads");
|
||||||
const { documentEndpoints } = require("./endpoints/document");
|
const { documentEndpoints } = require("./endpoints/document");
|
||||||
|
const { agentWebsocket } = require("./endpoints/agentWebsocket");
|
||||||
const app = express();
|
const app = express();
|
||||||
const apiRouter = express.Router();
|
const apiRouter = express.Router();
|
||||||
const FILE_LIMIT = "3GB";
|
const FILE_LIMIT = "3GB";
|
||||||
@ -39,6 +40,7 @@ app.use(
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
require("express-ws")(app);
|
||||||
app.use("/api", apiRouter);
|
app.use("/api", apiRouter);
|
||||||
systemEndpoints(apiRouter);
|
systemEndpoints(apiRouter);
|
||||||
extensionEndpoints(apiRouter);
|
extensionEndpoints(apiRouter);
|
||||||
@ -50,6 +52,7 @@ inviteEndpoints(apiRouter);
|
|||||||
embedManagementEndpoints(apiRouter);
|
embedManagementEndpoints(apiRouter);
|
||||||
utilEndpoints(apiRouter);
|
utilEndpoints(apiRouter);
|
||||||
documentEndpoints(apiRouter);
|
documentEndpoints(apiRouter);
|
||||||
|
agentWebsocket(apiRouter);
|
||||||
developerEndpoints(app, apiRouter);
|
developerEndpoints(app, apiRouter);
|
||||||
|
|
||||||
// Externally facing embedder endpoints
|
// Externally facing embedder endpoints
|
||||||
|
@ -202,6 +202,15 @@ const Document = {
|
|||||||
return { document: null, message: error.message };
|
return { document: null, message: error.message };
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
content: async function (docId) {
|
||||||
|
if (!docId) throw new Error("No workspace docId provided!");
|
||||||
|
const document = await this.get({ docId: String(docId) });
|
||||||
|
if (!document) throw new Error(`Could not find a document by id ${docId}`);
|
||||||
|
|
||||||
|
const { fileData } = require("../utils/files");
|
||||||
|
const data = await fileData(document.docpath);
|
||||||
|
return { title: data.title, content: data.pageContent };
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = { Document };
|
module.exports = { Document };
|
||||||
|
@ -26,6 +26,8 @@ const SystemSettings = {
|
|||||||
"support_email",
|
"support_email",
|
||||||
"text_splitter_chunk_size",
|
"text_splitter_chunk_size",
|
||||||
"text_splitter_chunk_overlap",
|
"text_splitter_chunk_overlap",
|
||||||
|
"agent_search_provider",
|
||||||
|
"default_agent_skills",
|
||||||
],
|
],
|
||||||
validations: {
|
validations: {
|
||||||
footer_data: (updates) => {
|
footer_data: (updates) => {
|
||||||
@ -65,6 +67,28 @@ const SystemSettings = {
|
|||||||
return 20;
|
return 20;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
agent_search_provider: (update) => {
|
||||||
|
try {
|
||||||
|
if (!["google-search-engine", "serper-dot-dev"].includes(update))
|
||||||
|
throw new Error("Invalid SERP provider.");
|
||||||
|
return String(update);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(
|
||||||
|
`Failed to run validation function on agent_search_provider`,
|
||||||
|
e.message
|
||||||
|
);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
default_agent_skills: (updates) => {
|
||||||
|
try {
|
||||||
|
const skills = updates.split(",").filter((skill) => !!skill);
|
||||||
|
return JSON.stringify(skills);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(`Could not validate agent skills.`);
|
||||||
|
return JSON.stringify([]);
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
currentSettings: async function () {
|
currentSettings: async function () {
|
||||||
const llmProvider = process.env.LLM_PROVIDER;
|
const llmProvider = process.env.LLM_PROVIDER;
|
||||||
@ -108,6 +132,13 @@ const SystemSettings = {
|
|||||||
// - then it can be shared.
|
// - then it can be shared.
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
WhisperProvider: process.env.WHISPER_PROVIDER || "local",
|
WhisperProvider: process.env.WHISPER_PROVIDER || "local",
|
||||||
|
|
||||||
|
// --------------------------------------------------------
|
||||||
|
// Agent Settings & Configs
|
||||||
|
// --------------------------------------------------------
|
||||||
|
AgentGoogleSearchEngineId: process.env.AGENT_GSE_CTX || null,
|
||||||
|
AgentGoogleSearchEngineKey: process.env.AGENT_GSE_KEY || null,
|
||||||
|
AgentSerperApiKey: process.env.AGENT_SERPER_DEV_KEY || null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -37,18 +37,25 @@ const Telemetry = {
|
|||||||
sendTelemetry: async function (
|
sendTelemetry: async function (
|
||||||
event,
|
event,
|
||||||
eventProperties = {},
|
eventProperties = {},
|
||||||
subUserId = null
|
subUserId = null,
|
||||||
|
silent = false
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
const { client, distinctId: systemId } = await this.connect();
|
const { client, distinctId: systemId } = await this.connect();
|
||||||
if (!client) return;
|
if (!client) return;
|
||||||
const distinctId = !!subUserId ? `${systemId}::${subUserId}` : systemId;
|
const distinctId = !!subUserId ? `${systemId}::${subUserId}` : systemId;
|
||||||
const properties = { ...eventProperties, runtime: this.runtime() };
|
const properties = { ...eventProperties, runtime: this.runtime() };
|
||||||
|
|
||||||
|
// Silence some events to keep logs from being too messy in production
|
||||||
|
// eg: Tool calls from agents spamming the logs.
|
||||||
|
if (!silent) {
|
||||||
console.log(`\x1b[32m[TELEMETRY SENT]\x1b[0m`, {
|
console.log(`\x1b[32m[TELEMETRY SENT]\x1b[0m`, {
|
||||||
event,
|
event,
|
||||||
distinctId,
|
distinctId,
|
||||||
properties,
|
properties,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
client.capture({
|
client.capture({
|
||||||
event,
|
event,
|
||||||
distinctId,
|
distinctId,
|
||||||
|
@ -24,6 +24,8 @@ const Workspace = {
|
|||||||
"topN",
|
"topN",
|
||||||
"chatMode",
|
"chatMode",
|
||||||
"pfpFilename",
|
"pfpFilename",
|
||||||
|
"agentProvider",
|
||||||
|
"agentModel",
|
||||||
],
|
],
|
||||||
|
|
||||||
new: async function (name = null, creatorId = null) {
|
new: async function (name = null, creatorId = null) {
|
||||||
|
95
server/models/workspaceAgentInvocation.js
Normal file
95
server/models/workspaceAgentInvocation.js
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
const prisma = require("../utils/prisma");
|
||||||
|
const { v4: uuidv4 } = require("uuid");
|
||||||
|
|
||||||
|
const WorkspaceAgentInvocation = {
|
||||||
|
// returns array of strings with their @ handle.
|
||||||
|
parseAgents: function (promptString) {
|
||||||
|
return promptString.split(/\s+/).filter((v) => v.startsWith("@"));
|
||||||
|
},
|
||||||
|
|
||||||
|
close: async function (uuid) {
|
||||||
|
if (!uuid) return;
|
||||||
|
try {
|
||||||
|
await prisma.workspace_agent_invocations.update({
|
||||||
|
where: { uuid: String(uuid) },
|
||||||
|
data: { closed: true },
|
||||||
|
});
|
||||||
|
} catch {}
|
||||||
|
},
|
||||||
|
|
||||||
|
new: async function ({ prompt, workspace, user = null, thread = null }) {
|
||||||
|
try {
|
||||||
|
const invocation = await prisma.workspace_agent_invocations.create({
|
||||||
|
data: {
|
||||||
|
uuid: uuidv4(),
|
||||||
|
workspace_id: workspace.id,
|
||||||
|
prompt: String(prompt),
|
||||||
|
user_id: user?.id,
|
||||||
|
thread_id: thread?.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return { invocation, message: null };
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error.message);
|
||||||
|
return { invocation: null, message: error.message };
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
get: async function (clause = {}) {
|
||||||
|
try {
|
||||||
|
const invocation = await prisma.workspace_agent_invocations.findFirst({
|
||||||
|
where: clause,
|
||||||
|
});
|
||||||
|
|
||||||
|
return invocation || null;
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error.message);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
getWithWorkspace: async function (clause = {}) {
|
||||||
|
try {
|
||||||
|
const invocation = await prisma.workspace_agent_invocations.findFirst({
|
||||||
|
where: clause,
|
||||||
|
include: {
|
||||||
|
workspace: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return invocation || null;
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error.message);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
delete: async function (clause = {}) {
|
||||||
|
try {
|
||||||
|
await prisma.workspace_agent_invocations.delete({
|
||||||
|
where: clause,
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error.message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
where: async function (clause = {}, limit = null, orderBy = null) {
|
||||||
|
try {
|
||||||
|
const results = await prisma.workspace_agent_invocations.findMany({
|
||||||
|
where: clause,
|
||||||
|
...(limit !== null ? { take: limit } : {}),
|
||||||
|
...(orderBy !== null ? { orderBy } : {}),
|
||||||
|
});
|
||||||
|
return results;
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error.message);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = { WorkspaceAgentInvocation };
|
@ -33,11 +33,13 @@
|
|||||||
"archiver": "^5.3.1",
|
"archiver": "^5.3.1",
|
||||||
"bcrypt": "^5.1.0",
|
"bcrypt": "^5.1.0",
|
||||||
"body-parser": "^1.20.2",
|
"body-parser": "^1.20.2",
|
||||||
|
"chalk": "^4",
|
||||||
"check-disk-space": "^3.4.0",
|
"check-disk-space": "^3.4.0",
|
||||||
"chromadb": "^1.5.2",
|
"chromadb": "^1.5.2",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"dotenv": "^16.0.3",
|
"dotenv": "^16.0.3",
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
|
"express-ws": "^5.0.2",
|
||||||
"extract-zip": "^2.0.1",
|
"extract-zip": "^2.0.1",
|
||||||
"graphql": "^16.7.1",
|
"graphql": "^16.7.1",
|
||||||
"joi": "^17.11.0",
|
"joi": "^17.11.0",
|
||||||
@ -48,9 +50,12 @@
|
|||||||
"mime": "^3.0.0",
|
"mime": "^3.0.0",
|
||||||
"moment": "^2.29.4",
|
"moment": "^2.29.4",
|
||||||
"multer": "^1.4.5-lts.1",
|
"multer": "^1.4.5-lts.1",
|
||||||
|
"node-html-markdown": "^1.3.0",
|
||||||
"node-llama-cpp": "^2.8.0",
|
"node-llama-cpp": "^2.8.0",
|
||||||
"openai": "^3.2.1",
|
"openai": "^3.2.1",
|
||||||
|
"openai:latest": "npm:openai@latest",
|
||||||
"pinecone-client": "^1.1.0",
|
"pinecone-client": "^1.1.0",
|
||||||
|
"pluralize": "^8.0.0",
|
||||||
"posthog-node": "^3.1.1",
|
"posthog-node": "^3.1.1",
|
||||||
"prisma": "5.3.1",
|
"prisma": "5.3.1",
|
||||||
"slugify": "^1.6.6",
|
"slugify": "^1.6.6",
|
||||||
@ -64,6 +69,7 @@
|
|||||||
"weaviate-ts-client": "^1.4.0"
|
"weaviate-ts-client": "^1.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@inquirer/prompts": "^4.3.1",
|
||||||
"eslint": "^8.50.0",
|
"eslint": "^8.50.0",
|
||||||
"eslint-config-prettier": "^9.0.0",
|
"eslint-config-prettier": "^9.0.0",
|
||||||
"eslint-plugin-ft-flow": "^3.0.0",
|
"eslint-plugin-ft-flow": "^3.0.0",
|
||||||
|
24
server/prisma/migrations/20240412183346_init/migration.sql
Normal file
24
server/prisma/migrations/20240412183346_init/migration.sql
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "workspaces" ADD COLUMN "agentModel" TEXT;
|
||||||
|
ALTER TABLE "workspaces" ADD COLUMN "agentProvider" TEXT;
|
||||||
|
|
||||||
|
-- CreateTable
|
||||||
|
CREATE TABLE "workspace_agent_invocations" (
|
||||||
|
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||||
|
"uuid" TEXT NOT NULL,
|
||||||
|
"prompt" TEXT NOT NULL,
|
||||||
|
"closed" BOOLEAN NOT NULL DEFAULT false,
|
||||||
|
"user_id" INTEGER,
|
||||||
|
"thread_id" INTEGER,
|
||||||
|
"workspace_id" INTEGER NOT NULL,
|
||||||
|
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"lastUpdatedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
CONSTRAINT "workspace_agent_invocations_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT "workspace_agent_invocations_workspace_id_fkey" FOREIGN KEY ("workspace_id") REFERENCES "workspaces" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE UNIQUE INDEX "workspace_agent_invocations_uuid_key" ON "workspace_agent_invocations"("uuid");
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE INDEX "workspace_agent_invocations_uuid_idx" ON "workspace_agent_invocations"("uuid");
|
@ -69,6 +69,7 @@ model users {
|
|||||||
embed_configs embed_configs[]
|
embed_configs embed_configs[]
|
||||||
embed_chats embed_chats[]
|
embed_chats embed_chats[]
|
||||||
threads workspace_threads[]
|
threads workspace_threads[]
|
||||||
|
workspace_agent_invocations workspace_agent_invocations[]
|
||||||
}
|
}
|
||||||
|
|
||||||
model document_vectors {
|
model document_vectors {
|
||||||
@ -103,11 +104,14 @@ model workspaces {
|
|||||||
topN Int? @default(4)
|
topN Int? @default(4)
|
||||||
chatMode String? @default("chat")
|
chatMode String? @default("chat")
|
||||||
pfpFilename String?
|
pfpFilename String?
|
||||||
|
agentProvider String?
|
||||||
|
agentModel String?
|
||||||
workspace_users workspace_users[]
|
workspace_users workspace_users[]
|
||||||
documents workspace_documents[]
|
documents workspace_documents[]
|
||||||
workspace_suggested_messages workspace_suggested_messages[]
|
workspace_suggested_messages workspace_suggested_messages[]
|
||||||
embed_configs embed_configs[]
|
embed_configs embed_configs[]
|
||||||
threads workspace_threads[]
|
threads workspace_threads[]
|
||||||
|
workspace_agent_invocations workspace_agent_invocations[]
|
||||||
}
|
}
|
||||||
|
|
||||||
model workspace_threads {
|
model workspace_threads {
|
||||||
@ -151,6 +155,22 @@ model workspace_chats {
|
|||||||
users users? @relation(fields: [user_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
users users? @relation(fields: [user_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
model workspace_agent_invocations {
|
||||||
|
id Int @id @default(autoincrement())
|
||||||
|
uuid String @unique
|
||||||
|
prompt String // Contains agent invocation to parse + option additional text for seed.
|
||||||
|
closed Boolean @default(false)
|
||||||
|
user_id Int?
|
||||||
|
thread_id Int? // No relation to prevent whole table migration
|
||||||
|
workspace_id Int
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
lastUpdatedAt DateTime @default(now())
|
||||||
|
user users? @relation(fields: [user_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
||||||
|
workspace workspaces @relation(fields: [workspace_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
||||||
|
|
||||||
|
@@index([uuid])
|
||||||
|
}
|
||||||
|
|
||||||
model workspace_users {
|
model workspace_users {
|
||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
user_id Int
|
user_id Int
|
||||||
|
@ -4,6 +4,7 @@ const {
|
|||||||
writeResponseChunk,
|
writeResponseChunk,
|
||||||
clientAbortedHandler,
|
clientAbortedHandler,
|
||||||
} = require("../../helpers/chat/responses");
|
} = require("../../helpers/chat/responses");
|
||||||
|
|
||||||
class AnthropicLLM {
|
class AnthropicLLM {
|
||||||
constructor(embedder = null, modelPreference = null) {
|
constructor(embedder = null, modelPreference = null) {
|
||||||
if (!process.env.ANTHROPIC_API_KEY)
|
if (!process.env.ANTHROPIC_API_KEY)
|
||||||
@ -28,7 +29,6 @@ class AnthropicLLM {
|
|||||||
"INVALID ANTHROPIC SETUP. No embedding engine has been set. Go to instance settings and set up an embedding interface to use Anthropic as your LLM."
|
"INVALID ANTHROPIC SETUP. No embedding engine has been set. Go to instance settings and set up an embedding interface to use Anthropic as your LLM."
|
||||||
);
|
);
|
||||||
this.embedder = embedder;
|
this.embedder = embedder;
|
||||||
this.answerKey = v4().split("-")[0];
|
|
||||||
this.defaultTemp = 0.7;
|
this.defaultTemp = 0.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ class AnthropicLLM {
|
|||||||
async streamGetChatCompletion(messages = null, { temperature = 0.7 }) {
|
async streamGetChatCompletion(messages = null, { temperature = 0.7 }) {
|
||||||
if (!this.isValidChatCompletionModel(this.model))
|
if (!this.isValidChatCompletionModel(this.model))
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`OpenAI chat: ${this.model} is not valid for chat completion!`
|
`Anthropic chat: ${this.model} is not valid for chat completion!`
|
||||||
);
|
);
|
||||||
|
|
||||||
const streamRequest = await this.anthropic.messages.stream({
|
const streamRequest = await this.anthropic.messages.stream({
|
||||||
@ -163,6 +163,28 @@ class AnthropicLLM {
|
|||||||
const handleAbort = () => clientAbortedHandler(resolve, fullText);
|
const handleAbort = () => clientAbortedHandler(resolve, fullText);
|
||||||
response.on("close", handleAbort);
|
response.on("close", handleAbort);
|
||||||
|
|
||||||
|
stream.on("error", (event) => {
|
||||||
|
const parseErrorMsg = (event) => {
|
||||||
|
const error = event?.error?.error;
|
||||||
|
if (!!error)
|
||||||
|
return `Anthropic Error:${error?.type || "unknown"} ${
|
||||||
|
error?.message || "unknown error."
|
||||||
|
}`;
|
||||||
|
return event.message;
|
||||||
|
};
|
||||||
|
|
||||||
|
writeResponseChunk(response, {
|
||||||
|
uuid,
|
||||||
|
sources: [],
|
||||||
|
type: "abort",
|
||||||
|
textResponse: null,
|
||||||
|
close: true,
|
||||||
|
error: parseErrorMsg(event),
|
||||||
|
});
|
||||||
|
response.removeListener("close", handleAbort);
|
||||||
|
resolve(fullText);
|
||||||
|
});
|
||||||
|
|
||||||
stream.on("streamEvent", (message) => {
|
stream.on("streamEvent", (message) => {
|
||||||
const data = message;
|
const data = message;
|
||||||
if (
|
if (
|
||||||
|
@ -46,32 +46,28 @@ class OpenAiLLM {
|
|||||||
promptWindowLimit() {
|
promptWindowLimit() {
|
||||||
switch (this.model) {
|
switch (this.model) {
|
||||||
case "gpt-3.5-turbo":
|
case "gpt-3.5-turbo":
|
||||||
return 4096;
|
|
||||||
case "gpt-3.5-turbo-1106":
|
case "gpt-3.5-turbo-1106":
|
||||||
return 16385;
|
return 16_385;
|
||||||
case "gpt-4":
|
case "gpt-4-turbo":
|
||||||
return 8192;
|
|
||||||
case "gpt-4-1106-preview":
|
case "gpt-4-1106-preview":
|
||||||
return 128000;
|
|
||||||
case "gpt-4-turbo-preview":
|
case "gpt-4-turbo-preview":
|
||||||
return 128000;
|
return 128_000;
|
||||||
|
case "gpt-4":
|
||||||
|
return 8_192;
|
||||||
case "gpt-4-32k":
|
case "gpt-4-32k":
|
||||||
return 32000;
|
return 32_000;
|
||||||
default:
|
default:
|
||||||
return 4096; // assume a fine-tune 3.5
|
return 4_096; // assume a fine-tune 3.5?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Short circuit if name has 'gpt' since we now fetch models from OpenAI API
|
||||||
|
// via the user API key, so the model must be relevant and real.
|
||||||
|
// and if somehow it is not, chat will fail but that is caught.
|
||||||
|
// we don't want to hit the OpenAI api every chat because it will get spammed
|
||||||
|
// and introduce latency for no reason.
|
||||||
async isValidChatCompletionModel(modelName = "") {
|
async isValidChatCompletionModel(modelName = "") {
|
||||||
const validModels = [
|
const isPreset = modelName.toLowerCase().includes("gpt");
|
||||||
"gpt-4",
|
|
||||||
"gpt-3.5-turbo",
|
|
||||||
"gpt-3.5-turbo-1106",
|
|
||||||
"gpt-4-1106-preview",
|
|
||||||
"gpt-4-turbo-preview",
|
|
||||||
"gpt-4-32k",
|
|
||||||
];
|
|
||||||
const isPreset = validModels.some((model) => modelName === model);
|
|
||||||
if (isPreset) return true;
|
if (isPreset) return true;
|
||||||
|
|
||||||
const model = await this.openai
|
const model = await this.openai
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
const MODELS = {
|
const MODELS = {
|
||||||
"nousresearch/nous-capybara-34b": {
|
|
||||||
id: "nousresearch/nous-capybara-34b",
|
|
||||||
name: "Nous: Capybara 34B",
|
|
||||||
organization: "Nousresearch",
|
|
||||||
maxLength: 32768,
|
|
||||||
},
|
|
||||||
"openrouter/auto": {
|
"openrouter/auto": {
|
||||||
id: "openrouter/auto",
|
id: "openrouter/auto",
|
||||||
name: "Auto (best for prompt)",
|
name: "Auto (best for prompt)",
|
||||||
@ -21,6 +15,12 @@ const MODELS = {
|
|||||||
id: "mistralai/mistral-7b-instruct:free",
|
id: "mistralai/mistral-7b-instruct:free",
|
||||||
name: "Mistral 7B Instruct (free)",
|
name: "Mistral 7B Instruct (free)",
|
||||||
organization: "Mistralai",
|
organization: "Mistralai",
|
||||||
|
maxLength: 32768,
|
||||||
|
},
|
||||||
|
"openchat/openchat-7b:free": {
|
||||||
|
id: "openchat/openchat-7b:free",
|
||||||
|
name: "OpenChat 3.5 (free)",
|
||||||
|
organization: "Openchat",
|
||||||
maxLength: 8192,
|
maxLength: 8192,
|
||||||
},
|
},
|
||||||
"gryphe/mythomist-7b:free": {
|
"gryphe/mythomist-7b:free": {
|
||||||
@ -45,13 +45,7 @@ const MODELS = {
|
|||||||
id: "google/gemma-7b-it:free",
|
id: "google/gemma-7b-it:free",
|
||||||
name: "Google: Gemma 7B (free)",
|
name: "Google: Gemma 7B (free)",
|
||||||
organization: "Google",
|
organization: "Google",
|
||||||
maxLength: 8000,
|
maxLength: 8192,
|
||||||
},
|
|
||||||
"jondurbin/bagel-34b": {
|
|
||||||
id: "jondurbin/bagel-34b",
|
|
||||||
name: "Bagel 34B v0.2",
|
|
||||||
organization: "Jondurbin",
|
|
||||||
maxLength: 8000,
|
|
||||||
},
|
},
|
||||||
"jebcarter/psyfighter-13b": {
|
"jebcarter/psyfighter-13b": {
|
||||||
id: "jebcarter/psyfighter-13b",
|
id: "jebcarter/psyfighter-13b",
|
||||||
@ -65,54 +59,12 @@ const MODELS = {
|
|||||||
organization: "Koboldai",
|
organization: "Koboldai",
|
||||||
maxLength: 4096,
|
maxLength: 4096,
|
||||||
},
|
},
|
||||||
"neversleep/noromaid-mixtral-8x7b-instruct": {
|
|
||||||
id: "neversleep/noromaid-mixtral-8x7b-instruct",
|
|
||||||
name: "Noromaid Mixtral 8x7B Instruct",
|
|
||||||
organization: "Neversleep",
|
|
||||||
maxLength: 8000,
|
|
||||||
},
|
|
||||||
"nousresearch/nous-hermes-llama2-13b": {
|
|
||||||
id: "nousresearch/nous-hermes-llama2-13b",
|
|
||||||
name: "Nous: Hermes 13B",
|
|
||||||
organization: "Nousresearch",
|
|
||||||
maxLength: 4096,
|
|
||||||
},
|
|
||||||
"meta-llama/codellama-34b-instruct": {
|
|
||||||
id: "meta-llama/codellama-34b-instruct",
|
|
||||||
name: "Meta: CodeLlama 34B Instruct",
|
|
||||||
organization: "Meta-llama",
|
|
||||||
maxLength: 8192,
|
|
||||||
},
|
|
||||||
"phind/phind-codellama-34b": {
|
|
||||||
id: "phind/phind-codellama-34b",
|
|
||||||
name: "Phind: CodeLlama 34B v2",
|
|
||||||
organization: "Phind",
|
|
||||||
maxLength: 4096,
|
|
||||||
},
|
|
||||||
"intel/neural-chat-7b": {
|
"intel/neural-chat-7b": {
|
||||||
id: "intel/neural-chat-7b",
|
id: "intel/neural-chat-7b",
|
||||||
name: "Neural Chat 7B v3.1",
|
name: "Neural Chat 7B v3.1",
|
||||||
organization: "Intel",
|
organization: "Intel",
|
||||||
maxLength: 4096,
|
maxLength: 4096,
|
||||||
},
|
},
|
||||||
"mistralai/mixtral-8x7b-instruct": {
|
|
||||||
id: "mistralai/mixtral-8x7b-instruct",
|
|
||||||
name: "Mistral: Mixtral 8x7B Instruct",
|
|
||||||
organization: "Mistralai",
|
|
||||||
maxLength: 32768,
|
|
||||||
},
|
|
||||||
"nousresearch/nous-hermes-2-mixtral-8x7b-dpo": {
|
|
||||||
id: "nousresearch/nous-hermes-2-mixtral-8x7b-dpo",
|
|
||||||
name: "Nous: Hermes 2 Mixtral 8x7B DPO",
|
|
||||||
organization: "Nousresearch",
|
|
||||||
maxLength: 32000,
|
|
||||||
},
|
|
||||||
"nousresearch/nous-hermes-2-mixtral-8x7b-sft": {
|
|
||||||
id: "nousresearch/nous-hermes-2-mixtral-8x7b-sft",
|
|
||||||
name: "Nous: Hermes 2 Mixtral 8x7B SFT",
|
|
||||||
organization: "Nousresearch",
|
|
||||||
maxLength: 32000,
|
|
||||||
},
|
|
||||||
"haotian-liu/llava-13b": {
|
"haotian-liu/llava-13b": {
|
||||||
id: "haotian-liu/llava-13b",
|
id: "haotian-liu/llava-13b",
|
||||||
name: "Llava 13B",
|
name: "Llava 13B",
|
||||||
@ -143,30 +95,12 @@ const MODELS = {
|
|||||||
organization: "Pygmalionai",
|
organization: "Pygmalionai",
|
||||||
maxLength: 8192,
|
maxLength: 8192,
|
||||||
},
|
},
|
||||||
"undi95/remm-slerp-l2-13b-6k": {
|
|
||||||
id: "undi95/remm-slerp-l2-13b-6k",
|
|
||||||
name: "ReMM SLERP 13B 6k",
|
|
||||||
organization: "Undi95",
|
|
||||||
maxLength: 6144,
|
|
||||||
},
|
|
||||||
"gryphe/mythomax-l2-13b": {
|
|
||||||
id: "gryphe/mythomax-l2-13b",
|
|
||||||
name: "MythoMax 13B",
|
|
||||||
organization: "Gryphe",
|
|
||||||
maxLength: 4096,
|
|
||||||
},
|
|
||||||
"xwin-lm/xwin-lm-70b": {
|
"xwin-lm/xwin-lm-70b": {
|
||||||
id: "xwin-lm/xwin-lm-70b",
|
id: "xwin-lm/xwin-lm-70b",
|
||||||
name: "Xwin 70B",
|
name: "Xwin 70B",
|
||||||
organization: "Xwin-lm",
|
organization: "Xwin-lm",
|
||||||
maxLength: 8192,
|
maxLength: 8192,
|
||||||
},
|
},
|
||||||
"gryphe/mythomax-l2-13b-8k": {
|
|
||||||
id: "gryphe/mythomax-l2-13b-8k",
|
|
||||||
name: "MythoMax 13B 8k",
|
|
||||||
organization: "Gryphe",
|
|
||||||
maxLength: 8192,
|
|
||||||
},
|
|
||||||
"alpindale/goliath-120b": {
|
"alpindale/goliath-120b": {
|
||||||
id: "alpindale/goliath-120b",
|
id: "alpindale/goliath-120b",
|
||||||
name: "Goliath 120B",
|
name: "Goliath 120B",
|
||||||
@ -185,15 +119,27 @@ const MODELS = {
|
|||||||
organization: "Gryphe",
|
organization: "Gryphe",
|
||||||
maxLength: 32768,
|
maxLength: 32768,
|
||||||
},
|
},
|
||||||
|
"sophosympatheia/midnight-rose-70b": {
|
||||||
|
id: "sophosympatheia/midnight-rose-70b",
|
||||||
|
name: "Midnight Rose 70B",
|
||||||
|
organization: "Sophosympatheia",
|
||||||
|
maxLength: 4096,
|
||||||
|
},
|
||||||
|
"undi95/remm-slerp-l2-13b:extended": {
|
||||||
|
id: "undi95/remm-slerp-l2-13b:extended",
|
||||||
|
name: "ReMM SLERP 13B (extended)",
|
||||||
|
organization: "Undi95",
|
||||||
|
maxLength: 6144,
|
||||||
|
},
|
||||||
"mancer/weaver": {
|
"mancer/weaver": {
|
||||||
id: "mancer/weaver",
|
id: "mancer/weaver",
|
||||||
name: "Mancer: Weaver (alpha)",
|
name: "Mancer: Weaver (alpha)",
|
||||||
organization: "Mancer",
|
organization: "Mancer",
|
||||||
maxLength: 8000,
|
maxLength: 8000,
|
||||||
},
|
},
|
||||||
"nousresearch/nous-hermes-llama2-70b": {
|
"nousresearch/nous-hermes-llama2-13b": {
|
||||||
id: "nousresearch/nous-hermes-llama2-70b",
|
id: "nousresearch/nous-hermes-llama2-13b",
|
||||||
name: "Nous: Hermes 70B",
|
name: "Nous: Hermes 13B",
|
||||||
organization: "Nousresearch",
|
organization: "Nousresearch",
|
||||||
maxLength: 4096,
|
maxLength: 4096,
|
||||||
},
|
},
|
||||||
@ -203,12 +149,24 @@ const MODELS = {
|
|||||||
organization: "Nousresearch",
|
organization: "Nousresearch",
|
||||||
maxLength: 4096,
|
maxLength: 4096,
|
||||||
},
|
},
|
||||||
|
"meta-llama/codellama-34b-instruct": {
|
||||||
|
id: "meta-llama/codellama-34b-instruct",
|
||||||
|
name: "Meta: CodeLlama 34B Instruct",
|
||||||
|
organization: "Meta-llama",
|
||||||
|
maxLength: 8192,
|
||||||
|
},
|
||||||
"codellama/codellama-70b-instruct": {
|
"codellama/codellama-70b-instruct": {
|
||||||
id: "codellama/codellama-70b-instruct",
|
id: "codellama/codellama-70b-instruct",
|
||||||
name: "Meta: CodeLlama 70B Instruct",
|
name: "Meta: CodeLlama 70B Instruct",
|
||||||
organization: "Codellama",
|
organization: "Codellama",
|
||||||
maxLength: 2048,
|
maxLength: 2048,
|
||||||
},
|
},
|
||||||
|
"phind/phind-codellama-34b": {
|
||||||
|
id: "phind/phind-codellama-34b",
|
||||||
|
name: "Phind: CodeLlama 34B v2",
|
||||||
|
organization: "Phind",
|
||||||
|
maxLength: 4096,
|
||||||
|
},
|
||||||
"teknium/openhermes-2-mistral-7b": {
|
"teknium/openhermes-2-mistral-7b": {
|
||||||
id: "teknium/openhermes-2-mistral-7b",
|
id: "teknium/openhermes-2-mistral-7b",
|
||||||
name: "OpenHermes 2 Mistral 7B",
|
name: "OpenHermes 2 Mistral 7B",
|
||||||
@ -227,12 +185,6 @@ const MODELS = {
|
|||||||
organization: "Undi95",
|
organization: "Undi95",
|
||||||
maxLength: 4096,
|
maxLength: 4096,
|
||||||
},
|
},
|
||||||
"undi95/toppy-m-7b": {
|
|
||||||
id: "undi95/toppy-m-7b",
|
|
||||||
name: "Toppy M 7B",
|
|
||||||
organization: "Undi95",
|
|
||||||
maxLength: 4096,
|
|
||||||
},
|
|
||||||
"openrouter/cinematika-7b": {
|
"openrouter/cinematika-7b": {
|
||||||
id: "openrouter/cinematika-7b",
|
id: "openrouter/cinematika-7b",
|
||||||
name: "Cinematika 7B (alpha)",
|
name: "Cinematika 7B (alpha)",
|
||||||
@ -271,7 +223,7 @@ const MODELS = {
|
|||||||
},
|
},
|
||||||
"mistralai/mixtral-8x7b": {
|
"mistralai/mixtral-8x7b": {
|
||||||
id: "mistralai/mixtral-8x7b",
|
id: "mistralai/mixtral-8x7b",
|
||||||
name: "Mistral: Mixtral 8x7B (base)",
|
name: "Mixtral 8x7B (base)",
|
||||||
organization: "Mistralai",
|
organization: "Mistralai",
|
||||||
maxLength: 32768,
|
maxLength: 32768,
|
||||||
},
|
},
|
||||||
@ -281,6 +233,12 @@ const MODELS = {
|
|||||||
organization: "Nousresearch",
|
organization: "Nousresearch",
|
||||||
maxLength: 4096,
|
maxLength: 4096,
|
||||||
},
|
},
|
||||||
|
"nousresearch/nous-hermes-2-mixtral-8x7b-sft": {
|
||||||
|
id: "nousresearch/nous-hermes-2-mixtral-8x7b-sft",
|
||||||
|
name: "Nous: Hermes 2 Mixtral 8x7B SFT",
|
||||||
|
organization: "Nousresearch",
|
||||||
|
maxLength: 32000,
|
||||||
|
},
|
||||||
"nousresearch/nous-hermes-2-mistral-7b-dpo": {
|
"nousresearch/nous-hermes-2-mistral-7b-dpo": {
|
||||||
id: "nousresearch/nous-hermes-2-mistral-7b-dpo",
|
id: "nousresearch/nous-hermes-2-mistral-7b-dpo",
|
||||||
name: "Nous: Hermes 2 Mistral 7B DPO",
|
name: "Nous: Hermes 2 Mistral 7B DPO",
|
||||||
@ -303,7 +261,7 @@ const MODELS = {
|
|||||||
id: "openai/gpt-3.5-turbo",
|
id: "openai/gpt-3.5-turbo",
|
||||||
name: "OpenAI: GPT-3.5 Turbo",
|
name: "OpenAI: GPT-3.5 Turbo",
|
||||||
organization: "Openai",
|
organization: "Openai",
|
||||||
maxLength: 4095,
|
maxLength: 16385,
|
||||||
},
|
},
|
||||||
"openai/gpt-3.5-turbo-0125": {
|
"openai/gpt-3.5-turbo-0125": {
|
||||||
id: "openai/gpt-3.5-turbo-0125",
|
id: "openai/gpt-3.5-turbo-0125",
|
||||||
@ -335,9 +293,15 @@ const MODELS = {
|
|||||||
organization: "Openai",
|
organization: "Openai",
|
||||||
maxLength: 16385,
|
maxLength: 16385,
|
||||||
},
|
},
|
||||||
|
"openai/gpt-4-turbo": {
|
||||||
|
id: "openai/gpt-4-turbo",
|
||||||
|
name: "OpenAI: GPT-4 Turbo",
|
||||||
|
organization: "Openai",
|
||||||
|
maxLength: 128000,
|
||||||
|
},
|
||||||
"openai/gpt-4-turbo-preview": {
|
"openai/gpt-4-turbo-preview": {
|
||||||
id: "openai/gpt-4-turbo-preview",
|
id: "openai/gpt-4-turbo-preview",
|
||||||
name: "OpenAI: GPT-4 Turbo (preview)",
|
name: "OpenAI: GPT-4 Turbo Preview",
|
||||||
organization: "Openai",
|
organization: "Openai",
|
||||||
maxLength: 128000,
|
maxLength: 128000,
|
||||||
},
|
},
|
||||||
@ -373,7 +337,7 @@ const MODELS = {
|
|||||||
},
|
},
|
||||||
"openai/gpt-4-vision-preview": {
|
"openai/gpt-4-vision-preview": {
|
||||||
id: "openai/gpt-4-vision-preview",
|
id: "openai/gpt-4-vision-preview",
|
||||||
name: "OpenAI: GPT-4 Vision (preview)",
|
name: "OpenAI: GPT-4 Vision",
|
||||||
organization: "Openai",
|
organization: "Openai",
|
||||||
maxLength: 128000,
|
maxLength: 128000,
|
||||||
},
|
},
|
||||||
@ -387,37 +351,43 @@ const MODELS = {
|
|||||||
id: "google/palm-2-chat-bison",
|
id: "google/palm-2-chat-bison",
|
||||||
name: "Google: PaLM 2 Chat",
|
name: "Google: PaLM 2 Chat",
|
||||||
organization: "Google",
|
organization: "Google",
|
||||||
maxLength: 36864,
|
maxLength: 25804,
|
||||||
},
|
},
|
||||||
"google/palm-2-codechat-bison": {
|
"google/palm-2-codechat-bison": {
|
||||||
id: "google/palm-2-codechat-bison",
|
id: "google/palm-2-codechat-bison",
|
||||||
name: "Google: PaLM 2 Code Chat",
|
name: "Google: PaLM 2 Code Chat",
|
||||||
organization: "Google",
|
organization: "Google",
|
||||||
maxLength: 28672,
|
maxLength: 20070,
|
||||||
},
|
},
|
||||||
"google/palm-2-chat-bison-32k": {
|
"google/palm-2-chat-bison-32k": {
|
||||||
id: "google/palm-2-chat-bison-32k",
|
id: "google/palm-2-chat-bison-32k",
|
||||||
name: "Google: PaLM 2 Chat 32k",
|
name: "Google: PaLM 2 Chat 32k",
|
||||||
organization: "Google",
|
organization: "Google",
|
||||||
maxLength: 131072,
|
maxLength: 91750,
|
||||||
},
|
},
|
||||||
"google/palm-2-codechat-bison-32k": {
|
"google/palm-2-codechat-bison-32k": {
|
||||||
id: "google/palm-2-codechat-bison-32k",
|
id: "google/palm-2-codechat-bison-32k",
|
||||||
name: "Google: PaLM 2 Code Chat 32k",
|
name: "Google: PaLM 2 Code Chat 32k",
|
||||||
organization: "Google",
|
organization: "Google",
|
||||||
maxLength: 131072,
|
maxLength: 91750,
|
||||||
},
|
},
|
||||||
"google/gemini-pro": {
|
"google/gemini-pro": {
|
||||||
id: "google/gemini-pro",
|
id: "google/gemini-pro",
|
||||||
name: "Google: Gemini Pro (preview)",
|
name: "Google: Gemini Pro 1.0",
|
||||||
organization: "Google",
|
organization: "Google",
|
||||||
maxLength: 131040,
|
maxLength: 91728,
|
||||||
},
|
},
|
||||||
"google/gemini-pro-vision": {
|
"google/gemini-pro-vision": {
|
||||||
id: "google/gemini-pro-vision",
|
id: "google/gemini-pro-vision",
|
||||||
name: "Google: Gemini Pro Vision (preview)",
|
name: "Google: Gemini Pro Vision 1.0",
|
||||||
organization: "Google",
|
organization: "Google",
|
||||||
maxLength: 65536,
|
maxLength: 45875,
|
||||||
|
},
|
||||||
|
"google/gemini-pro-1.5": {
|
||||||
|
id: "google/gemini-pro-1.5",
|
||||||
|
name: "Google: Gemini Pro 1.5 (preview)",
|
||||||
|
organization: "Google",
|
||||||
|
maxLength: 2800000,
|
||||||
},
|
},
|
||||||
"perplexity/pplx-70b-online": {
|
"perplexity/pplx-70b-online": {
|
||||||
id: "perplexity/pplx-70b-online",
|
id: "perplexity/pplx-70b-online",
|
||||||
@ -443,18 +413,96 @@ const MODELS = {
|
|||||||
organization: "Perplexity",
|
organization: "Perplexity",
|
||||||
maxLength: 4096,
|
maxLength: 4096,
|
||||||
},
|
},
|
||||||
|
"perplexity/sonar-small-chat": {
|
||||||
|
id: "perplexity/sonar-small-chat",
|
||||||
|
name: "Perplexity: Sonar 7B",
|
||||||
|
organization: "Perplexity",
|
||||||
|
maxLength: 16384,
|
||||||
|
},
|
||||||
|
"perplexity/sonar-medium-chat": {
|
||||||
|
id: "perplexity/sonar-medium-chat",
|
||||||
|
name: "Perplexity: Sonar 8x7B",
|
||||||
|
organization: "Perplexity",
|
||||||
|
maxLength: 16384,
|
||||||
|
},
|
||||||
|
"perplexity/sonar-small-online": {
|
||||||
|
id: "perplexity/sonar-small-online",
|
||||||
|
name: "Perplexity: Sonar 7B Online",
|
||||||
|
organization: "Perplexity",
|
||||||
|
maxLength: 12000,
|
||||||
|
},
|
||||||
|
"perplexity/sonar-medium-online": {
|
||||||
|
id: "perplexity/sonar-medium-online",
|
||||||
|
name: "Perplexity: Sonar 8x7B Online",
|
||||||
|
organization: "Perplexity",
|
||||||
|
maxLength: 12000,
|
||||||
|
},
|
||||||
|
"fireworks/mixtral-8x22b-instruct-preview": {
|
||||||
|
id: "fireworks/mixtral-8x22b-instruct-preview",
|
||||||
|
name: "Fireworks Mixtral 8x22B Instruct OH (preview)",
|
||||||
|
organization: "Fireworks",
|
||||||
|
maxLength: 8192,
|
||||||
|
},
|
||||||
|
"anthropic/claude-3-opus": {
|
||||||
|
id: "anthropic/claude-3-opus",
|
||||||
|
name: "Anthropic: Claude 3 Opus",
|
||||||
|
organization: "Anthropic",
|
||||||
|
maxLength: 200000,
|
||||||
|
},
|
||||||
|
"anthropic/claude-3-sonnet": {
|
||||||
|
id: "anthropic/claude-3-sonnet",
|
||||||
|
name: "Anthropic: Claude 3 Sonnet",
|
||||||
|
organization: "Anthropic",
|
||||||
|
maxLength: 200000,
|
||||||
|
},
|
||||||
|
"anthropic/claude-3-haiku": {
|
||||||
|
id: "anthropic/claude-3-haiku",
|
||||||
|
name: "Anthropic: Claude 3 Haiku",
|
||||||
|
organization: "Anthropic",
|
||||||
|
maxLength: 200000,
|
||||||
|
},
|
||||||
|
"anthropic/claude-3-opus:beta": {
|
||||||
|
id: "anthropic/claude-3-opus:beta",
|
||||||
|
name: "Anthropic: Claude 3 Opus (self-moderated)",
|
||||||
|
organization: "Anthropic",
|
||||||
|
maxLength: 200000,
|
||||||
|
},
|
||||||
|
"anthropic/claude-3-sonnet:beta": {
|
||||||
|
id: "anthropic/claude-3-sonnet:beta",
|
||||||
|
name: "Anthropic: Claude 3 Sonnet (self-moderated)",
|
||||||
|
organization: "Anthropic",
|
||||||
|
maxLength: 200000,
|
||||||
|
},
|
||||||
|
"anthropic/claude-3-haiku:beta": {
|
||||||
|
id: "anthropic/claude-3-haiku:beta",
|
||||||
|
name: "Anthropic: Claude 3 Haiku (self-moderated)",
|
||||||
|
organization: "Anthropic",
|
||||||
|
maxLength: 200000,
|
||||||
|
},
|
||||||
"meta-llama/llama-2-70b-chat": {
|
"meta-llama/llama-2-70b-chat": {
|
||||||
id: "meta-llama/llama-2-70b-chat",
|
id: "meta-llama/llama-2-70b-chat",
|
||||||
name: "Meta: Llama v2 70B Chat",
|
name: "Meta: Llama v2 70B Chat",
|
||||||
organization: "Meta-llama",
|
organization: "Meta-llama",
|
||||||
maxLength: 4096,
|
maxLength: 4096,
|
||||||
},
|
},
|
||||||
|
"nousresearch/nous-capybara-34b": {
|
||||||
|
id: "nousresearch/nous-capybara-34b",
|
||||||
|
name: "Nous: Capybara 34B",
|
||||||
|
organization: "Nousresearch",
|
||||||
|
maxLength: 32768,
|
||||||
|
},
|
||||||
"jondurbin/airoboros-l2-70b": {
|
"jondurbin/airoboros-l2-70b": {
|
||||||
id: "jondurbin/airoboros-l2-70b",
|
id: "jondurbin/airoboros-l2-70b",
|
||||||
name: "Airoboros 70B",
|
name: "Airoboros 70B",
|
||||||
organization: "Jondurbin",
|
organization: "Jondurbin",
|
||||||
maxLength: 4096,
|
maxLength: 4096,
|
||||||
},
|
},
|
||||||
|
"jondurbin/bagel-34b": {
|
||||||
|
id: "jondurbin/bagel-34b",
|
||||||
|
name: "Bagel 34B v0.2",
|
||||||
|
organization: "Jondurbin",
|
||||||
|
maxLength: 8000,
|
||||||
|
},
|
||||||
"austism/chronos-hermes-13b": {
|
"austism/chronos-hermes-13b": {
|
||||||
id: "austism/chronos-hermes-13b",
|
id: "austism/chronos-hermes-13b",
|
||||||
name: "Chronos Hermes 13B v2",
|
name: "Chronos Hermes 13B v2",
|
||||||
@ -465,7 +513,13 @@ const MODELS = {
|
|||||||
id: "mistralai/mistral-7b-instruct",
|
id: "mistralai/mistral-7b-instruct",
|
||||||
name: "Mistral 7B Instruct",
|
name: "Mistral 7B Instruct",
|
||||||
organization: "Mistralai",
|
organization: "Mistralai",
|
||||||
maxLength: 8192,
|
maxLength: 32768,
|
||||||
|
},
|
||||||
|
"gryphe/mythomax-l2-13b": {
|
||||||
|
id: "gryphe/mythomax-l2-13b",
|
||||||
|
name: "MythoMax 13B",
|
||||||
|
organization: "Gryphe",
|
||||||
|
maxLength: 4096,
|
||||||
},
|
},
|
||||||
"openchat/openchat-7b": {
|
"openchat/openchat-7b": {
|
||||||
id: "openchat/openchat-7b",
|
id: "openchat/openchat-7b",
|
||||||
@ -473,18 +527,42 @@ const MODELS = {
|
|||||||
organization: "Openchat",
|
organization: "Openchat",
|
||||||
maxLength: 8192,
|
maxLength: 8192,
|
||||||
},
|
},
|
||||||
|
"undi95/toppy-m-7b": {
|
||||||
|
id: "undi95/toppy-m-7b",
|
||||||
|
name: "Toppy M 7B",
|
||||||
|
organization: "Undi95",
|
||||||
|
maxLength: 4096,
|
||||||
|
},
|
||||||
"lizpreciatior/lzlv-70b-fp16-hf": {
|
"lizpreciatior/lzlv-70b-fp16-hf": {
|
||||||
id: "lizpreciatior/lzlv-70b-fp16-hf",
|
id: "lizpreciatior/lzlv-70b-fp16-hf",
|
||||||
name: "lzlv 70B",
|
name: "lzlv 70B",
|
||||||
organization: "Lizpreciatior",
|
organization: "Lizpreciatior",
|
||||||
maxLength: 4096,
|
maxLength: 4096,
|
||||||
},
|
},
|
||||||
|
"mistralai/mixtral-8x7b-instruct": {
|
||||||
|
id: "mistralai/mixtral-8x7b-instruct",
|
||||||
|
name: "Mixtral 8x7B Instruct",
|
||||||
|
organization: "Mistralai",
|
||||||
|
maxLength: 32768,
|
||||||
|
},
|
||||||
"cognitivecomputations/dolphin-mixtral-8x7b": {
|
"cognitivecomputations/dolphin-mixtral-8x7b": {
|
||||||
id: "cognitivecomputations/dolphin-mixtral-8x7b",
|
id: "cognitivecomputations/dolphin-mixtral-8x7b",
|
||||||
name: "Dolphin 2.6 Mixtral 8x7B 🐬",
|
name: "Dolphin 2.6 Mixtral 8x7B 🐬",
|
||||||
organization: "Cognitivecomputations",
|
organization: "Cognitivecomputations",
|
||||||
maxLength: 32000,
|
maxLength: 32000,
|
||||||
},
|
},
|
||||||
|
"neversleep/noromaid-mixtral-8x7b-instruct": {
|
||||||
|
id: "neversleep/noromaid-mixtral-8x7b-instruct",
|
||||||
|
name: "Noromaid Mixtral 8x7B Instruct",
|
||||||
|
organization: "Neversleep",
|
||||||
|
maxLength: 8000,
|
||||||
|
},
|
||||||
|
"nousresearch/nous-hermes-2-mixtral-8x7b-dpo": {
|
||||||
|
id: "nousresearch/nous-hermes-2-mixtral-8x7b-dpo",
|
||||||
|
name: "Nous: Hermes 2 Mixtral 8x7B DPO",
|
||||||
|
organization: "Nousresearch",
|
||||||
|
maxLength: 32000,
|
||||||
|
},
|
||||||
"rwkv/rwkv-5-world-3b": {
|
"rwkv/rwkv-5-world-3b": {
|
||||||
id: "rwkv/rwkv-5-world-3b",
|
id: "rwkv/rwkv-5-world-3b",
|
||||||
name: "RWKV v5 World 3B",
|
name: "RWKV v5 World 3B",
|
||||||
@ -507,7 +585,19 @@ const MODELS = {
|
|||||||
id: "google/gemma-7b-it",
|
id: "google/gemma-7b-it",
|
||||||
name: "Google: Gemma 7B",
|
name: "Google: Gemma 7B",
|
||||||
organization: "Google",
|
organization: "Google",
|
||||||
maxLength: 8000,
|
maxLength: 8192,
|
||||||
|
},
|
||||||
|
"databricks/dbrx-instruct": {
|
||||||
|
id: "databricks/dbrx-instruct",
|
||||||
|
name: "Databricks: DBRX 132B Instruct",
|
||||||
|
organization: "Databricks",
|
||||||
|
maxLength: 32768,
|
||||||
|
},
|
||||||
|
"huggingfaceh4/zephyr-orpo-141b-a35b": {
|
||||||
|
id: "huggingfaceh4/zephyr-orpo-141b-a35b",
|
||||||
|
name: "Zephyr 141B-A35B",
|
||||||
|
organization: "Huggingfaceh4",
|
||||||
|
maxLength: 65536,
|
||||||
},
|
},
|
||||||
"anthropic/claude-2": {
|
"anthropic/claude-2": {
|
||||||
id: "anthropic/claude-2",
|
id: "anthropic/claude-2",
|
||||||
@ -565,58 +655,124 @@ const MODELS = {
|
|||||||
},
|
},
|
||||||
"anthropic/claude-2:beta": {
|
"anthropic/claude-2:beta": {
|
||||||
id: "anthropic/claude-2:beta",
|
id: "anthropic/claude-2:beta",
|
||||||
name: "Anthropic: Claude v2 (experimental)",
|
name: "Anthropic: Claude v2 (self-moderated)",
|
||||||
organization: "Anthropic",
|
organization: "Anthropic",
|
||||||
maxLength: 200000,
|
maxLength: 200000,
|
||||||
},
|
},
|
||||||
"anthropic/claude-2.1:beta": {
|
"anthropic/claude-2.1:beta": {
|
||||||
id: "anthropic/claude-2.1:beta",
|
id: "anthropic/claude-2.1:beta",
|
||||||
name: "Anthropic: Claude v2.1 (experimental)",
|
name: "Anthropic: Claude v2.1 (self-moderated)",
|
||||||
organization: "Anthropic",
|
organization: "Anthropic",
|
||||||
maxLength: 200000,
|
maxLength: 200000,
|
||||||
},
|
},
|
||||||
"anthropic/claude-2.0:beta": {
|
"anthropic/claude-2.0:beta": {
|
||||||
id: "anthropic/claude-2.0:beta",
|
id: "anthropic/claude-2.0:beta",
|
||||||
name: "Anthropic: Claude v2.0 (experimental)",
|
name: "Anthropic: Claude v2.0 (self-moderated)",
|
||||||
organization: "Anthropic",
|
organization: "Anthropic",
|
||||||
maxLength: 100000,
|
maxLength: 100000,
|
||||||
},
|
},
|
||||||
"anthropic/claude-instant-1:beta": {
|
"anthropic/claude-instant-1:beta": {
|
||||||
id: "anthropic/claude-instant-1:beta",
|
id: "anthropic/claude-instant-1:beta",
|
||||||
name: "Anthropic: Claude Instant v1 (experimental)",
|
name: "Anthropic: Claude Instant v1 (self-moderated)",
|
||||||
organization: "Anthropic",
|
organization: "Anthropic",
|
||||||
maxLength: 100000,
|
maxLength: 100000,
|
||||||
},
|
},
|
||||||
|
"mistralai/mixtral-8x22b": {
|
||||||
|
id: "mistralai/mixtral-8x22b",
|
||||||
|
name: "Mistral: Mixtral 8x22B (base)",
|
||||||
|
organization: "Mistralai",
|
||||||
|
maxLength: 65536,
|
||||||
|
},
|
||||||
"huggingfaceh4/zephyr-7b-beta:free": {
|
"huggingfaceh4/zephyr-7b-beta:free": {
|
||||||
id: "huggingfaceh4/zephyr-7b-beta:free",
|
id: "huggingfaceh4/zephyr-7b-beta:free",
|
||||||
name: "Hugging Face: Zephyr 7B (free)",
|
name: "Hugging Face: Zephyr 7B (free)",
|
||||||
organization: "Huggingfaceh4",
|
organization: "Huggingfaceh4",
|
||||||
maxLength: 4096,
|
maxLength: 4096,
|
||||||
},
|
},
|
||||||
"openchat/openchat-7b:free": {
|
"mistralai/mixtral-8x7b-instruct:nitro": {
|
||||||
id: "openchat/openchat-7b:free",
|
id: "mistralai/mixtral-8x7b-instruct:nitro",
|
||||||
name: "OpenChat 3.5 (free)",
|
name: "Mixtral 8x7B Instruct (nitro)",
|
||||||
organization: "Openchat",
|
organization: "Mistralai",
|
||||||
|
maxLength: 32768,
|
||||||
|
},
|
||||||
|
"meta-llama/llama-2-70b-chat:nitro": {
|
||||||
|
id: "meta-llama/llama-2-70b-chat:nitro",
|
||||||
|
name: "Meta: Llama v2 70B Chat (nitro)",
|
||||||
|
organization: "Meta-llama",
|
||||||
|
maxLength: 4096,
|
||||||
|
},
|
||||||
|
"gryphe/mythomax-l2-13b:nitro": {
|
||||||
|
id: "gryphe/mythomax-l2-13b:nitro",
|
||||||
|
name: "MythoMax 13B (nitro)",
|
||||||
|
organization: "Gryphe",
|
||||||
|
maxLength: 4096,
|
||||||
|
},
|
||||||
|
"mistralai/mistral-7b-instruct:nitro": {
|
||||||
|
id: "mistralai/mistral-7b-instruct:nitro",
|
||||||
|
name: "Mistral 7B Instruct (nitro)",
|
||||||
|
organization: "Mistralai",
|
||||||
|
maxLength: 32768,
|
||||||
|
},
|
||||||
|
"google/gemma-7b-it:nitro": {
|
||||||
|
id: "google/gemma-7b-it:nitro",
|
||||||
|
name: "Google: Gemma 7B (nitro)",
|
||||||
|
organization: "Google",
|
||||||
|
maxLength: 8192,
|
||||||
|
},
|
||||||
|
"databricks/dbrx-instruct:nitro": {
|
||||||
|
id: "databricks/dbrx-instruct:nitro",
|
||||||
|
name: "Databricks: DBRX 132B Instruct (nitro)",
|
||||||
|
organization: "Databricks",
|
||||||
|
maxLength: 32768,
|
||||||
|
},
|
||||||
|
"gryphe/mythomax-l2-13b:extended": {
|
||||||
|
id: "gryphe/mythomax-l2-13b:extended",
|
||||||
|
name: "MythoMax 13B (extended)",
|
||||||
|
organization: "Gryphe",
|
||||||
maxLength: 8192,
|
maxLength: 8192,
|
||||||
},
|
},
|
||||||
"mistralai/mistral-tiny": {
|
"mistralai/mistral-tiny": {
|
||||||
id: "mistralai/mistral-tiny",
|
id: "mistralai/mistral-tiny",
|
||||||
name: "Mistral: Tiny",
|
name: "Mistral Tiny",
|
||||||
organization: "Mistralai",
|
organization: "Mistralai",
|
||||||
maxLength: 32000,
|
maxLength: 32000,
|
||||||
},
|
},
|
||||||
"mistralai/mistral-small": {
|
"mistralai/mistral-small": {
|
||||||
id: "mistralai/mistral-small",
|
id: "mistralai/mistral-small",
|
||||||
name: "Mistral: Small",
|
name: "Mistral Small",
|
||||||
organization: "Mistralai",
|
organization: "Mistralai",
|
||||||
maxLength: 32000,
|
maxLength: 32000,
|
||||||
},
|
},
|
||||||
"mistralai/mistral-medium": {
|
"mistralai/mistral-medium": {
|
||||||
id: "mistralai/mistral-medium",
|
id: "mistralai/mistral-medium",
|
||||||
name: "Mistral: Medium",
|
name: "Mistral Medium",
|
||||||
organization: "Mistralai",
|
organization: "Mistralai",
|
||||||
maxLength: 32000,
|
maxLength: 32000,
|
||||||
},
|
},
|
||||||
|
"mistralai/mistral-large": {
|
||||||
|
id: "mistralai/mistral-large",
|
||||||
|
name: "Mistral Large",
|
||||||
|
organization: "Mistralai",
|
||||||
|
maxLength: 32000,
|
||||||
|
},
|
||||||
|
"cohere/command": {
|
||||||
|
id: "cohere/command",
|
||||||
|
name: "Cohere: Command",
|
||||||
|
organization: "Cohere",
|
||||||
|
maxLength: 4096,
|
||||||
|
},
|
||||||
|
"cohere/command-r": {
|
||||||
|
id: "cohere/command-r",
|
||||||
|
name: "Cohere: Command R",
|
||||||
|
organization: "Cohere",
|
||||||
|
maxLength: 128000,
|
||||||
|
},
|
||||||
|
"cohere/command-r-plus": {
|
||||||
|
id: "cohere/command-r-plus",
|
||||||
|
name: "Cohere: Command R+",
|
||||||
|
organization: "Cohere",
|
||||||
|
maxLength: 128000,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.MODELS = MODELS;
|
module.exports.MODELS = MODELS;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
// copy outputs into the export in ../models.js
|
// copy outputs into the export in ../models.js
|
||||||
|
|
||||||
// Update the date below if you run this again because OpenRouter added new models.
|
// Update the date below if you run this again because OpenRouter added new models.
|
||||||
// Last Collected: Feb 23, 2024
|
// Last Collected: Apr 14, 2024
|
||||||
|
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
|
|
||||||
|
@ -19,21 +19,11 @@ const MODELS = {
|
|||||||
name: "sonar-medium-online",
|
name: "sonar-medium-online",
|
||||||
maxLength: 12000,
|
maxLength: 12000,
|
||||||
},
|
},
|
||||||
"codellama-34b-instruct": {
|
|
||||||
id: "codellama-34b-instruct",
|
|
||||||
name: "codellama-34b-instruct",
|
|
||||||
maxLength: 16384,
|
|
||||||
},
|
|
||||||
"codellama-70b-instruct": {
|
"codellama-70b-instruct": {
|
||||||
id: "codellama-70b-instruct",
|
id: "codellama-70b-instruct",
|
||||||
name: "codellama-70b-instruct",
|
name: "codellama-70b-instruct",
|
||||||
maxLength: 16384,
|
maxLength: 16384,
|
||||||
},
|
},
|
||||||
"llama-2-70b-chat": {
|
|
||||||
id: "llama-2-70b-chat",
|
|
||||||
name: "llama-2-70b-chat",
|
|
||||||
maxLength: 4096,
|
|
||||||
},
|
|
||||||
"mistral-7b-instruct": {
|
"mistral-7b-instruct": {
|
||||||
id: "mistral-7b-instruct",
|
id: "mistral-7b-instruct",
|
||||||
name: "mistral-7b-instruct",
|
name: "mistral-7b-instruct",
|
||||||
@ -44,26 +34,6 @@ const MODELS = {
|
|||||||
name: "mixtral-8x7b-instruct",
|
name: "mixtral-8x7b-instruct",
|
||||||
maxLength: 16384,
|
maxLength: 16384,
|
||||||
},
|
},
|
||||||
"pplx-7b-chat": {
|
|
||||||
id: "pplx-7b-chat",
|
|
||||||
name: "pplx-7b-chat",
|
|
||||||
maxLength: 16384,
|
|
||||||
},
|
|
||||||
"pplx-7b-online": {
|
|
||||||
id: "pplx-7b-online",
|
|
||||||
name: "pplx-7b-online",
|
|
||||||
maxLength: 12000,
|
|
||||||
},
|
|
||||||
"pplx-70b-chat": {
|
|
||||||
id: "pplx-70b-chat",
|
|
||||||
name: "pplx-70b-chat",
|
|
||||||
maxLength: 8192,
|
|
||||||
},
|
|
||||||
"pplx-70b-online": {
|
|
||||||
id: "pplx-70b-online",
|
|
||||||
name: "pplx-70b-online",
|
|
||||||
maxLength: 4000,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.MODELS = MODELS;
|
module.exports.MODELS = MODELS;
|
||||||
|
@ -1,15 +1,9 @@
|
|||||||
| Model | Parameter Count | Context Length | Model Type |
|
| Model | Parameter Count | Context Length | Model Type |
|
||||||
| :-------------------------- | :-------------- | :------------- | :-------------- |
|
| :-------------------- | :-------------- | :------------- | :-------------- |
|
||||||
| `sonar-small-chat` | 7B | 16384 | Chat Completion |
|
| `sonar-small-chat` | 7B | 16384 | Chat Completion |
|
||||||
| `sonar-small-online` | 7B | 12000 | Chat Completion |
|
| `sonar-small-online` | 7B | 12000 | Chat Completion |
|
||||||
| `sonar-medium-chat` | 8x7B | 16384 | Chat Completion |
|
| `sonar-medium-chat` | 8x7B | 16384 | Chat Completion |
|
||||||
| `sonar-medium-online` | 8x7B | 12000 | Chat Completion |
|
| `sonar-medium-online` | 8x7B | 12000 | Chat Completion |
|
||||||
| `codellama-34b-instruct`[3] | 34B | 16384 | Chat Completion |
|
|
||||||
| `codellama-70b-instruct` | 70B | 16384 | Chat Completion |
|
| `codellama-70b-instruct` | 70B | 16384 | Chat Completion |
|
||||||
| `llama-2-70b-chat`[3] | 70B | 4096 | Chat Completion |
|
|
||||||
| `mistral-7b-instruct` [1] | 7B | 16384 | Chat Completion |
|
| `mistral-7b-instruct` [1] | 7B | 16384 | Chat Completion |
|
||||||
| `mixtral-8x7b-instruct` | 8x7B | 16384 | Chat Completion |
|
| `mixtral-8x7b-instruct` | 8x7B | 16384 | Chat Completion |
|
||||||
| `pplx-7b-chat`[2] [3] | 7B | 16384 | Chat Completion |
|
|
||||||
| `pplx-7b-online`[2] [3] | 7B | 12000 | Chat Completion |
|
|
||||||
| `pplx-70b-chat`[3] | 70B | 8192 | Chat Completion |
|
|
||||||
| `pplx-70b-online`[3] | 70B | 4000 | Chat Completion |
|
|
@ -8,7 +8,7 @@
|
|||||||
// copy outputs into the export in ../models.js
|
// copy outputs into the export in ../models.js
|
||||||
|
|
||||||
// Update the date below if you run this again because Perplexity added new models.
|
// Update the date below if you run this again because Perplexity added new models.
|
||||||
// Last Collected: Feb 23, 2024
|
// Last Collected: Apr 14, 2024
|
||||||
|
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
|
|
||||||
|
@ -1,8 +1,26 @@
|
|||||||
const MODELS = {
|
const MODELS = {
|
||||||
"togethercomputer/alpaca-7b": {
|
"zero-one-ai/Yi-34B-Chat": {
|
||||||
id: "togethercomputer/alpaca-7b",
|
id: "zero-one-ai/Yi-34B-Chat",
|
||||||
organization: "Stanford",
|
organization: "01.AI",
|
||||||
name: "Alpaca (7B)",
|
name: "01-ai Yi Chat (34B)",
|
||||||
|
maxLength: 4096,
|
||||||
|
},
|
||||||
|
"allenai/OLMo-7B-Instruct": {
|
||||||
|
id: "allenai/OLMo-7B-Instruct",
|
||||||
|
organization: "Allen AI",
|
||||||
|
name: "OLMo Instruct (7B)",
|
||||||
|
maxLength: 2048,
|
||||||
|
},
|
||||||
|
"allenai/OLMo-7B-Twin-2T": {
|
||||||
|
id: "allenai/OLMo-7B-Twin-2T",
|
||||||
|
organization: "Allen AI",
|
||||||
|
name: "OLMo Twin-2T (7B)",
|
||||||
|
maxLength: 2048,
|
||||||
|
},
|
||||||
|
"allenai/OLMo-7B": {
|
||||||
|
id: "allenai/OLMo-7B",
|
||||||
|
organization: "Allen AI",
|
||||||
|
name: "OLMo (7B)",
|
||||||
maxLength: 2048,
|
maxLength: 2048,
|
||||||
},
|
},
|
||||||
"Austism/chronos-hermes-13b": {
|
"Austism/chronos-hermes-13b": {
|
||||||
@ -11,96 +29,150 @@ const MODELS = {
|
|||||||
name: "Chronos Hermes (13B)",
|
name: "Chronos Hermes (13B)",
|
||||||
maxLength: 2048,
|
maxLength: 2048,
|
||||||
},
|
},
|
||||||
"togethercomputer/CodeLlama-13b-Instruct": {
|
"cognitivecomputations/dolphin-2.5-mixtral-8x7b": {
|
||||||
id: "togethercomputer/CodeLlama-13b-Instruct",
|
id: "cognitivecomputations/dolphin-2.5-mixtral-8x7b",
|
||||||
organization: "Meta",
|
organization: "cognitivecomputations",
|
||||||
name: "Code Llama Instruct (13B)",
|
name: "Dolphin 2.5 Mixtral 8x7b",
|
||||||
|
maxLength: 32768,
|
||||||
|
},
|
||||||
|
"databricks/dbrx-instruct": {
|
||||||
|
id: "databricks/dbrx-instruct",
|
||||||
|
organization: "databricks",
|
||||||
|
name: "DBRX Instruct",
|
||||||
|
maxLength: 32000,
|
||||||
|
},
|
||||||
|
"deepseek-ai/deepseek-coder-33b-instruct": {
|
||||||
|
id: "deepseek-ai/deepseek-coder-33b-instruct",
|
||||||
|
organization: "DeepSeek",
|
||||||
|
name: "Deepseek Coder Instruct (33B)",
|
||||||
|
maxLength: 16384,
|
||||||
|
},
|
||||||
|
"deepseek-ai/deepseek-llm-67b-chat": {
|
||||||
|
id: "deepseek-ai/deepseek-llm-67b-chat",
|
||||||
|
organization: "DeepSeek",
|
||||||
|
name: "DeepSeek LLM Chat (67B)",
|
||||||
|
maxLength: 4096,
|
||||||
|
},
|
||||||
|
"garage-bAInd/Platypus2-70B-instruct": {
|
||||||
|
id: "garage-bAInd/Platypus2-70B-instruct",
|
||||||
|
organization: "garage-bAInd",
|
||||||
|
name: "Platypus2 Instruct (70B)",
|
||||||
|
maxLength: 4096,
|
||||||
|
},
|
||||||
|
"google/gemma-2b-it": {
|
||||||
|
id: "google/gemma-2b-it",
|
||||||
|
organization: "Google",
|
||||||
|
name: "Gemma Instruct (2B)",
|
||||||
maxLength: 8192,
|
maxLength: 8192,
|
||||||
},
|
},
|
||||||
"togethercomputer/CodeLlama-34b-Instruct": {
|
"google/gemma-7b-it": {
|
||||||
id: "togethercomputer/CodeLlama-34b-Instruct",
|
id: "google/gemma-7b-it",
|
||||||
organization: "Meta",
|
organization: "Google",
|
||||||
name: "Code Llama Instruct (34B)",
|
name: "Gemma Instruct (7B)",
|
||||||
maxLength: 8192,
|
maxLength: 8192,
|
||||||
},
|
},
|
||||||
"togethercomputer/CodeLlama-7b-Instruct": {
|
|
||||||
id: "togethercomputer/CodeLlama-7b-Instruct",
|
|
||||||
organization: "Meta",
|
|
||||||
name: "Code Llama Instruct (7B)",
|
|
||||||
maxLength: 8192,
|
|
||||||
},
|
|
||||||
"DiscoResearch/DiscoLM-mixtral-8x7b-v2": {
|
|
||||||
id: "DiscoResearch/DiscoLM-mixtral-8x7b-v2",
|
|
||||||
organization: "DiscoResearch",
|
|
||||||
name: "DiscoLM Mixtral 8x7b",
|
|
||||||
maxLength: 32768,
|
|
||||||
},
|
|
||||||
"togethercomputer/falcon-40b-instruct": {
|
|
||||||
id: "togethercomputer/falcon-40b-instruct",
|
|
||||||
organization: "TII UAE",
|
|
||||||
name: "Falcon Instruct (40B)",
|
|
||||||
maxLength: 2048,
|
|
||||||
},
|
|
||||||
"togethercomputer/falcon-7b-instruct": {
|
|
||||||
id: "togethercomputer/falcon-7b-instruct",
|
|
||||||
organization: "TII UAE",
|
|
||||||
name: "Falcon Instruct (7B)",
|
|
||||||
maxLength: 2048,
|
|
||||||
},
|
|
||||||
"togethercomputer/GPT-NeoXT-Chat-Base-20B": {
|
|
||||||
id: "togethercomputer/GPT-NeoXT-Chat-Base-20B",
|
|
||||||
organization: "Together",
|
|
||||||
name: "GPT-NeoXT-Chat-Base (20B)",
|
|
||||||
maxLength: 2048,
|
|
||||||
},
|
|
||||||
"togethercomputer/llama-2-13b-chat": {
|
|
||||||
id: "togethercomputer/llama-2-13b-chat",
|
|
||||||
organization: "Meta",
|
|
||||||
name: "LLaMA-2 Chat (13B)",
|
|
||||||
maxLength: 4096,
|
|
||||||
},
|
|
||||||
"togethercomputer/llama-2-70b-chat": {
|
|
||||||
id: "togethercomputer/llama-2-70b-chat",
|
|
||||||
organization: "Meta",
|
|
||||||
name: "LLaMA-2 Chat (70B)",
|
|
||||||
maxLength: 4096,
|
|
||||||
},
|
|
||||||
"togethercomputer/llama-2-7b-chat": {
|
|
||||||
id: "togethercomputer/llama-2-7b-chat",
|
|
||||||
organization: "Meta",
|
|
||||||
name: "LLaMA-2 Chat (7B)",
|
|
||||||
maxLength: 4096,
|
|
||||||
},
|
|
||||||
"togethercomputer/Llama-2-7B-32K-Instruct": {
|
|
||||||
id: "togethercomputer/Llama-2-7B-32K-Instruct",
|
|
||||||
organization: "Together",
|
|
||||||
name: "LLaMA-2-7B-32K-Instruct (7B)",
|
|
||||||
maxLength: 32768,
|
|
||||||
},
|
|
||||||
"mistralai/Mistral-7B-Instruct-v0.1": {
|
|
||||||
id: "mistralai/Mistral-7B-Instruct-v0.1",
|
|
||||||
organization: "MistralAI",
|
|
||||||
name: "Mistral (7B) Instruct v0.1",
|
|
||||||
maxLength: 4096,
|
|
||||||
},
|
|
||||||
"mistralai/Mistral-7B-Instruct-v0.2": {
|
|
||||||
id: "mistralai/Mistral-7B-Instruct-v0.2",
|
|
||||||
organization: "MistralAI",
|
|
||||||
name: "Mistral (7B) Instruct v0.2",
|
|
||||||
maxLength: 32768,
|
|
||||||
},
|
|
||||||
"mistralai/Mixtral-8x7B-Instruct-v0.1": {
|
|
||||||
id: "mistralai/Mixtral-8x7B-Instruct-v0.1",
|
|
||||||
organization: "MistralAI",
|
|
||||||
name: "Mixtral-8x7B Instruct",
|
|
||||||
maxLength: 32768,
|
|
||||||
},
|
|
||||||
"Gryphe/MythoMax-L2-13b": {
|
"Gryphe/MythoMax-L2-13b": {
|
||||||
id: "Gryphe/MythoMax-L2-13b",
|
id: "Gryphe/MythoMax-L2-13b",
|
||||||
organization: "Gryphe",
|
organization: "Gryphe",
|
||||||
name: "MythoMax-L2 (13B)",
|
name: "MythoMax-L2 (13B)",
|
||||||
maxLength: 4096,
|
maxLength: 4096,
|
||||||
},
|
},
|
||||||
|
"lmsys/vicuna-13b-v1.5": {
|
||||||
|
id: "lmsys/vicuna-13b-v1.5",
|
||||||
|
organization: "LM Sys",
|
||||||
|
name: "Vicuna v1.5 (13B)",
|
||||||
|
maxLength: 4096,
|
||||||
|
},
|
||||||
|
"lmsys/vicuna-7b-v1.5": {
|
||||||
|
id: "lmsys/vicuna-7b-v1.5",
|
||||||
|
organization: "LM Sys",
|
||||||
|
name: "Vicuna v1.5 (7B)",
|
||||||
|
maxLength: 4096,
|
||||||
|
},
|
||||||
|
"codellama/CodeLlama-13b-Instruct-hf": {
|
||||||
|
id: "codellama/CodeLlama-13b-Instruct-hf",
|
||||||
|
organization: "Meta",
|
||||||
|
name: "Code Llama Instruct (13B)",
|
||||||
|
maxLength: 16384,
|
||||||
|
},
|
||||||
|
"codellama/CodeLlama-34b-Instruct-hf": {
|
||||||
|
id: "codellama/CodeLlama-34b-Instruct-hf",
|
||||||
|
organization: "Meta",
|
||||||
|
name: "Code Llama Instruct (34B)",
|
||||||
|
maxLength: 16384,
|
||||||
|
},
|
||||||
|
"codellama/CodeLlama-70b-Instruct-hf": {
|
||||||
|
id: "codellama/CodeLlama-70b-Instruct-hf",
|
||||||
|
organization: "Meta",
|
||||||
|
name: "Code Llama Instruct (70B)",
|
||||||
|
maxLength: 4096,
|
||||||
|
},
|
||||||
|
"codellama/CodeLlama-7b-Instruct-hf": {
|
||||||
|
id: "codellama/CodeLlama-7b-Instruct-hf",
|
||||||
|
organization: "Meta",
|
||||||
|
name: "Code Llama Instruct (7B)",
|
||||||
|
maxLength: 16384,
|
||||||
|
},
|
||||||
|
"meta-llama/Llama-2-70b-chat-hf": {
|
||||||
|
id: "meta-llama/Llama-2-70b-chat-hf",
|
||||||
|
organization: "Meta",
|
||||||
|
name: "LLaMA-2 Chat (70B)",
|
||||||
|
maxLength: 4096,
|
||||||
|
},
|
||||||
|
"meta-llama/Llama-2-13b-chat-hf": {
|
||||||
|
id: "meta-llama/Llama-2-13b-chat-hf",
|
||||||
|
organization: "Meta",
|
||||||
|
name: "LLaMA-2 Chat (13B)",
|
||||||
|
maxLength: 4096,
|
||||||
|
},
|
||||||
|
"meta-llama/Llama-2-7b-chat-hf": {
|
||||||
|
id: "meta-llama/Llama-2-7b-chat-hf",
|
||||||
|
organization: "Meta",
|
||||||
|
name: "LLaMA-2 Chat (7B)",
|
||||||
|
maxLength: 4096,
|
||||||
|
},
|
||||||
|
"mistralai/Mistral-7B-Instruct-v0.1": {
|
||||||
|
id: "mistralai/Mistral-7B-Instruct-v0.1",
|
||||||
|
organization: "mistralai",
|
||||||
|
name: "Mistral (7B) Instruct",
|
||||||
|
maxLength: 8192,
|
||||||
|
},
|
||||||
|
"mistralai/Mistral-7B-Instruct-v0.2": {
|
||||||
|
id: "mistralai/Mistral-7B-Instruct-v0.2",
|
||||||
|
organization: "mistralai",
|
||||||
|
name: "Mistral (7B) Instruct v0.2",
|
||||||
|
maxLength: 32768,
|
||||||
|
},
|
||||||
|
"mistralai/Mixtral-8x7B-Instruct-v0.1": {
|
||||||
|
id: "mistralai/Mixtral-8x7B-Instruct-v0.1",
|
||||||
|
organization: "mistralai",
|
||||||
|
name: "Mixtral-8x7B Instruct (46.7B)",
|
||||||
|
maxLength: 32768,
|
||||||
|
},
|
||||||
|
"NousResearch/Nous-Capybara-7B-V1p9": {
|
||||||
|
id: "NousResearch/Nous-Capybara-7B-V1p9",
|
||||||
|
organization: "NousResearch",
|
||||||
|
name: "Nous Capybara v1.9 (7B)",
|
||||||
|
maxLength: 8192,
|
||||||
|
},
|
||||||
|
"NousResearch/Nous-Hermes-2-Mistral-7B-DPO": {
|
||||||
|
id: "NousResearch/Nous-Hermes-2-Mistral-7B-DPO",
|
||||||
|
organization: "NousResearch",
|
||||||
|
name: "Nous Hermes 2 - Mistral DPO (7B)",
|
||||||
|
maxLength: 32768,
|
||||||
|
},
|
||||||
|
"NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO": {
|
||||||
|
id: "NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO",
|
||||||
|
organization: "NousResearch",
|
||||||
|
name: "Nous Hermes 2 - Mixtral 8x7B-DPO (46.7B)",
|
||||||
|
maxLength: 32768,
|
||||||
|
},
|
||||||
|
"NousResearch/Nous-Hermes-2-Mixtral-8x7B-SFT": {
|
||||||
|
id: "NousResearch/Nous-Hermes-2-Mixtral-8x7B-SFT",
|
||||||
|
organization: "NousResearch",
|
||||||
|
name: "Nous Hermes 2 - Mixtral 8x7B-SFT (46.7B)",
|
||||||
|
maxLength: 32768,
|
||||||
|
},
|
||||||
"NousResearch/Nous-Hermes-llama-2-7b": {
|
"NousResearch/Nous-Hermes-llama-2-7b": {
|
||||||
id: "NousResearch/Nous-Hermes-llama-2-7b",
|
id: "NousResearch/Nous-Hermes-llama-2-7b",
|
||||||
organization: "NousResearch",
|
organization: "NousResearch",
|
||||||
@ -113,66 +185,96 @@ const MODELS = {
|
|||||||
name: "Nous Hermes Llama-2 (13B)",
|
name: "Nous Hermes Llama-2 (13B)",
|
||||||
maxLength: 4096,
|
maxLength: 4096,
|
||||||
},
|
},
|
||||||
"NousResearch/Nous-Hermes-Llama2-70b": {
|
|
||||||
id: "NousResearch/Nous-Hermes-Llama2-70b",
|
|
||||||
organization: "NousResearch",
|
|
||||||
name: "Nous Hermes Llama-2 (70B)",
|
|
||||||
maxLength: 4096,
|
|
||||||
},
|
|
||||||
"NousResearch/Nous-Hermes-2-Yi-34B": {
|
"NousResearch/Nous-Hermes-2-Yi-34B": {
|
||||||
id: "NousResearch/Nous-Hermes-2-Yi-34B",
|
id: "NousResearch/Nous-Hermes-2-Yi-34B",
|
||||||
organization: "NousResearch",
|
organization: "NousResearch",
|
||||||
name: "Nous Hermes-2 Yi (34B)",
|
name: "Nous Hermes-2 Yi (34B)",
|
||||||
maxLength: 4096,
|
maxLength: 4096,
|
||||||
},
|
},
|
||||||
"NousResearch/Nous-Capybara-7B-V1p9": {
|
|
||||||
id: "NousResearch/Nous-Capybara-7B-V1p9",
|
|
||||||
organization: "NousResearch",
|
|
||||||
name: "Nous Capybara v1.9 (7B)",
|
|
||||||
maxLength: 8192,
|
|
||||||
},
|
|
||||||
"openchat/openchat-3.5-1210": {
|
"openchat/openchat-3.5-1210": {
|
||||||
id: "openchat/openchat-3.5-1210",
|
id: "openchat/openchat-3.5-1210",
|
||||||
organization: "OpenChat",
|
organization: "OpenChat",
|
||||||
name: "OpenChat 3.5 1210 (7B)",
|
name: "OpenChat 3.5 (7B)",
|
||||||
maxLength: 8192,
|
maxLength: 8192,
|
||||||
},
|
},
|
||||||
"teknium/OpenHermes-2-Mistral-7B": {
|
|
||||||
id: "teknium/OpenHermes-2-Mistral-7B",
|
|
||||||
organization: "teknium",
|
|
||||||
name: "OpenHermes-2-Mistral (7B)",
|
|
||||||
maxLength: 4096,
|
|
||||||
},
|
|
||||||
"teknium/OpenHermes-2p5-Mistral-7B": {
|
|
||||||
id: "teknium/OpenHermes-2p5-Mistral-7B",
|
|
||||||
organization: "teknium",
|
|
||||||
name: "OpenHermes-2.5-Mistral (7B)",
|
|
||||||
maxLength: 4096,
|
|
||||||
},
|
|
||||||
"Open-Orca/Mistral-7B-OpenOrca": {
|
"Open-Orca/Mistral-7B-OpenOrca": {
|
||||||
id: "Open-Orca/Mistral-7B-OpenOrca",
|
id: "Open-Orca/Mistral-7B-OpenOrca",
|
||||||
organization: "OpenOrca",
|
organization: "OpenOrca",
|
||||||
name: "OpenOrca Mistral (7B) 8K",
|
name: "OpenOrca Mistral (7B) 8K",
|
||||||
maxLength: 8192,
|
maxLength: 8192,
|
||||||
},
|
},
|
||||||
"garage-bAInd/Platypus2-70B-instruct": {
|
"Qwen/Qwen1.5-0.5B-Chat": {
|
||||||
id: "garage-bAInd/Platypus2-70B-instruct",
|
id: "Qwen/Qwen1.5-0.5B-Chat",
|
||||||
organization: "garage-bAInd",
|
organization: "Qwen",
|
||||||
name: "Platypus2 Instruct (70B)",
|
name: "Qwen 1.5 Chat (0.5B)",
|
||||||
maxLength: 4096,
|
maxLength: 32768,
|
||||||
},
|
},
|
||||||
"togethercomputer/Pythia-Chat-Base-7B-v0.16": {
|
"Qwen/Qwen1.5-1.8B-Chat": {
|
||||||
id: "togethercomputer/Pythia-Chat-Base-7B-v0.16",
|
id: "Qwen/Qwen1.5-1.8B-Chat",
|
||||||
organization: "Together",
|
organization: "Qwen",
|
||||||
name: "Pythia-Chat-Base (7B)",
|
name: "Qwen 1.5 Chat (1.8B)",
|
||||||
|
maxLength: 32768,
|
||||||
|
},
|
||||||
|
"Qwen/Qwen1.5-4B-Chat": {
|
||||||
|
id: "Qwen/Qwen1.5-4B-Chat",
|
||||||
|
organization: "Qwen",
|
||||||
|
name: "Qwen 1.5 Chat (4B)",
|
||||||
|
maxLength: 32768,
|
||||||
|
},
|
||||||
|
"Qwen/Qwen1.5-7B-Chat": {
|
||||||
|
id: "Qwen/Qwen1.5-7B-Chat",
|
||||||
|
organization: "Qwen",
|
||||||
|
name: "Qwen 1.5 Chat (7B)",
|
||||||
|
maxLength: 32768,
|
||||||
|
},
|
||||||
|
"Qwen/Qwen1.5-14B-Chat": {
|
||||||
|
id: "Qwen/Qwen1.5-14B-Chat",
|
||||||
|
organization: "Qwen",
|
||||||
|
name: "Qwen 1.5 Chat (14B)",
|
||||||
|
maxLength: 32768,
|
||||||
|
},
|
||||||
|
"Qwen/Qwen1.5-32B-Chat": {
|
||||||
|
id: "Qwen/Qwen1.5-32B-Chat",
|
||||||
|
organization: "Qwen",
|
||||||
|
name: "Qwen 1.5 Chat (32B)",
|
||||||
|
maxLength: 32768,
|
||||||
|
},
|
||||||
|
"Qwen/Qwen1.5-72B-Chat": {
|
||||||
|
id: "Qwen/Qwen1.5-72B-Chat",
|
||||||
|
organization: "Qwen",
|
||||||
|
name: "Qwen 1.5 Chat (72B)",
|
||||||
|
maxLength: 32768,
|
||||||
|
},
|
||||||
|
"snorkelai/Snorkel-Mistral-PairRM-DPO": {
|
||||||
|
id: "snorkelai/Snorkel-Mistral-PairRM-DPO",
|
||||||
|
organization: "Snorkel AI",
|
||||||
|
name: "Snorkel Mistral PairRM DPO (7B)",
|
||||||
|
maxLength: 32768,
|
||||||
|
},
|
||||||
|
"togethercomputer/alpaca-7b": {
|
||||||
|
id: "togethercomputer/alpaca-7b",
|
||||||
|
organization: "Stanford",
|
||||||
|
name: "Alpaca (7B)",
|
||||||
maxLength: 2048,
|
maxLength: 2048,
|
||||||
},
|
},
|
||||||
"togethercomputer/Qwen-7B-Chat": {
|
"teknium/OpenHermes-2-Mistral-7B": {
|
||||||
id: "togethercomputer/Qwen-7B-Chat",
|
id: "teknium/OpenHermes-2-Mistral-7B",
|
||||||
organization: "Qwen",
|
organization: "Teknium",
|
||||||
name: "Qwen-Chat (7B)",
|
name: "OpenHermes-2-Mistral (7B)",
|
||||||
maxLength: 8192,
|
maxLength: 8192,
|
||||||
},
|
},
|
||||||
|
"teknium/OpenHermes-2p5-Mistral-7B": {
|
||||||
|
id: "teknium/OpenHermes-2p5-Mistral-7B",
|
||||||
|
organization: "Teknium",
|
||||||
|
name: "OpenHermes-2.5-Mistral (7B)",
|
||||||
|
maxLength: 8192,
|
||||||
|
},
|
||||||
|
"togethercomputer/Llama-2-7B-32K-Instruct": {
|
||||||
|
id: "togethercomputer/Llama-2-7B-32K-Instruct",
|
||||||
|
organization: "Together",
|
||||||
|
name: "LLaMA-2-7B-32K-Instruct (7B)",
|
||||||
|
maxLength: 32768,
|
||||||
|
},
|
||||||
"togethercomputer/RedPajama-INCITE-Chat-3B-v1": {
|
"togethercomputer/RedPajama-INCITE-Chat-3B-v1": {
|
||||||
id: "togethercomputer/RedPajama-INCITE-Chat-3B-v1",
|
id: "togethercomputer/RedPajama-INCITE-Chat-3B-v1",
|
||||||
organization: "Together",
|
organization: "Together",
|
||||||
@ -185,40 +287,34 @@ const MODELS = {
|
|||||||
name: "RedPajama-INCITE Chat (7B)",
|
name: "RedPajama-INCITE Chat (7B)",
|
||||||
maxLength: 2048,
|
maxLength: 2048,
|
||||||
},
|
},
|
||||||
"upstage/SOLAR-0-70b-16bit": {
|
|
||||||
id: "upstage/SOLAR-0-70b-16bit",
|
|
||||||
organization: "Upstage",
|
|
||||||
name: "SOLAR v0 (70B)",
|
|
||||||
maxLength: 4096,
|
|
||||||
},
|
|
||||||
"togethercomputer/StripedHyena-Nous-7B": {
|
"togethercomputer/StripedHyena-Nous-7B": {
|
||||||
id: "togethercomputer/StripedHyena-Nous-7B",
|
id: "togethercomputer/StripedHyena-Nous-7B",
|
||||||
organization: "Together",
|
organization: "Together",
|
||||||
name: "StripedHyena Nous (7B)",
|
name: "StripedHyena Nous (7B)",
|
||||||
maxLength: 32768,
|
maxLength: 32768,
|
||||||
},
|
},
|
||||||
"lmsys/vicuna-7b-v1.5": {
|
"Undi95/ReMM-SLERP-L2-13B": {
|
||||||
id: "lmsys/vicuna-7b-v1.5",
|
id: "Undi95/ReMM-SLERP-L2-13B",
|
||||||
organization: "LM Sys",
|
organization: "Undi95",
|
||||||
name: "Vicuna v1.5 (7B)",
|
name: "ReMM SLERP L2 (13B)",
|
||||||
maxLength: 4096,
|
maxLength: 4096,
|
||||||
},
|
},
|
||||||
"lmsys/vicuna-13b-v1.5": {
|
"Undi95/Toppy-M-7B": {
|
||||||
id: "lmsys/vicuna-13b-v1.5",
|
id: "Undi95/Toppy-M-7B",
|
||||||
organization: "LM Sys",
|
organization: "Undi95",
|
||||||
name: "Vicuna v1.5 (13B)",
|
name: "Toppy M (7B)",
|
||||||
maxLength: 4096,
|
maxLength: 4096,
|
||||||
},
|
},
|
||||||
"lmsys/vicuna-13b-v1.5-16k": {
|
"WizardLM/WizardLM-13B-V1.2": {
|
||||||
id: "lmsys/vicuna-13b-v1.5-16k",
|
id: "WizardLM/WizardLM-13B-V1.2",
|
||||||
organization: "LM Sys",
|
organization: "WizardLM",
|
||||||
name: "Vicuna v1.5 16K (13B)",
|
name: "WizardLM v1.2 (13B)",
|
||||||
maxLength: 16384,
|
maxLength: 4096,
|
||||||
},
|
},
|
||||||
"zero-one-ai/Yi-34B-Chat": {
|
"upstage/SOLAR-10.7B-Instruct-v1.0": {
|
||||||
id: "zero-one-ai/Yi-34B-Chat",
|
id: "upstage/SOLAR-10.7B-Instruct-v1.0",
|
||||||
organization: "01.AI",
|
organization: "upstage",
|
||||||
name: "01-ai Yi Chat (34B)",
|
name: "Upstage SOLAR Instruct v1 (11B)",
|
||||||
maxLength: 4096,
|
maxLength: 4096,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -1,39 +1,55 @@
|
|||||||
| Organization | Model Name | Model String for API | Max Seq Length |
|
| Organization | Model Name | Model String for API | Context length |
|
||||||
| ------------- | ---------------------------- | -------------------------------------------- | -------------- |
|
| --- | --- | --- | --- |
|
||||||
| Stanford | Alpaca (7B) | togethercomputer/alpaca-7b | 2048 |
|
| 01.AI | 01-ai Yi Chat (34B) | zero-one-ai/Yi-34B-Chat | 4096 |
|
||||||
|
| Allen AI | OLMo Instruct (7B) | allenai/OLMo-7B-Instruct | 2048 |
|
||||||
|
| Allen AI | OLMo Twin-2T (7B) | allenai/OLMo-7B-Twin-2T | 2048 |
|
||||||
|
| Allen AI | OLMo (7B) | allenai/OLMo-7B | 2048 |
|
||||||
| Austism | Chronos Hermes (13B) | Austism/chronos-hermes-13b | 2048 |
|
| Austism | Chronos Hermes (13B) | Austism/chronos-hermes-13b | 2048 |
|
||||||
| Meta | Code Llama Instruct (13B) | togethercomputer/CodeLlama-13b-Instruct | 8192 |
|
| cognitivecomputations | Dolphin 2.5 Mixtral 8x7b | cognitivecomputations/dolphin-2.5-mixtral-8x7b | 32768 |
|
||||||
| Meta | Code Llama Instruct (34B) | togethercomputer/CodeLlama-34b-Instruct | 8192 |
|
| databricks | DBRX Instruct | databricks/dbrx-instruct | 32000 |
|
||||||
| Meta | Code Llama Instruct (7B) | togethercomputer/CodeLlama-7b-Instruct | 8192 |
|
| DeepSeek | Deepseek Coder Instruct (33B) | deepseek-ai/deepseek-coder-33b-instruct | 16384 |
|
||||||
| DiscoResearch | DiscoLM Mixtral 8x7b | DiscoResearch/DiscoLM-mixtral-8x7b-v2 | 32768 |
|
| DeepSeek | DeepSeek LLM Chat (67B) | deepseek-ai/deepseek-llm-67b-chat | 4096 |
|
||||||
| TII UAE | Falcon Instruct (40B) | togethercomputer/falcon-40b-instruct | 2048 |
|
| garage-bAInd | Platypus2 Instruct (70B) | garage-bAInd/Platypus2-70B-instruct | 4096 |
|
||||||
| TII UAE | Falcon Instruct (7B) | togethercomputer/falcon-7b-instruct | 2048 |
|
| Google | Gemma Instruct (2B) | google/gemma-2b-it | 8192 |
|
||||||
| Together | GPT-NeoXT-Chat-Base (20B) | togethercomputer/GPT-NeoXT-Chat-Base-20B | 2048 |
|
| Google | Gemma Instruct (7B) | google/gemma-7b-it | 8192 |
|
||||||
| Meta | LLaMA-2 Chat (13B) | togethercomputer/llama-2-13b-chat | 4096 |
|
|
||||||
| Meta | LLaMA-2 Chat (70B) | togethercomputer/llama-2-70b-chat | 4096 |
|
|
||||||
| Meta | LLaMA-2 Chat (7B) | togethercomputer/llama-2-7b-chat | 4096 |
|
|
||||||
| Together | LLaMA-2-7B-32K-Instruct (7B) | togethercomputer/Llama-2-7B-32K-Instruct | 32768 |
|
|
||||||
| MistralAI | Mistral (7B) Instruct v0.1 | mistralai/Mistral-7B-Instruct-v0.1 | 4096 |
|
|
||||||
| MistralAI | Mistral (7B) Instruct v0.2 | mistralai/Mistral-7B-Instruct-v0.2 | 32768 |
|
|
||||||
| MistralAI | Mixtral-8x7B Instruct | mistralai/Mixtral-8x7B-Instruct-v0.1 | 32768 |
|
|
||||||
| Gryphe | MythoMax-L2 (13B) | Gryphe/MythoMax-L2-13b | 4096 |
|
| Gryphe | MythoMax-L2 (13B) | Gryphe/MythoMax-L2-13b | 4096 |
|
||||||
|
| LM Sys | Vicuna v1.5 (13B) | lmsys/vicuna-13b-v1.5 | 4096 |
|
||||||
|
| LM Sys | Vicuna v1.5 (7B) | lmsys/vicuna-7b-v1.5 | 4096 |
|
||||||
|
| Meta | Code Llama Instruct (13B) | codellama/CodeLlama-13b-Instruct-hf | 16384 |
|
||||||
|
| Meta | Code Llama Instruct (34B) | codellama/CodeLlama-34b-Instruct-hf | 16384 |
|
||||||
|
| Meta | Code Llama Instruct (70B) | codellama/CodeLlama-70b-Instruct-hf | 4096 |
|
||||||
|
| Meta | Code Llama Instruct (7B) | codellama/CodeLlama-7b-Instruct-hf | 16384 |
|
||||||
|
| Meta | LLaMA-2 Chat (70B) | meta-llama/Llama-2-70b-chat-hf | 4096 |
|
||||||
|
| Meta | LLaMA-2 Chat (13B) | meta-llama/Llama-2-13b-chat-hf | 4096 |
|
||||||
|
| Meta | LLaMA-2 Chat (7B) | meta-llama/Llama-2-7b-chat-hf | 4096 |
|
||||||
|
| mistralai | Mistral (7B) Instruct | mistralai/Mistral-7B-Instruct-v0.1 | 8192 |
|
||||||
|
| mistralai | Mistral (7B) Instruct v0.2 | mistralai/Mistral-7B-Instruct-v0.2 | 32768 |
|
||||||
|
| mistralai | Mixtral-8x7B Instruct (46.7B) | mistralai/Mixtral-8x7B-Instruct-v0.1 | 32768 |
|
||||||
|
| NousResearch | Nous Capybara v1.9 (7B) | NousResearch/Nous-Capybara-7B-V1p9 | 8192 |
|
||||||
|
| NousResearch | Nous Hermes 2 - Mistral DPO (7B) | NousResearch/Nous-Hermes-2-Mistral-7B-DPO | 32768 |
|
||||||
|
| NousResearch | Nous Hermes 2 - Mixtral 8x7B-DPO (46.7B) | NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO | 32768 |
|
||||||
|
| NousResearch | Nous Hermes 2 - Mixtral 8x7B-SFT (46.7B) | NousResearch/Nous-Hermes-2-Mixtral-8x7B-SFT | 32768 |
|
||||||
| NousResearch | Nous Hermes LLaMA-2 (7B) | NousResearch/Nous-Hermes-llama-2-7b | 4096 |
|
| NousResearch | Nous Hermes LLaMA-2 (7B) | NousResearch/Nous-Hermes-llama-2-7b | 4096 |
|
||||||
| NousResearch | Nous Hermes Llama-2 (13B) | NousResearch/Nous-Hermes-Llama2-13b | 4096 |
|
| NousResearch | Nous Hermes Llama-2 (13B) | NousResearch/Nous-Hermes-Llama2-13b | 4096 |
|
||||||
| NousResearch | Nous Hermes Llama-2 (70B) | NousResearch/Nous-Hermes-Llama2-70b | 4096 |
|
|
||||||
| NousResearch | Nous Hermes-2 Yi (34B) | NousResearch/Nous-Hermes-2-Yi-34B | 4096 |
|
| NousResearch | Nous Hermes-2 Yi (34B) | NousResearch/Nous-Hermes-2-Yi-34B | 4096 |
|
||||||
| NousResearch | Nous Capybara v1.9 (7B) | NousResearch/Nous-Capybara-7B-V1p9 | 8192 |
|
| OpenChat | OpenChat 3.5 (7B) | openchat/openchat-3.5-1210 | 8192 |
|
||||||
| OpenChat | OpenChat 3.5 1210 (7B) | openchat/openchat-3.5-1210 | 8192 |
|
|
||||||
| teknium | OpenHermes-2-Mistral (7B) | teknium/OpenHermes-2-Mistral-7B | 4096 |
|
|
||||||
| teknium | OpenHermes-2.5-Mistral (7B) | teknium/OpenHermes-2p5-Mistral-7B | 4096 |
|
|
||||||
| OpenOrca | OpenOrca Mistral (7B) 8K | Open-Orca/Mistral-7B-OpenOrca | 8192 |
|
| OpenOrca | OpenOrca Mistral (7B) 8K | Open-Orca/Mistral-7B-OpenOrca | 8192 |
|
||||||
| garage-bAInd | Platypus2 Instruct (70B) | garage-bAInd/Platypus2-70B-instruct | 4096 |
|
| Qwen | Qwen 1.5 Chat (0.5B) | Qwen/Qwen1.5-0.5B-Chat | 32768 |
|
||||||
| Together | Pythia-Chat-Base (7B) | togethercomputer/Pythia-Chat-Base-7B-v0.16 | 2048 |
|
| Qwen | Qwen 1.5 Chat (1.8B) | Qwen/Qwen1.5-1.8B-Chat | 32768 |
|
||||||
| Qwen | Qwen-Chat (7B) | togethercomputer/Qwen-7B-Chat | 8192 |
|
| Qwen | Qwen 1.5 Chat (4B) | Qwen/Qwen1.5-4B-Chat | 32768 |
|
||||||
|
| Qwen | Qwen 1.5 Chat (7B) | Qwen/Qwen1.5-7B-Chat | 32768 |
|
||||||
|
| Qwen | Qwen 1.5 Chat (14B) | Qwen/Qwen1.5-14B-Chat | 32768 |
|
||||||
|
| Qwen | Qwen 1.5 Chat (32B) | Qwen/Qwen1.5-32B-Chat | 32768 |
|
||||||
|
| Qwen | Qwen 1.5 Chat (72B) | Qwen/Qwen1.5-72B-Chat | 32768 |
|
||||||
|
| Snorkel AI | Snorkel Mistral PairRM DPO (7B) | snorkelai/Snorkel-Mistral-PairRM-DPO | 32768 |
|
||||||
|
| Stanford | Alpaca (7B) | togethercomputer/alpaca-7b | 2048 |
|
||||||
|
| Teknium | OpenHermes-2-Mistral (7B) | teknium/OpenHermes-2-Mistral-7B | 8192 |
|
||||||
|
| Teknium | OpenHermes-2.5-Mistral (7B) | teknium/OpenHermes-2p5-Mistral-7B | 8192 |
|
||||||
|
| Together | LLaMA-2-7B-32K-Instruct (7B) | togethercomputer/Llama-2-7B-32K-Instruct | 32768 |
|
||||||
| Together | RedPajama-INCITE Chat (3B) | togethercomputer/RedPajama-INCITE-Chat-3B-v1 | 2048 |
|
| Together | RedPajama-INCITE Chat (3B) | togethercomputer/RedPajama-INCITE-Chat-3B-v1 | 2048 |
|
||||||
| Together | RedPajama-INCITE Chat (7B) | togethercomputer/RedPajama-INCITE-7B-Chat | 2048 |
|
| Together | RedPajama-INCITE Chat (7B) | togethercomputer/RedPajama-INCITE-7B-Chat | 2048 |
|
||||||
| Upstage | SOLAR v0 (70B) | upstage/SOLAR-0-70b-16bit | 4096 |
|
|
||||||
| Together | StripedHyena Nous (7B) | togethercomputer/StripedHyena-Nous-7B | 32768 |
|
| Together | StripedHyena Nous (7B) | togethercomputer/StripedHyena-Nous-7B | 32768 |
|
||||||
| LM Sys | Vicuna v1.5 (7B) | lmsys/vicuna-7b-v1.5 | 4096 |
|
| Undi95 | ReMM SLERP L2 (13B) | Undi95/ReMM-SLERP-L2-13B | 4096 |
|
||||||
| LM Sys | Vicuna v1.5 (13B) | lmsys/vicuna-13b-v1.5 | 4096 |
|
| Undi95 | Toppy M (7B) | Undi95/Toppy-M-7B | 4096 |
|
||||||
| LM Sys | Vicuna v1.5 16K (13B) | lmsys/vicuna-13b-v1.5-16k | 16384 |
|
| WizardLM | WizardLM v1.2 (13B) | WizardLM/WizardLM-13B-V1.2 | 4096 |
|
||||||
| 01.AI | 01-ai Yi Chat (34B) | zero-one-ai/Yi-34B-Chat | 4096 |
|
| upstage | Upstage SOLAR Instruct v1 (11B) | upstage/SOLAR-10.7B-Instruct-v1.0 | 4096 |
|
@ -8,7 +8,9 @@
|
|||||||
// copy outputs into the export in ../models.js
|
// copy outputs into the export in ../models.js
|
||||||
|
|
||||||
// Update the date below if you run this again because TogetherAI added new models.
|
// Update the date below if you run this again because TogetherAI added new models.
|
||||||
// Last Collected: Jan 10, 2023
|
// Last Collected: Apr 14, 2024
|
||||||
|
// Since last collection Together's docs are broken. I just copied the HTML table
|
||||||
|
// and had claude3 convert to markdown and it works well enough.
|
||||||
|
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
|
|
||||||
|
18
server/utils/agents/aibitat/error.js
Normal file
18
server/utils/agents/aibitat/error.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
class AIbitatError extends Error {}
|
||||||
|
|
||||||
|
class APIError extends AIbitatError {
|
||||||
|
constructor(message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The error when the AI provider returns an error that should be treated as something
|
||||||
|
* that should be retried.
|
||||||
|
*/
|
||||||
|
class RetryError extends APIError {}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
APIError,
|
||||||
|
RetryError,
|
||||||
|
};
|
1
server/utils/agents/aibitat/example/.gitignore
vendored
Normal file
1
server/utils/agents/aibitat/example/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
history/
|
56
server/utils/agents/aibitat/example/beginner-chat.js
Normal file
56
server/utils/agents/aibitat/example/beginner-chat.js
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
// You must execute this example from within the example folder.
|
||||||
|
const AIbitat = require("../index.js");
|
||||||
|
const { cli } = require("../plugins/cli.js");
|
||||||
|
const { NodeHtmlMarkdown } = require("node-html-markdown");
|
||||||
|
require("dotenv").config({ path: `../../../../.env.development` });
|
||||||
|
|
||||||
|
const Agent = {
|
||||||
|
HUMAN: "🧑",
|
||||||
|
AI: "🤖",
|
||||||
|
};
|
||||||
|
|
||||||
|
const aibitat = new AIbitat({
|
||||||
|
provider: "openai",
|
||||||
|
model: "gpt-3.5-turbo",
|
||||||
|
})
|
||||||
|
.use(cli.plugin())
|
||||||
|
.function({
|
||||||
|
name: "aibitat-documentations",
|
||||||
|
description: "The documentation about aibitat AI project.",
|
||||||
|
parameters: {
|
||||||
|
type: "object",
|
||||||
|
properties: {},
|
||||||
|
},
|
||||||
|
handler: async () => {
|
||||||
|
return await fetch(
|
||||||
|
"https://raw.githubusercontent.com/wladiston/aibitat/main/README.md"
|
||||||
|
)
|
||||||
|
.then((res) => res.text())
|
||||||
|
.then((html) => NodeHtmlMarkdown.translate(html))
|
||||||
|
.catch((e) => {
|
||||||
|
console.error(e.message);
|
||||||
|
return "FAILED TO FETCH";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.agent(Agent.HUMAN, {
|
||||||
|
interrupt: "ALWAYS",
|
||||||
|
role: "You are a human assistant.",
|
||||||
|
})
|
||||||
|
.agent(Agent.AI, {
|
||||||
|
functions: ["aibitat-documentations"],
|
||||||
|
});
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
if (!process.env.OPEN_AI_KEY)
|
||||||
|
throw new Error(
|
||||||
|
"This example requires a valid OPEN_AI_KEY in the env.development file"
|
||||||
|
);
|
||||||
|
await aibitat.start({
|
||||||
|
from: Agent.HUMAN,
|
||||||
|
to: Agent.AI,
|
||||||
|
content: `Please, talk about the documentation of AIbitat.`,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
55
server/utils/agents/aibitat/example/blog-post-coding.js
Normal file
55
server/utils/agents/aibitat/example/blog-post-coding.js
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
const AIbitat = require("../index.js");
|
||||||
|
const {
|
||||||
|
cli,
|
||||||
|
webBrowsing,
|
||||||
|
fileHistory,
|
||||||
|
webScraping,
|
||||||
|
} = require("../plugins/index.js");
|
||||||
|
require("dotenv").config({ path: `../../../../.env.development` });
|
||||||
|
|
||||||
|
const aibitat = new AIbitat({
|
||||||
|
model: "gpt-3.5-turbo",
|
||||||
|
})
|
||||||
|
.use(cli.plugin())
|
||||||
|
.use(fileHistory.plugin())
|
||||||
|
.use(webBrowsing.plugin()) // Does not have introspect so will fail.
|
||||||
|
.use(webScraping.plugin())
|
||||||
|
.agent("researcher", {
|
||||||
|
role: `You are a Researcher. Conduct thorough research to gather all necessary information about the topic
|
||||||
|
you are writing about. Collect data, facts, and statistics. Analyze competitor blogs for insights.
|
||||||
|
Provide accurate and up-to-date information that supports the blog post's content to @copywriter.`,
|
||||||
|
functions: ["web-browsing"],
|
||||||
|
})
|
||||||
|
.agent("copywriter", {
|
||||||
|
role: `You are a Copywriter. Interpret the draft as general idea and write the full blog post using markdown,
|
||||||
|
ensuring it is tailored to the target audience's preferences, interests, and demographics. Apply genre-specific
|
||||||
|
writing techniques relevant to the author's genre. Add code examples when needed. Code must be written in
|
||||||
|
Typescript. Always mention references. Revisit and edit the post for clarity, coherence, and
|
||||||
|
correctness based on the feedback provided. Ask for feedbacks to the channel when you are done`,
|
||||||
|
})
|
||||||
|
.agent("pm", {
|
||||||
|
role: `You are a Project Manager. Coordinate the project, ensure tasks are completed on time and within budget.
|
||||||
|
Communicate with team members and stakeholders.`,
|
||||||
|
interrupt: "ALWAYS",
|
||||||
|
})
|
||||||
|
.channel("content-team", ["researcher", "copywriter", "pm"]);
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
if (!process.env.OPEN_AI_KEY)
|
||||||
|
throw new Error(
|
||||||
|
"This example requires a valid OPEN_AI_KEY in the env.development file"
|
||||||
|
);
|
||||||
|
await aibitat.start({
|
||||||
|
from: "pm",
|
||||||
|
to: "content-team",
|
||||||
|
content: `We have got this draft of the new blog post, let us start working on it.
|
||||||
|
--- BEGIN DRAFT OF POST ---
|
||||||
|
|
||||||
|
Maui is a beautiful island in the state of Hawaii and is world-reknown for its whale watching season. Here are 2 other additional things to do in Maui, HI:
|
||||||
|
|
||||||
|
--- END DRAFT OF POST ---
|
||||||
|
`,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
67
server/utils/agents/aibitat/example/websocket/index.html
Normal file
67
server/utils/agents/aibitat/example/websocket/index.html
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script type="text/javascript">
|
||||||
|
window.buttonEl;
|
||||||
|
window.outputEl;
|
||||||
|
|
||||||
|
function handleListen() {
|
||||||
|
const socket = new WebSocket("ws://localhost:3000/ws");
|
||||||
|
window.buttonEl.setAttribute("hidden", "true");
|
||||||
|
|
||||||
|
socket.addEventListener("message", (event) => {
|
||||||
|
try {
|
||||||
|
const data = JSON.parse(event.data);
|
||||||
|
|
||||||
|
if (!data.hasOwnProperty("type")) {
|
||||||
|
window.outputEl.innerHTML += `<p>${data.from} says to ${data.to}: ${data.content}<p></br></br>`;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle async input loops
|
||||||
|
if (data?.type === "WAITING_ON_INPUT") {
|
||||||
|
// Put in time as hack to now have the prompt block DOM update.
|
||||||
|
setTimeout(() => {
|
||||||
|
console.log(
|
||||||
|
"We are waiting for feedback from the socket. Will timeout in 30s..."
|
||||||
|
);
|
||||||
|
const feedback = window.prompt(
|
||||||
|
"We are waiting for feedback from the socket. Will timeout in 30s..."
|
||||||
|
);
|
||||||
|
!!feedback
|
||||||
|
? socket.send(
|
||||||
|
JSON.stringify({ type: "awaitingFeedback", feedback })
|
||||||
|
)
|
||||||
|
: socket.send(
|
||||||
|
JSON.stringify({
|
||||||
|
type: "awaitingFeedback",
|
||||||
|
feedback: "exit",
|
||||||
|
})
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}, 800);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error("Failed to parse data");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.addEventListener("close", (event) => {
|
||||||
|
window.outputEl.innerHTML = `<p>Socket connection closed. Test is complete.<p></br></br>`;
|
||||||
|
window.buttonEl.removeAttribute("hidden");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener("load", function () {
|
||||||
|
window.buttonEl = document.getElementById("listen");
|
||||||
|
window.outputEl = document.getElementById("output");
|
||||||
|
window.buttonEl.addEventListener("click", handleListen);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<button type="button" id="listen">Open websocket connection chat</button>
|
||||||
|
<div id="output"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,100 @@
|
|||||||
|
// You can only run this example from within the websocket/ directory.
|
||||||
|
// NODE_ENV=development node websock-branding-collab.js
|
||||||
|
// Scraping is enabled, but search requires AGENT_GSE_* keys.
|
||||||
|
|
||||||
|
const express = require("express");
|
||||||
|
const chalk = require("chalk");
|
||||||
|
const AIbitat = require("../../index.js");
|
||||||
|
const {
|
||||||
|
websocket,
|
||||||
|
webBrowsing,
|
||||||
|
webScraping,
|
||||||
|
} = require("../../plugins/index.js");
|
||||||
|
const path = require("path");
|
||||||
|
const port = 3000;
|
||||||
|
const app = express();
|
||||||
|
require("express-ws")(app);
|
||||||
|
require("dotenv").config({ path: `../../../../../.env.development` });
|
||||||
|
|
||||||
|
// Debugging echo function if this is working for you.
|
||||||
|
// app.ws('/echo', function (ws, req) {
|
||||||
|
// ws.on('message', function (msg) {
|
||||||
|
// ws.send(msg);
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
|
||||||
|
// Set up WSS sockets for listening.
|
||||||
|
app.ws("/ws", function (ws, _response) {
|
||||||
|
try {
|
||||||
|
ws.on("message", function (msg) {
|
||||||
|
if (ws?.handleFeedback) ws.handleFeedback(msg);
|
||||||
|
});
|
||||||
|
|
||||||
|
ws.on("close", function () {
|
||||||
|
console.log("Socket killed");
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("Socket online and waiting...");
|
||||||
|
runAIbitat(ws).catch((error) => {
|
||||||
|
ws.send(
|
||||||
|
JSON.stringify({
|
||||||
|
from: "AI",
|
||||||
|
to: "HUMAN",
|
||||||
|
content: error.message,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
} catch (error) {}
|
||||||
|
});
|
||||||
|
|
||||||
|
app.all("*", function (_, response) {
|
||||||
|
response.sendFile(path.join(__dirname, "index.html"));
|
||||||
|
});
|
||||||
|
|
||||||
|
app.listen(port, () => {
|
||||||
|
console.log(`Testing HTTP/WSS server listening at http://localhost:${port}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
async function runAIbitat(socket) {
|
||||||
|
console.log(chalk.blue("Booting AIbitat class & starting agent(s)"));
|
||||||
|
|
||||||
|
const aibitat = new AIbitat({
|
||||||
|
provider: "openai",
|
||||||
|
model: "gpt-4",
|
||||||
|
})
|
||||||
|
.use(websocket.plugin({ socket }))
|
||||||
|
.use(webBrowsing.plugin())
|
||||||
|
.use(webScraping.plugin())
|
||||||
|
.agent("creativeDirector", {
|
||||||
|
role: `You are a Creative Director. Your role is overseeing the entire branding project, ensuring
|
||||||
|
the client's brief is met, and maintaining consistency across all brand elements, developing the
|
||||||
|
brand strategy, guiding the visual and conceptual direction, and providing overall creative leadership.`,
|
||||||
|
})
|
||||||
|
.agent("marketResearcher", {
|
||||||
|
role: `You do competitive market analysis via searching on the internet and learning about
|
||||||
|
comparative products and services. You can search by using keywords and phrases that you think will lead
|
||||||
|
to competitor research that can help find the unique angle and market of the idea.`,
|
||||||
|
functions: ["web-browsing"],
|
||||||
|
})
|
||||||
|
.agent("PM", {
|
||||||
|
role: `You are the Project Coordinator. Your role is overseeing the project's progress, timeline,
|
||||||
|
and budget. Ensure effective communication and coordination among team members, client, and stakeholders.
|
||||||
|
Your tasks include planning and scheduling project milestones, tracking tasks, and managing any
|
||||||
|
risks or issues that arise.`,
|
||||||
|
interrupt: "ALWAYS",
|
||||||
|
})
|
||||||
|
.channel("<b>#branding</b>", [
|
||||||
|
"creativeDirector",
|
||||||
|
"marketResearcher",
|
||||||
|
"PM",
|
||||||
|
]);
|
||||||
|
|
||||||
|
await aibitat.start({
|
||||||
|
from: "PM",
|
||||||
|
to: "<b>#branding</b>",
|
||||||
|
content: `I have an idea for a muslim focused meetup called Chai & Vibes.
|
||||||
|
I want to focus on professionals that are muslim and are in their 18-30 year old range who live in big cities.
|
||||||
|
Does anything like this exist? How can we differentiate?`,
|
||||||
|
});
|
||||||
|
}
|
@ -0,0 +1,91 @@
|
|||||||
|
// You can only run this example from within the websocket/ directory.
|
||||||
|
// NODE_ENV=development node websock-multi-turn-chat.js
|
||||||
|
// Scraping is enabled, but search requires AGENT_GSE_* keys.
|
||||||
|
|
||||||
|
const express = require("express");
|
||||||
|
const chalk = require("chalk");
|
||||||
|
const AIbitat = require("../../index.js");
|
||||||
|
const {
|
||||||
|
websocket,
|
||||||
|
webBrowsing,
|
||||||
|
webScraping,
|
||||||
|
} = require("../../plugins/index.js");
|
||||||
|
const path = require("path");
|
||||||
|
const port = 3000;
|
||||||
|
const app = express();
|
||||||
|
require("express-ws")(app);
|
||||||
|
require("dotenv").config({ path: `../../../../../.env.development` });
|
||||||
|
|
||||||
|
// Debugging echo function if this is working for you.
|
||||||
|
// app.ws('/echo', function (ws, req) {
|
||||||
|
// ws.on('message', function (msg) {
|
||||||
|
// ws.send(msg);
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
|
||||||
|
// Set up WSS sockets for listening.
|
||||||
|
app.ws("/ws", function (ws, _response) {
|
||||||
|
try {
|
||||||
|
ws.on("message", function (msg) {
|
||||||
|
if (ws?.handleFeedback) ws.handleFeedback(msg);
|
||||||
|
});
|
||||||
|
|
||||||
|
ws.on("close", function () {
|
||||||
|
console.log("Socket killed");
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("Socket online and waiting...");
|
||||||
|
runAIbitat(ws).catch((error) => {
|
||||||
|
ws.send(
|
||||||
|
JSON.stringify({
|
||||||
|
from: Agent.AI,
|
||||||
|
to: Agent.HUMAN,
|
||||||
|
content: error.message,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
} catch (error) {}
|
||||||
|
});
|
||||||
|
|
||||||
|
app.all("*", function (_, response) {
|
||||||
|
response.sendFile(path.join(__dirname, "index.html"));
|
||||||
|
});
|
||||||
|
|
||||||
|
app.listen(port, () => {
|
||||||
|
console.log(`Testing HTTP/WSS server listening at http://localhost:${port}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
const Agent = {
|
||||||
|
HUMAN: "🧑",
|
||||||
|
AI: "🤖",
|
||||||
|
};
|
||||||
|
|
||||||
|
async function runAIbitat(socket) {
|
||||||
|
if (!process.env.OPEN_AI_KEY)
|
||||||
|
throw new Error(
|
||||||
|
"This example requires a valid OPEN_AI_KEY in the env.development file"
|
||||||
|
);
|
||||||
|
console.log(chalk.blue("Booting AIbitat class & starting agent(s)"));
|
||||||
|
const aibitat = new AIbitat({
|
||||||
|
provider: "openai",
|
||||||
|
model: "gpt-3.5-turbo",
|
||||||
|
})
|
||||||
|
.use(websocket.plugin({ socket }))
|
||||||
|
.use(webBrowsing.plugin())
|
||||||
|
.use(webScraping.plugin())
|
||||||
|
.agent(Agent.HUMAN, {
|
||||||
|
interrupt: "ALWAYS",
|
||||||
|
role: "You are a human assistant.",
|
||||||
|
})
|
||||||
|
.agent(Agent.AI, {
|
||||||
|
role: "You are a helpful ai assistant who likes to chat with the user who an also browse the web for questions it does not know or have real-time access to.",
|
||||||
|
functions: ["web-browsing"],
|
||||||
|
});
|
||||||
|
|
||||||
|
await aibitat.start({
|
||||||
|
from: Agent.HUMAN,
|
||||||
|
to: Agent.AI,
|
||||||
|
content: `How are you doing today?`,
|
||||||
|
});
|
||||||
|
}
|
747
server/utils/agents/aibitat/index.js
Normal file
747
server/utils/agents/aibitat/index.js
Normal file
@ -0,0 +1,747 @@
|
|||||||
|
const { EventEmitter } = require("events");
|
||||||
|
const { APIError } = require("./error.js");
|
||||||
|
const Providers = require("./providers/index.js");
|
||||||
|
const { Telemetry } = require("../../../models/telemetry.js");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AIbitat is a class that manages the conversation between agents.
|
||||||
|
* It is designed to solve a task with LLM.
|
||||||
|
*
|
||||||
|
* Guiding the chat through a graph of agents.
|
||||||
|
*/
|
||||||
|
class AIbitat {
|
||||||
|
emitter = new EventEmitter();
|
||||||
|
|
||||||
|
defaultProvider = null;
|
||||||
|
defaultInterrupt;
|
||||||
|
maxRounds;
|
||||||
|
_chats;
|
||||||
|
|
||||||
|
agents = new Map();
|
||||||
|
channels = new Map();
|
||||||
|
functions = new Map();
|
||||||
|
|
||||||
|
constructor(props = {}) {
|
||||||
|
const {
|
||||||
|
chats = [],
|
||||||
|
interrupt = "NEVER",
|
||||||
|
maxRounds = 100,
|
||||||
|
provider = "openai",
|
||||||
|
handlerProps = {}, // Inherited props we can spread so aibitat can access.
|
||||||
|
...rest
|
||||||
|
} = props;
|
||||||
|
this._chats = chats;
|
||||||
|
this.defaultInterrupt = interrupt;
|
||||||
|
this.maxRounds = maxRounds;
|
||||||
|
this.handlerProps = handlerProps;
|
||||||
|
|
||||||
|
this.defaultProvider = {
|
||||||
|
provider,
|
||||||
|
...rest,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the chat history between agents and channels.
|
||||||
|
*/
|
||||||
|
get chats() {
|
||||||
|
return this._chats;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Install a plugin.
|
||||||
|
*/
|
||||||
|
use(plugin) {
|
||||||
|
plugin.setup(this);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a new agent to the AIbitat.
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* @param config
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
agent(name = "", config = {}) {
|
||||||
|
this.agents.set(name, config);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a new channel to the AIbitat.
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* @param members
|
||||||
|
* @param config
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
channel(name = "", members = [""], config = {}) {
|
||||||
|
this.channels.set(name, {
|
||||||
|
members,
|
||||||
|
...config,
|
||||||
|
});
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the specific agent configuration.
|
||||||
|
*
|
||||||
|
* @param agent The name of the agent.
|
||||||
|
* @throws When the agent configuration is not found.
|
||||||
|
* @returns The agent configuration.
|
||||||
|
*/
|
||||||
|
getAgentConfig(agent = "") {
|
||||||
|
const config = this.agents.get(agent);
|
||||||
|
if (!config) {
|
||||||
|
throw new Error(`Agent configuration "${agent}" not found`);
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
role: "You are a helpful AI assistant.",
|
||||||
|
// role: `You are a helpful AI assistant.
|
||||||
|
// Solve tasks using your coding and language skills.
|
||||||
|
// In the following cases, suggest typescript code (in a typescript coding block) or shell script (in a sh coding block) for the user to execute.
|
||||||
|
// 1. When you need to collect info, use the code to output the info you need, for example, browse or search the web, download/read a file, print the content of a webpage or a file, get the current date/time, check the operating system. After sufficient info is printed and the task is ready to be solved based on your language skill, you can solve the task by yourself.
|
||||||
|
// 2. When you need to perform some task with code, use the code to perform the task and output the result. Finish the task smartly.
|
||||||
|
// Solve the task step by step if you need to. If a plan is not provided, explain your plan first. Be clear which step uses code, and which step uses your language skill.
|
||||||
|
// When using code, you must indicate the script type in the code block. The user cannot provide any other feedback or perform any other action beyond executing the code you suggest. The user can't modify your code. So do not suggest incomplete code which requires users to modify. Don't use a code block if it's not intended to be executed by the user.
|
||||||
|
// If you want the user to save the code in a file before executing it, put # filename: <filename> inside the code block as the first line. Don't include multiple code blocks in one response. Do not ask users to copy and paste the result. Instead, use 'print' function for the output when relevant. Check the execution result returned by the user.
|
||||||
|
// If the result indicates there is an error, fix the error and output the code again. Suggest the full code instead of partial code or code changes. If the error can't be fixed or if the task is not solved even after the code is executed successfully, analyze the problem, revisit your assumption, collect additional info you need, and think of a different approach to try.
|
||||||
|
// When you find an answer, verify the answer carefully. Include verifiable evidence in your response if possible.
|
||||||
|
// Reply "TERMINATE" when everything is done.`,
|
||||||
|
...config,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the specific channel configuration.
|
||||||
|
*
|
||||||
|
* @param channel The name of the channel.
|
||||||
|
* @throws When the channel configuration is not found.
|
||||||
|
* @returns The channel configuration.
|
||||||
|
*/
|
||||||
|
getChannelConfig(channel = "") {
|
||||||
|
const config = this.channels.get(channel);
|
||||||
|
if (!config) {
|
||||||
|
throw new Error(`Channel configuration "${channel}" not found`);
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
maxRounds: 10,
|
||||||
|
role: "",
|
||||||
|
...config,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the members of a group.
|
||||||
|
* @throws When the group is not defined as an array in the connections.
|
||||||
|
* @param node The name of the group.
|
||||||
|
* @returns The members of the group.
|
||||||
|
*/
|
||||||
|
getGroupMembers(node = "") {
|
||||||
|
const group = this.getChannelConfig(node);
|
||||||
|
return group.members;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Triggered when a plugin, socket, or command is aborted.
|
||||||
|
*
|
||||||
|
* @param listener
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
onAbort(listener = () => null) {
|
||||||
|
this.emitter.on("abort", listener);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abort the running of any plugins that may still be pending (Langchain summarize)
|
||||||
|
*/
|
||||||
|
abort() {
|
||||||
|
this.emitter.emit("abort", null, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Triggered when a chat is terminated. After this, the chat can't be continued.
|
||||||
|
*
|
||||||
|
* @param listener
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
onTerminate(listener = () => null) {
|
||||||
|
this.emitter.on("terminate", listener);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Terminate the chat. After this, the chat can't be continued.
|
||||||
|
*
|
||||||
|
* @param node Last node to chat with
|
||||||
|
*/
|
||||||
|
terminate(node = "") {
|
||||||
|
this.emitter.emit("terminate", node, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Triggered when a chat is interrupted by a node.
|
||||||
|
*
|
||||||
|
* @param listener
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
onInterrupt(listener = () => null) {
|
||||||
|
this.emitter.on("interrupt", listener);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interruption the chat.
|
||||||
|
*
|
||||||
|
* @param route The nodes that participated in the interruption.
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
interrupt(route) {
|
||||||
|
this._chats.push({
|
||||||
|
...route,
|
||||||
|
state: "interrupt",
|
||||||
|
});
|
||||||
|
this.emitter.emit("interrupt", route, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Triggered when a message is added to the chat history.
|
||||||
|
* This can either be the first message or a reply to a message.
|
||||||
|
*
|
||||||
|
* @param listener
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
onMessage(listener = (chat) => null) {
|
||||||
|
this.emitter.on("message", listener);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register a new successful message in the chat history.
|
||||||
|
* This will trigger the `onMessage` event.
|
||||||
|
*
|
||||||
|
* @param message
|
||||||
|
*/
|
||||||
|
newMessage(message) {
|
||||||
|
const chat = {
|
||||||
|
...message,
|
||||||
|
state: "success",
|
||||||
|
};
|
||||||
|
|
||||||
|
this._chats.push(chat);
|
||||||
|
this.emitter.emit("message", chat, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Triggered when an error occurs during the chat.
|
||||||
|
*
|
||||||
|
* @param listener
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
onError(
|
||||||
|
listener = (
|
||||||
|
/**
|
||||||
|
* The error that occurred.
|
||||||
|
*
|
||||||
|
* Native errors are:
|
||||||
|
* - `APIError`
|
||||||
|
* - `AuthorizationError`
|
||||||
|
* - `UnknownError`
|
||||||
|
* - `RateLimitError`
|
||||||
|
* - `ServerError`
|
||||||
|
*/
|
||||||
|
error = null,
|
||||||
|
/**
|
||||||
|
* The message when the error occurred.
|
||||||
|
*/
|
||||||
|
{}
|
||||||
|
) => null
|
||||||
|
) {
|
||||||
|
this.emitter.on("replyError", listener);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register an error in the chat history.
|
||||||
|
* This will trigger the `onError` event.
|
||||||
|
*
|
||||||
|
* @param route
|
||||||
|
* @param error
|
||||||
|
*/
|
||||||
|
newError(route, error) {
|
||||||
|
const chat = {
|
||||||
|
...route,
|
||||||
|
content: error instanceof Error ? error.message : String(error),
|
||||||
|
state: "error",
|
||||||
|
};
|
||||||
|
this._chats.push(chat);
|
||||||
|
this.emitter.emit("replyError", error, chat);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Triggered when a chat is interrupted by a node.
|
||||||
|
*
|
||||||
|
* @param listener
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
onStart(listener = (chat, aibitat) => null) {
|
||||||
|
this.emitter.on("start", listener);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start a new chat.
|
||||||
|
*
|
||||||
|
* @param message The message to start the chat.
|
||||||
|
*/
|
||||||
|
async start(message) {
|
||||||
|
// register the message in the chat history
|
||||||
|
this.newMessage(message);
|
||||||
|
this.emitter.emit("start", message, this);
|
||||||
|
|
||||||
|
// ask the node to reply
|
||||||
|
await this.chat({
|
||||||
|
to: message.from,
|
||||||
|
from: message.to,
|
||||||
|
});
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursively chat between two nodes.
|
||||||
|
*
|
||||||
|
* @param route
|
||||||
|
* @param keepAlive Whether to keep the chat alive.
|
||||||
|
*/
|
||||||
|
async chat(route, keepAlive = true) {
|
||||||
|
// check if the message is for a group
|
||||||
|
// if it is, select the next node to chat with from the group
|
||||||
|
// and then ask them to reply.
|
||||||
|
if (this.channels.get(route.from)) {
|
||||||
|
// select a node from the group
|
||||||
|
let nextNode;
|
||||||
|
try {
|
||||||
|
nextNode = await this.selectNext(route.from);
|
||||||
|
} catch (error) {
|
||||||
|
if (error instanceof APIError) {
|
||||||
|
return this.newError({ from: route.from, to: route.to }, error);
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!nextNode) {
|
||||||
|
// TODO: should it throw an error or keep the chat alive when there is no node to chat with in the group?
|
||||||
|
// maybe it should wrap up the chat and reply to the original node
|
||||||
|
// For now, it will terminate the chat
|
||||||
|
this.terminate(route.from);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const nextChat = {
|
||||||
|
from: nextNode,
|
||||||
|
to: route.from,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (this.shouldAgentInterrupt(nextNode)) {
|
||||||
|
this.interrupt(nextChat);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get chats only from the group's nodes
|
||||||
|
const history = this.getHistory({ to: route.from });
|
||||||
|
const group = this.getGroupMembers(route.from);
|
||||||
|
const rounds = history.filter((chat) => group.includes(chat.from)).length;
|
||||||
|
|
||||||
|
const { maxRounds } = this.getChannelConfig(route.from);
|
||||||
|
if (rounds >= maxRounds) {
|
||||||
|
this.terminate(route.to);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.chat(nextChat);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If it's a direct message, reply to the message
|
||||||
|
let reply = "";
|
||||||
|
try {
|
||||||
|
reply = await this.reply(route);
|
||||||
|
} catch (error) {
|
||||||
|
if (error instanceof APIError) {
|
||||||
|
return this.newError({ from: route.from, to: route.to }, error);
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
reply === "TERMINATE" ||
|
||||||
|
this.hasReachedMaximumRounds(route.from, route.to)
|
||||||
|
) {
|
||||||
|
this.terminate(route.to);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const newChat = { to: route.from, from: route.to };
|
||||||
|
|
||||||
|
if (
|
||||||
|
reply === "INTERRUPT" ||
|
||||||
|
(this.agents.get(route.to) && this.shouldAgentInterrupt(route.to))
|
||||||
|
) {
|
||||||
|
this.interrupt(newChat);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keepAlive) {
|
||||||
|
// keep the chat alive by replying to the other node
|
||||||
|
await this.chat(newChat, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the agent should interrupt the chat based on its configuration.
|
||||||
|
*
|
||||||
|
* @param agent
|
||||||
|
* @returns {boolean} Whether the agent should interrupt the chat.
|
||||||
|
*/
|
||||||
|
shouldAgentInterrupt(agent = "") {
|
||||||
|
const config = this.getAgentConfig(agent);
|
||||||
|
return this.defaultInterrupt === "ALWAYS" || config.interrupt === "ALWAYS";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select the next node to chat with from a group. The node will be selected based on the history of chats.
|
||||||
|
* It will select the node that has not reached the maximum number of rounds yet and has not chatted with the channel in the last round.
|
||||||
|
* If it could not determine the next node, it will return a random node.
|
||||||
|
*
|
||||||
|
* @param channel The name of the group.
|
||||||
|
* @returns The name of the node to chat with.
|
||||||
|
*/
|
||||||
|
async selectNext(channel = "") {
|
||||||
|
// get all members of the group
|
||||||
|
const nodes = this.getGroupMembers(channel);
|
||||||
|
const channelConfig = this.getChannelConfig(channel);
|
||||||
|
|
||||||
|
// TODO: move this to when the group is created
|
||||||
|
// warn if the group is underpopulated
|
||||||
|
if (nodes.length < 3) {
|
||||||
|
console.warn(
|
||||||
|
`- Group (${channel}) is underpopulated with ${nodes.length} agents. Direct communication would be more efficient.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the nodes that have not reached the maximum number of rounds
|
||||||
|
const availableNodes = nodes.filter(
|
||||||
|
(node) => !this.hasReachedMaximumRounds(channel, node)
|
||||||
|
);
|
||||||
|
|
||||||
|
// remove the last node that chatted with the channel, so it doesn't chat again
|
||||||
|
const lastChat = this._chats.filter((c) => c.to === channel).at(-1);
|
||||||
|
if (lastChat) {
|
||||||
|
const index = availableNodes.indexOf(lastChat.from);
|
||||||
|
if (index > -1) {
|
||||||
|
availableNodes.splice(index, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: what should it do when there is no node to chat with?
|
||||||
|
if (!availableNodes.length) return;
|
||||||
|
|
||||||
|
// get the provider that will be used for the channel
|
||||||
|
// if the channel has a provider, use that otherwise
|
||||||
|
// use the GPT-4 because it has a better reasoning
|
||||||
|
const provider = this.getProviderForConfig({
|
||||||
|
// @ts-expect-error
|
||||||
|
model: "gpt-4",
|
||||||
|
...this.defaultProvider,
|
||||||
|
...channelConfig,
|
||||||
|
});
|
||||||
|
const history = this.getHistory({ to: channel });
|
||||||
|
|
||||||
|
// build the messages to send to the provider
|
||||||
|
const messages = [
|
||||||
|
{
|
||||||
|
role: "system",
|
||||||
|
content: channelConfig.role,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
role: "user",
|
||||||
|
content: `You are in a role play game. The following roles are available:
|
||||||
|
${availableNodes
|
||||||
|
.map((node) => `@${node}: ${this.getAgentConfig(node).role}`)
|
||||||
|
.join("\n")}.
|
||||||
|
|
||||||
|
Read the following conversation.
|
||||||
|
|
||||||
|
CHAT HISTORY
|
||||||
|
${history.map((c) => `@${c.from}: ${c.content}`).join("\n")}
|
||||||
|
|
||||||
|
Then select the next role from that is going to speak next.
|
||||||
|
Only return the role.
|
||||||
|
`,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
// ask the provider to select the next node to chat with
|
||||||
|
// and remove the @ from the response
|
||||||
|
const { result } = await provider.complete(messages);
|
||||||
|
const name = result?.replace(/^@/g, "");
|
||||||
|
if (this.agents.get(name)) {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if the name is not in the nodes, return a random node
|
||||||
|
return availableNodes[Math.floor(Math.random() * availableNodes.length)];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the chat has reached the maximum number of rounds.
|
||||||
|
*/
|
||||||
|
hasReachedMaximumRounds(from = "", to = "") {
|
||||||
|
return this.getHistory({ from, to }).length >= this.maxRounds;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ask the for the AI provider to generate a reply to the chat.
|
||||||
|
*
|
||||||
|
* @param route.to The node that sent the chat.
|
||||||
|
* @param route.from The node that will reply to the chat.
|
||||||
|
*/
|
||||||
|
async reply(route) {
|
||||||
|
// get the provider for the node that will reply
|
||||||
|
const fromConfig = this.getAgentConfig(route.from);
|
||||||
|
|
||||||
|
const chatHistory =
|
||||||
|
// if it is sending message to a group, send the group chat history to the provider
|
||||||
|
// otherwise, send the chat history between the two nodes
|
||||||
|
this.channels.get(route.to)
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
role: "user",
|
||||||
|
content: `You are in a whatsapp group. Read the following conversation and then reply.
|
||||||
|
Do not add introduction or conclusion to your reply because this will be a continuous conversation. Don't introduce yourself.
|
||||||
|
|
||||||
|
CHAT HISTORY
|
||||||
|
${this.getHistory({ to: route.to })
|
||||||
|
.map((c) => `@${c.from}: ${c.content}`)
|
||||||
|
.join("\n")}
|
||||||
|
|
||||||
|
@${route.from}:`,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: this.getHistory(route).map((c) => ({
|
||||||
|
content: c.content,
|
||||||
|
role: c.from === route.to ? "user" : "assistant",
|
||||||
|
}));
|
||||||
|
|
||||||
|
// build the messages to send to the provider
|
||||||
|
const messages = [
|
||||||
|
{
|
||||||
|
content: fromConfig.role,
|
||||||
|
role: "system",
|
||||||
|
},
|
||||||
|
// get the history of chats between the two nodes
|
||||||
|
...chatHistory,
|
||||||
|
];
|
||||||
|
|
||||||
|
// get the functions that the node can call
|
||||||
|
const functions = fromConfig.functions
|
||||||
|
?.map((name) => this.functions.get(name))
|
||||||
|
.filter((a) => !!a);
|
||||||
|
|
||||||
|
const provider = this.getProviderForConfig({
|
||||||
|
...this.defaultProvider,
|
||||||
|
...fromConfig,
|
||||||
|
});
|
||||||
|
|
||||||
|
// get the chat completion
|
||||||
|
const content = await this.handleExecution(
|
||||||
|
provider,
|
||||||
|
messages,
|
||||||
|
functions,
|
||||||
|
route.from
|
||||||
|
);
|
||||||
|
this.newMessage({ ...route, content });
|
||||||
|
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
async handleExecution(
|
||||||
|
provider,
|
||||||
|
messages = [],
|
||||||
|
functions = [],
|
||||||
|
byAgent = null
|
||||||
|
) {
|
||||||
|
// get the chat completion
|
||||||
|
const completion = await provider.complete(messages, functions);
|
||||||
|
|
||||||
|
if (completion.functionCall) {
|
||||||
|
const { name, arguments: args } = completion.functionCall;
|
||||||
|
const fn = this.functions.get(name);
|
||||||
|
|
||||||
|
// if provider hallucinated on the function name
|
||||||
|
// ask the provider to complete again
|
||||||
|
if (!fn) {
|
||||||
|
return await this.handleExecution(
|
||||||
|
provider,
|
||||||
|
[
|
||||||
|
...messages,
|
||||||
|
{
|
||||||
|
name,
|
||||||
|
role: "function",
|
||||||
|
content: `Function "${name}" not found. Try again.`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
functions,
|
||||||
|
byAgent
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Execute the function and return the result to the provider
|
||||||
|
fn.caller = byAgent || "agent";
|
||||||
|
const result = await fn.handler(args);
|
||||||
|
Telemetry.sendTelemetry("agent_tool_call", { tool: name }, null, true);
|
||||||
|
return await this.handleExecution(
|
||||||
|
provider,
|
||||||
|
[
|
||||||
|
...messages,
|
||||||
|
{
|
||||||
|
name,
|
||||||
|
role: "function",
|
||||||
|
content: result,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
functions,
|
||||||
|
byAgent
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return completion?.result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Continue the chat from the last interruption.
|
||||||
|
* If the last chat was not an interruption, it will throw an error.
|
||||||
|
* Provide a feedback where it was interrupted if you want to.
|
||||||
|
*
|
||||||
|
* @param feedback The feedback to the interruption if any.
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
async continue(feedback) {
|
||||||
|
const lastChat = this._chats.at(-1);
|
||||||
|
if (!lastChat || lastChat.state !== "interrupt") {
|
||||||
|
throw new Error("No chat to continue");
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove the last chat's that was interrupted
|
||||||
|
this._chats.pop();
|
||||||
|
|
||||||
|
const { from, to } = lastChat;
|
||||||
|
|
||||||
|
if (this.hasReachedMaximumRounds(from, to)) {
|
||||||
|
throw new Error("Maximum rounds reached");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (feedback) {
|
||||||
|
const message = {
|
||||||
|
from,
|
||||||
|
to,
|
||||||
|
content: feedback,
|
||||||
|
};
|
||||||
|
|
||||||
|
// register the message in the chat history
|
||||||
|
this.newMessage(message);
|
||||||
|
|
||||||
|
// ask the node to reply
|
||||||
|
await this.chat({
|
||||||
|
to: message.from,
|
||||||
|
from: message.to,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
await this.chat({ from, to });
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retry the last chat that threw an error.
|
||||||
|
* If the last chat was not an error, it will throw an error.
|
||||||
|
*/
|
||||||
|
async retry() {
|
||||||
|
const lastChat = this._chats.at(-1);
|
||||||
|
if (!lastChat || lastChat.state !== "error") {
|
||||||
|
throw new Error("No chat to retry");
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove the last chat's that threw an error
|
||||||
|
const { from, to } = this?._chats?.pop();
|
||||||
|
|
||||||
|
await this.chat({ from, to });
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the chat history between two nodes or all chats to/from a node.
|
||||||
|
*/
|
||||||
|
getHistory({ from, to }) {
|
||||||
|
return this._chats.filter((chat) => {
|
||||||
|
const isSuccess = chat.state === "success";
|
||||||
|
|
||||||
|
// return all chats to the node
|
||||||
|
if (!from) {
|
||||||
|
return isSuccess && chat.to === to;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get all chats from the node
|
||||||
|
if (!to) {
|
||||||
|
return isSuccess && chat.from === from;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if the chat is between the two nodes
|
||||||
|
const hasSent = chat.from === from && chat.to === to;
|
||||||
|
const hasReceived = chat.from === to && chat.to === from;
|
||||||
|
const mutual = hasSent || hasReceived;
|
||||||
|
|
||||||
|
return isSuccess && mutual;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get provider based on configurations.
|
||||||
|
* If the provider is a string, it will return the default provider for that string.
|
||||||
|
*
|
||||||
|
* @param config The provider configuration.
|
||||||
|
*/
|
||||||
|
getProviderForConfig(config) {
|
||||||
|
if (typeof config.provider === "object") {
|
||||||
|
return config.provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (config.provider) {
|
||||||
|
case "openai":
|
||||||
|
return new Providers.OpenAIProvider({ model: config.model });
|
||||||
|
case "anthropic":
|
||||||
|
return new Providers.AnthropicProvider({ model: config.model });
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new Error(
|
||||||
|
`Unknown provider: ${config.provider}. Please use "openai"`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register a new function to be called by the AIbitat agents.
|
||||||
|
* You are also required to specify the which node can call the function.
|
||||||
|
* @param functionConfig The function configuration.
|
||||||
|
*/
|
||||||
|
function(functionConfig) {
|
||||||
|
this.functions.set(functionConfig.name, functionConfig);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = AIbitat;
|
49
server/utils/agents/aibitat/plugins/chat-history.js
Normal file
49
server/utils/agents/aibitat/plugins/chat-history.js
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
const { WorkspaceChats } = require("../../../../models/workspaceChats");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plugin to save chat history to AnythingLLM DB.
|
||||||
|
*/
|
||||||
|
const chatHistory = {
|
||||||
|
name: "chat-history",
|
||||||
|
startupConfig: {
|
||||||
|
params: {},
|
||||||
|
},
|
||||||
|
plugin: function () {
|
||||||
|
return {
|
||||||
|
name: this.name,
|
||||||
|
setup: function (aibitat) {
|
||||||
|
aibitat.onMessage(async () => {
|
||||||
|
try {
|
||||||
|
const lastResponses = aibitat.chats.slice(-2);
|
||||||
|
if (lastResponses.length !== 2) return;
|
||||||
|
const [prev, last] = lastResponses;
|
||||||
|
|
||||||
|
// We need a full conversation reply with prev being from
|
||||||
|
// the USER and the last being from anyone other than the user.
|
||||||
|
if (prev.from !== "USER" || last.from === "USER") return;
|
||||||
|
await this._store(aibitat, {
|
||||||
|
prompt: prev.content,
|
||||||
|
response: last.content,
|
||||||
|
});
|
||||||
|
} catch {}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
_store: async function (aibitat, { prompt, response } = {}) {
|
||||||
|
const invocation = aibitat.handlerProps.invocation;
|
||||||
|
await WorkspaceChats.new({
|
||||||
|
workspaceId: Number(invocation.workspace_id),
|
||||||
|
prompt,
|
||||||
|
response: {
|
||||||
|
text: response,
|
||||||
|
sources: [],
|
||||||
|
type: "chat",
|
||||||
|
},
|
||||||
|
user: { id: invocation?.user_id || null },
|
||||||
|
threadId: invocation?.thread_id || null,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = { chatHistory };
|
140
server/utils/agents/aibitat/plugins/cli.js
Normal file
140
server/utils/agents/aibitat/plugins/cli.js
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
// Plugin CAN ONLY BE USE IN DEVELOPMENT.
|
||||||
|
const { input } = require("@inquirer/prompts");
|
||||||
|
const chalk = require("chalk");
|
||||||
|
const { RetryError } = require("../error");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command-line Interface plugin. It prints the messages on the console and asks for feedback
|
||||||
|
* while the conversation is running in the background.
|
||||||
|
*/
|
||||||
|
const cli = {
|
||||||
|
name: "cli",
|
||||||
|
startupConfig: {
|
||||||
|
params: {},
|
||||||
|
},
|
||||||
|
plugin: function ({ simulateStream = true } = {}) {
|
||||||
|
return {
|
||||||
|
name: this.name,
|
||||||
|
setup(aibitat) {
|
||||||
|
let printing = [];
|
||||||
|
|
||||||
|
aibitat.onError(async (error) => {
|
||||||
|
console.error(chalk.red(` error: ${error?.message}`));
|
||||||
|
if (error instanceof RetryError) {
|
||||||
|
console.error(chalk.red(` retrying in 60 seconds...`));
|
||||||
|
setTimeout(() => {
|
||||||
|
aibitat.retry();
|
||||||
|
}, 60000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
aibitat.onStart(() => {
|
||||||
|
console.log();
|
||||||
|
console.log("🚀 starting chat ...\n");
|
||||||
|
printing = [Promise.resolve()];
|
||||||
|
});
|
||||||
|
|
||||||
|
aibitat.onMessage(async (message) => {
|
||||||
|
const next = new Promise(async (resolve) => {
|
||||||
|
await Promise.all(printing);
|
||||||
|
await this.print(message, simulateStream);
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
printing.push(next);
|
||||||
|
});
|
||||||
|
|
||||||
|
aibitat.onTerminate(async () => {
|
||||||
|
await Promise.all(printing);
|
||||||
|
console.log("🚀 chat finished");
|
||||||
|
});
|
||||||
|
|
||||||
|
aibitat.onInterrupt(async (node) => {
|
||||||
|
await Promise.all(printing);
|
||||||
|
const feedback = await this.askForFeedback(node);
|
||||||
|
// Add an extra line after the message
|
||||||
|
console.log();
|
||||||
|
|
||||||
|
if (feedback === "exit") {
|
||||||
|
console.log("🚀 chat finished");
|
||||||
|
return process.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
await aibitat.continue(feedback);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print a message on the terminal
|
||||||
|
*
|
||||||
|
* @param message
|
||||||
|
* // message Type { from: string; to: string; content?: string } & {
|
||||||
|
state: 'loading' | 'error' | 'success' | 'interrupt'
|
||||||
|
}
|
||||||
|
* @param simulateStream
|
||||||
|
*/
|
||||||
|
print: async function (message = {}, simulateStream = true) {
|
||||||
|
const replying = chalk.dim(`(to ${message.to})`);
|
||||||
|
const reference = `${chalk.magenta("✎")} ${chalk.bold(
|
||||||
|
message.from
|
||||||
|
)} ${replying}:`;
|
||||||
|
|
||||||
|
if (!simulateStream) {
|
||||||
|
console.log(reference);
|
||||||
|
console.log(message.content);
|
||||||
|
// Add an extra line after the message
|
||||||
|
console.log();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
process.stdout.write(`${reference}\n`);
|
||||||
|
|
||||||
|
// Emulate streaming by breaking the cached response into chunks
|
||||||
|
const chunks = message.content?.split(" ") || [];
|
||||||
|
const stream = new ReadableStream({
|
||||||
|
async start(controller) {
|
||||||
|
for (const chunk of chunks) {
|
||||||
|
const bytes = new TextEncoder().encode(chunk + " ");
|
||||||
|
controller.enqueue(bytes);
|
||||||
|
await new Promise((r) =>
|
||||||
|
setTimeout(
|
||||||
|
r,
|
||||||
|
// get a random number between 10ms and 50ms to simulate a random delay
|
||||||
|
Math.floor(Math.random() * 40) + 10
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
controller.close();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Stream the response to the chat
|
||||||
|
for await (const chunk of stream) {
|
||||||
|
process.stdout.write(new TextDecoder().decode(chunk));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add an extra line after the message
|
||||||
|
console.log();
|
||||||
|
console.log();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ask for feedback to the user using the terminal
|
||||||
|
*
|
||||||
|
* @param node //{ from: string; to: string }
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
askForFeedback: function (node = {}) {
|
||||||
|
return input({
|
||||||
|
message: `Provide feedback to ${chalk.yellow(
|
||||||
|
node.to
|
||||||
|
)} as ${chalk.yellow(
|
||||||
|
node.from
|
||||||
|
)}. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: `,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = { cli };
|
37
server/utils/agents/aibitat/plugins/file-history.js
Normal file
37
server/utils/agents/aibitat/plugins/file-history.js
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
const fs = require("fs");
|
||||||
|
const path = require("path");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plugin to save chat history to a json file
|
||||||
|
*/
|
||||||
|
const fileHistory = {
|
||||||
|
name: "file-history-plugin",
|
||||||
|
startupConfig: {
|
||||||
|
params: {},
|
||||||
|
},
|
||||||
|
plugin: function ({
|
||||||
|
filename = `history/chat-history-${new Date().toISOString()}.json`,
|
||||||
|
} = {}) {
|
||||||
|
return {
|
||||||
|
name: this.name,
|
||||||
|
setup(aibitat) {
|
||||||
|
const folderPath = path.dirname(filename);
|
||||||
|
// get path from filename
|
||||||
|
if (folderPath) {
|
||||||
|
fs.mkdirSync(folderPath, { recursive: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
aibitat.onMessage(() => {
|
||||||
|
const content = JSON.stringify(aibitat.chats, null, 2);
|
||||||
|
fs.writeFile(filename, content, (err) => {
|
||||||
|
if (err) {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = { fileHistory };
|
26
server/utils/agents/aibitat/plugins/index.js
Normal file
26
server/utils/agents/aibitat/plugins/index.js
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
const { webBrowsing } = require("./web-browsing.js");
|
||||||
|
const { webScraping } = require("./web-scraping.js");
|
||||||
|
const { websocket } = require("./websocket.js");
|
||||||
|
const { docSummarizer } = require("./summarize.js");
|
||||||
|
const { saveFileInBrowser } = require("./save-file-browser.js");
|
||||||
|
const { chatHistory } = require("./chat-history.js");
|
||||||
|
const { memory } = require("./memory.js");
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
webScraping,
|
||||||
|
webBrowsing,
|
||||||
|
websocket,
|
||||||
|
docSummarizer,
|
||||||
|
saveFileInBrowser,
|
||||||
|
chatHistory,
|
||||||
|
memory,
|
||||||
|
|
||||||
|
// Plugin name aliases so they can be pulled by slug as well.
|
||||||
|
[webScraping.name]: webScraping,
|
||||||
|
[webBrowsing.name]: webBrowsing,
|
||||||
|
[websocket.name]: websocket,
|
||||||
|
[docSummarizer.name]: docSummarizer,
|
||||||
|
[saveFileInBrowser.name]: saveFileInBrowser,
|
||||||
|
[chatHistory.name]: chatHistory,
|
||||||
|
[memory.name]: memory,
|
||||||
|
};
|
134
server/utils/agents/aibitat/plugins/memory.js
Normal file
134
server/utils/agents/aibitat/plugins/memory.js
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
const { v4 } = require("uuid");
|
||||||
|
const { getVectorDbClass, getLLMProvider } = require("../../../helpers");
|
||||||
|
const { Deduplicator } = require("../utils/dedupe");
|
||||||
|
|
||||||
|
const memory = {
|
||||||
|
name: "rag-memory",
|
||||||
|
startupConfig: {
|
||||||
|
params: {},
|
||||||
|
},
|
||||||
|
plugin: function () {
|
||||||
|
return {
|
||||||
|
name: this.name,
|
||||||
|
setup(aibitat) {
|
||||||
|
aibitat.function({
|
||||||
|
super: aibitat,
|
||||||
|
tracker: new Deduplicator(),
|
||||||
|
name: this.name,
|
||||||
|
description:
|
||||||
|
"Search against local documents for context that is relevant to the query or store a snippet of text into memory for retrieval later. Storing information should only be done when the user specifically requests for information to be remembered or saved to long-term memory. You should use this tool before search the internet for information.",
|
||||||
|
parameters: {
|
||||||
|
$schema: "http://json-schema.org/draft-07/schema#",
|
||||||
|
type: "object",
|
||||||
|
properties: {
|
||||||
|
action: {
|
||||||
|
type: "string",
|
||||||
|
enum: ["search", "store"],
|
||||||
|
description:
|
||||||
|
"The action we want to take to search for existing similar context or storage of new context.",
|
||||||
|
},
|
||||||
|
content: {
|
||||||
|
type: "string",
|
||||||
|
description:
|
||||||
|
"The plain text to search our local documents with or to store in our vector database.",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
additionalProperties: false,
|
||||||
|
},
|
||||||
|
handler: async function ({ action = "", content = "" }) {
|
||||||
|
try {
|
||||||
|
if (this.tracker.isDuplicate(this.name, { action, content }))
|
||||||
|
return `This was a duplicated call and it's output will be ignored.`;
|
||||||
|
|
||||||
|
let response = "There was nothing to do.";
|
||||||
|
if (action === "search") response = await this.search(content);
|
||||||
|
if (action === "store") response = await this.store(content);
|
||||||
|
|
||||||
|
this.tracker.trackRun(this.name, { action, content });
|
||||||
|
return response;
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
return `There was an error while calling the function. ${error.message}`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
search: async function (query = "") {
|
||||||
|
try {
|
||||||
|
const workspace = this.super.handlerProps.invocation.workspace;
|
||||||
|
const LLMConnector = getLLMProvider({
|
||||||
|
provider: workspace?.chatProvider,
|
||||||
|
model: workspace?.chatModel,
|
||||||
|
});
|
||||||
|
const vectorDB = getVectorDbClass();
|
||||||
|
const { contextTexts = [] } =
|
||||||
|
await vectorDB.performSimilaritySearch({
|
||||||
|
namespace: workspace.slug,
|
||||||
|
input: query,
|
||||||
|
LLMConnector,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (contextTexts.length === 0) {
|
||||||
|
this.super.introspect(
|
||||||
|
`${this.caller}: I didn't find anything locally that would help answer this question.`
|
||||||
|
);
|
||||||
|
return "There was no additional context found for that query. We should search the web for this information.";
|
||||||
|
}
|
||||||
|
|
||||||
|
this.super.introspect(
|
||||||
|
`${this.caller}: Found ${contextTexts.length} additional piece of context to help answer this question.`
|
||||||
|
);
|
||||||
|
|
||||||
|
let combinedText = "Additional context for query:\n";
|
||||||
|
for (const text of contextTexts) combinedText += text + "\n\n";
|
||||||
|
return combinedText;
|
||||||
|
} catch (error) {
|
||||||
|
this.super.handlerProps.log(
|
||||||
|
`memory.search raised an error. ${error.message}`
|
||||||
|
);
|
||||||
|
return `An error was raised while searching the vector database. ${error.message}`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
store: async function (content = "") {
|
||||||
|
try {
|
||||||
|
const workspace = this.super.handlerProps.invocation.workspace;
|
||||||
|
const vectorDB = getVectorDbClass();
|
||||||
|
const { error } = await vectorDB.addDocumentToNamespace(
|
||||||
|
workspace.slug,
|
||||||
|
{
|
||||||
|
docId: v4(),
|
||||||
|
id: v4(),
|
||||||
|
url: "file://embed-via-agent.txt",
|
||||||
|
title: "agent-memory.txt",
|
||||||
|
docAuthor: "@agent",
|
||||||
|
description: "Unknown",
|
||||||
|
docSource: "a text file stored by the workspace agent.",
|
||||||
|
chunkSource: "",
|
||||||
|
published: new Date().toLocaleString(),
|
||||||
|
wordCount: content.split(" ").length,
|
||||||
|
pageContent: content,
|
||||||
|
token_count_estimate: 0,
|
||||||
|
},
|
||||||
|
null
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!!error)
|
||||||
|
return "The content was failed to be embedded properly.";
|
||||||
|
this.super.introspect(
|
||||||
|
`${this.caller}: I saved the content to long-term memory in this workspaces vector database.`
|
||||||
|
);
|
||||||
|
return "The content given was successfully embedded. There is nothing else to do.";
|
||||||
|
} catch (error) {
|
||||||
|
this.super.handlerProps.log(
|
||||||
|
`memory.store raised an error. ${error.message}`
|
||||||
|
);
|
||||||
|
return `Let the user know this action was not successful. An error was raised while storing data in the vector database. ${error.message}`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
memory,
|
||||||
|
};
|
70
server/utils/agents/aibitat/plugins/save-file-browser.js
Normal file
70
server/utils/agents/aibitat/plugins/save-file-browser.js
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
const { Deduplicator } = require("../utils/dedupe");
|
||||||
|
|
||||||
|
const saveFileInBrowser = {
|
||||||
|
name: "save-file-to-browser",
|
||||||
|
startupConfig: {
|
||||||
|
params: {},
|
||||||
|
},
|
||||||
|
plugin: function () {
|
||||||
|
return {
|
||||||
|
name: this.name,
|
||||||
|
setup(aibitat) {
|
||||||
|
// List and summarize the contents of files that are embedded in the workspace
|
||||||
|
aibitat.function({
|
||||||
|
super: aibitat,
|
||||||
|
tracker: new Deduplicator(),
|
||||||
|
name: this.name,
|
||||||
|
description:
|
||||||
|
"Save content to a file when the user explicity asks for a download of the file.",
|
||||||
|
parameters: {
|
||||||
|
$schema: "http://json-schema.org/draft-07/schema#",
|
||||||
|
type: "object",
|
||||||
|
properties: {
|
||||||
|
file_content: {
|
||||||
|
type: "string",
|
||||||
|
description: "The content of the file that will be saved.",
|
||||||
|
},
|
||||||
|
filename: {
|
||||||
|
type: "string",
|
||||||
|
description:
|
||||||
|
"filename to save the file as with extension. Extension should be plaintext file extension.",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
additionalProperties: false,
|
||||||
|
},
|
||||||
|
handler: async function ({ file_content = "", filename }) {
|
||||||
|
try {
|
||||||
|
if (
|
||||||
|
this.tracker.isDuplicate(this.name, { file_content, filename })
|
||||||
|
) {
|
||||||
|
this.super.handlerProps.log(
|
||||||
|
`${this.name} was called, but exited early since it was not a unique call.`
|
||||||
|
);
|
||||||
|
return `${filename} file has been saved successfully!`;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.super.socket.send("fileDownload", {
|
||||||
|
filename,
|
||||||
|
b64Content:
|
||||||
|
"data:text/plain;base64," +
|
||||||
|
Buffer.from(file_content, "utf8").toString("base64"),
|
||||||
|
});
|
||||||
|
this.super.introspect(`${this.caller}: Saving file ${filename}.`);
|
||||||
|
this.tracker.trackRun(this.name, { file_content, filename });
|
||||||
|
return `${filename} file has been saved successfully and will be downloaded automatically to the users browser.`;
|
||||||
|
} catch (error) {
|
||||||
|
this.super.handlerProps.log(
|
||||||
|
`save-file-to-browser raised an error. ${error.message}`
|
||||||
|
);
|
||||||
|
return `Let the user know this action was not successful. An error was raised while saving a file to the browser. ${error.message}`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
saveFileInBrowser,
|
||||||
|
};
|
130
server/utils/agents/aibitat/plugins/summarize.js
Normal file
130
server/utils/agents/aibitat/plugins/summarize.js
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
const { Document } = require("../../../../models/documents");
|
||||||
|
const { safeJsonParse } = require("../../../http");
|
||||||
|
const { validate } = require("uuid");
|
||||||
|
const { summarizeContent } = require("../utils/summarize");
|
||||||
|
|
||||||
|
const docSummarizer = {
|
||||||
|
name: "document-summarizer",
|
||||||
|
startupConfig: {
|
||||||
|
params: {},
|
||||||
|
},
|
||||||
|
plugin: function () {
|
||||||
|
return {
|
||||||
|
name: this.name,
|
||||||
|
setup(aibitat) {
|
||||||
|
aibitat.function({
|
||||||
|
super: aibitat,
|
||||||
|
name: this.name,
|
||||||
|
controller: new AbortController(),
|
||||||
|
description:
|
||||||
|
"Can get the list of files available to search with descriptions and can select a single file to open and summarize.",
|
||||||
|
parameters: {
|
||||||
|
$schema: "http://json-schema.org/draft-07/schema#",
|
||||||
|
type: "object",
|
||||||
|
properties: {
|
||||||
|
action: {
|
||||||
|
type: "string",
|
||||||
|
enum: ["list", "summarize"],
|
||||||
|
description:
|
||||||
|
"The action to take. 'list' will return all files available and their document ids. 'summarize' will open and summarize the file by the document_id, in the format of a uuid.",
|
||||||
|
},
|
||||||
|
document_id: {
|
||||||
|
type: "string",
|
||||||
|
"x-nullable": true,
|
||||||
|
description:
|
||||||
|
"A document id to summarize the content of. Document id must be a uuid.",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
additionalProperties: false,
|
||||||
|
},
|
||||||
|
handler: async function ({ action, document_id }) {
|
||||||
|
if (action === "list") return await this.listDocuments();
|
||||||
|
if (action === "summarize")
|
||||||
|
return await this.summarizeDoc(document_id);
|
||||||
|
return "There is nothing we can do. This function call returns no information.";
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List all documents available in a workspace
|
||||||
|
* @returns List of files and their descriptions if available.
|
||||||
|
*/
|
||||||
|
listDocuments: async function () {
|
||||||
|
try {
|
||||||
|
this.super.introspect(
|
||||||
|
`${this.caller}: Looking at the available documents.`
|
||||||
|
);
|
||||||
|
const documents = await Document.where({
|
||||||
|
workspaceId: this.super.handlerProps.invocation.workspace_id,
|
||||||
|
});
|
||||||
|
if (documents.length === 0)
|
||||||
|
return "No documents found - nothing can be done. Stop.";
|
||||||
|
|
||||||
|
this.super.introspect(
|
||||||
|
`${this.caller}: Found ${documents.length} documents`
|
||||||
|
);
|
||||||
|
const foundDocuments = documents.map((doc) => {
|
||||||
|
const metadata = safeJsonParse(doc.metadata, {});
|
||||||
|
return {
|
||||||
|
document_id: doc.docId,
|
||||||
|
filename: metadata?.title ?? "unknown.txt",
|
||||||
|
description: metadata?.description ?? "no description",
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
return JSON.stringify(foundDocuments);
|
||||||
|
} catch (error) {
|
||||||
|
this.super.handlerProps.log(
|
||||||
|
`document-summarizer.list raised an error. ${error.message}`
|
||||||
|
);
|
||||||
|
return `Let the user know this action was not successful. An error was raised while listing available files. ${error.message}`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
summarizeDoc: async function (documentId) {
|
||||||
|
try {
|
||||||
|
if (!validate(documentId)) {
|
||||||
|
this.super.handlerProps.log(
|
||||||
|
`${this.caller}: documentId ${documentId} is not a valid UUID`
|
||||||
|
);
|
||||||
|
return "This was not a valid documentID because it was not a uuid. No content was found.";
|
||||||
|
}
|
||||||
|
|
||||||
|
const document = await Document.content(documentId);
|
||||||
|
this.super.introspect(
|
||||||
|
`${this.caller}: Grabbing all content for ${
|
||||||
|
document?.title ?? "a discovered file."
|
||||||
|
}`
|
||||||
|
);
|
||||||
|
if (document?.content?.length < 8000) return content;
|
||||||
|
|
||||||
|
this.super.introspect(
|
||||||
|
`${this.caller}: Summarizing ${document?.title ?? ""}...`
|
||||||
|
);
|
||||||
|
|
||||||
|
this.super.onAbort(() => {
|
||||||
|
this.super.handlerProps.log(
|
||||||
|
"Abort was triggered, exiting summarization early."
|
||||||
|
);
|
||||||
|
this.controller.abort();
|
||||||
|
});
|
||||||
|
|
||||||
|
return await summarizeContent(
|
||||||
|
this.controller.signal,
|
||||||
|
document.content
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
this.super.handlerProps.log(
|
||||||
|
`document-summarizer.summarizeDoc raised an error. ${error.message}`
|
||||||
|
);
|
||||||
|
return `Let the user know this action was not successful. An error was raised while summarizing the file. ${error.message}`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
docSummarizer,
|
||||||
|
};
|
169
server/utils/agents/aibitat/plugins/web-browsing.js
Normal file
169
server/utils/agents/aibitat/plugins/web-browsing.js
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
const { SystemSettings } = require("../../../../models/systemSettings");
|
||||||
|
|
||||||
|
const webBrowsing = {
|
||||||
|
name: "web-browsing",
|
||||||
|
startupConfig: {
|
||||||
|
params: {},
|
||||||
|
},
|
||||||
|
plugin: function () {
|
||||||
|
return {
|
||||||
|
name: this.name,
|
||||||
|
setup(aibitat) {
|
||||||
|
aibitat.function({
|
||||||
|
super: aibitat,
|
||||||
|
name: this.name,
|
||||||
|
description:
|
||||||
|
"Searches for a given query online using a search engine.",
|
||||||
|
parameters: {
|
||||||
|
$schema: "http://json-schema.org/draft-07/schema#",
|
||||||
|
type: "object",
|
||||||
|
properties: {
|
||||||
|
query: {
|
||||||
|
type: "string",
|
||||||
|
description: "A search query.",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
additionalProperties: false,
|
||||||
|
},
|
||||||
|
handler: async function ({ query }) {
|
||||||
|
try {
|
||||||
|
if (query) return await this.search(query);
|
||||||
|
return "There is nothing we can do. This function call returns no information.";
|
||||||
|
} catch (error) {
|
||||||
|
return `There was an error while calling the function. No data or response was found. Let the user know this was the error: ${error.message}`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use Google Custom Search Engines
|
||||||
|
* Free to set up, easy to use, 100 calls/day!
|
||||||
|
* https://programmablesearchengine.google.com/controlpanel/create
|
||||||
|
*/
|
||||||
|
search: async function (query) {
|
||||||
|
const provider =
|
||||||
|
(await SystemSettings.get({ label: "agent_search_provider" }))
|
||||||
|
?.value ?? "unknown";
|
||||||
|
let engine;
|
||||||
|
switch (provider) {
|
||||||
|
case "google-search-engine":
|
||||||
|
engine = "_googleSearchEngine";
|
||||||
|
break;
|
||||||
|
case "serper-dot-dev":
|
||||||
|
engine = "_serperDotDev";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
engine = "_googleSearchEngine";
|
||||||
|
}
|
||||||
|
return await this[engine](query);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use Google Custom Search Engines
|
||||||
|
* Free to set up, easy to use, 100 calls/day
|
||||||
|
* https://programmablesearchengine.google.com/controlpanel/create
|
||||||
|
*/
|
||||||
|
_googleSearchEngine: async function (query) {
|
||||||
|
if (!process.env.AGENT_GSE_CTX || !process.env.AGENT_GSE_KEY) {
|
||||||
|
this.super.introspect(
|
||||||
|
`${this.caller}: I can't use Google searching because the user has not defined the required API keys.\nVisit: https://programmablesearchengine.google.com/controlpanel/create to create the API keys.`
|
||||||
|
);
|
||||||
|
return `Search is disabled and no content was found. This functionality is disabled because the user has not set it up yet.`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const searchURL = new URL(
|
||||||
|
"https://www.googleapis.com/customsearch/v1"
|
||||||
|
);
|
||||||
|
searchURL.searchParams.append("key", process.env.AGENT_GSE_KEY);
|
||||||
|
searchURL.searchParams.append("cx", process.env.AGENT_GSE_CTX);
|
||||||
|
searchURL.searchParams.append("q", query);
|
||||||
|
|
||||||
|
this.super.introspect(
|
||||||
|
`${this.caller}: Searching on Google for "${
|
||||||
|
query.length > 100 ? `${query.slice(0, 100)}...` : query
|
||||||
|
}"`
|
||||||
|
);
|
||||||
|
const searchResponse = await fetch(searchURL)
|
||||||
|
.then((res) => res.json())
|
||||||
|
.then((searchResult) => searchResult?.items || [])
|
||||||
|
.then((items) => {
|
||||||
|
return items.map((item) => {
|
||||||
|
return {
|
||||||
|
title: item.title,
|
||||||
|
link: item.link,
|
||||||
|
snippet: item.snippet,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
console.log(e);
|
||||||
|
return {};
|
||||||
|
});
|
||||||
|
|
||||||
|
return JSON.stringify(searchResponse);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use Serper.dev
|
||||||
|
* Free to set up, easy to use, 2,500 calls for free one-time
|
||||||
|
* https://serper.dev
|
||||||
|
*/
|
||||||
|
_serperDotDev: async function (query) {
|
||||||
|
if (!process.env.AGENT_SERPER_DEV_KEY) {
|
||||||
|
this.super.introspect(
|
||||||
|
`${this.caller}: I can't use Serper.dev searching because the user has not defined the required API key.\nVisit: https://serper.dev to create the API key for free.`
|
||||||
|
);
|
||||||
|
return `Search is disabled and no content was found. This functionality is disabled because the user has not set it up yet.`;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.super.introspect(
|
||||||
|
`${this.caller}: Using Serper.dev to search for "${
|
||||||
|
query.length > 100 ? `${query.slice(0, 100)}...` : query
|
||||||
|
}"`
|
||||||
|
);
|
||||||
|
const { response, error } = await fetch(
|
||||||
|
"https://google.serper.dev/search",
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"X-API-KEY": process.env.AGENT_SERPER_DEV_KEY,
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
body: JSON.stringify({ q: query }),
|
||||||
|
redirect: "follow",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then((res) => res.json())
|
||||||
|
.then((data) => {
|
||||||
|
return { response: data, error: null };
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
return { response: null, error: e.message };
|
||||||
|
});
|
||||||
|
if (error)
|
||||||
|
return `There was an error searching for content. ${error}`;
|
||||||
|
|
||||||
|
const data = [];
|
||||||
|
if (response.hasOwnProperty("knowledgeGraph"))
|
||||||
|
data.push(response.knowledgeGraph);
|
||||||
|
response.organic?.forEach((searchResult) => {
|
||||||
|
const { title, link, snippet } = searchResult;
|
||||||
|
data.push({
|
||||||
|
title,
|
||||||
|
link,
|
||||||
|
snippet,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
if (data.length === 0)
|
||||||
|
return `No information was found online for the search query.`;
|
||||||
|
return JSON.stringify(data);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
webBrowsing,
|
||||||
|
};
|
87
server/utils/agents/aibitat/plugins/web-scraping.js
Normal file
87
server/utils/agents/aibitat/plugins/web-scraping.js
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
const { CollectorApi } = require("../../../collectorApi");
|
||||||
|
const { summarizeContent } = require("../utils/summarize");
|
||||||
|
|
||||||
|
const webScraping = {
|
||||||
|
name: "web-scraping",
|
||||||
|
startupConfig: {
|
||||||
|
params: {},
|
||||||
|
},
|
||||||
|
plugin: function () {
|
||||||
|
return {
|
||||||
|
name: this.name,
|
||||||
|
setup(aibitat) {
|
||||||
|
aibitat.function({
|
||||||
|
super: aibitat,
|
||||||
|
name: this.name,
|
||||||
|
controller: new AbortController(),
|
||||||
|
description:
|
||||||
|
"Scrapes the content of a webpage or online resource from a URL.",
|
||||||
|
parameters: {
|
||||||
|
$schema: "http://json-schema.org/draft-07/schema#",
|
||||||
|
type: "object",
|
||||||
|
properties: {
|
||||||
|
url: {
|
||||||
|
type: "string",
|
||||||
|
format: "uri",
|
||||||
|
description: "A web URL.",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
additionalProperties: false,
|
||||||
|
},
|
||||||
|
handler: async function ({ url }) {
|
||||||
|
try {
|
||||||
|
if (url) return await this.scrape(url);
|
||||||
|
return "There is nothing we can do. This function call returns no information.";
|
||||||
|
} catch (error) {
|
||||||
|
return `There was an error while calling the function. No data or response was found. Let the user know this was the error: ${error.message}`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scrape a website and summarize the content based on objective if the content is too large.
|
||||||
|
* Objective is the original objective & task that user give to the agent, url is the url of the website to be scraped.
|
||||||
|
* Here we can leverage the document collector to get raw website text quickly.
|
||||||
|
*
|
||||||
|
* @param url
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
scrape: async function (url) {
|
||||||
|
this.super.introspect(
|
||||||
|
`${this.caller}: Scraping the content of ${url}`
|
||||||
|
);
|
||||||
|
const { success, content } =
|
||||||
|
await new CollectorApi().getLinkContent(url);
|
||||||
|
|
||||||
|
if (!success) {
|
||||||
|
this.super.introspect(
|
||||||
|
`${this.caller}: could not scrape ${url}. I can't use this page's content.`
|
||||||
|
);
|
||||||
|
throw new Error(
|
||||||
|
`URL could not be scraped and no content was found.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (content?.length <= 8000) {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.super.introspect(
|
||||||
|
`${this.caller}: This page's content is way too long. I will summarize it right now.`
|
||||||
|
);
|
||||||
|
this.super.onAbort(() => {
|
||||||
|
this.super.handlerProps.log(
|
||||||
|
"Abort was triggered, exiting summarization early."
|
||||||
|
);
|
||||||
|
this.controller.abort();
|
||||||
|
});
|
||||||
|
return summarizeContent(this.controller.signal, content);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
webScraping,
|
||||||
|
};
|
156
server/utils/agents/aibitat/plugins/websocket.js
Normal file
156
server/utils/agents/aibitat/plugins/websocket.js
Normal file
@ -0,0 +1,156 @@
|
|||||||
|
const chalk = require("chalk");
|
||||||
|
const { RetryError } = require("../error");
|
||||||
|
const { Telemetry } = require("../../../../models/telemetry");
|
||||||
|
const SOCKET_TIMEOUT_MS = 300 * 1_000; // 5 mins
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Websocket Interface plugin. It prints the messages on the console and asks for feedback
|
||||||
|
* while the conversation is running in the background.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// export interface AIbitatWebSocket extends ServerWebSocket<unknown> {
|
||||||
|
// askForFeedback?: any
|
||||||
|
// awaitResponse?: any
|
||||||
|
// handleFeedback?: (message: string) => void;
|
||||||
|
// }
|
||||||
|
|
||||||
|
const WEBSOCKET_BAIL_COMMANDS = [
|
||||||
|
"exit",
|
||||||
|
"/exit",
|
||||||
|
"stop",
|
||||||
|
"/stop",
|
||||||
|
"halt",
|
||||||
|
"/halt",
|
||||||
|
];
|
||||||
|
const websocket = {
|
||||||
|
name: "websocket",
|
||||||
|
startupConfig: {
|
||||||
|
params: {
|
||||||
|
socket: {
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
muteUserReply: {
|
||||||
|
required: false,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
introspection: {
|
||||||
|
required: false,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
plugin: function ({
|
||||||
|
socket, // @type AIbitatWebSocket
|
||||||
|
muteUserReply = true, // Do not post messages to "USER" back to frontend.
|
||||||
|
introspection = false, // when enabled will attach socket to Aibitat object with .introspect method which reports status updates to frontend.
|
||||||
|
}) {
|
||||||
|
return {
|
||||||
|
name: this.name,
|
||||||
|
setup(aibitat) {
|
||||||
|
aibitat.onError(async (error) => {
|
||||||
|
if (!!error?.message) {
|
||||||
|
console.error(chalk.red(` error: ${error.message}`));
|
||||||
|
aibitat.introspect(
|
||||||
|
`Error encountered while running: ${error.message}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (error instanceof RetryError) {
|
||||||
|
console.error(chalk.red(` retrying in 60 seconds...`));
|
||||||
|
setTimeout(() => {
|
||||||
|
aibitat.retry();
|
||||||
|
}, 60000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
aibitat.introspect = (messageText) => {
|
||||||
|
if (!introspection) return; // Dump thoughts when not wanted.
|
||||||
|
socket.send(
|
||||||
|
JSON.stringify({ type: "statusResponse", content: messageText })
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
// expose function for sockets across aibitat
|
||||||
|
// type param must be set or else msg will not be shown or handled in UI.
|
||||||
|
aibitat.socket = {
|
||||||
|
send: (type = "__unhandled", content = "") => {
|
||||||
|
socket.send(JSON.stringify({ type, content }));
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// aibitat.onStart(() => {
|
||||||
|
// console.log("🚀 starting chat ...");
|
||||||
|
// });
|
||||||
|
|
||||||
|
aibitat.onMessage((message) => {
|
||||||
|
if (message.from !== "USER")
|
||||||
|
Telemetry.sendTelemetry("agent_chat_sent");
|
||||||
|
if (message.from === "USER" && muteUserReply) return;
|
||||||
|
socket.send(JSON.stringify(message));
|
||||||
|
});
|
||||||
|
|
||||||
|
aibitat.onTerminate(() => {
|
||||||
|
// console.log("🚀 chat finished");
|
||||||
|
socket.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
aibitat.onInterrupt(async (node) => {
|
||||||
|
const feedback = await socket.askForFeedback(socket, node);
|
||||||
|
if (WEBSOCKET_BAIL_COMMANDS.includes(feedback)) {
|
||||||
|
socket.close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await aibitat.continue(feedback);
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Socket wait for feedback on socket
|
||||||
|
*
|
||||||
|
* @param socket The content to summarize. // AIbitatWebSocket & { receive: any, echo: any }
|
||||||
|
* @param node The chat node // { from: string; to: string }
|
||||||
|
* @returns The summarized content.
|
||||||
|
*/
|
||||||
|
socket.askForFeedback = (socket, node) => {
|
||||||
|
socket.awaitResponse = (question = "waiting...") => {
|
||||||
|
socket.send(JSON.stringify({ type: "WAITING_ON_INPUT", question }));
|
||||||
|
|
||||||
|
return new Promise(function (resolve) {
|
||||||
|
let socketTimeout = null;
|
||||||
|
socket.handleFeedback = (message) => {
|
||||||
|
const data = JSON.parse(message);
|
||||||
|
if (data.type !== "awaitingFeedback") return;
|
||||||
|
delete socket.handleFeedback;
|
||||||
|
clearTimeout(socketTimeout);
|
||||||
|
resolve(data.feedback);
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
socketTimeout = setTimeout(() => {
|
||||||
|
console.log(
|
||||||
|
chalk.red(
|
||||||
|
`Client took too long to respond, chat thread is dead after ${SOCKET_TIMEOUT_MS}ms`
|
||||||
|
)
|
||||||
|
);
|
||||||
|
resolve("exit");
|
||||||
|
return;
|
||||||
|
}, SOCKET_TIMEOUT_MS);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return socket.awaitResponse(`Provide feedback to ${chalk.yellow(
|
||||||
|
node.to
|
||||||
|
)} as ${chalk.yellow(node.from)}.
|
||||||
|
Press enter to skip and use auto-reply, or type 'exit' to end the conversation: \n`);
|
||||||
|
};
|
||||||
|
// console.log("🚀 WS plugin is complete.");
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
websocket,
|
||||||
|
WEBSOCKET_BAIL_COMMANDS,
|
||||||
|
};
|
19
server/utils/agents/aibitat/providers/ai-provider.js
Normal file
19
server/utils/agents/aibitat/providers/ai-provider.js
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* A service that provides an AI client to create a completion.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Provider {
|
||||||
|
_client;
|
||||||
|
constructor(client) {
|
||||||
|
if (this.constructor == Provider) {
|
||||||
|
throw new Error("Class is of abstract type and can't be instantiated");
|
||||||
|
}
|
||||||
|
this._client = client;
|
||||||
|
}
|
||||||
|
|
||||||
|
get client() {
|
||||||
|
return this._client;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Provider;
|
210
server/utils/agents/aibitat/providers/anthropic.js
Normal file
210
server/utils/agents/aibitat/providers/anthropic.js
Normal file
@ -0,0 +1,210 @@
|
|||||||
|
const Anthropic = require("@anthropic-ai/sdk");
|
||||||
|
const { RetryError } = require("../error.js");
|
||||||
|
const Provider = require("./ai-provider.js");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The provider for the Anthropic API.
|
||||||
|
* By default, the model is set to 'claude-2'.
|
||||||
|
*/
|
||||||
|
class AnthropicProvider extends Provider {
|
||||||
|
model;
|
||||||
|
|
||||||
|
constructor(config = {}) {
|
||||||
|
const {
|
||||||
|
options = {
|
||||||
|
apiKey: process.env.ANTHROPIC_API_KEY,
|
||||||
|
maxRetries: 3,
|
||||||
|
},
|
||||||
|
model = "claude-2",
|
||||||
|
} = config;
|
||||||
|
|
||||||
|
const client = new Anthropic(options);
|
||||||
|
|
||||||
|
super(client);
|
||||||
|
|
||||||
|
this.model = model;
|
||||||
|
}
|
||||||
|
|
||||||
|
// For Anthropic we will always need to ensure the message sequence is role,content
|
||||||
|
// as we can attach any data to message nodes and this keeps the message property
|
||||||
|
// sent to the API always in spec.
|
||||||
|
#sanitize(chats) {
|
||||||
|
const sanitized = [...chats];
|
||||||
|
|
||||||
|
// If the first message is not a USER, Anthropic will abort so keep shifting the
|
||||||
|
// message array until that is the case.
|
||||||
|
while (sanitized.length > 0 && sanitized[0].role !== "user")
|
||||||
|
sanitized.shift();
|
||||||
|
|
||||||
|
return sanitized.map((msg) => {
|
||||||
|
const { role, content } = msg;
|
||||||
|
return { role, content };
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#normalizeChats(messages = []) {
|
||||||
|
if (!messages.length) return messages;
|
||||||
|
const normalized = [];
|
||||||
|
|
||||||
|
[...messages].forEach((msg, i) => {
|
||||||
|
if (msg.role !== "function") return normalized.push(msg);
|
||||||
|
|
||||||
|
// If the last message is a role "function" this is our special aibitat message node.
|
||||||
|
// and we need to remove it from the array of messages.
|
||||||
|
// Since Anthropic needs to have the tool call resolved, we look at the previous chat to "function"
|
||||||
|
// and go through its content "thought" from ~ln:143 and get the tool_call id so we can resolve
|
||||||
|
// this tool call properly.
|
||||||
|
const functionCompletion = msg;
|
||||||
|
const toolCallId = messages[i - 1]?.content?.find(
|
||||||
|
(msg) => msg.type === "tool_use"
|
||||||
|
)?.id;
|
||||||
|
|
||||||
|
// Append the Anthropic acceptable node to the message chain so function can resolve.
|
||||||
|
normalized.push({
|
||||||
|
role: "user",
|
||||||
|
content: [
|
||||||
|
{
|
||||||
|
type: "tool_result",
|
||||||
|
tool_use_id: toolCallId,
|
||||||
|
content: functionCompletion.content,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return normalized;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Anthropic handles system message as a property, so here we split the system message prompt
|
||||||
|
// from all the chats and then normalize them so they will be useable in case of tool_calls or general chat.
|
||||||
|
#parseSystemPrompt(messages = []) {
|
||||||
|
const chats = [];
|
||||||
|
let systemPrompt =
|
||||||
|
"You are a helpful ai assistant who can assist the user and use tools available to help answer the users prompts and questions.";
|
||||||
|
for (const msg of messages) {
|
||||||
|
if (msg.role === "system") {
|
||||||
|
systemPrompt = msg.content;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
chats.push(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return [systemPrompt, this.#normalizeChats(chats)];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Anthropic does not use the regular schema for functions so here we need to ensure it is in there specific format
|
||||||
|
// so that the call can run correctly.
|
||||||
|
#formatFunctions(functions = []) {
|
||||||
|
return functions.map((func) => {
|
||||||
|
const { name, description, parameters, required } = func;
|
||||||
|
const { type, properties } = parameters;
|
||||||
|
return {
|
||||||
|
name,
|
||||||
|
description,
|
||||||
|
input_schema: {
|
||||||
|
type,
|
||||||
|
properties,
|
||||||
|
required,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a completion based on the received messages.
|
||||||
|
*
|
||||||
|
* @param messages A list of messages to send to the Anthropic API.
|
||||||
|
* @param functions
|
||||||
|
* @returns The completion.
|
||||||
|
*/
|
||||||
|
async complete(messages, functions = null) {
|
||||||
|
try {
|
||||||
|
const [systemPrompt, chats] = this.#parseSystemPrompt(messages);
|
||||||
|
const response = await this.client.messages.create(
|
||||||
|
{
|
||||||
|
model: this.model,
|
||||||
|
max_tokens: 4096,
|
||||||
|
system: systemPrompt,
|
||||||
|
messages: this.#sanitize(chats),
|
||||||
|
stream: false,
|
||||||
|
...(Array.isArray(functions) && functions?.length > 0
|
||||||
|
? { tools: this.#formatFunctions(functions) }
|
||||||
|
: {}),
|
||||||
|
},
|
||||||
|
{ headers: { "anthropic-beta": "tools-2024-04-04" } } // Required to we can use tools.
|
||||||
|
);
|
||||||
|
|
||||||
|
// We know that we need to call a tool. So we are about to recurse through completions/handleExecution
|
||||||
|
// https://docs.anthropic.com/claude/docs/tool-use#how-tool-use-works
|
||||||
|
if (response.stop_reason === "tool_use") {
|
||||||
|
// Get the tool call explicitly.
|
||||||
|
const toolCall = response.content.find(
|
||||||
|
(res) => res.type === "tool_use"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Here we need the chain of thought the model may or may not have generated alongside the call.
|
||||||
|
// this needs to be in a very specific format so we always ensure there is a 2-item content array
|
||||||
|
// so that we can ensure the tool_call content is correct. For anthropic all text items must not
|
||||||
|
// be empty, but the api will still return empty text so we need to make 100% sure text is not empty
|
||||||
|
// or the tool call will fail.
|
||||||
|
// wtf.
|
||||||
|
let thought = response.content.find((res) => res.type === "text");
|
||||||
|
thought =
|
||||||
|
thought?.content?.length > 0
|
||||||
|
? {
|
||||||
|
role: thought.role,
|
||||||
|
content: [
|
||||||
|
{ type: "text", text: thought.content },
|
||||||
|
{ ...toolCall },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
role: "assistant",
|
||||||
|
content: [
|
||||||
|
{
|
||||||
|
type: "text",
|
||||||
|
text: `Okay, im going to use ${toolCall.name} to help me.`,
|
||||||
|
},
|
||||||
|
{ ...toolCall },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
// Modify messages forcefully by adding system thought so that tool_use/tool_result
|
||||||
|
// messaging works with Anthropic's disastrous tool calling API.
|
||||||
|
messages.push(thought);
|
||||||
|
|
||||||
|
const functionArgs = toolCall.input;
|
||||||
|
return {
|
||||||
|
result: null,
|
||||||
|
functionCall: {
|
||||||
|
name: toolCall.name,
|
||||||
|
arguments: functionArgs,
|
||||||
|
},
|
||||||
|
cost: 0,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const completion = response.content.find((msg) => msg.type === "text");
|
||||||
|
return {
|
||||||
|
result:
|
||||||
|
completion?.text ?? "I could not generate a response from this.",
|
||||||
|
cost: 0,
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
// If invalid Auth error we need to abort because no amount of waiting
|
||||||
|
// will make auth better.
|
||||||
|
if (error instanceof Anthropic.AuthenticationError) throw error;
|
||||||
|
|
||||||
|
if (
|
||||||
|
error instanceof Anthropic.RateLimitError ||
|
||||||
|
error instanceof Anthropic.InternalServerError ||
|
||||||
|
error instanceof Anthropic.APIError // Also will catch AuthenticationError!!!
|
||||||
|
) {
|
||||||
|
throw new RetryError(error.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = AnthropicProvider;
|
7
server/utils/agents/aibitat/providers/index.js
Normal file
7
server/utils/agents/aibitat/providers/index.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
const OpenAIProvider = require("./openai.js");
|
||||||
|
const AnthropicProvider = require("./anthropic.js");
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
OpenAIProvider,
|
||||||
|
AnthropicProvider,
|
||||||
|
};
|
147
server/utils/agents/aibitat/providers/openai.js
Normal file
147
server/utils/agents/aibitat/providers/openai.js
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
const OpenAI = require("openai:latest");
|
||||||
|
const Provider = require("./ai-provider.js");
|
||||||
|
const { RetryError } = require("../error.js");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The provider for the OpenAI API.
|
||||||
|
* By default, the model is set to 'gpt-3.5-turbo'.
|
||||||
|
*/
|
||||||
|
class OpenAIProvider extends Provider {
|
||||||
|
model;
|
||||||
|
static COST_PER_TOKEN = {
|
||||||
|
"gpt-4": {
|
||||||
|
input: 0.03,
|
||||||
|
output: 0.06,
|
||||||
|
},
|
||||||
|
"gpt-4-32k": {
|
||||||
|
input: 0.06,
|
||||||
|
output: 0.12,
|
||||||
|
},
|
||||||
|
"gpt-3.5-turbo": {
|
||||||
|
input: 0.0015,
|
||||||
|
output: 0.002,
|
||||||
|
},
|
||||||
|
"gpt-3.5-turbo-16k": {
|
||||||
|
input: 0.003,
|
||||||
|
output: 0.004,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
constructor(config = {}) {
|
||||||
|
const {
|
||||||
|
options = {
|
||||||
|
apiKey: process.env.OPEN_AI_KEY,
|
||||||
|
maxRetries: 3,
|
||||||
|
},
|
||||||
|
model = "gpt-3.5-turbo",
|
||||||
|
} = config;
|
||||||
|
|
||||||
|
const client = new OpenAI(options);
|
||||||
|
|
||||||
|
super(client);
|
||||||
|
|
||||||
|
this.model = model;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a completion based on the received messages.
|
||||||
|
*
|
||||||
|
* @param messages A list of messages to send to the OpenAI API.
|
||||||
|
* @param functions
|
||||||
|
* @returns The completion.
|
||||||
|
*/
|
||||||
|
async complete(messages, functions = null) {
|
||||||
|
try {
|
||||||
|
const response = await this.client.chat.completions.create({
|
||||||
|
model: this.model,
|
||||||
|
// stream: true,
|
||||||
|
messages,
|
||||||
|
...(Array.isArray(functions) && functions?.length > 0
|
||||||
|
? { functions }
|
||||||
|
: {}),
|
||||||
|
});
|
||||||
|
|
||||||
|
// Right now, we only support one completion,
|
||||||
|
// so we just take the first one in the list
|
||||||
|
const completion = response.choices[0].message;
|
||||||
|
const cost = this.getCost(response.usage);
|
||||||
|
// treat function calls
|
||||||
|
if (completion.function_call) {
|
||||||
|
let functionArgs = {};
|
||||||
|
try {
|
||||||
|
functionArgs = JSON.parse(completion.function_call.arguments);
|
||||||
|
} catch (error) {
|
||||||
|
// call the complete function again in case it gets a json error
|
||||||
|
return this.complete(
|
||||||
|
[
|
||||||
|
...messages,
|
||||||
|
{
|
||||||
|
role: "function",
|
||||||
|
name: completion.function_call.name,
|
||||||
|
function_call: completion.function_call,
|
||||||
|
content: error?.message,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
functions
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// console.log(completion, { functionArgs })
|
||||||
|
return {
|
||||||
|
result: null,
|
||||||
|
functionCall: {
|
||||||
|
name: completion.function_call.name,
|
||||||
|
arguments: functionArgs,
|
||||||
|
},
|
||||||
|
cost,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
result: completion.content,
|
||||||
|
cost,
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
// If invalid Auth error we need to abort because no amount of waiting
|
||||||
|
// will make auth better.
|
||||||
|
if (error instanceof OpenAI.AuthenticationError) throw error;
|
||||||
|
|
||||||
|
if (
|
||||||
|
error instanceof OpenAI.RateLimitError ||
|
||||||
|
error instanceof OpenAI.InternalServerError ||
|
||||||
|
error instanceof OpenAI.APIError // Also will catch AuthenticationError!!!
|
||||||
|
) {
|
||||||
|
throw new RetryError(error.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the cost of the completion.
|
||||||
|
*
|
||||||
|
* @param usage The completion to get the cost for.
|
||||||
|
* @returns The cost of the completion.
|
||||||
|
*/
|
||||||
|
getCost(usage) {
|
||||||
|
if (!usage) {
|
||||||
|
return Number.NaN;
|
||||||
|
}
|
||||||
|
|
||||||
|
// regex to remove the version number from the model
|
||||||
|
const modelBase = this.model.replace(/-(\d{4})$/, "");
|
||||||
|
|
||||||
|
if (!(modelBase in OpenAIProvider.COST_PER_TOKEN)) {
|
||||||
|
return Number.NaN;
|
||||||
|
}
|
||||||
|
|
||||||
|
const costPerToken = OpenAIProvider.COST_PER_TOKEN?.[modelBase];
|
||||||
|
const inputCost = (usage.prompt_tokens / 1000) * costPerToken.input;
|
||||||
|
const outputCost = (usage.completion_tokens / 1000) * costPerToken.output;
|
||||||
|
|
||||||
|
return inputCost + outputCost;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = OpenAIProvider;
|
35
server/utils/agents/aibitat/utils/dedupe.js
Normal file
35
server/utils/agents/aibitat/utils/dedupe.js
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// Some models may attempt to call an expensive or annoying function many times and in that case we will want
|
||||||
|
// to implement some stateful tracking during that agent session. GPT4 and other more powerful models are smart
|
||||||
|
// enough to realize this, but models like 3.5 lack this. Open source models suffer greatly from this issue.
|
||||||
|
// eg: "save something to file..."
|
||||||
|
// agent -> saves
|
||||||
|
// agent -> saves
|
||||||
|
// agent -> saves
|
||||||
|
// agent -> saves
|
||||||
|
// ... do random # of times.
|
||||||
|
// We want to block all the reruns of a plugin, so we can add this to prevent that behavior from
|
||||||
|
// spamming the user (or other costly function) that have the exact same signatures.
|
||||||
|
const crypto = require("crypto");
|
||||||
|
|
||||||
|
class Deduplicator {
|
||||||
|
#hashes = {};
|
||||||
|
constructor() {}
|
||||||
|
|
||||||
|
trackRun(key, params = {}) {
|
||||||
|
const hash = crypto
|
||||||
|
.createHash("sha256")
|
||||||
|
.update(JSON.stringify({ key, params }))
|
||||||
|
.digest("hex");
|
||||||
|
this.#hashes[hash] = Number(new Date());
|
||||||
|
}
|
||||||
|
|
||||||
|
isDuplicate(key, params = {}) {
|
||||||
|
const newSig = crypto
|
||||||
|
.createHash("sha256")
|
||||||
|
.update(JSON.stringify({ key, params }))
|
||||||
|
.digest("hex");
|
||||||
|
return this.#hashes.hasOwnProperty(newSig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.Deduplicator = Deduplicator;
|
52
server/utils/agents/aibitat/utils/summarize.js
Normal file
52
server/utils/agents/aibitat/utils/summarize.js
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
const { loadSummarizationChain } = require("langchain/chains");
|
||||||
|
const { ChatOpenAI } = require("langchain/chat_models/openai");
|
||||||
|
const { PromptTemplate } = require("langchain/prompts");
|
||||||
|
const { RecursiveCharacterTextSplitter } = require("langchain/text_splitter");
|
||||||
|
/**
|
||||||
|
* Summarize content using OpenAI's GPT-3.5 model.
|
||||||
|
*
|
||||||
|
* @param self The context of the caller function
|
||||||
|
* @param content The content to summarize.
|
||||||
|
* @returns The summarized content.
|
||||||
|
*/
|
||||||
|
async function summarizeContent(controllerSignal, content) {
|
||||||
|
const llm = new ChatOpenAI({
|
||||||
|
openAIApiKey: process.env.OPEN_AI_KEY,
|
||||||
|
temperature: 0,
|
||||||
|
modelName: "gpt-3.5-turbo-16k-0613",
|
||||||
|
});
|
||||||
|
|
||||||
|
const textSplitter = new RecursiveCharacterTextSplitter({
|
||||||
|
separators: ["\n\n", "\n"],
|
||||||
|
chunkSize: 10000,
|
||||||
|
chunkOverlap: 500,
|
||||||
|
});
|
||||||
|
const docs = await textSplitter.createDocuments([content]);
|
||||||
|
|
||||||
|
const mapPrompt = `
|
||||||
|
Write a detailed summary of the following text for a research purpose:
|
||||||
|
"{text}"
|
||||||
|
SUMMARY:
|
||||||
|
`;
|
||||||
|
|
||||||
|
const mapPromptTemplate = new PromptTemplate({
|
||||||
|
template: mapPrompt,
|
||||||
|
inputVariables: ["text"],
|
||||||
|
});
|
||||||
|
|
||||||
|
// This convenience function creates a document chain prompted to summarize a set of documents.
|
||||||
|
const chain = loadSummarizationChain(llm, {
|
||||||
|
type: "map_reduce",
|
||||||
|
combinePrompt: mapPromptTemplate,
|
||||||
|
combineMapPrompt: mapPromptTemplate,
|
||||||
|
verbose: process.env.NODE_ENV === "development",
|
||||||
|
});
|
||||||
|
const res = await chain.call({
|
||||||
|
...(controllerSignal ? { signal: controllerSignal } : {}),
|
||||||
|
input_documents: docs,
|
||||||
|
});
|
||||||
|
|
||||||
|
return res.text;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { summarizeContent };
|
42
server/utils/agents/defaults.js
Normal file
42
server/utils/agents/defaults.js
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
const AgentPlugins = require("./aibitat/plugins");
|
||||||
|
const { SystemSettings } = require("../../models/systemSettings");
|
||||||
|
const { safeJsonParse } = require("../http");
|
||||||
|
|
||||||
|
const USER_AGENT = {
|
||||||
|
name: "USER",
|
||||||
|
getDefinition: async () => {
|
||||||
|
return {
|
||||||
|
interrupt: "ALWAYS",
|
||||||
|
role: "I am the human monitor and oversee this chat. Any questions on action or decision making should be directed to me.",
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const WORKSPACE_AGENT = {
|
||||||
|
name: "@agent",
|
||||||
|
getDefinition: async () => {
|
||||||
|
const defaultFunctions = [
|
||||||
|
AgentPlugins.memory.name, // RAG
|
||||||
|
AgentPlugins.docSummarizer.name, // Doc Summary
|
||||||
|
AgentPlugins.webScraping.name, // Collector web-scraping
|
||||||
|
];
|
||||||
|
|
||||||
|
const _setting = (
|
||||||
|
await SystemSettings.get({ label: "default_agent_skills" })
|
||||||
|
)?.value;
|
||||||
|
safeJsonParse(_setting, []).forEach((skillName) => {
|
||||||
|
if (!AgentPlugins.hasOwnProperty(skillName)) return;
|
||||||
|
defaultFunctions.push(AgentPlugins[skillName].name);
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
role: "You are a helpful ai assistant who can assist the user and use tools available to help answer the users prompts and questions.",
|
||||||
|
functions: defaultFunctions,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
USER_AGENT,
|
||||||
|
WORKSPACE_AGENT,
|
||||||
|
};
|
202
server/utils/agents/index.js
Normal file
202
server/utils/agents/index.js
Normal file
@ -0,0 +1,202 @@
|
|||||||
|
const AIbitat = require("./aibitat");
|
||||||
|
const AgentPlugins = require("./aibitat/plugins");
|
||||||
|
const {
|
||||||
|
WorkspaceAgentInvocation,
|
||||||
|
} = require("../../models/workspaceAgentInvocation");
|
||||||
|
const { WorkspaceChats } = require("../../models/workspaceChats");
|
||||||
|
const { safeJsonParse } = require("../http");
|
||||||
|
const { USER_AGENT, WORKSPACE_AGENT } = require("./defaults");
|
||||||
|
|
||||||
|
class AgentHandler {
|
||||||
|
#invocationUUID;
|
||||||
|
#funcsToLoad = [];
|
||||||
|
invocation = null;
|
||||||
|
aibitat = null;
|
||||||
|
channel = null;
|
||||||
|
provider = null;
|
||||||
|
model = null;
|
||||||
|
|
||||||
|
constructor({ uuid }) {
|
||||||
|
this.#invocationUUID = uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
log(text, ...args) {
|
||||||
|
console.log(`\x1b[36m[AgentHandler]\x1b[0m ${text}`, ...args);
|
||||||
|
}
|
||||||
|
|
||||||
|
closeAlert() {
|
||||||
|
this.log(`End ${this.#invocationUUID}::${this.provider}:${this.model}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async #chatHistory(limit = 10) {
|
||||||
|
try {
|
||||||
|
const rawHistory = (
|
||||||
|
await WorkspaceChats.where(
|
||||||
|
{
|
||||||
|
workspaceId: this.invocation.workspace_id,
|
||||||
|
user_id: this.invocation.user_id || null,
|
||||||
|
thread_id: this.invocation.user_id || null,
|
||||||
|
include: true,
|
||||||
|
},
|
||||||
|
limit,
|
||||||
|
{ id: "desc" }
|
||||||
|
)
|
||||||
|
).reverse();
|
||||||
|
|
||||||
|
const agentHistory = [];
|
||||||
|
rawHistory.forEach((chatLog) => {
|
||||||
|
agentHistory.push(
|
||||||
|
{
|
||||||
|
from: USER_AGENT.name,
|
||||||
|
to: WORKSPACE_AGENT.name,
|
||||||
|
content: chatLog.prompt,
|
||||||
|
state: "success",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: WORKSPACE_AGENT.name,
|
||||||
|
to: USER_AGENT.name,
|
||||||
|
content: safeJsonParse(chatLog.response)?.text || "",
|
||||||
|
state: "success",
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
return agentHistory;
|
||||||
|
} catch (e) {
|
||||||
|
this.log("Error loading chat history", e.message);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#checkSetup() {
|
||||||
|
switch (this.provider) {
|
||||||
|
case "openai":
|
||||||
|
if (!process.env.OPEN_AI_KEY)
|
||||||
|
throw new Error("OpenAI API key must be provided to use agents.");
|
||||||
|
break;
|
||||||
|
case "anthropic":
|
||||||
|
if (!process.env.ANTHROPIC_API_KEY)
|
||||||
|
throw new Error("Anthropic API key must be provided to use agents.");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Error("No provider found to power agent cluster.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#providerSetupAndCheck() {
|
||||||
|
this.provider = this.invocation.workspace.agentProvider || "openai";
|
||||||
|
this.model = this.invocation.workspace.agentModel || "gpt-3.5-turbo";
|
||||||
|
this.log(`Start ${this.#invocationUUID}::${this.provider}:${this.model}`);
|
||||||
|
this.#checkSetup();
|
||||||
|
}
|
||||||
|
|
||||||
|
async #validInvocation() {
|
||||||
|
const invocation = await WorkspaceAgentInvocation.getWithWorkspace({
|
||||||
|
uuid: String(this.#invocationUUID),
|
||||||
|
});
|
||||||
|
if (invocation?.closed)
|
||||||
|
throw new Error("This agent invocation is already closed");
|
||||||
|
this.invocation = invocation ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
#attachPlugins(args) {
|
||||||
|
for (const name of this.#funcsToLoad) {
|
||||||
|
if (!AgentPlugins.hasOwnProperty(name)) {
|
||||||
|
this.log(
|
||||||
|
`${name} is not a valid plugin. Skipping inclusion to agent cluster.`
|
||||||
|
);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const callOpts = {};
|
||||||
|
for (const [param, definition] of Object.entries(
|
||||||
|
AgentPlugins[name].startupConfig.params
|
||||||
|
)) {
|
||||||
|
if (
|
||||||
|
definition.required &&
|
||||||
|
(!args.hasOwnProperty(param) || args[param] === null)
|
||||||
|
) {
|
||||||
|
this.log(
|
||||||
|
`'${param}' required parameter for '${name}' plugin is missing. Plugin may not function or crash agent.`
|
||||||
|
);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
callOpts[param] = args.hasOwnProperty(param)
|
||||||
|
? args[param]
|
||||||
|
: definition.default || null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const AIbitatPlugin = AgentPlugins[name];
|
||||||
|
this.aibitat.use(AIbitatPlugin.plugin(callOpts));
|
||||||
|
this.log(`Attached ${name} plugin to Agent cluster`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async #loadAgents() {
|
||||||
|
// Default User agent and workspace agent
|
||||||
|
this.log(`Attaching user and default agent to Agent cluster.`);
|
||||||
|
this.aibitat.agent(USER_AGENT.name, await USER_AGENT.getDefinition());
|
||||||
|
this.aibitat.agent(
|
||||||
|
WORKSPACE_AGENT.name,
|
||||||
|
await WORKSPACE_AGENT.getDefinition()
|
||||||
|
);
|
||||||
|
|
||||||
|
this.#funcsToLoad = [
|
||||||
|
...((await USER_AGENT.getDefinition())?.functions || []),
|
||||||
|
...((await WORKSPACE_AGENT.getDefinition())?.functions || []),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
async init() {
|
||||||
|
await this.#validInvocation();
|
||||||
|
this.#providerSetupAndCheck();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
async createAIbitat(
|
||||||
|
args = {
|
||||||
|
socket,
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
this.aibitat = new AIbitat({
|
||||||
|
provider: this.provider ?? "openai",
|
||||||
|
model: this.model ?? "gpt-3.5-turbo",
|
||||||
|
chats: await this.#chatHistory(20),
|
||||||
|
handlerProps: {
|
||||||
|
invocation: this.invocation,
|
||||||
|
log: this.log,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Attach standard websocket plugin for frontend communication.
|
||||||
|
this.log(`Attached ${AgentPlugins.websocket.name} plugin to Agent cluster`);
|
||||||
|
this.aibitat.use(
|
||||||
|
AgentPlugins.websocket.plugin({
|
||||||
|
socket: args.socket,
|
||||||
|
muteUserReply: true,
|
||||||
|
introspection: true,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
// Attach standard chat-history plugin for message storage.
|
||||||
|
this.log(
|
||||||
|
`Attached ${AgentPlugins.chatHistory.name} plugin to Agent cluster`
|
||||||
|
);
|
||||||
|
this.aibitat.use(AgentPlugins.chatHistory.plugin());
|
||||||
|
|
||||||
|
// Load required agents (Default + custom)
|
||||||
|
await this.#loadAgents();
|
||||||
|
|
||||||
|
// Attach all required plugins for functions to operate.
|
||||||
|
this.#attachPlugins(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
startAgentCluster() {
|
||||||
|
return this.aibitat.start({
|
||||||
|
from: USER_AGENT.name,
|
||||||
|
to: this.channel ?? WORKSPACE_AGENT.name,
|
||||||
|
content: this.invocation.prompt,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.AgentHandler = AgentHandler;
|
71
server/utils/chats/agents.js
Normal file
71
server/utils/chats/agents.js
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
const pluralize = require("pluralize");
|
||||||
|
const {
|
||||||
|
WorkspaceAgentInvocation,
|
||||||
|
} = require("../../models/workspaceAgentInvocation");
|
||||||
|
const { writeResponseChunk } = require("../helpers/chat/responses");
|
||||||
|
|
||||||
|
async function grepAgents({
|
||||||
|
uuid,
|
||||||
|
response,
|
||||||
|
message,
|
||||||
|
workspace,
|
||||||
|
user = null,
|
||||||
|
thread = null,
|
||||||
|
}) {
|
||||||
|
const agentHandles = WorkspaceAgentInvocation.parseAgents(message);
|
||||||
|
if (agentHandles.length > 0) {
|
||||||
|
const { invocation: newInvocation } = await WorkspaceAgentInvocation.new({
|
||||||
|
prompt: message,
|
||||||
|
workspace: workspace,
|
||||||
|
user: user,
|
||||||
|
thread: thread,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!newInvocation) {
|
||||||
|
writeResponseChunk(response, {
|
||||||
|
id: uuid,
|
||||||
|
type: "statusResponse",
|
||||||
|
textResponse: `${pluralize(
|
||||||
|
"Agent",
|
||||||
|
agentHandles.length
|
||||||
|
)} ${agentHandles.join(
|
||||||
|
", "
|
||||||
|
)} could not be called. Chat will be handled as default chat.`,
|
||||||
|
sources: [],
|
||||||
|
close: true,
|
||||||
|
error: null,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
writeResponseChunk(response, {
|
||||||
|
id: uuid,
|
||||||
|
type: "agentInitWebsocketConnection",
|
||||||
|
textResponse: null,
|
||||||
|
sources: [],
|
||||||
|
close: false,
|
||||||
|
error: null,
|
||||||
|
websocketUUID: newInvocation.uuid,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Close HTTP stream-able chunk response method because we will swap to agents now.
|
||||||
|
writeResponseChunk(response, {
|
||||||
|
id: uuid,
|
||||||
|
type: "statusResponse",
|
||||||
|
textResponse: `${pluralize(
|
||||||
|
"Agent",
|
||||||
|
agentHandles.length
|
||||||
|
)} ${agentHandles.join(
|
||||||
|
", "
|
||||||
|
)} invoked.\nSwapping over to agent chat. Type /exit to exit agent execution loop early.`,
|
||||||
|
sources: [],
|
||||||
|
close: true,
|
||||||
|
error: null,
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { grepAgents };
|
@ -3,6 +3,7 @@ const { DocumentManager } = require("../DocumentManager");
|
|||||||
const { WorkspaceChats } = require("../../models/workspaceChats");
|
const { WorkspaceChats } = require("../../models/workspaceChats");
|
||||||
const { getVectorDbClass, getLLMProvider } = require("../helpers");
|
const { getVectorDbClass, getLLMProvider } = require("../helpers");
|
||||||
const { writeResponseChunk } = require("../helpers/chat/responses");
|
const { writeResponseChunk } = require("../helpers/chat/responses");
|
||||||
|
const { grepAgents } = require("./agents");
|
||||||
const {
|
const {
|
||||||
grepCommand,
|
grepCommand,
|
||||||
VALID_COMMANDS,
|
VALID_COMMANDS,
|
||||||
@ -35,6 +36,17 @@ async function streamChatWithWorkspace(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If is agent enabled chat we will exit this flow early.
|
||||||
|
const isAgentChat = await grepAgents({
|
||||||
|
uuid,
|
||||||
|
response,
|
||||||
|
message,
|
||||||
|
user,
|
||||||
|
workspace,
|
||||||
|
thread,
|
||||||
|
});
|
||||||
|
if (isAgentChat) return;
|
||||||
|
|
||||||
const LLMConnector = getLLMProvider({
|
const LLMConnector = getLLMProvider({
|
||||||
provider: workspace?.chatProvider,
|
provider: workspace?.chatProvider,
|
||||||
model: workspace?.chatModel,
|
model: workspace?.chatModel,
|
||||||
@ -193,6 +205,7 @@ async function streamChatWithWorkspace(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (completeText?.length > 0) {
|
||||||
const { chat } = await WorkspaceChats.new({
|
const { chat } = await WorkspaceChats.new({
|
||||||
workspaceId: workspace.id,
|
workspaceId: workspace.id,
|
||||||
prompt: message,
|
prompt: message,
|
||||||
@ -211,6 +224,15 @@ async function streamChatWithWorkspace(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
writeResponseChunk(response, {
|
||||||
|
uuid,
|
||||||
|
type: "finalizeResponseStream",
|
||||||
|
close: true,
|
||||||
|
error: false,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
VALID_CHAT_MODE,
|
VALID_CHAT_MODE,
|
||||||
streamChatWithWorkspace,
|
streamChatWithWorkspace,
|
||||||
|
@ -133,6 +133,29 @@ class CollectorApi {
|
|||||||
return { success: false, data: {}, reason: e.message };
|
return { success: false, data: {}, reason: e.message };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getLinkContent(link = "") {
|
||||||
|
if (!link) return false;
|
||||||
|
|
||||||
|
const data = JSON.stringify({ link });
|
||||||
|
return await fetch(`${this.endpoint}/util/get-link`, {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"X-Integrity": this.comkey.sign(data),
|
||||||
|
},
|
||||||
|
body: data,
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
if (!res.ok) throw new Error("Response could not be completed");
|
||||||
|
return res.json();
|
||||||
|
})
|
||||||
|
.then((res) => res)
|
||||||
|
.catch((e) => {
|
||||||
|
this.log(e.message);
|
||||||
|
return { success: false, content: null };
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.CollectorApi = CollectorApi;
|
module.exports.CollectorApi = CollectorApi;
|
||||||
|
@ -47,21 +47,85 @@ async function openAiModels(apiKey = null) {
|
|||||||
apiKey: apiKey || process.env.OPEN_AI_KEY,
|
apiKey: apiKey || process.env.OPEN_AI_KEY,
|
||||||
});
|
});
|
||||||
const openai = new OpenAIApi(config);
|
const openai = new OpenAIApi(config);
|
||||||
const models = (
|
const allModels = await openai
|
||||||
await openai
|
|
||||||
.listModels()
|
.listModels()
|
||||||
.then((res) => res.data.data)
|
.then((res) => res.data.data)
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
console.error(`OpenAI:listModels`, e.message);
|
console.error(`OpenAI:listModels`, e.message);
|
||||||
return [];
|
return [
|
||||||
})
|
{
|
||||||
).filter(
|
name: "gpt-3.5-turbo",
|
||||||
(model) => !model.owned_by.includes("openai") && model.owned_by !== "system"
|
id: "gpt-3.5-turbo",
|
||||||
);
|
object: "model",
|
||||||
|
created: 1677610602,
|
||||||
|
owned_by: "openai",
|
||||||
|
organization: "OpenAi",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "gpt-4",
|
||||||
|
id: "gpt-4",
|
||||||
|
object: "model",
|
||||||
|
created: 1687882411,
|
||||||
|
owned_by: "openai",
|
||||||
|
organization: "OpenAi",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "gpt-4-turbo",
|
||||||
|
id: "gpt-4-turbo",
|
||||||
|
object: "model",
|
||||||
|
created: 1712361441,
|
||||||
|
owned_by: "system",
|
||||||
|
organization: "OpenAi",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "gpt-4-32k",
|
||||||
|
id: "gpt-4-32k",
|
||||||
|
object: "model",
|
||||||
|
created: 1687979321,
|
||||||
|
owned_by: "openai",
|
||||||
|
organization: "OpenAi",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "gpt-3.5-turbo-16k",
|
||||||
|
id: "gpt-3.5-turbo-16k",
|
||||||
|
object: "model",
|
||||||
|
created: 1683758102,
|
||||||
|
owned_by: "openai-internal",
|
||||||
|
organization: "OpenAi",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
|
const gpts = allModels
|
||||||
|
.filter((model) => model.id.startsWith("gpt"))
|
||||||
|
.filter(
|
||||||
|
(model) => !model.id.includes("vision") && !model.id.includes("instruct")
|
||||||
|
)
|
||||||
|
.map((model) => {
|
||||||
|
return {
|
||||||
|
...model,
|
||||||
|
name: model.id,
|
||||||
|
organization: "OpenAi",
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const customModels = allModels
|
||||||
|
.filter(
|
||||||
|
(model) =>
|
||||||
|
!model.owned_by.includes("openai") && model.owned_by !== "system"
|
||||||
|
)
|
||||||
|
.map((model) => {
|
||||||
|
return {
|
||||||
|
...model,
|
||||||
|
name: model.id,
|
||||||
|
organization: "Your Fine-Tunes",
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
// Api Key was successful so lets save it for future uses
|
// Api Key was successful so lets save it for future uses
|
||||||
if (models.length > 0 && !!apiKey) process.env.OPEN_AI_KEY = apiKey;
|
if ((gpts.length > 0 || customModels.length > 0) && !!apiKey)
|
||||||
return { models, error: null };
|
process.env.OPEN_AI_KEY = apiKey;
|
||||||
|
return { models: [...gpts, ...customModels], error: null };
|
||||||
}
|
}
|
||||||
|
|
||||||
async function localAIModels(basePath = null, apiKey = null) {
|
async function localAIModels(basePath = null, apiKey = null) {
|
||||||
|
@ -292,6 +292,20 @@ const KEY_MAPPING = {
|
|||||||
envKey: "DISABLE_TELEMETRY",
|
envKey: "DISABLE_TELEMETRY",
|
||||||
checks: [],
|
checks: [],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Agent Integration ENVs
|
||||||
|
AgentGoogleSearchEngineId: {
|
||||||
|
envKey: "AGENT_GSE_CTX",
|
||||||
|
checks: [],
|
||||||
|
},
|
||||||
|
AgentGoogleSearchEngineKey: {
|
||||||
|
envKey: "AGENT_GSE_KEY",
|
||||||
|
checks: [],
|
||||||
|
},
|
||||||
|
AgentSerperApiKey: {
|
||||||
|
envKey: "AGENT_SERPER_DEV_KEY",
|
||||||
|
checks: [],
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
function isNotEmpty(input = "") {
|
function isNotEmpty(input = "") {
|
||||||
@ -571,6 +585,12 @@ async function dumpENV() {
|
|||||||
"HTTPS_KEY_PATH",
|
"HTTPS_KEY_PATH",
|
||||||
// DISABLED TELEMETRY
|
// DISABLED TELEMETRY
|
||||||
"DISABLE_TELEMETRY",
|
"DISABLE_TELEMETRY",
|
||||||
|
|
||||||
|
// Agent Integrations
|
||||||
|
// Search engine integrations
|
||||||
|
"AGENT_GSE_CTX",
|
||||||
|
"AGENT_GSE_KEY",
|
||||||
|
"AGENT_SERPER_DEV_KEY",
|
||||||
];
|
];
|
||||||
|
|
||||||
// Simple sanitization of each value to prevent ENV injection via newline or quote escaping.
|
// Simple sanitization of each value to prevent ENV injection via newline or quote escaping.
|
||||||
|
321
server/yarn.lock
321
server/yarn.lock
@ -302,6 +302,119 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz#e5211452df060fa8522b55c7b3c0c4d1981cb044"
|
resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz#e5211452df060fa8522b55c7b3c0c4d1981cb044"
|
||||||
integrity sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==
|
integrity sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==
|
||||||
|
|
||||||
|
"@inquirer/checkbox@^2.2.1":
|
||||||
|
version "2.2.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@inquirer/checkbox/-/checkbox-2.2.1.tgz#100fcade0209a9b5eaef80403e06130401a0b438"
|
||||||
|
integrity sha512-eYdhZWZMOaliMBPOL/AO3uId58lp+zMyrJdoZ2xw9hfUY4IYJlIMvgW80RJdvCY3q9fGMUyZI5GwguH2tO51ew==
|
||||||
|
dependencies:
|
||||||
|
"@inquirer/core" "^7.1.1"
|
||||||
|
"@inquirer/type" "^1.2.1"
|
||||||
|
ansi-escapes "^4.3.2"
|
||||||
|
chalk "^4.1.2"
|
||||||
|
figures "^3.2.0"
|
||||||
|
|
||||||
|
"@inquirer/confirm@^3.1.1":
|
||||||
|
version "3.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@inquirer/confirm/-/confirm-3.1.1.tgz#e17c9eafa3d8f494fad3f848ba1e4c61d0a7ddcf"
|
||||||
|
integrity sha512-epf2RVHJJxX5qF85U41PBq9qq2KTJW9sKNLx6+bb2/i2rjXgeoHVGUm8kJxZHavrESgXgBLKCABcfOJYIso8cQ==
|
||||||
|
dependencies:
|
||||||
|
"@inquirer/core" "^7.1.1"
|
||||||
|
"@inquirer/type" "^1.2.1"
|
||||||
|
|
||||||
|
"@inquirer/core@^7.1.1":
|
||||||
|
version "7.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@inquirer/core/-/core-7.1.1.tgz#9339095720c00cfd1f85943977ae15d2f66f336a"
|
||||||
|
integrity sha512-rD1UI3eARN9qJBcLRXPOaZu++Bg+xsk0Tuz1EUOXEW+UbYif1sGjr0Tw7lKejHzKD9IbXE1CEtZ+xR/DrNlQGQ==
|
||||||
|
dependencies:
|
||||||
|
"@inquirer/type" "^1.2.1"
|
||||||
|
"@types/mute-stream" "^0.0.4"
|
||||||
|
"@types/node" "^20.11.30"
|
||||||
|
"@types/wrap-ansi" "^3.0.0"
|
||||||
|
ansi-escapes "^4.3.2"
|
||||||
|
chalk "^4.1.2"
|
||||||
|
cli-spinners "^2.9.2"
|
||||||
|
cli-width "^4.1.0"
|
||||||
|
figures "^3.2.0"
|
||||||
|
mute-stream "^1.0.0"
|
||||||
|
signal-exit "^4.1.0"
|
||||||
|
strip-ansi "^6.0.1"
|
||||||
|
wrap-ansi "^6.2.0"
|
||||||
|
|
||||||
|
"@inquirer/editor@^2.1.1":
|
||||||
|
version "2.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@inquirer/editor/-/editor-2.1.1.tgz#e2d50246fd7dd4b4c2f20b86c969912be4c36899"
|
||||||
|
integrity sha512-SGVAmSKY2tt62+5KUySYFeMwJEXX866Ws5MyjwbrbB+WqC8iZAtPcK0pz8KVsO0ak/DB3/vCZw0k2nl7TifV5g==
|
||||||
|
dependencies:
|
||||||
|
"@inquirer/core" "^7.1.1"
|
||||||
|
"@inquirer/type" "^1.2.1"
|
||||||
|
external-editor "^3.1.0"
|
||||||
|
|
||||||
|
"@inquirer/expand@^2.1.1":
|
||||||
|
version "2.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@inquirer/expand/-/expand-2.1.1.tgz#5364c5ddf0fb6358c5610103efde6a4aa366c2fe"
|
||||||
|
integrity sha512-FTHf56CgE24CtweB+3sF4mOFa6Q7H8NfTO+SvYio3CgQwhIWylSNueEeJ7sYBnWaXHNUfiX883akgvSbWqSBoQ==
|
||||||
|
dependencies:
|
||||||
|
"@inquirer/core" "^7.1.1"
|
||||||
|
"@inquirer/type" "^1.2.1"
|
||||||
|
chalk "^4.1.2"
|
||||||
|
|
||||||
|
"@inquirer/input@^2.1.1":
|
||||||
|
version "2.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@inquirer/input/-/input-2.1.1.tgz#a293a1d1bef103a1f4176d5b41df6d3272b7b48f"
|
||||||
|
integrity sha512-Ag5PDh3/V3B68WGD/5LKXDqbdWKlF7zyfPAlstzu0NoZcZGBbZFjfgXlZIcb6Gs+AfdSi7wNf7soVAaMGH7moQ==
|
||||||
|
dependencies:
|
||||||
|
"@inquirer/core" "^7.1.1"
|
||||||
|
"@inquirer/type" "^1.2.1"
|
||||||
|
|
||||||
|
"@inquirer/password@^2.1.1":
|
||||||
|
version "2.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@inquirer/password/-/password-2.1.1.tgz#9465dc1afa28bc75de2ee5fdb18852a25b2fe00e"
|
||||||
|
integrity sha512-R5R6NVXDKXEjAOGBqgRGrchFlfdZIx/qiDvH63m1u1NQVOQFUMfHth9VzVwuTZ2LHzbb9UrYpBumh2YytFE9iQ==
|
||||||
|
dependencies:
|
||||||
|
"@inquirer/core" "^7.1.1"
|
||||||
|
"@inquirer/type" "^1.2.1"
|
||||||
|
ansi-escapes "^4.3.2"
|
||||||
|
|
||||||
|
"@inquirer/prompts@^4.3.1":
|
||||||
|
version "4.3.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@inquirer/prompts/-/prompts-4.3.1.tgz#f2906a5d7b4c2c8af9bd5bd8d495466bdd52f411"
|
||||||
|
integrity sha512-FI8jhVm3GRJ/z40qf7YZnSP0TfPKDPdIYZT9W6hmiYuaSmAXL66YMXqonKyysE5DwtKQBhIqt0oSoTKp7FCvQQ==
|
||||||
|
dependencies:
|
||||||
|
"@inquirer/checkbox" "^2.2.1"
|
||||||
|
"@inquirer/confirm" "^3.1.1"
|
||||||
|
"@inquirer/core" "^7.1.1"
|
||||||
|
"@inquirer/editor" "^2.1.1"
|
||||||
|
"@inquirer/expand" "^2.1.1"
|
||||||
|
"@inquirer/input" "^2.1.1"
|
||||||
|
"@inquirer/password" "^2.1.1"
|
||||||
|
"@inquirer/rawlist" "^2.1.1"
|
||||||
|
"@inquirer/select" "^2.2.1"
|
||||||
|
|
||||||
|
"@inquirer/rawlist@^2.1.1":
|
||||||
|
version "2.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@inquirer/rawlist/-/rawlist-2.1.1.tgz#07ba2f9c4185e3787954e4023ae16d1a44d6da92"
|
||||||
|
integrity sha512-PIpJdNqVhjnl2bDz8iUKqMmgGdspN4s7EZiuNPnNrqZLP+LRUDDHVyd7X7xjiEMulBt3lt2id4SjTbra+v/Ajg==
|
||||||
|
dependencies:
|
||||||
|
"@inquirer/core" "^7.1.1"
|
||||||
|
"@inquirer/type" "^1.2.1"
|
||||||
|
chalk "^4.1.2"
|
||||||
|
|
||||||
|
"@inquirer/select@^2.2.1":
|
||||||
|
version "2.2.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@inquirer/select/-/select-2.2.1.tgz#cd1f8b7869a74ff7f409a01f27998d06e234ea98"
|
||||||
|
integrity sha512-JR4FeHvuxPSPWQy8DzkIvoIsJ4SWtSFb4xVLvLto84dL+jkv12lm8ILtuax4bMHvg5MBj3wYUF6Tk9izJ07gdw==
|
||||||
|
dependencies:
|
||||||
|
"@inquirer/core" "^7.1.1"
|
||||||
|
"@inquirer/type" "^1.2.1"
|
||||||
|
ansi-escapes "^4.3.2"
|
||||||
|
chalk "^4.1.2"
|
||||||
|
figures "^3.2.0"
|
||||||
|
|
||||||
|
"@inquirer/type@^1.2.1":
|
||||||
|
version "1.2.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@inquirer/type/-/type-1.2.1.tgz#fbc7ab3a2e5050d0c150642d5e8f5e88faa066b8"
|
||||||
|
integrity sha512-xwMfkPAxeo8Ji/IxfUSqzRi0/+F2GIqJmpc5/thelgMGsjNZcjDDRBO9TLXT1s/hdx/mK5QbVIvgoLIFgXhTMQ==
|
||||||
|
|
||||||
"@kwsites/file-exists@^1.1.1":
|
"@kwsites/file-exists@^1.1.1":
|
||||||
version "1.1.1"
|
version "1.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/@kwsites/file-exists/-/file-exists-1.1.1.tgz#ad1efcac13e1987d8dbaf235ef3be5b0d96faa99"
|
resolved "https://registry.yarnpkg.com/@kwsites/file-exists/-/file-exists-1.1.1.tgz#ad1efcac13e1987d8dbaf235ef3be5b0d96faa99"
|
||||||
@ -802,6 +915,13 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.2.tgz#b74129719fc8d11c01868010082d483b7545591a"
|
resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.2.tgz#b74129719fc8d11c01868010082d483b7545591a"
|
||||||
integrity sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==
|
integrity sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==
|
||||||
|
|
||||||
|
"@types/mute-stream@^0.0.4":
|
||||||
|
version "0.0.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/mute-stream/-/mute-stream-0.0.4.tgz#77208e56a08767af6c5e1237be8888e2f255c478"
|
||||||
|
integrity sha512-CPM9nzrCPPJHQNA9keH9CVkVI+WR5kMa+7XEs5jcGQ0VoAGnLv242w8lIVgwAEfmE4oufJRaTc9PNLQl0ioAow==
|
||||||
|
dependencies:
|
||||||
|
"@types/node" "*"
|
||||||
|
|
||||||
"@types/node-fetch@^2.6.4":
|
"@types/node-fetch@^2.6.4":
|
||||||
version "2.6.7"
|
version "2.6.7"
|
||||||
resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.7.tgz#a1abe2ce24228b58ad97f99480fdcf9bbc6ab16d"
|
resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.7.tgz#a1abe2ce24228b58ad97f99480fdcf9bbc6ab16d"
|
||||||
@ -841,6 +961,13 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
undici-types "~5.26.4"
|
undici-types "~5.26.4"
|
||||||
|
|
||||||
|
"@types/node@^20.11.30":
|
||||||
|
version "20.12.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.4.tgz#af5921bd75ccdf3a3d8b3fa75bf3d3359268cd11"
|
||||||
|
integrity sha512-E+Fa9z3wSQpzgYQdYmme5X3OTuejnnTx88A6p6vkkJosR3KBz+HpE3kqNm98VE6cfLFcISx7zW7MsJkH6KwbTw==
|
||||||
|
dependencies:
|
||||||
|
undici-types "~5.26.4"
|
||||||
|
|
||||||
"@types/pad-left@2.1.1":
|
"@types/pad-left@2.1.1":
|
||||||
version "2.1.1"
|
version "2.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/@types/pad-left/-/pad-left-2.1.1.tgz#17d906fc75804e1cc722da73623f1d978f16a137"
|
resolved "https://registry.yarnpkg.com/@types/pad-left/-/pad-left-2.1.1.tgz#17d906fc75804e1cc722da73623f1d978f16a137"
|
||||||
@ -861,6 +988,11 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-9.0.7.tgz#b14cebc75455eeeb160d5fe23c2fcc0c64f724d8"
|
resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-9.0.7.tgz#b14cebc75455eeeb160d5fe23c2fcc0c64f724d8"
|
||||||
integrity sha512-WUtIVRUZ9i5dYXefDEAI7sh9/O7jGvHg7Df/5O/gtH3Yabe5odI3UWopVR1qbPXQtvOxWu3mM4XxlYeZtMWF4g==
|
integrity sha512-WUtIVRUZ9i5dYXefDEAI7sh9/O7jGvHg7Df/5O/gtH3Yabe5odI3UWopVR1qbPXQtvOxWu3mM4XxlYeZtMWF4g==
|
||||||
|
|
||||||
|
"@types/wrap-ansi@^3.0.0":
|
||||||
|
version "3.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/wrap-ansi/-/wrap-ansi-3.0.0.tgz#18b97a972f94f60a679fd5c796d96421b9abb9fd"
|
||||||
|
integrity sha512-ltIpx+kM7g/MLRZfkbL7EsCEjfzCcScLpkg37eXEtx5kmrAKBkTJwd1GIAjDSL8wTpM6Hzn5YO4pSb91BEwu1g==
|
||||||
|
|
||||||
"@types/yauzl@^2.9.1":
|
"@types/yauzl@^2.9.1":
|
||||||
version "2.10.0"
|
version "2.10.0"
|
||||||
resolved "https://registry.yarnpkg.com/@types/yauzl/-/yauzl-2.10.0.tgz#b3248295276cf8c6f153ebe6a9aba0c988cb2599"
|
resolved "https://registry.yarnpkg.com/@types/yauzl/-/yauzl-2.10.0.tgz#b3248295276cf8c6f153ebe6a9aba0c988cb2599"
|
||||||
@ -982,6 +1114,13 @@ ajv@^8.12.0:
|
|||||||
require-from-string "^2.0.2"
|
require-from-string "^2.0.2"
|
||||||
uri-js "^4.2.2"
|
uri-js "^4.2.2"
|
||||||
|
|
||||||
|
ansi-escapes@^4.3.2:
|
||||||
|
version "4.3.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e"
|
||||||
|
integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==
|
||||||
|
dependencies:
|
||||||
|
type-fest "^0.21.3"
|
||||||
|
|
||||||
ansi-regex@^5.0.1:
|
ansi-regex@^5.0.1:
|
||||||
version "5.0.1"
|
version "5.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
|
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
|
||||||
@ -1335,6 +1474,11 @@ body-parser@^1.20.2:
|
|||||||
type-is "~1.6.18"
|
type-is "~1.6.18"
|
||||||
unpipe "1.0.0"
|
unpipe "1.0.0"
|
||||||
|
|
||||||
|
boolbase@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e"
|
||||||
|
integrity sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==
|
||||||
|
|
||||||
bottleneck@^2.15.3:
|
bottleneck@^2.15.3:
|
||||||
version "2.19.5"
|
version "2.19.5"
|
||||||
resolved "https://registry.yarnpkg.com/bottleneck/-/bottleneck-2.19.5.tgz#5df0b90f59fd47656ebe63c78a98419205cadd91"
|
resolved "https://registry.yarnpkg.com/bottleneck/-/bottleneck-2.19.5.tgz#5df0b90f59fd47656ebe63c78a98419205cadd91"
|
||||||
@ -1475,7 +1619,7 @@ chalk@^2.4.2:
|
|||||||
escape-string-regexp "^1.0.5"
|
escape-string-regexp "^1.0.5"
|
||||||
supports-color "^5.3.0"
|
supports-color "^5.3.0"
|
||||||
|
|
||||||
chalk@^4.0.0:
|
chalk@^4, chalk@^4.0.0, chalk@^4.1.2:
|
||||||
version "4.1.2"
|
version "4.1.2"
|
||||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01"
|
resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01"
|
||||||
integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==
|
integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==
|
||||||
@ -1488,6 +1632,11 @@ chalk@^5.0.0, chalk@^5.3.0:
|
|||||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.3.0.tgz#67c20a7ebef70e7f3970a01f90fa210cb6860385"
|
resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.3.0.tgz#67c20a7ebef70e7f3970a01f90fa210cb6860385"
|
||||||
integrity sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==
|
integrity sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==
|
||||||
|
|
||||||
|
chardet@^0.7.0:
|
||||||
|
version "0.7.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e"
|
||||||
|
integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==
|
||||||
|
|
||||||
charenc@0.0.2:
|
charenc@0.0.2:
|
||||||
version "0.0.2"
|
version "0.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667"
|
resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667"
|
||||||
@ -1554,11 +1703,16 @@ cli-progress@^3.12.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
string-width "^4.2.3"
|
string-width "^4.2.3"
|
||||||
|
|
||||||
cli-spinners@^2.9.0:
|
cli-spinners@^2.9.0, cli-spinners@^2.9.2:
|
||||||
version "2.9.2"
|
version "2.9.2"
|
||||||
resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.9.2.tgz#1773a8f4b9c4d6ac31563df53b3fc1d79462fe41"
|
resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.9.2.tgz#1773a8f4b9c4d6ac31563df53b3fc1d79462fe41"
|
||||||
integrity sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==
|
integrity sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==
|
||||||
|
|
||||||
|
cli-width@^4.1.0:
|
||||||
|
version "4.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-4.1.0.tgz#42daac41d3c254ef38ad8ac037672130173691c5"
|
||||||
|
integrity sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==
|
||||||
|
|
||||||
cliui@^8.0.1:
|
cliui@^8.0.1:
|
||||||
version "8.0.1"
|
version "8.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa"
|
resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa"
|
||||||
@ -1796,6 +1950,22 @@ crypt@0.0.2:
|
|||||||
resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b"
|
resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b"
|
||||||
integrity sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==
|
integrity sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==
|
||||||
|
|
||||||
|
css-select@^5.1.0:
|
||||||
|
version "5.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/css-select/-/css-select-5.1.0.tgz#b8ebd6554c3637ccc76688804ad3f6a6fdaea8a6"
|
||||||
|
integrity sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==
|
||||||
|
dependencies:
|
||||||
|
boolbase "^1.0.0"
|
||||||
|
css-what "^6.1.0"
|
||||||
|
domhandler "^5.0.2"
|
||||||
|
domutils "^3.0.1"
|
||||||
|
nth-check "^2.0.1"
|
||||||
|
|
||||||
|
css-what@^6.1.0:
|
||||||
|
version "6.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/css-what/-/css-what-6.1.0.tgz#fb5effcf76f1ddea2c81bdfaa4de44e79bac70f4"
|
||||||
|
integrity sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==
|
||||||
|
|
||||||
dayjs@^1.11.7:
|
dayjs@^1.11.7:
|
||||||
version "1.11.10"
|
version "1.11.10"
|
||||||
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.10.tgz#68acea85317a6e164457d6d6947564029a6a16a0"
|
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.10.tgz#68acea85317a6e164457d6d6947564029a6a16a0"
|
||||||
@ -1919,6 +2089,36 @@ doctrine@^3.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
esutils "^2.0.2"
|
esutils "^2.0.2"
|
||||||
|
|
||||||
|
dom-serializer@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-2.0.0.tgz#e41b802e1eedf9f6cae183ce5e622d789d7d8e53"
|
||||||
|
integrity sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==
|
||||||
|
dependencies:
|
||||||
|
domelementtype "^2.3.0"
|
||||||
|
domhandler "^5.0.2"
|
||||||
|
entities "^4.2.0"
|
||||||
|
|
||||||
|
domelementtype@^2.3.0:
|
||||||
|
version "2.3.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-2.3.0.tgz#5c45e8e869952626331d7aab326d01daf65d589d"
|
||||||
|
integrity sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==
|
||||||
|
|
||||||
|
domhandler@^5.0.2, domhandler@^5.0.3:
|
||||||
|
version "5.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-5.0.3.tgz#cc385f7f751f1d1fc650c21374804254538c7d31"
|
||||||
|
integrity sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==
|
||||||
|
dependencies:
|
||||||
|
domelementtype "^2.3.0"
|
||||||
|
|
||||||
|
domutils@^3.0.1:
|
||||||
|
version "3.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/domutils/-/domutils-3.1.0.tgz#c47f551278d3dc4b0b1ab8cbb42d751a6f0d824e"
|
||||||
|
integrity sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==
|
||||||
|
dependencies:
|
||||||
|
dom-serializer "^2.0.0"
|
||||||
|
domelementtype "^2.3.0"
|
||||||
|
domhandler "^5.0.3"
|
||||||
|
|
||||||
dotenv@^16.0.3:
|
dotenv@^16.0.3:
|
||||||
version "16.3.1"
|
version "16.3.1"
|
||||||
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.3.1.tgz#369034de7d7e5b120972693352a3bf112172cc3e"
|
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.3.1.tgz#369034de7d7e5b120972693352a3bf112172cc3e"
|
||||||
@ -1980,6 +2180,11 @@ end-of-stream@^1.1.0, end-of-stream@^1.4.1:
|
|||||||
dependencies:
|
dependencies:
|
||||||
once "^1.4.0"
|
once "^1.4.0"
|
||||||
|
|
||||||
|
entities@^4.2.0:
|
||||||
|
version "4.5.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/entities/-/entities-4.5.0.tgz#5d268ea5e7113ec74c4d033b79ea5a35a488fb48"
|
||||||
|
integrity sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==
|
||||||
|
|
||||||
env-paths@^2.2.0:
|
env-paths@^2.2.0:
|
||||||
version "2.2.1"
|
version "2.2.1"
|
||||||
resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.1.tgz#420399d416ce1fbe9bc0a07c62fa68d67fd0f8f2"
|
resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.1.tgz#420399d416ce1fbe9bc0a07c62fa68d67fd0f8f2"
|
||||||
@ -2273,6 +2478,13 @@ expr-eval@^2.0.2:
|
|||||||
resolved "https://registry.yarnpkg.com/expr-eval/-/expr-eval-2.0.2.tgz#fa6f044a7b0c93fde830954eb9c5b0f7fbc7e201"
|
resolved "https://registry.yarnpkg.com/expr-eval/-/expr-eval-2.0.2.tgz#fa6f044a7b0c93fde830954eb9c5b0f7fbc7e201"
|
||||||
integrity sha512-4EMSHGOPSwAfBiibw3ndnP0AvjDWLsMvGOvWEZ2F96IGk0bIVdjQisOHxReSkE13mHcfbuCiXw+G4y0zv6N8Eg==
|
integrity sha512-4EMSHGOPSwAfBiibw3ndnP0AvjDWLsMvGOvWEZ2F96IGk0bIVdjQisOHxReSkE13mHcfbuCiXw+G4y0zv6N8Eg==
|
||||||
|
|
||||||
|
express-ws@^5.0.2:
|
||||||
|
version "5.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/express-ws/-/express-ws-5.0.2.tgz#5b02d41b937d05199c6c266d7cc931c823bda8eb"
|
||||||
|
integrity sha512-0uvmuk61O9HXgLhGl3QhNSEtRsQevtmbL94/eILaliEADZBHZOQUAiHFrGPrgsjikohyrmSG5g+sCfASTt0lkQ==
|
||||||
|
dependencies:
|
||||||
|
ws "^7.4.6"
|
||||||
|
|
||||||
express@^4.18.2:
|
express@^4.18.2:
|
||||||
version "4.18.2"
|
version "4.18.2"
|
||||||
resolved "https://registry.yarnpkg.com/express/-/express-4.18.2.tgz#3fabe08296e930c796c19e3c516979386ba9fd59"
|
resolved "https://registry.yarnpkg.com/express/-/express-4.18.2.tgz#3fabe08296e930c796c19e3c516979386ba9fd59"
|
||||||
@ -2315,6 +2527,15 @@ extend@^3.0.2:
|
|||||||
resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa"
|
resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa"
|
||||||
integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==
|
integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==
|
||||||
|
|
||||||
|
external-editor@^3.1.0:
|
||||||
|
version "3.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.1.0.tgz#cb03f740befae03ea4d283caed2741a83f335495"
|
||||||
|
integrity sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==
|
||||||
|
dependencies:
|
||||||
|
chardet "^0.7.0"
|
||||||
|
iconv-lite "^0.4.24"
|
||||||
|
tmp "^0.0.33"
|
||||||
|
|
||||||
extract-files@^9.0.0:
|
extract-files@^9.0.0:
|
||||||
version "9.0.0"
|
version "9.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/extract-files/-/extract-files-9.0.0.tgz#8a7744f2437f81f5ed3250ed9f1550de902fe54a"
|
resolved "https://registry.yarnpkg.com/extract-files/-/extract-files-9.0.0.tgz#8a7744f2437f81f5ed3250ed9f1550de902fe54a"
|
||||||
@ -2380,6 +2601,13 @@ fecha@^4.2.0:
|
|||||||
resolved "https://registry.yarnpkg.com/fecha/-/fecha-4.2.3.tgz#4d9ccdbc61e8629b259fdca67e65891448d569fd"
|
resolved "https://registry.yarnpkg.com/fecha/-/fecha-4.2.3.tgz#4d9ccdbc61e8629b259fdca67e65891448d569fd"
|
||||||
integrity sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw==
|
integrity sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw==
|
||||||
|
|
||||||
|
figures@^3.2.0:
|
||||||
|
version "3.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af"
|
||||||
|
integrity sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==
|
||||||
|
dependencies:
|
||||||
|
escape-string-regexp "^1.0.5"
|
||||||
|
|
||||||
file-entry-cache@^6.0.1:
|
file-entry-cache@^6.0.1:
|
||||||
version "6.0.1"
|
version "6.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027"
|
resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027"
|
||||||
@ -2868,6 +3096,11 @@ hasown@^2.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
function-bind "^1.1.2"
|
function-bind "^1.1.2"
|
||||||
|
|
||||||
|
he@1.2.0:
|
||||||
|
version "1.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"
|
||||||
|
integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==
|
||||||
|
|
||||||
hermes-eslint@^0.15.0:
|
hermes-eslint@^0.15.0:
|
||||||
version "0.15.1"
|
version "0.15.1"
|
||||||
resolved "https://registry.yarnpkg.com/hermes-eslint/-/hermes-eslint-0.15.1.tgz#c5919a6fdbd151febc3d5ed8ff17e5433913528c"
|
resolved "https://registry.yarnpkg.com/hermes-eslint/-/hermes-eslint-0.15.1.tgz#c5919a6fdbd151febc3d5ed8ff17e5433913528c"
|
||||||
@ -2950,7 +3183,7 @@ humanize-ms@^1.2.1:
|
|||||||
dependencies:
|
dependencies:
|
||||||
ms "^2.0.0"
|
ms "^2.0.0"
|
||||||
|
|
||||||
iconv-lite@0.4.24:
|
iconv-lite@0.4.24, iconv-lite@^0.4.24:
|
||||||
version "0.4.24"
|
version "0.4.24"
|
||||||
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
|
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
|
||||||
integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==
|
integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==
|
||||||
@ -3928,6 +4161,11 @@ multer@^1.4.5-lts.1:
|
|||||||
type-is "^1.6.4"
|
type-is "^1.6.4"
|
||||||
xtend "^4.0.0"
|
xtend "^4.0.0"
|
||||||
|
|
||||||
|
mute-stream@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-1.0.0.tgz#e31bd9fe62f0aed23520aa4324ea6671531e013e"
|
||||||
|
integrity sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==
|
||||||
|
|
||||||
napi-build-utils@^1.0.1:
|
napi-build-utils@^1.0.1:
|
||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/napi-build-utils/-/napi-build-utils-1.0.2.tgz#b1fddc0b2c46e380a0b7a76f984dd47c41a13806"
|
resolved "https://registry.yarnpkg.com/napi-build-utils/-/napi-build-utils-1.0.2.tgz#b1fddc0b2c46e380a0b7a76f984dd47c41a13806"
|
||||||
@ -4008,6 +4246,21 @@ node-gyp@8.x:
|
|||||||
tar "^6.1.2"
|
tar "^6.1.2"
|
||||||
which "^2.0.2"
|
which "^2.0.2"
|
||||||
|
|
||||||
|
node-html-markdown@^1.3.0:
|
||||||
|
version "1.3.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/node-html-markdown/-/node-html-markdown-1.3.0.tgz#ef0b19a3bbfc0f1a880abb9ff2a0c9aa6bbff2a9"
|
||||||
|
integrity sha512-OeFi3QwC/cPjvVKZ114tzzu+YoR+v9UXW5RwSXGUqGb0qCl0DvP406tzdL7SFn8pZrMyzXoisfG2zcuF9+zw4g==
|
||||||
|
dependencies:
|
||||||
|
node-html-parser "^6.1.1"
|
||||||
|
|
||||||
|
node-html-parser@^6.1.1:
|
||||||
|
version "6.1.13"
|
||||||
|
resolved "https://registry.yarnpkg.com/node-html-parser/-/node-html-parser-6.1.13.tgz#a1df799b83df5c6743fcd92740ba14682083b7e4"
|
||||||
|
integrity sha512-qIsTMOY4C/dAa5Q5vsobRpOOvPfC4pB61UVW2uSwZNUp0QU/jCekTal1vMmbO0DgdHeLUJpv/ARmDqErVxA3Sg==
|
||||||
|
dependencies:
|
||||||
|
css-select "^5.1.0"
|
||||||
|
he "1.2.0"
|
||||||
|
|
||||||
node-llama-cpp@^2.8.0:
|
node-llama-cpp@^2.8.0:
|
||||||
version "2.8.0"
|
version "2.8.0"
|
||||||
resolved "https://registry.yarnpkg.com/node-llama-cpp/-/node-llama-cpp-2.8.0.tgz#c01e469761caa4b9c51dbcf7555260caf7fb7bd6"
|
resolved "https://registry.yarnpkg.com/node-llama-cpp/-/node-llama-cpp-2.8.0.tgz#c01e469761caa4b9c51dbcf7555260caf7fb7bd6"
|
||||||
@ -4090,6 +4343,13 @@ npmlog@^6.0.0, npmlog@^6.0.2:
|
|||||||
gauge "^4.0.3"
|
gauge "^4.0.3"
|
||||||
set-blocking "^2.0.0"
|
set-blocking "^2.0.0"
|
||||||
|
|
||||||
|
nth-check@^2.0.1:
|
||||||
|
version "2.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/nth-check/-/nth-check-2.1.1.tgz#c9eab428effce36cd6b92c924bdb000ef1f1ed1d"
|
||||||
|
integrity sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==
|
||||||
|
dependencies:
|
||||||
|
boolbase "^1.0.0"
|
||||||
|
|
||||||
num-sort@^2.0.0:
|
num-sort@^2.0.0:
|
||||||
version "2.1.0"
|
version "2.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/num-sort/-/num-sort-2.1.0.tgz#1cbb37aed071329fdf41151258bc011898577a9b"
|
resolved "https://registry.yarnpkg.com/num-sort/-/num-sort-2.1.0.tgz#1cbb37aed071329fdf41151258bc011898577a9b"
|
||||||
@ -4235,6 +4495,20 @@ onnxruntime-web@1.14.0:
|
|||||||
onnxruntime-common "~1.14.0"
|
onnxruntime-common "~1.14.0"
|
||||||
platform "^1.3.6"
|
platform "^1.3.6"
|
||||||
|
|
||||||
|
"openai:latest@npm:openai@latest":
|
||||||
|
version "4.32.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/openai/-/openai-4.32.1.tgz#9e375fdbc727330c5ea5d287beb325db3e6f9ad7"
|
||||||
|
integrity sha512-3e9QyCY47tgOkxBe2CSVKlXOE2lLkMa24Y0s3LYZR40yYjiBU9dtVze+C3mu1TwWDGiRX52STpQAEJZvRNuIrA==
|
||||||
|
dependencies:
|
||||||
|
"@types/node" "^18.11.18"
|
||||||
|
"@types/node-fetch" "^2.6.4"
|
||||||
|
abort-controller "^3.0.0"
|
||||||
|
agentkeepalive "^4.2.1"
|
||||||
|
form-data-encoder "1.7.2"
|
||||||
|
formdata-node "^4.3.2"
|
||||||
|
node-fetch "^2.6.7"
|
||||||
|
web-streams-polyfill "^3.2.1"
|
||||||
|
|
||||||
openai@^3.2.1:
|
openai@^3.2.1:
|
||||||
version "3.3.0"
|
version "3.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/openai/-/openai-3.3.0.tgz#a6408016ad0945738e1febf43f2fccca83a3f532"
|
resolved "https://registry.yarnpkg.com/openai/-/openai-3.3.0.tgz#a6408016ad0945738e1febf43f2fccca83a3f532"
|
||||||
@ -4290,6 +4564,11 @@ ora@^7.0.1:
|
|||||||
string-width "^6.1.0"
|
string-width "^6.1.0"
|
||||||
strip-ansi "^7.1.0"
|
strip-ansi "^7.1.0"
|
||||||
|
|
||||||
|
os-tmpdir@~1.0.2:
|
||||||
|
version "1.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274"
|
||||||
|
integrity sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==
|
||||||
|
|
||||||
p-finally@^1.0.0:
|
p-finally@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae"
|
resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae"
|
||||||
@ -4412,6 +4691,11 @@ platform@^1.3.6:
|
|||||||
resolved "https://registry.yarnpkg.com/platform/-/platform-1.3.6.tgz#48b4ce983164b209c2d45a107adb31f473a6e7a7"
|
resolved "https://registry.yarnpkg.com/platform/-/platform-1.3.6.tgz#48b4ce983164b209c2d45a107adb31f473a6e7a7"
|
||||||
integrity sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==
|
integrity sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==
|
||||||
|
|
||||||
|
pluralize@^8.0.0:
|
||||||
|
version "8.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-8.0.0.tgz#1a6fa16a38d12a1901e0320fa017051c539ce3b1"
|
||||||
|
integrity sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==
|
||||||
|
|
||||||
posthog-node@^3.1.1:
|
posthog-node@^3.1.1:
|
||||||
version "3.1.1"
|
version "3.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/posthog-node/-/posthog-node-3.1.1.tgz#f92c44a871552c9bfb98bf4cc8fd326d36af6cbd"
|
resolved "https://registry.yarnpkg.com/posthog-node/-/posthog-node-3.1.1.tgz#f92c44a871552c9bfb98bf4cc8fd326d36af6cbd"
|
||||||
@ -4931,6 +5215,11 @@ signal-exit@^3.0.0, signal-exit@^3.0.2, signal-exit@^3.0.7:
|
|||||||
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9"
|
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9"
|
||||||
integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==
|
integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==
|
||||||
|
|
||||||
|
signal-exit@^4.1.0:
|
||||||
|
version "4.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04"
|
||||||
|
integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==
|
||||||
|
|
||||||
simple-concat@^1.0.0:
|
simple-concat@^1.0.0:
|
||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.1.tgz#f46976082ba35c2263f1c8ab5edfe26c41c9552f"
|
resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.1.tgz#f46976082ba35c2263f1c8ab5edfe26c41c9552f"
|
||||||
@ -5271,6 +5560,13 @@ text-table@^0.2.0:
|
|||||||
resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
|
resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
|
||||||
integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==
|
integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==
|
||||||
|
|
||||||
|
tmp@^0.0.33:
|
||||||
|
version "0.0.33"
|
||||||
|
resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9"
|
||||||
|
integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==
|
||||||
|
dependencies:
|
||||||
|
os-tmpdir "~1.0.2"
|
||||||
|
|
||||||
to-regex-range@^5.0.1:
|
to-regex-range@^5.0.1:
|
||||||
version "5.0.1"
|
version "5.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4"
|
resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4"
|
||||||
@ -5334,6 +5630,11 @@ type-fest@^0.20.2:
|
|||||||
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4"
|
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4"
|
||||||
integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==
|
integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==
|
||||||
|
|
||||||
|
type-fest@^0.21.3:
|
||||||
|
version "0.21.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37"
|
||||||
|
integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==
|
||||||
|
|
||||||
type-is@^1.6.4, type-is@~1.6.18:
|
type-is@^1.6.4, type-is@~1.6.18:
|
||||||
version "1.6.18"
|
version "1.6.18"
|
||||||
resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131"
|
resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131"
|
||||||
@ -5675,6 +5976,15 @@ wordwrapjs@^4.0.0:
|
|||||||
reduce-flatten "^2.0.0"
|
reduce-flatten "^2.0.0"
|
||||||
typical "^5.2.0"
|
typical "^5.2.0"
|
||||||
|
|
||||||
|
wrap-ansi@^6.2.0:
|
||||||
|
version "6.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53"
|
||||||
|
integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==
|
||||||
|
dependencies:
|
||||||
|
ansi-styles "^4.0.0"
|
||||||
|
string-width "^4.1.0"
|
||||||
|
strip-ansi "^6.0.0"
|
||||||
|
|
||||||
wrap-ansi@^7.0.0:
|
wrap-ansi@^7.0.0:
|
||||||
version "7.0.0"
|
version "7.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
|
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
|
||||||
@ -5689,6 +5999,11 @@ wrappy@1:
|
|||||||
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
|
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
|
||||||
integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==
|
integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==
|
||||||
|
|
||||||
|
ws@^7.4.6:
|
||||||
|
version "7.5.9"
|
||||||
|
resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.9.tgz#54fa7db29f4c7cec68b1ddd3a89de099942bb591"
|
||||||
|
integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==
|
||||||
|
|
||||||
xtend@^4.0.0:
|
xtend@^4.0.0:
|
||||||
version "4.0.2"
|
version "4.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54"
|
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54"
|
||||||
|
Loading…
Reference in New Issue
Block a user