From 568e78d3efe968845b1af0773a853edbb2c90c5e Mon Sep 17 00:00:00 2001 From: timothycarambat Date: Tue, 19 Mar 2024 09:04:33 -0700 Subject: [PATCH 01/13] update Docker readme --- docker/HOW_TO_USE_DOCKER.md | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/docker/HOW_TO_USE_DOCKER.md b/docker/HOW_TO_USE_DOCKER.md index 9532fea0b..20ae0ccf7 100644 --- a/docker/HOW_TO_USE_DOCKER.md +++ b/docker/HOW_TO_USE_DOCKER.md @@ -109,29 +109,23 @@ container rebuilds or pulls from Docker Hub. Your docker host will show the image as online once the build process is completed. This will build the app to `http://localhost:3001`. -## ⚠️ Vector DB support ⚠️ - -Out of the box, all vector databases are supported. Any vector databases requiring special configuration are listed below. - -### Using local ChromaDB with Dockerized AnythingLLM - -- Ensure in your `./docker/.env` file that you have - -``` -#./docker/.env -...other configs - -VECTOR_DB="chroma" -CHROMA_ENDPOINT='http://host.docker.internal:8000' # Allow docker to look on host port, not container. -# CHROMA_API_HEADER="X-Api-Key" // If you have an Auth middleware on your instance. -# CHROMA_API_KEY="sk-123abc" - -...other configs - -``` - ## Common questions and fixes +### Cannot connect to service running on localhost! + +If you are in docker and cannot connect to a service running on your host machine running on a local interface or loopback: + +- `localhost` +- `127.0.0.1` +- `0.0.0.0` + +> [!IMPORTANT] +> On linux `http://host.docker.internal:xxxx` does not work. +> Use `http://172.17.0.1:xxxx` instead to emulate this functionality. + +Then in docker you need to replace that localhost part with `host.docker.internal`. For example, if running Ollama on the host machine, bound to http://127.0.0.1:11434 you should put `http://host.docker.internal:11434` into the connection URL in AnythingLLM. + + ### API is not working, cannot login, LLM is "offline"? You are likely running the docker container on a remote machine like EC2 or some other instance where the reachable URL From 45f50ce13cc3bbb7e64630df7fc19cde6ec37afe Mon Sep 17 00:00:00 2001 From: Sean Hatfield Date: Tue, 19 Mar 2024 18:14:34 -0700 Subject: [PATCH 02/13] [FIX] Update metadata tags in PDF collector script (#925) update title in pdf collector script to be the filename instead of metadata title --- collector/processSingleFile/convert/asPDF.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/collector/processSingleFile/convert/asPDF.js b/collector/processSingleFile/convert/asPDF.js index 560c4939f..e81fe6c76 100644 --- a/collector/processSingleFile/convert/asPDF.js +++ b/collector/processSingleFile/convert/asPDF.js @@ -40,9 +40,9 @@ async function asPDF({ fullFilePath = "", filename = "" }) { const data = { id: v4(), url: "file://" + fullFilePath, - title: docs[0]?.metadata?.pdf?.info?.Title || filename, + title: filename, docAuthor: docs[0]?.metadata?.pdf?.info?.Creator || "no author found", - description: "No description found.", + description: docs[0]?.metadata?.pdf?.info?.Title || "No description found.", docSource: "pdf file uploaded by the user.", chunkSource: "", published: createdDate(fullFilePath), From fd626b14b278c44ce125f5636c5b0b8b952f6c11 Mon Sep 17 00:00:00 2001 From: Sean Hatfield Date: Wed, 20 Mar 2024 14:53:12 -0700 Subject: [PATCH 03/13] [FEAT] Improve UX of PromptInput (#939) improve UX of PromptInput + cleanup props --- .../ChatContainer/PromptInput/index.jsx | 31 +++++++++++++------ .../WorkspaceChat/ChatContainer/index.jsx | 1 - 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/index.jsx index 52e870123..d424c906f 100644 --- a/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/index.jsx +++ b/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/index.jsx @@ -1,4 +1,4 @@ -import React, { useState, useRef } from "react"; +import React, { useState, useRef, useEffect } from "react"; import SlashCommandsButton, { SlashCommands, useSlashCommands, @@ -7,9 +7,7 @@ import { isMobile } from "react-device-detect"; import debounce from "lodash.debounce"; import { PaperPlaneRight } from "@phosphor-icons/react"; import StopGenerationButton from "./StopGenerationButton"; - export default function PromptInput({ - workspace, message, submit, onChange, @@ -19,13 +17,27 @@ export default function PromptInput({ }) { const { showSlashCommand, setShowSlashCommand } = useSlashCommands(); const formRef = useRef(null); + const textareaRef = useRef(null); const [_, setFocused] = useState(false); + useEffect(() => { + if (!inputDisabled && textareaRef.current) { + textareaRef.current.focus(); + } + resetTextAreaHeight(); + }, [inputDisabled]); + const handleSubmit = (e) => { setFocused(false); submit(e); }; + const resetTextAreaHeight = () => { + if (textareaRef.current) { + textareaRef.current.style.height = "auto"; + } + }; + const checkForSlash = (e) => { const input = e.target.value; if (input === "/") setShowSlashCommand(true); @@ -44,14 +56,12 @@ export default function PromptInput({ const adjustTextArea = (event) => { if (isMobile) return false; const element = event.target; - element.style.height = "1px"; - element.style.height = - event.target.value.length !== 0 - ? 25 + element.scrollHeight + "px" - : "1px"; + element.style.height = "auto"; + element.style.height = `${element.scrollHeight}px`; }; const watchForSlash = debounce(checkForSlash, 300); + return (