Skip to content

Commit

Permalink
Update README and refactor backend and frontend code for improved cla…
Browse files Browse the repository at this point in the history
…rity and functionality
  • Loading branch information
md-abid-hussain committed Jan 30, 2025
1 parent c10e141 commit 6030b2f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ DocQuery is a comprehensive project consisting of both frontend and backend comp
1. Clone the repository:

```sh
git clone <repository-url>
git clone https://github.com/md-abid-hussain/docquery.git
cd docquery-frontend
```

Expand Down
4 changes: 2 additions & 2 deletions docquery-backend/app/agents/utils/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from .models import get_embedding_model

client = MongoClient(os.environ.get("MONGODB_ATLAS_CLUSTER_URI"))

DB_NAME = "docquery_db"
COLLECTION_NAME = "vectorstore"
ATLAS_VECTOR_SEARCH_INDEX = "rag_index"
Expand All @@ -18,10 +17,11 @@
relevance_score_fn="cosine",
)


def get_vector_store():
return vector_store


def save_to_database(name: str):
repository_collection = client["docquery"]["repositories"]
repository_collection.insert_one({"name": name})

14 changes: 9 additions & 5 deletions docquery-backend/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,21 @@
sdk = CopilotKitSDK(
agents=[
LangGraphAgent(
name="ingestion_agent", graph=ingestion_agent_graph, description="Ingestion Agent"
name="ingestion_agent",
graph=ingestion_agent_graph,
description="Ingestion Agent",
),
LangGraphAgent(
name="qa_agent", graph=qa_agent_graph, description="QA Agent"
)
name="qa_agent",
graph=qa_agent_graph,
description="QA Agent"
),
]
)

add_fastapi_endpoint(app, sdk, "/copilotkit")


@app.get("/")
@app.get("/test")
def read_root():
return {"Hello": "World"}
return "running"
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@

import { useParams } from 'next/navigation';
import { useEffect } from 'react';
import { useCoAgent, useCopilotReadable } from '@copilotkit/react-core';
import { useCoAgent, useCopilotReadable, useCopilotMessagesContext, useCopilotContext } from '@copilotkit/react-core';
import { CopilotChat } from '@copilotkit/react-ui';
import { QAAgentState } from '@/lib/types';
import useRepoDetails from '@/hooks/useRepoDetails';
import CopilotTextMessage from '@/components/copilot/copilot-text-message';

const ChatRepoPage = () => {

const { owner, repo } = useParams();
const { setMessages } = useCopilotMessagesContext();
const { setAgentSession } = useCopilotContext()

if (!owner || !repo) {
return <div>Loading...</div>;
Expand All @@ -30,13 +33,18 @@ const ChatRepoPage = () => {
repository_name: `${owner}/${repo}`,
messages: []
}

});

useEffect(() => {
setState({
question: "",
repository_name: `${owner}/${repo}`,
})
return () => {
setMessages([]);
setAgentSession(null);
}
}, []);

return (
Expand Down

0 comments on commit 6030b2f

Please sign in to comment.