Merge branch 'main' of https://github.com/RohittCodes/DocsGPT into fix-1210

This commit is contained in:
rohittcodes
2024-10-09 05:40:13 +05:30
17 changed files with 262 additions and 31 deletions

View File

@@ -1,10 +1,8 @@
name: Build and push DocsGPT Docker image
on:
workflow_dispatch:
push:
branches:
- main
release:
types: [published]
jobs:
deploy:
@@ -43,5 +41,7 @@ jobs:
context: ./application
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/docsgpt:latest
ghcr.io/${{ github.repository_owner }}/docsgpt:latest
${{ secrets.DOCKER_USERNAME }}/docsgpt:${{ github.event.release.tag_name }},${{ secrets.DOCKER_USERNAME }}/docsgpt:latest
ghcr.io/${{ github.repository_owner }}/docsgpt:${{ github.event.release.tag_name }},ghcr.io/${{ github.repository_owner }}/docsgpt:latest
cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/docsgpt:latest
cache-to: type=inline

View File

@@ -1,10 +1,8 @@
name: Build and push DocsGPT-FE Docker image
on:
workflow_dispatch:
push:
branches:
- main
release:
types: [published]
jobs:
deploy:
@@ -44,5 +42,7 @@ jobs:
context: ./frontend
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/docsgpt-fe:latest
ghcr.io/${{ github.repository_owner }}/docsgpt-fe:latest
${{ secrets.DOCKER_USERNAME }}/docsgpt-fe:${{ github.event.release.tag_name }},${{ secrets.DOCKER_USERNAME }}/docsgpt-fe:latest
ghcr.io/${{ github.repository_owner }}/docsgpt-fe:${{ github.event.release.tag_name }},ghcr.io/${{ github.repository_owner }}/docsgpt-fe:latest
cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/docsgpt-fe:latest
cache-to: type=inline

View File

@@ -0,0 +1,49 @@
name: Build and push DocsGPT Docker image for development
on:
workflow_dispatch:
push:
branches:
- main
jobs:
deploy:
if: github.repository == 'arc53/DocsGPT'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to ghcr.io
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker images to docker.io and ghcr.io
uses: docker/build-push-action@v4
with:
file: './application/Dockerfile'
platforms: linux/amd64
context: ./application
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/docsgpt:develop
ghcr.io/${{ github.repository_owner }}/docsgpt:develop
cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/docsgpt:develop
cache-to: type=inline

View File

@@ -0,0 +1,49 @@
name: Build and push DocsGPT FE Docker image for development
on:
workflow_dispatch:
push:
branches:
- main
jobs:
deploy:
if: github.repository == 'arc53/DocsGPT'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to ghcr.io
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker images to docker.io and ghcr.io
uses: docker/build-push-action@v4
with:
file: './frontend/Dockerfile'
platforms: linux/amd64
context: ./frontend
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/docsgpt-fe:develop
ghcr.io/${{ github.repository_owner }}/docsgpt-fe:develop
cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/docsgpt-fe:develop
cache-to: type=inline

View File

@@ -4,7 +4,7 @@ Welcome, contributors! We're excited to announce that DocsGPT is participating i
All contributors with accepted PRs will receive a cool Holopin! 🤩 (Watch out for a reply in your PR to collect it).
### 🏆 Top 50 contributors will recieve a special T-shirt
### 🏆 Top 50 contributors will receive a special T-shirt
### 🏆 [LLM Document analysis by LexEU competition](https://github.com/arc53/DocsGPT/blob/main/lexeu-competition.md):
A separate competition is available for those who submit new retrieval / workflow method that will analyze a Document using EU laws.

View File

