diff --git a/application/app.py b/application/app.py index 2dafefc0..882a2cbc 100644 --- a/application/app.py +++ b/application/app.py @@ -196,7 +196,7 @@ def api_answer(): else: qa_chain = load_qa_chain(llm=llm, chain_type="map_reduce", combine_prompt=c_prompt, question_prompt=q_prompt) - chain = VectorDBQA(combine_documents_chain=qa_chain, vectorstore=docsearch, k=4) + chain = VectorDBQA(combine_documents_chain=qa_chain, vectorstore=docsearch, k=3) result = chain({"query": question}) print(result) @@ -285,7 +285,17 @@ def combined_json(): """Provide json file with combined available indexes.""" # get json from https://d3dg1063dc54p9.cloudfront.net/combined.json - data = [] + data = [{ + "name": 'default', + "language": 'default', + "version": '', + "description": 'default', + "fullName": 'default', + "date": 'default', + "docLink": 'default', + "model": embeddings_choice, + "location": "local" + }] # structure: name, language, version, description, fullName, date, docLink # append data from vectors_collection for index in vectors_collection.find({'user': user}): @@ -335,7 +345,7 @@ def upload_file(): os.makedirs(save_dir) file.save(os.path.join(save_dir, filename)) - task = ingest.delay('temp', [".rst", ".md", ".pdf"], job_name, filename, user) + task = ingest.delay('temp', [".rst", ".md", ".pdf", ".txt"], job_name, filename, user) # task id task_id = task.id return {"status": 'ok', "task_id": task_id} diff --git a/application/prompts/chat_combine_prompt.txt b/application/prompts/chat_combine_prompt.txt index 608d2a88..981b6e64 100644 --- a/application/prompts/chat_combine_prompt.txt +++ b/application/prompts/chat_combine_prompt.txt @@ -1,4 +1,4 @@ You are a DocsGPT, friendly and helpful AI assistant by Arc53 that provides help with documents. You give thorough answers with code examples if possible. -Use the following pieces of context to help answer the users question. +Use the following pieces of context to help answer the users question. If its not relevant to the question, provide friendly responses. ---------------- {summaries} \ No newline at end of file diff --git a/application/worker.py b/application/worker.py index 90bc9bf8..ce2c82d5 100644 --- a/application/worker.py +++ b/application/worker.py @@ -96,4 +96,4 @@ def ingest_worker(self, directory, formats, name_job, filename, user): # delete local shutil.rmtree(full_path) - return {'directory': directory, 'formats': formats, 'name_job': name_job, 'filename': filename, 'user': user} + return {'directory': directory, 'formats': formats, 'name_job': name_job, 'filename': filename, 'user': user, 'limited': False} diff --git a/docker-compose.yaml b/docker-compose.yaml index 172b6bae..6a4b4cf2 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -21,7 +21,9 @@ services: ports: - "5001:5001" volumes: - - app_data_container:/app + - ./application/indexes:/app/indexes + - ./application/inputs:/app/inputs + - ./application/vectors:/app/vectors depends_on: - redis - mongo @@ -55,5 +57,4 @@ services: volumes: - mongodb_data_container: - app_data_container: \ No newline at end of file + mongodb_data_container: \ No newline at end of file diff --git a/frontend/.env.production b/frontend/.env.production index 46e738b1..e0c76c77 100644 --- a/frontend/.env.production +++ b/frontend/.env.production @@ -1 +1 @@ -VITE_API_HOST = https://docsapi.arc53.com \ No newline at end of file +VITE_API_HOST = https://gptcloud.arc53.com \ No newline at end of file diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index 979f64ea..a660a135 100644 --- a/frontend/src/Navigation.tsx +++ b/frontend/src/Navigation.tsx @@ -38,9 +38,8 @@ export default function Navigation({ const [isDocsListOpen, setIsDocsListOpen] = useState(false); const isApiKeySet = useSelector(selectApiKeyStatus); - const [apiKeyModalState, setApiKeyModalState] = useState( - isApiKeySet ? 'INACTIVE' : 'ACTIVE', - ); + const [apiKeyModalState, setApiKeyModalState] = + useState('INACTIVE'); const isSelectedDocsSet = useSelector(selectSelectedDocsStatus); const [selectedDocsModalState, setSelectedDocsModalState] = diff --git a/frontend/src/conversation/Conversation.tsx b/frontend/src/conversation/Conversation.tsx index de8ace00..fd3f3e93 100644 --- a/frontend/src/conversation/Conversation.tsx +++ b/frontend/src/conversation/Conversation.tsx @@ -71,9 +71,9 @@ export default function Conversation() { }; return ( -
+
{queries.length > 0 && ( -
+
{queries.map((query, index) => { return ( diff --git a/frontend/src/preferences/preferenceSlice.ts b/frontend/src/preferences/preferenceSlice.ts index 78951e74..edf582ce 100644 --- a/frontend/src/preferences/preferenceSlice.ts +++ b/frontend/src/preferences/preferenceSlice.ts @@ -13,8 +13,18 @@ interface Preference { } const initialState: Preference = { - apiKey: '', - selectedDocs: null, + apiKey: 'xxx', + selectedDocs: { + name: 'default', + language: 'default', + location: 'default', + version: 'default', + description: 'default', + fullName: 'default', + dat: 'default', + docLink: 'default', + model: 'openai_text-embedding-ada-002', + } as Doc, sourceDocs: null, }; diff --git a/frontend/src/upload/Upload.tsx b/frontend/src/upload/Upload.tsx index e404bd12..be1e6ac4 100644 --- a/frontend/src/upload/Upload.tsx +++ b/frontend/src/upload/Upload.tsx @@ -19,20 +19,27 @@ export default function Upload({ type: 'UPLOAD' | 'TRAINIING'; percentage: number; taskId?: string; + failed?: boolean; }>(); function Progress({ title, isCancellable = false, + isFailed = false, }: { title: string; isCancellable?: boolean; + isFailed?: boolean; }) { return (

{title}...

This may take several minutes

+

+ Over the token limit, please consider uploading smaller document +

{progress?.percentage || 0}%

+
+