petercat-ai / petercat

A conversational Q&A agent configuration system, self-hosted deployment solutions, and a convenient all-in-one application SDK, allowing you to create intelligent Q&A bots for your GitHub repositories
https://petercat.ai
MIT License
605 stars 17 forks source link

refactor: change the filter condition of the tool search_knowledge #434

Closed xingwanying closed 1 month ago

xingwanying commented 1 month ago
vercel[bot] commented 1 month ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
petercat ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 15, 2024 7:27am
petercat-assistant[bot] commented 1 month ago

Walkthrough

此PR通过将文档存储和知识查询的索引更改为repo_name,以避免不同机器人但相同仓库的重复存储导致的资源浪费。涉及的更改包括数据库类型定义、SQL函数、任务处理逻辑和API路由。

Changes

文件 概要
client/types/database.types.ts 更新了数据库类型定义,添加了match_embedding_docs类型,并调整了类型定义的语法。
migrations/supabase/migrations/20240911082857_remote_schema.sql 修改了SQL函数match_rag_docsmatch_embedding_docs,并更改了过滤条件。
petercat_utils/rag_helper/git_doc_task.py 重构了add_rag_git_doc_task函数和GitDocTask类的初始化逻辑。
petercat_utils/rag_helper/git_task.py 重构了GitTask类的初始化逻辑。
petercat_utils/rag_helper/retrieval.py 更新了查询逻辑,移除了对bot_id的依赖,增加了BotDAO的使用。
server/README.zh-CN.md 更新了文档,移除了bot_id相关内容。
server/core/models/bot.py Bot模型中添加了repo_name字段。
server/rag/router.py 修改了search_knowledge路由的参数,从bot_id改为repo_name
codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 43.47826% with 13 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
petercat_utils/rag_helper/git_doc_task.py 33.33% 4 Missing :warning:
petercat_utils/rag_helper/retrieval.py 42.85% 4 Missing :warning:
petercat_utils/rag_helper/git_task.py 40.00% 3 Missing :warning:
server/rag/router.py 50.00% 2 Missing :warning:
Files with missing lines Coverage Δ
server/core/models/bot.py 100.00% <100.00%> (ø)
server/rag/router.py 37.50% <50.00%> (ø)
petercat_utils/rag_helper/git_task.py 52.00% <40.00%> (ø)
petercat_utils/rag_helper/git_doc_task.py 24.59% <33.33%> (ø)
petercat_utils/rag_helper/retrieval.py 30.43% <42.85%> (+0.13%) :arrow_up:

... and 7 files with indirect coverage changes