diff --git a/.github/workflows/close-issue.yml b/.github/workflows/close-issue.yml new file mode 100644 index 0000000..d5cd3cf --- /dev/null +++ b/.github/workflows/close-issue.yml @@ -0,0 +1,22 @@ +name: Close inactive issues +on: + schedule: + - cron: "30 1 * * *" + +jobs: + close-issues: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/stale@v5 + with: + days-before-issue-stale: 30 + days-before-issue-close: 14 + stale-issue-label: "stale" + stale-issue-message: "This issue is stale because it has been open for 30 days with no activity." + close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale." + days-before-pr-stale: -1 + days-before-pr-close: -1 + repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index a7ef90f..f5bd3e4 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,6 @@ logs .idea/ __pycache__/ /knowledge_base/ -configs/*.py +/configs/*.py .vscode/ .pytest_cache/ diff --git a/README.md b/README.md index 1090ac9..453a491 100644 --- a/README.md +++ b/README.md @@ -485,6 +485,6 @@ $ streamlit run webui.py --server.port 666 ## 项目交流群 -二维码 +二维码 🎉 langchain-ChatGLM 项目微信交流群,如果你也对本项目感兴趣,欢迎加入群聊参与讨论交流。 diff --git a/document_loaders/mypdfloader.py b/document_loaders/mypdfloader.py index 71e063d..a3153a8 100644 --- a/document_loaders/mypdfloader.py +++ b/document_loaders/mypdfloader.py @@ -5,7 +5,7 @@ from langchain.document_loaders.unstructured import UnstructuredFileLoader class RapidOCRPDFLoader(UnstructuredFileLoader): def _get_elements(self) -> List: def pdf2text(filepath): - import fitz + import fitz # pyMuPDF里面的fitz包,不要与pip install fitz混淆 from rapidocr_onnxruntime import RapidOCR import numpy as np ocr = RapidOCR() diff --git a/img/qr_code_60.jpg b/img/qr_code_60.jpg new file mode 100644 index 0000000..0188834 Binary files /dev/null and b/img/qr_code_60.jpg differ diff --git a/server/knowledge_base/utils.py b/server/knowledge_base/utils.py index a8a9bcc..fe7fce1 100644 --- a/server/knowledge_base/utils.py +++ b/server/knowledge_base/utils.py @@ -91,8 +91,8 @@ LOADER_DICT = {"UnstructuredHTMLLoader": ['.html'], "RapidOCRLoader": ['.png', '.jpg', '.jpeg', '.bmp'], "UnstructuredFileLoader": ['.eml', '.msg', '.rst', '.rtf', '.txt', '.xml', - '.doc', '.docx', '.epub', '.odt', - '.ppt', '.pptx', '.tsv'], # '.xlsx' + '.docx', '.epub', '.odt', + '.ppt', '.pptx', '.tsv'], } SUPPORTED_EXTS = [ext for sublist in LOADER_DICT.values() for ext in sublist] diff --git a/webui_pages/dialogue/dialogue.py b/webui_pages/dialogue/dialogue.py index 25b885b..afefe32 100644 --- a/webui_pages/dialogue/dialogue.py +++ b/webui_pages/dialogue/dialogue.py @@ -153,9 +153,10 @@ def dialogue_page(api: ApiRequest): for d in api.knowledge_base_chat(prompt, selected_kb, kb_top_k, score_threshold, history, model=llm_model): if error_msg := check_error_msg(d): # check whether error occured st.error(error_msg) - text += d["answer"] - chat_box.update_msg(text, 0) - chat_box.update_msg("\n\n".join(d["docs"]), 1, streaming=False) + else: + text += d["answer"] + chat_box.update_msg(text, 0) + chat_box.update_msg("\n\n".join(d["docs"]), 1, streaming=False) chat_box.update_msg(text, 0, streaming=False) elif dialogue_mode == "搜索引擎问答": chat_box.ai_say([