Commit ·
f62b4e3
1
Parent(s): 25f1028
load all faq
Browse filesFiles changed (5)
- .gitignoreAdded+129
- PipfileAdded+13
- app.pyAdded+10
- pages/chat_page.pyAdded+16
- pages/faq_page.pyAdded+33
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129# Byte-compiled / optimized / DLL files__pycache__/*.py[cod]*$py.class
# C extensions*.so
# Distribution / packaging.Pythonbuild/develop-eggs/dist/downloads/eggs/.eggs/lib/lib64/parts/sdist/var/wheels/pip-wheel-metadata/share/python-wheels/*.egg-info/.installed.cfg*.eggMANIFEST
# PyInstaller# Usually these files are written by a python script from a template# before PyInstaller builds the exe, so as to inject date/other infos into it.*.manifest*.spec
# Installer logspip-log.txtpip-delete-this-directory.txt
# Unit test / coverage reportshtmlcov/.tox/.nox/.coverage.coverage.*.cachenosetests.xmlcoverage.xml*.cover*.py,cover.hypothesis/.pytest_cache/
# Translations*.mo*.pot
# Django stuff:*.loglocal_settings.pydb.sqlite3db.sqlite3-journal
# Flask stuff:instance/.webassets-cache
# Scrapy stuff:.scrapy
# Sphinx documentationdocs/_build/
# PyBuildertarget/
# Jupyter Notebook.ipynb_checkpoints
# IPythonprofile_default/ipython_config.py
# pyenv.python-version
# pipenv# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.# However, in case of collaboration, if having platform-specific dependencies or dependencies# having no cross-platform support, pipenv may install dependencies that don't work, or not# install all needed dependencies.#Pipfile.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow__pypackages__/
# Celery stuffcelerybeat-schedulecelerybeat.pid
# SageMath parsed files*.sage.py
# Environments.env.venvenv/venv/ENV/env.bak/venv.bak/
# Spyder project settings.spyderproject.spyproject
# Rope project settings.ropeproject
# mkdocs documentation/site
# mypy.mypy_cache/.dmypy.jsondmypy.json
# Pyre type checker.pyre/12345678910111213[[source]]url = "https://pypi.org/simple"verify_ssl = truename = "pypi"
[packages]streamlit = "*"pymongo = {extras = ["srv"], version = "*"}
[dev-packages]
[requires]python_version = "3.12"12345678910import streamlit as st
st.set_page_config(page_title="FAQ and Chat App")st.title("FAQ and Chat App")st.write("Welcome to the FAQ and Chat App! Navigate using the sidebar.")
(st.page_link("pages/faq_page.py", label="FAQ"))(st.page_link("pages/chat_page.py", label="Chat"))
12345678910111213141516import streamlit as st
st.title("Chat")
# Create a placeholder for the chat historychat_history = st.empty()
# Create a text input for the user's messageuser_message = st.text_input("Type your message here", "")
# Simulate a response from the chatbot (replace this with your RAG model later)if user_message: response = f"Response: {user_message.upper()}"
# Update the chat history placeholder chat_history.markdown(f"**User:** {user_message}\n\n**Bot:** {response}")123456789101112131415161718192021222324252627282930313233import streamlit as stimport pandas as pdfrom pymongo import MongoClient
#uri = "mongodb+srv://<username>:<password>@cluster0.firly.gcp.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0"db_user = "api-chat-faq" db_pass = 'WI231DhvwtTDQwBe'db_uri = f"mongodb+srv://{db_user}:{db_pass}@cluster0.firly.gcp.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0"# Connect to MongoDBclient = MongoClient(db_uri)db = client["chat_support"]faq_collection = db["faq"]
# Fetch FAQ data from MongoDBfaq_data = pd.DataFrame(list(faq_collection.find()))
st.title("Frequently Asked Questions")
# Search functionalitysearch_term = st.text_input("Search FAQs", "")if search_term: filtered_data = faq_data[faq_data['questions'].apply(lambda x: any(search_term.lower() in q.lower() for q in x))]else: filtered_data = faq_data
# Display the FAQ listfor _, row in filtered_data.iterrows(): with st.expander(row['title']): # st.write("**Questions:**") # for question in row['questions']: # st.write(f"- {question}") st.write(f"\n**Answer:**") st.write(row['answer']).gitignoreAdded+129
PipfileAdded+13
app.pyAdded+10
pages/chat_page.pyAdded+16
pages/faq_page.pyAdded+33