### What problem does this PR solve? _Briefly describe what this PR aims to solve. Include background context that will help reviewers understand the purpose of the PR._ Issue link:#[Link the issue here] ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) - [ ] New Feature (non-breaking change which adds functionality) - [ ] Breaking Change (fix or feature that could cause existing functionality not to work as expected) - [ ] Documentation Update - [ ] Refactoring - [ ] Performance Improvement - [ ] Test cases - [ ] Python SDK impacted, Need to update PyPI - [ ] Other (please describe):tags/v0.1.0
| tkweight=1 - dialog.vector_similarity_weight, | tkweight=1 - dialog.vector_similarity_weight, | ||||
| vtweight=dialog.vector_similarity_weight) | vtweight=dialog.vector_similarity_weight) | ||||
| idx = set([kbinfos["chunks"][int(i)]["doc_id"] for i in idx]) | idx = set([kbinfos["chunks"][int(i)]["doc_id"] for i in idx]) | ||||
| kbinfos["doc_aggs"] = [ | |||||
| recall_docs = [ | |||||
| d for d in kbinfos["doc_aggs"] if d["doc_id"] in idx] | d for d in kbinfos["doc_aggs"] if d["doc_id"] in idx] | ||||
| if not recall_docs: recall_docs = kbinfos["doc_aggs"] | |||||
| kbinfos["doc_aggs"] = recall_docs | |||||
| for c in kbinfos["chunks"]: | for c in kbinfos["chunks"]: | ||||
| if c.get("vector"): | if c.get("vector"): | ||||
| del c["vector"] | del c["vector"] |
| for llm in LLMService.query(fid=factory): | for llm in LLMService.query(fid=factory): | ||||
| if llm.model_type == LLMType.EMBEDDING.value: | if llm.model_type == LLMType.EMBEDDING.value: | ||||
| mdl = EmbeddingModel[factory]( | mdl = EmbeddingModel[factory]( | ||||
| req["api_key"], llm.llm_name, req.get("base_url")) | |||||
| req["api_key"], llm.llm_name, base_url=req.get("base_url")) | |||||
| try: | try: | ||||
| arr, tc = mdl.encode(["Test if the api key is available"]) | arr, tc = mdl.encode(["Test if the api key is available"]) | ||||
| if len(arr[0]) == 0 or tc == 0: | if len(arr[0]) == 0 or tc == 0: | ||||
| msg += f"\nFail to access embedding model({llm.llm_name}) using this api key." + str(e) | msg += f"\nFail to access embedding model({llm.llm_name}) using this api key." + str(e) | ||||
| elif not chat_passed and llm.model_type == LLMType.CHAT.value: | elif not chat_passed and llm.model_type == LLMType.CHAT.value: | ||||
| mdl = ChatModel[factory]( | mdl = ChatModel[factory]( | ||||
| req["api_key"], llm.llm_name, req.get("base_url")) | |||||
| req["api_key"], llm.llm_name, base_url=req.get("base_url")) | |||||
| try: | try: | ||||
| m, tc = mdl.chat(None, [{"role": "user", "content": "Hello! How are you doing!"}], { | m, tc = mdl.chat(None, [{"role": "user", "content": "Hello! How are you doing!"}], { | ||||
| "temperature": 0.9}) | "temperature": 0.9}) |
| if not objs: return fnm | if not objs: return fnm | ||||
| ext = pathlib.Path(fnm).suffix #.jpg | ext = pathlib.Path(fnm).suffix #.jpg | ||||
| nm = re.sub(r"%s$"%ext, "", fnm) | nm = re.sub(r"%s$"%ext, "", fnm) | ||||
| r = re.search(r"\([0-9]+\)$", nm) | |||||
| r = re.search(r"\(([0-9]+)\)$", nm) | |||||
| c = 0 | c = 0 | ||||
| if r: | if r: | ||||
| c = int(r.group(1)) | c = int(r.group(1)) |
| --- | |||||
| sidebar_position: 0 | |||||
| slug: /contribution_guidelines | |||||
| --- | |||||
| # Contribution Guidelines | |||||
| Thanks for wanting to contribute to RAGFlow. This document offers guidlines and major considerations for submitting your contributions. | |||||
| - To report a bug, file a [GitHub issue](https://github.com/infiniflow/ragflow/issues/new/choose) with us. | |||||
| - For further questions, you can explore existing discussions or initiate a new one in [Discussions](https://github.com/orgs/infiniflow/discussions). | |||||
| ## What you can contribute | |||||
| The list below mentions some contributions you can make, but it is not a complete list. | |||||
| - Proposing or implementing new features | |||||
| - Fixing a bug | |||||
| - Adding test cases or demos | |||||
| - Posting a blog or tutorial | |||||
| - Updates to existing documents, codes, or annotations. | |||||
| - Suggesting more user-friendly error codes | |||||
| ## File a pull request (PR) | |||||
| ### General workflow | |||||
| 1. Fork our GitHub repository. | |||||
| 2. Clone your fork to your local machine: | |||||
| `git clone git@github.com:<yourname>/ragflow.git` | |||||
| 3. Create a local branch: | |||||
| `git checkout -b my-branch` | |||||
| 4. Provide sufficient information in your commit message | |||||
| `git commit -m 'Provide sufficient info in your commit message'` | |||||
| 5. Commit changes to your local branch, and push to GitHub: (include necessary commit message) | |||||
| `git push origin my-branch.` | |||||
| 6. Submit a pull request for review. | |||||
| ### Before filing a PR | |||||
| - Consider splitting a large PR into multiple smaller, standalone PRs to keep a traceable development history. | |||||
| - Ensure that your PR addresses just one issue, or keep any unrelated changes small. | |||||
| - Add test cases when contributing new features. They demonstrate that your code functions correctly and protect against potential issues from future changes. | |||||
| ### Describing your PR | |||||
| - Ensure that your PR title is concise and clear, providing all the required information. | |||||
| - Refer to a corresponding GitHub issue in your PR description if applicable. | |||||
| - Include sufficient design details for *breaking changes* or *API changes* in your description. | |||||
| ### Reviewing & merging a PR | |||||
| - Ensure that your PR passes all Continuous Integration (CI) tests before merging it. |