{"id":33589333,"url":"https://github.com/mjennings061/vgs-chatbot","last_synced_at":"2026-03-10T14:04:38.338Z","repository":{"id":320470837,"uuid":"732306037","full_name":"mjennings061/vgs-chatbot","owner":"mjennings061","description":"Search engine for 2FTS documents.","archived":false,"fork":false,"pushed_at":"2025-11-29T08:50:32.000Z","size":1296,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-12-01T10:12:37.249Z","etag":null,"topics":["aviation","chatbot","llm","streamlit"],"latest_commit_sha":null,"homepage":"https://vgs-chatbot.streamlit.app/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mjennings061.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-12-16T08:28:36.000Z","updated_at":"2025-11-29T08:50:06.000Z","dependencies_parsed_at":"2025-10-24T01:30:51.289Z","dependency_job_id":"48b286fe-5222-463e-904e-76af4e1fa1e9","html_url":"https://github.com/mjennings061/vgs-chatbot","commit_stats":null,"previous_names":["mjennings061/vgs-chatbot"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/mjennings061/vgs-chatbot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjennings061%2Fvgs-chatbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjennings061%2Fvgs-chatbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjennings061%2Fvgs-chatbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjennings061%2Fvgs-chatbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mjennings061","download_url":"https://codeload.github.com/mjennings061/vgs-chatbot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjennings061%2Fvgs-chatbot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30336105,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T12:41:07.687Z","status":"ssl_error","status_checked_at":"2026-03-10T12:41:06.728Z","response_time":106,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aviation","chatbot","llm","streamlit"],"created_at":"2025-11-29T14:04:26.491Z","updated_at":"2026-03-10T14:04:38.323Z","avatar_url":"https://github.com/mjennings061.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VGS Chatbot\n\nA Streamlit application that lets RAF 2FTS instructors explore Viking training material through a knowledge-graph assisted RAG pipeline. Admins can upload documents, the chatbot cites its answers, and MongoDB Atlas stores the full corpus.\n\n## Features\n\n- Streamlit login and registration backed by `chatbot.users` with hashed passwords.\n- Document ingestion for PDF and DOCX files with progress reporting; sources live in GridFS.\n- Automatic section detection, ~900 character chunking, and FastEmbed embeddings.\n- Lightweight knowledge graph that links keyphrases to chunk candidates.\n- Retrieval that fuses Atlas Vector Search, Atlas Search (BM25), and graph priors before answering.\n- Optional OpenAI `gpt-4o-mini` generation with an extractive fallback when the API key is absent.\n\n## Prerequisites\n\n- Python 3.13\n- MongoDB Atlas cluster with Search and Vector Search enabled\n\n## Setup\n\nCreate and activate a virtual environment, install dependencies, and prepare env vars.\n\nmacOS/Linux\n\n```bash\npython3 -m venv .venv\nsource .venv/bin/activate\npip install -r requirements.txt\ncp .env.example .env\n```\n\nWindows (PowerShell)\n\n```powershell\npython -m venv .venv\n.venv\\Scripts\\Activate.ps1\npip install -r requirements.txt\nCopy-Item .env.example .env\n```\n\nEdit `.streamlit/secrets.toml` (or `.env`) with:\n\n- `MONGO_URI` – full Atlas connection string (for example `mongodb+srv://user:pass@cluster0.example.mongodb.net/?retryWrites=true\u0026w=majority\u0026appName=vgs-chatbot`)\n- `OPENAI_API_KEY` – optional; enables generative answers instead of the extractive fallback\n- `LOG_LEVEL` – optional; adjusts app logging (`INFO` by default)\n\n## Prepare MongoDB Atlas\n\nCreate a database (for example `vgs`) and let the app create the collections on first use:\n\n- `documents` – metadata for each uploaded file\n- `doc_chunks` – embedded text chunks with section and page references\n- `kg_nodes` / `kg_edges` – knowledge graph nodes and associations\n- GridFS buckets `fs.files` / `fs.chunks` – original documents\n\nConfigure the indexes before querying:\n\nVector Search (`doc_chunks`, name `vgs_vector`)\n\n```json\n{\n  \"name\": \"vgs_vector\",\n  \"type\": \"vectorSearch\",\n  \"definition\": {\n    \"fields\": [\n      { \"type\": \"vector\", \"path\": \"embedding\", \"numDimensions\": 384, \"similarity\": \"cosine\" },\n      { \"type\": \"filter\", \"path\": \"_id\" },\n      { \"type\": \"filter\", \"path\": \"doc_id\" },\n      { \"type\": \"filter\", \"path\": \"section_id\" },\n      { \"type\": \"filter\", \"path\": \"page_start\" }\n    ]\n  }\n}\n```\n\nAtlas Search (`doc_chunks`, name `vgs_text`)\n\n```json\n{\n  \"name\": \"vgs_text\",\n  \"mappings\": {\n    \"dynamic\": false,\n    \"fields\": {\n      \"text\": { \"type\": \"string\" },\n      \"section_title\": { \"type\": \"string\" },\n      \"doc_title\": { \"type\": \"string\" }\n    }\n  }\n}\n```\n\n## Running the app\n\n```bash\nstreamlit run streamlit_app.py\n```\n\n1. Open the displayed local URL, register with an eligible email, or sign in with an existing account.\n2. Use the sidebar to open **Chat** or **Admin**.\n\n### Admin workflow\n\n- Upload a PDF or DOCX file and trigger **Ingest document** to push it to GridFS, create chunks, embed them, and update the knowledge graph.\n- The **Library** section lists stored documents with chunk counts and lets you delete an item (removing GridFS blobs, metadata, and related chunks).\n- Progress bars report ingestion stages, and errors surface friendly messages.\n\n### Chat workflow\n\n- Ask a question such as “What are the canopy checks before launch?”.\n- Retrieval expands the query to graph-linked chunks, runs Vector Search and text search, fuses the scores, and shows cited answers (`Document · Section · Page`).\n- When `OPENAI_API_KEY` is unset, responses fall back to the highest scoring chunk extract.\n\n## Development notes\n\n- Optional: use tools like Ruff, isort, and pre-commit locally if you wish.\n\n### Enable OpenAI (optional)\n\nBy default, the app runs without an LLM and falls back to extractive answers. To enable OpenAI responses:\n\n- Install the SDK: `pip install openai` (or add it to `requirements.txt`).\n- Set `OPENAI_API_KEY` in `.env`.\n\n## Security notes\n\n- Demo credentials are intentionally low-privilege. Restrict them to the chatbot database and rotate them frequently.\n- Do not reuse production secrets in `.env`. Use Atlas network rules to limit inbound connections.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmjennings061%2Fvgs-chatbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmjennings061%2Fvgs-chatbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmjennings061%2Fvgs-chatbot/lists"}