Skip to content

Commit

Permalink
Merge branch 'master' into agent-skill-plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
timothycarambat authored Sep 7, 2024
2 parents cf5eafe + 86f4466 commit 8f3b1a3
Show file tree
Hide file tree
Showing 29 changed files with 309 additions and 171 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"Qdrant",
"royalblue",
"searxng",
"SearchApi",
"Serper",
"Serply",
"streamable",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ AnythingLLM divides your documents into objects called `workspaces`. A Workspace

### Supported LLMs, Embedder Models, Speech models, and Vector Databases

**Language Learning Models:**
**Large Language Models (LLMs):**

- [Any open-source llama.cpp compatible model](/server/storage/models/README.md#text-generation-llm-selection)
- [OpenAI](https://openai.com)
Expand Down
1 change: 0 additions & 1 deletion collector/extensions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ function extensions(app) {
reqBody(request),
response,
);
console.log({ success, reason, data })
response.status(200).json({
success,
reason,
Expand Down
4 changes: 4 additions & 0 deletions docker/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,10 @@ GID='1000'
# AGENT_GSE_KEY=
# AGENT_GSE_CTX=

#------ SearchApi.io ----------- https://www.searchapi.io/
# AGENT_SEARCHAPI_API_KEY=
# AGENT_SEARCHAPI_ENGINE=google

#------ Serper.dev ----------- https://serper.dev/
# AGENT_SERPER_DEV_KEY=

Expand Down
4 changes: 2 additions & 2 deletions docker/HOW_TO_USE_DOCKER.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ services:
- WHISPER_PROVIDER=local
- TTS_PROVIDER=native
- PASSWORDMINCHAR=8
- AGENT_SERPER_DEV_KEY="SERPER DEV API KEY"
- AGENT_SERPLY_API_KEY="Serply.io API KEY"
# Add any other keys here for services or settings
# you can find in the docker/.env.example file
volumes:
- anythingllm_storage:/app/server/storage
restart: always
Expand Down
3 changes: 1 addition & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"preview": "vite preview"
},
"dependencies": {
"@metamask/jazzicon": "^2.0.0",
"@microsoft/fetch-event-source": "^2.0.1",
"@mintplex-labs/piper-tts-web": "^1.0.4",
"@phosphor-icons/react": "^2.1.7",
Expand Down Expand Up @@ -71,4 +70,4 @@
"tailwindcss": "^3.3.1",
"vite": "^4.3.0"
}
}
}
21 changes: 17 additions & 4 deletions frontend/src/components/Modals/ManageWorkspace/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,19 +127,32 @@ const ModalTabSwitcher = ({ selectedTab, setSelectedTab }) => {
</div>
);
};

export function useManageWorkspaceModal() {
const { user } = useUser();
const [showing, setShowing] = useState(false);

const showModal = () => {
function showModal() {
if (user?.role !== "default") {
setShowing(true);
}
};
}

const hideModal = () => {
function hideModal() {
setShowing(false);
};
}

useEffect(() => {
function onEscape(event) {
if (!showing || event.key !== "Escape") return;
setShowing(false);
}

document.addEventListener("keydown", onEscape);
return () => {
document.removeEventListener("keydown", onEscape);
};
}, [showing]);

return { showing, showModal, hideModal };
}
51 changes: 29 additions & 22 deletions frontend/src/components/UserIcon/index.jsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,42 @@
import React, { useRef, useEffect } from "react";
import JAZZ from "@metamask/jazzicon";
import React, { memo } from "react";
import usePfp from "../../hooks/usePfp";
import UserDefaultPfp from "./user.svg";
import WorkspaceDefaultPfp from "./workspace.svg";