@@ -131,10 +131,10 @@ def ingest_worker(
logging.info(f"Ingest file: {full_path}", extra={"user": user, "job": name_job})
file_data = {"name": name_job, "file": filename, "user": user}
download_file(urljoin(settings.API_URL, "/api/download"), file_data, os.path.join(full_path, filename))
if not os.path.exists(full_path):
os.makedirs(full_path)
download_file(urljoin(settings.API_URL, "/api/download"), file_data, os.path.join(full_path, filename))
# check if file is .zip and extract it
if filename.endswith(".zip"):

View File

@@ -28,15 +28,15 @@ Navigate to the sidebar where you will find `Source Docs` option,here you will f
### Step 2
Click on the `Upload icon` just beside the source docs options,now borwse and upload the document which you want to train on or select the `remote` option if you have to insert the link of the documentation.
Click on the `Upload icon` just beside the source docs options,now browse and upload the document which you want to train on or select the `remote` option if you have to insert the link of the documentation.
### Step 3
Now you will be able to see the name of the file uploaded under the Uploaded Files ,now click on `Train`,once you click on train it might take some time to train on the document. You will be able to see the `Training progress` and once the training is completed you can click the `finish` button and there you go your docuemnt is uploaded.
Now you will be able to see the name of the file uploaded under the Uploaded Files ,now click on `Train`,once you click on train it might take some time to train on the document. You will be able to see the `Training progress` and once the training is completed you can click the `finish` button and there you go your document is uploaded.
### Step 4
Go to `New chat` and from the side bar select the document you uploaded under the `Source Docs` and go ahead with your chat, now you can ask qestions regarding the document you uploaded and you will get the effective answer based on it.
Go to `New chat` and from the side bar select the document you uploaded under the `Source Docs` and go ahead with your chat, now you can ask questions regarding the document you uploaded and you will get the effective answer based on it.
</Steps>

View File

@@ -33,7 +33,7 @@ For open source you have to edit .env file with LLM_NAME with their desired LLM
All the supported LLM providers are here application/llm and you can check what env variable are needed for each
List of latest supported LLMs are https://github.com/arc53/DocsGPT/blob/main/application/llm/llm_creator.py
### Step 3
Visit application/llm and select the file of your selected llm and there you will find the speicifc requirements needed to be filled in order to use it,i.e API key of that llm.
Visit application/llm and select the file of your selected llm and there you will find the specific requirements needed to be filled in order to use it,i.e API key of that llm.
</Steps>
### For OpenAI-Compatible Endpoints:

View File

@@ -32,7 +32,10 @@ function MainLayout() {
}
export default function App() {
useDarkTheme();
const [,,componentMounted] = useDarkTheme();
if(!componentMounted) {
return <div />
}
return (
<div className="h-full relative overflow-auto">
<Routes>

View File

@@ -2,8 +2,6 @@ import { SyntheticEvent, useEffect, useRef, useState } from 'react';
import { useSelector } from 'react-redux';
import Edit from '../assets/edit.svg';
import Exit from '../assets/exit.svg';
import Message from '../assets/message.svg';
import MessageDark from '../assets/message-dark.svg';
import { useDarkTheme } from '../hooks';
import ConfirmationModal from '../modals/ConfirmationModal';
import CheckMark2 from '../assets/checkMark2.svg';
@@ -96,17 +94,13 @@ export default function ConversationTile({
conversationId !== conversation.id &&
selectConversation(conversation.id);
}}
className={`my-auto mx-4 mt-4 flex h-9 cursor-pointer items-center justify-between gap-4 rounded-3xl hover:bg-gray-100 dark:hover:bg-[#28292E] ${
className={`my-auto mx-4 mt-4 flex h-9 cursor-pointer items-center justify-between pl-4 gap-4 rounded-3xl hover:bg-gray-100 dark:hover:bg-[#28292E] ${
conversationId === conversation.id || isOpen || isHovered
? 'bg-gray-100 dark:bg-[#28292E]'
: ''
}`}
>
<div className={`flex w-10/12 gap-4`}>
<img
src={isDarkTheme ? MessageDark : Message}
className="ml-4 w-5 dark:text-white"
/>
{isEdit ? (
<input
autoFocus

View File

@@ -82,6 +82,7 @@ export function useDarkTheme() {
};
const [isDarkTheme, setIsDarkTheme] = useState<boolean>(getInitialTheme());
const [componentMounted, setComponentMounted] = useState(false);
useEffect(() => {
const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
@@ -102,11 +103,12 @@ export function useDarkTheme() {
} else {
document.body?.classList.remove('dark');
}
setComponentMounted(true);
}, [isDarkTheme]);
const toggleTheme = () => {
setIsDarkTheme(!isDarkTheme);
};
return [isDarkTheme, toggleTheme] as const;
return [isDarkTheme, toggleTheme, componentMounted] as const;
}

View File

@@ -7,7 +7,7 @@
"about": "About",
"inputPlaceholder": "Type your message here...",
"tagline": "DocsGPT uses GenAI, please review critical information using sources.",
"sourceDocs": "Source Docs",
"sourceDocs": "Source",
"none": "None",
"cancel": "Cancel",
"demo": [

View File

@@ -7,7 +7,7 @@
"about": "Acerca de",
"inputPlaceholder": "Escribe tu mensaje aquí...",
"tagline": "DocsGPT utiliza GenAI, por favor revisa información crítica utilizando fuentes.",
"sourceDocs": "Documentos Fuente",
"sourceDocs": "Fuente",
"none": "Nada",
"cancel": "Cancelar",
"demo": [

View File

@@ -6,6 +6,7 @@ import en from './en.json'; //English
import es from './es.json'; //Spanish
import jp from './jp.json'; //Japanese
import zh from './zh.json'; //Mandarin
import zhTW from './zh-TW.json'; //Traditional Chinese
i18n
.use(LanguageDetector)
@@ -24,6 +25,9 @@ i18n
zh: {
translation: zh,
},
"zh-TW": {
translation: zhTW,
},
},
fallbackLng: 'en',
detection: {

View File

@@ -7,7 +7,7 @@
"about": "について",
"inputPlaceholder": "ここにメッセージを入力してください...",
"tagline": "DocsGPTはGenAIを使用しています。重要な情報はソースで確認してください。",
"sourceDocs": "ソースドキュメント",
"sourceDocs": "ソース",
"none": "なし",
"cancel": "キャンセル",
"demo": [

View File

@@ -0,0 +1,130 @@
{
"language": "繁體中文(臺灣)",
"chat": "對話",
"chats": "對話",
"newChat": "新對話",
"myPlan": "我的方案",
"about": "關於",
"inputPlaceholder": "在此輸入您的訊息...",
"tagline": "DocsGPT 使用生成式 AI請使用原始資料來源審閱重要資訊。",
"sourceDocs": "原始文件",
"none": "無",
"cancel": "取消",
"demo": [
{
"header": "了解 DocsGPT",
"query": "什麼是 DocsGPT"
},
{
"header": "摘要文件",
"query": "摘要目前的內容"
},
{
"header": "撰寫程式碼",
"query": "為 /api/answer 撰寫 API 請求程式碼"
},
{
"header": "學習輔助",
"query": "為此內容撰寫可能的問題"
}
],
"settings": {
"label": "設定",
"general": {
"label": "一般",
"selectTheme": "選擇主題",
"light": "淺色",
"dark": "深色",
"selectLanguage": "選擇語言",
"chunks": "每次查詢處理的區塊數",
"prompt": "使用中的提示",
"deleteAllLabel": "刪除所有對話",
"deleteAllBtn": "全部刪除",
"addNew": "新增",
"convHistory": "對話歷史記錄",
"none": "無",
"low": "低",
"medium": "中",
"high": "高",
"unlimited": "無限制",
"default": "預設"
},
"documents": {
"label": "文件",
"name": "文件名稱",
"date": "向量日期",
"type": "類型",
"tokenUsage": "Token 使用量"
},
"apiKeys": {
"label": "API 金鑰",
"name": "名稱",
"key": "API 金鑰",
"sourceDoc": "來源文件",
"createNew": "新增"
},
"analytics": {
"label": "分析"
},
"logs": {
"label": "日誌"
}
},
"modals": {
"uploadDoc": {
"label": "上傳新文件",
"file": "從檔案",
"remote": "遠端",
"name": "名稱",
"choose": "選擇檔案",
"info": "請上傳 .pdf, .txt, .rst, .docx, .md, .zip 檔案,大小限制為 25MB",
"uploadedFiles": "已上傳的檔案",
"cancel": "取消",
"train": "訓練",
"link": "連結",
"urlLink": "URL 連結",
"reddit": {
"id": "用戶端 ID",
"secret": "用戶端金鑰",
"agent": "使用者代理(User-Agent)",
"searchQueries": "搜尋查詢",
"numberOfPosts": "貼文數量"
}
},
"createAPIKey": {
"label": "建立新的 API 金鑰",
"apiKeyName": "API 金鑰名稱",
"chunks": "每次查詢處理的區塊數",
"prompt": "選擇使用中的提示",
"sourceDoc": "來源文件",
"create": "建立"
},
"saveKey": {
"note": "請儲存您的金鑰",
"disclaimer": "這是唯一一次顯示您的金鑰。",
"copy": "複製",
"copied": "已複製",
"confirm": "我已儲存金鑰"
},
"deleteConv": {
"confirm": "您確定要刪除所有對話嗎?",
"delete": "刪除"
},
"shareConv": {
"label": "建立公開頁面以分享",
"note": "來源文件、個人資訊和後續對話將保持私密",
"create": "建立"
}
},
"sharedConv": {
"subtitle": "使用以下工具建立",
"button": "開始使用 DocsGPT",
"meta": "DocsGPT 使用生成式 AI請使用原始資料來源審閱重要資訊。"
},
"convTile": {
"share": "分享",
"delete": "刪除",
"rename": "重新命名",
"deleteWarning": "您確定要刪除這個對話嗎?"
}
}

View File

@@ -7,7 +7,7 @@
"about": "关于",
"inputPlaceholder": "在这里输入您的消息...",
"tagline": "DocsGPT 使用 GenAI, 请使用来源审核关键信息.",
"sourceDocs": "来源文档",
"sourceDocs": "",
"none": "无",
"cancel": "取消",
"demo": [