chore: sync local code#137
Open
yzj-hsz wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
backend/core/rag.py的写入流程,避免索引刷新时因内部commit/rollback打断外层业务事务;对应在题目编辑、答案更新、作答更新和手动重建索引流程中显式处理提交与回滚backend/db/__init__.py中新增扩展预检查、向量列补建和 ivfflat 索引补建逻辑;在backend/db/models.py中为RagDocumentChunk增加embedding_vector字段,并通过自定义类型兼容 PostgreSQL 与 SQLitebackend/tests/test_db_init.py,覆盖vector扩展创建、缺失向量列自动补建、索引创建以及已存在列时跳过重复ALTER TABLE的场景RagDocumentChunk,删除项目时批量清理项目下题目的 RAG chunk,避免遗留脏索引数据POST /api/save-to-db现在要求明确传入并解析错题项目project_id,避免题目落入空项目;同时补充接口测试覆盖缺少项目和正常导入到指定项目的场景backend/core/model_selection.py中恢复对逗号分隔模型名的解析,避免旧数据格式影响模型选择逻辑backend/routes/chat.py中先校验会话是否存在,再解析模型选择,避免不存在会话时提前返回模型配置错误backend/src/workflow.py中 OCR 批次构建与去重逻辑、backend/src/utils.py中错题导出对question_id的兼容过滤和无分组标题层级处理,并补充对应测试说明与用例Test plan
backend/tests/test_db_init.py覆盖 PostgreSQL 初始化流程,可验证vector扩展、embedding_vector列和 ivfflat 索引的自动创建逻辑RagDocumentChunk,并在批次清空时一并删除空批次,backend/tests/test_migrate_and_delete_question.py已覆盖POST /api/save-to-db在缺少project_id时返回 400,传入有效项目时可正常导入并绑定到目标错题库,backend/tests/test_web_routes.py已覆盖backend/tests/test_workflow_helpers.py已覆盖backend/tests/test_chat_routes.py已同步更新POST /api/rag/reindex在真实 PostgreSQL / pgvector 环境下的整链路重建效果,仍建议补做一次联调验证question_id、无uid的历史数据场景下的 Markdown 结构展示,仍建议补做一次人工验收