export default function UserIcon({ size = 36, user, role }) {
const UserIcon = memo(({ role }) => {
const { pfp } = usePfp();
const divRef = useRef(null);
const seed = user?.uid
? toPseudoRandomInteger(user.uid)
: Math.floor(100000 + Math.random() * 900000);

useEffect(() => {
if (!divRef.current || (role === "user" && pfp)) return;

const result = JAZZ(size, seed);
divRef.current.appendChild(result);
}, [pfp, role, seed, size]);

return (
<div className="relative w-[35px] h-[35px] rounded-full flex-shrink-0 overflow-hidden">
<div ref={divRef} />
{role === "user" && pfp && (
{role === "user" && <RenderUserPfp pfp={pfp} />}
{role !== "user" && (
<img
src={pfp}
alt="User profile picture"
className="absolute top-0 left-0 w-full h-full object-cover rounded-full bg-white"
src={WorkspaceDefaultPfp}
alt="system profile picture"
className="flex items-center justify-center rounded-full border border-white/40"
/>
)}
</div>
);
}
});

function RenderUserPfp({ pfp }) {
if (!pfp)
return (
<img
src={UserDefaultPfp}
alt="User profile picture"
className="rounded-full border-none"
/>
);

function toPseudoRandomInteger(uidString = "") {
return uidString.split("").reduce((acc, char) => acc + char.charCodeAt(0), 0);
return (
<img
src={pfp}
alt="User profile picture"
className="absolute top-0 left-0 w-full h-full object-cover rounded-full border-none"
/>
);
}

export default UserIcon;
12 changes: 12 additions & 0 deletions frontend/src/components/UserIcon/user.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed frontend/src/components/UserIcon/workspace.png
Binary file not shown.
20 changes: 20 additions & 0 deletions frontend/src/components/UserIcon/workspace.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const HistoricalMessage = ({
role === "user" ? USER_BACKGROUND_COLOR : AI_BACKGROUND_COLOR
}`}
>
<div className={`py-8 px-4 w-full flex gap-x-5 md:max-w-[80%] flex-col`}>
<div className="py-8 px-4 w-full flex gap-x-5 md:max-w-[80%] flex-col">
<div className="flex gap-x-5">
<div className="flex flex-col items-center">
<ProfileImage role={role} workspace={workspace} />
Expand All @@ -98,9 +98,9 @@ const HistoricalMessage = ({
saveChanges={saveEditedMessage}
/>
) : (
<div className={"overflow-x-scroll break-words"}>
<div className="overflow-x-scroll break-words no-scroll">
<span
className={`flex flex-col gap-y-1`}
className="flex flex-col gap-y-1"
dangerouslySetInnerHTML={{
__html: DOMPurify.sanitize(renderMarkdown(message)),
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,83 @@ export function GoogleSearchOptions({ settings }) {
);
}

const SearchApiEngines = [
{ name: "Google Search", value: "google" },
{ name: "Google Maps", value: "google_maps" },
{ name: "Google Shopping", value: "google_shopping" },
{ name: "Google News", value: "google_news" },
{ name: "Google Jobs", value: "google_jobs" },
{ name: "Google Scholar", value: "google_scholar" },
{ name: "Google Finance", value: "google_finance" },
{ name: "Google Patents", value: "google_patents" },
{ name: "YouTube", value: "youtube" },
{ name: "Bing", value: "bing" },
{ name: "Bing News", value: "bing_news" },
{ name: "Amazon Product Search", value: "amazon_search" },
{ name: "Baidu", value: "baidu" },
];
export function SearchApiOptions({ settings }) {
return (
<>
<p className="text-sm text-white/60 my-2">
You can get a free API key{" "}
<a
href="https://www.searchapi.io/"
target="_blank"
rel="noreferrer"
className="text-blue-300 underline"
>
from SearchApi.
</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-3">
API Key
</label>
<input
type="password"
name="env::AgentSearchApiKey"
className="border-none bg-zinc-900 text-white placeholder:text-white/20 text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5"
placeholder="SearchApi API Key"
defaultValue={settings?.AgentSearchApiKey ? "*".repeat(20) : ""}
required={true}
autoComplete="off"
spellCheck={false}
/>
</div>
<div className="flex flex-col w-60">
<label className="text-white text-sm font-semibold block mb-3">
Engine
</label>
<select
name="env::AgentSearchApiEngine"
required={true}
className="border-none bg-zinc-900 text-white placeholder:text-white/20 text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5"
defaultValue={settings?.AgentSearchApiEngine || "google"}
>
{SearchApiEngines.map(({ name, value }) => (
<option key={name} value={value}>
{name}
</option>
))}
</select>
{/* <input
type="text"
name="env::AgentSearchApiEngine"
className="border-none bg-zinc-900 text-white placeholder:text-white/20 text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5"
placeholder="SearchApi engine (Google, Bing...)"
defaultValue={settings?.AgentSearchApiEngine || "google"}
required={true}
autoComplete="off"
spellCheck={false}
/> */}
</div>
</div>
</>
);
}

export function SerperDotDevOptions({ settings }) {
return (
<>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions frontend/src/pages/Admin/Agents/WebSearchSelection/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useEffect, useRef, useState } from "react";
import AnythingLLMIcon from "@/media/logo/anything-llm-icon.png";
import GoogleSearchIcon from "./icons/google.png";
import SearchApiIcon from "./icons/searchapi.png";
import SerperDotDevIcon from "./icons/serper.png";
import BingSearchIcon from "./icons/bing.png";
import SerplySearchIcon from "./icons/serply.png";
Expand All @@ -14,6 +15,7 @@ import {
import SearchProviderItem from "./SearchProviderItem";
import WebSearchImage from "@/media/agents/scrape-websites.png";
import {
SearchApiOptions,
SerperDotDevOptions,
GoogleSearchOptions,
BingSearchOptions,
Expand All @@ -38,6 +40,14 @@ const SEARCH_PROVIDERS = [
description:
"Web search powered by a custom Google Search Engine. Free for 100 queries per day.",
},
{
name: "SearchApi",
value: "searchapi",
logo: SearchApiIcon,
options: (settings) => <SearchApiOptions settings={settings} />,
description:
"SearchApi delivers structured data from multiple search engines. Free for 100 queries, but then paid. ",
},
{
name: "Serper.dev",
value: "serper-dot-dev",
Expand Down
1 change: 0 additions & 1 deletion frontend/src/pages/Admin/System/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ export default function AdminSystem() {
}}
value={messageLimit.limit}
min={1}
max={300}
className="bg-zinc-900 text-white placeholder:text-white/20 text-sm rounded-lg focus:border-white block w-60 p-2.5"
/>
</div>
Expand Down
Loading

0 comments on commit 8f3b1a3

Please sign in to comment.