Skip to content

synchronous#133

Merged
CJBshuosi merged 108 commits into
dev_liufrom
master
Feb 19, 2026
Merged

synchronous#133
CJBshuosi merged 108 commits into
dev_liufrom
master

Conversation

@CJBshuosi

Copy link
Copy Markdown
Collaborator

No description provided.

…ion, unified search, enrichment pipeline

P0 — Identity Unification:
- Add paper_identifiers table (Alembic 0009) + PaperIdentifierModel
- Add PaperIdentity value object, IdentityStore CRUD, IdentityResolver service
- Dual-write canonical_paper_id on paper_feedback + paper_identifiers on paper upsert
- Feature-flagged single-FK JOIN path for get_user_library (PAPERBOT_USE_CANONICAL_FK)
- Backfill script (scripts/backfill_identifiers.py)

P1 — Unified PaperSearchService:
- SearchPort protocol + 5 adapters (S2, arXiv, papers.cool, HF Daily, OpenAlex)
- PaperSearchService facade with concurrent fan-out, dedup, optional persistence
- ContextEngine refactored to prefer PaperSearchService with legacy fallback
- RegistryPort, FeedbackPort, EnrichmentPort protocol interfaces

P2 — Enrichment Pipeline:
- EnrichmentPipeline (Chain of Responsibility) for judge/summary/repo steps

Domain:
- PaperCandidate (normalized ACL output), FeedbackAction, JudgeScore, LLMSummary, ResearchTrack

Fix: remove PaperModel.external_url reference in _resolve_paper_ref_id (column doesn't exist)
Feat(core): DDD + Hexagonal Architecture — 身份统一 + 统一搜索 + Enrichment Pipeline
jerry609 and others added 25 commits February 13, 2026 15:23
- Migration 0011: use boolean defaults (true/false) instead of integer (1/0)
- Migration 0012: dialect-aware randomblob → md5(random()::text) for Postgres
- Disable psycopg prepared statements (prepare_threshold=0) for PgBouncer
Closes #114

Signed-off-by: LIU BOYU <oor2020@163.com>
Closes #114

Signed-off-by: LIU BOYU <oor2020@163.com>
feat(Research): Rebuild -- Research page, Papers library and dashboard
Closes #116

Signed-off-by: LIU BOYU <oor2020@163.com>
feat(Harvest): Implement the function to obtain anchor author
* feat(search): add RRF fusion for multi-source retrieval

Closes #118

* feat(search): wire personalized mode and anchor boosts

Closes #119

* feat(search): feedback-driven adaptive source weights for RRF

Learn per-source RRF weights from user feedback (save/like/dislike)
using Beta-style smoothing. Wires learned weights into search pipeline
when personalized mode is active.

Closes #120

* feat(search): add date range filters to research search

Add year_from/year_to params to context API and wire through to
search pipeline. Frontend gets two compact number inputs in the
search toolbar.

Closes #121

* fix(search): year filter in dedup loop + venue NOT NULL persist failure

- Add post-search year range filtering in the dedup/filter loop so
  papers outside year_from..year_to are excluded regardless of adapter
- Default venue to empty string instead of None to satisfy NOT NULL
  constraint from migration 0003

* chore(mcp): add playwright server and polish year filter UI

* fix(search): avoid interactive search stalls from author sync lock retries

Closes #123
@vercel

vercel Bot commented Feb 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
paper-bot Ready Ready Preview, Comment Feb 19, 2026 10:01pm

@coderabbitai

coderabbitai Bot commented Feb 19, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch master

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@CJBshuosi
CJBshuosi merged commit e30ef63 into dev_liu Feb 19, 2026
5 checks passed
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @CJBshuosi, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces significant architectural and feature enhancements across the application. It establishes a robust foundation for managing LLM model endpoints, tracking usage, and supporting long-running pipeline sessions with resume capabilities. Key new features include a comprehensive anchor author system for personalized recommendations, structured paper card extraction, and related work generation. The data layer has been extensively upgraded with new tables and migrations for improved paper identity resolution, author management, and repository enrichment. The core search and daily paper workflows have been refactored to leverage a new unified PaperSearchService and EnrichmentPipeline, improving modularity and extensibility. Additionally, new import/export options for research papers (BibTeX, Zotero) and a conference deadline tracker have been integrated, along with updated documentation for deployment and development workflows.

Highlights

  • Unified Agent Runtime and SSE Envelope: Introduced a standardized AgentRuntime contract and LegacyMethodRuntime adapter, along with an enhanced SSE wrap_generator that provides a normalized event envelope for consistent observability across workflows.
  • LLM Model Provider Management: Added a new API and database schema (model_endpoints, llm_usage) for managing multiple LLM providers, their API keys (with Keychain support), models, and tracking usage metrics.
  • Enhanced Paper Search and Enrichment Pipeline: Refactored core search and daily paper workflows to leverage a new PaperSearchService for unified search across multiple sources and an EnrichmentPipeline for modular paper processing (LLM analysis, judging, filtering).
  • Anchor Author System: Implemented a comprehensive anchor author system with new database tables (authors, paper_authors, user_anchor_scores, user_anchor_actions), personalized scoring, and API endpoints for discovery and actions.
  • Paper Identity Resolution and Repository Enrichment: Introduced paper_identifiers table and IdentityResolver service for robust paper deduplication and linking. Added paper_repos table and asynchronous enrichment for GitHub repository metadata.
  • Research Paper Management Features: Added new functionalities including BibTeX and Zotero import/export, paper collections, structured paper card extraction via LLM, and related work draft generation.
  • Workflow Session Management: Implemented pipeline_sessions to support long-running workflows with checkpointing, resume capabilities, and manual approval steps.
  • Updated Documentation and Development Tools: Significantly updated README.md with new features and architecture, added detailed deployment guides (Vercel/Supabase), a long-running harness for development, and comprehensive documentation for new systems.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • .mcp.json
    • Added configuration for drawio and playwright MCP servers.
  • README.md
    • Updated feature list, architecture diagrams, module maturity table, API endpoints, and installation/deployment instructions.
  • alembic/env.py
    • Modified database connection arguments to support PostgreSQL psycopg driver.
  • alembic/versions/0007_paper_harvest_tables.py
    • Updated index creation logic to ensure column existence.
  • alembic/versions/0008_paper_repos.py
    • Added a new migration to create the paper_repos table.
  • alembic/versions/0009_paper_identifiers.py
    • Added a new migration to create paper_identifiers table and canonical_paper_id column.
  • alembic/versions/0010_contract_feedback_fk.py
    • Added a new migration to backfill canonical_paper_id and optimize feedback indexes.
  • alembic/versions/0011_model_endpoints.py
    • Added a new migration to create the model_endpoints table.
  • alembic/versions/0012_reconcile_papers_schema.py
    • Added a new migration to reconcile the papers table schema.
  • alembic/versions/0013_model_endpoint_api_key.py
    • Added a new migration to add api_key_value column to model_endpoints.
  • alembic/versions/0014_llm_usage.py
    • Added a new migration to create the llm_usage table.
  • alembic/versions/0015_pipeline_sessions.py
    • Added a new migration to create the pipeline_sessions table.
  • alembic/versions/0016_anchor_author_schema.py
    • Added a new migration to create authors and paper_authors tables.
  • alembic/versions/0016_structured_card.py
    • Added a new migration to add structured_card_json column to papers table.
  • alembic/versions/0017_user_anchor_scores.py
    • Added a new migration to create the user_anchor_scores table.
  • alembic/versions/0018_user_anchor_actions.py
    • Added a new migration to create the user_anchor_actions table.
  • alembic/versions/4c71b28a2f67_merge_structured_card_and_anchor_author_.py
    • Added a new migration to merge structured card and anchor author branches.
  • docs/ANCHOR_TODO.md
    • Added a new document outlining anchor author system development tasks.
  • docs/DEPLOY_VERCEL_SUPABASE.md
    • Added a new deployment guide for Vercel and Supabase.
  • docs/HARNESS.md
    • Added a new document defining the long-running harness workflow.
  • docs/PROJECT_ISSUE_BACKLOG.md
    • Updated delivery rules and issue entries.
  • docs/RESEARCHRABBIT_INTEGRATION.md
    • Added a new document detailing ResearchRabbit-style integration.
  • docs/ROADMAP_TODO.md
    • Updated roadmap with completed items and new phases.
  • docs/agent_inventory.md
    • Added a new document inventorying agents and defining boundaries.
  • docs/anchor_author_implementation.md
    • Added a new document detailing anchor author system implementation.
  • docs/issue_contract.json
    • Added a new JSON file for issue contracts.
  • docs/paperbot-workflow.drawio
    • Added a new Draw.io diagram for workflow visualization.
  • docs/progress/progress.txt
    • Added a new progress log for session handoff.
  • docs/workflow-overview.md
    • Added a new document summarizing workflow and design principles.
  • env.example
    • Updated environment variables for database and client.
  • pyproject.toml
    • Added cryptography and keyring dependencies.
  • requirements.txt
    • Added psycopg[binary] dependency.
  • scripts/backfill_identifiers.py
    • Added a new script to backfill paper identifiers.
  • scripts/backfill_paper_authors.py
    • Added a new script to backfill paper authors.
  • scripts/recompute_anchor_scores.py
    • Added a new script to recompute anchor author scores.
  • scripts/session_bootstrap.sh
    • Added a new script for session bootstrapping.
  • scripts/validate_anchor_author_mvp.py
    • Added a new script to validate anchor author MVP.
  • src/paperbot/api/main.py
    • Included the model_endpoints router.
  • src/paperbot/api/routes/init.py
    • Added model_endpoints to the list of exported routes.
  • src/paperbot/api/routes/analyze.py
    • Refactored analysis streaming to use the AgentRuntime contract.
  • src/paperbot/api/routes/chat.py
    • Modified chat streaming to include workflow context.
  • src/paperbot/api/routes/gen_code.py
    • Refactored code generation streaming to use AgentRunContext and LegacyMethodRuntime.
  • src/paperbot/api/routes/harvest.py
    • Modified harvest streaming to include workflow context.
  • src/paperbot/api/routes/model_endpoints.py
    • Added a new API route for managing LLM model endpoints.
  • src/paperbot/api/routes/paperscool.py
    • Refactored daily paper and analysis workflows to use new services and pipeline session management.
  • src/paperbot/api/routes/research.py
    • Added new API endpoints for various research features including collections, exports, and anchor authors.
  • src/paperbot/api/routes/review.py
    • Refactored review streaming to use the AgentRuntime contract.
  • src/paperbot/api/routes/sandbox.py
    • Modified sandbox log and metric streaming to include workflow context.
  • src/paperbot/api/routes/track.py
    • Modified track streaming to include workflow context.
  • src/paperbot/api/streaming.py
    • Enhanced SSE wrap_generator with a normalized event envelope.
  • src/paperbot/application/ports/init.py
    • Added new port interfaces for event logging, harvester, and source collection.
  • src/paperbot/application/ports/enrichment_port.py
    • Added a new protocol for paper enrichment.
  • src/paperbot/application/ports/feedback_port.py
    • Added a new protocol for paper feedback.
  • src/paperbot/application/ports/paper_registry_port.py
    • Added a new protocol for paper registry.
  • src/paperbot/application/ports/paper_search_port.py
    • Added a new protocol for paper search.
  • src/paperbot/application/ports/source_collector.py
    • Added new dataclasses and protocol for source collection.
  • src/paperbot/application/prompts/paper_analysis.py
    • Added new prompts for structured card and related work.
  • src/paperbot/application/prompts/registry.py
    • Added new prompt templates for structured card and related work.
  • src/paperbot/application/services/anchor_service.py
    • Added a new service for discovering and scoring anchor authors.
  • src/paperbot/application/services/author_backfill_service.py
    • Added a new service for backfilling author data.
  • src/paperbot/application/services/enrichment_pipeline.py
    • Added a new pipeline for paper enrichment with various steps.
  • src/paperbot/application/services/identity_resolver.py
    • Added a new service for resolving paper identities.
  • src/paperbot/application/services/llm_service.py
    • Modified to use ProviderResolver and LLMUsageStore, and added structured card/related work generation.
  • src/paperbot/application/services/paper_search_service.py
    • Added a new service for unified paper search.
  • src/paperbot/application/services/provider_resolver.py
    • Added new protocols for provider resolution.
  • src/paperbot/application/workflows/analysis/judge_prompts.py
    • Modified judge prompt to include evidence quotes.
  • src/paperbot/application/workflows/analysis/paper_judge.py
    • Modified PaperJudgment to include evidence_quotes and added a parsing method.
  • src/paperbot/application/workflows/harvest_pipeline.py
    • Refactored harvest pipeline to use PaperSearchService.
  • src/paperbot/application/workflows/paperscool_topic_search.py
    • Removed.
  • src/paperbot/application/workflows/unified_topic_search.py
    • Added a new workflow for unified topic search.
  • src/paperbot/context_engine/engine.py
    • Enhanced context engine with query expansion, paper filtering, and integration with new services.
  • src/paperbot/core/abstractions/init.py
    • Added new agent runtime abstractions.
  • src/paperbot/core/abstractions/agent_runtime.py
    • Added new classes for agent runtime contracts.
  • src/paperbot/domain/enrichment.py
    • Added new dataclasses for judge scores and LLM summaries.
  • src/paperbot/domain/feedback.py
    • Added new enum and dataclass for paper feedback.
  • src/paperbot/domain/identity.py
    • Added a new dataclass for paper identity.
  • src/paperbot/domain/paper.py
    • Modified PaperMeta and added PaperCandidate dataclass.
  • src/paperbot/domain/track.py
    • Added a new dataclass for research track.
  • src/paperbot/infrastructure/adapters/init.py
    • Added a new function to build adapter registry.
  • src/paperbot/infrastructure/adapters/arxiv_search_adapter.py
    • Added a new adapter for arXiv search.
  • src/paperbot/infrastructure/adapters/hf_daily_adapter.py
    • Added a new adapter for Hugging Face Daily Papers.
  • src/paperbot/infrastructure/adapters/openalex_adapter.py
    • Added a new adapter for OpenAlex.
  • src/paperbot/infrastructure/adapters/paperscool_adapter.py
    • Added a new adapter for papers.cool.
  • src/paperbot/infrastructure/adapters/s2_search_adapter.py
    • Added a new adapter for Semantic Scholar search.
  • src/paperbot/infrastructure/api_clients/base.py
    • Enhanced GET requests with exponential backoff and jitter for retries.
  • src/paperbot/infrastructure/api_clients/semantic_scholar.py
    • Added search_authors method and updated get method calls.
  • src/paperbot/infrastructure/connectors/openalex_connector.py
    • Added a new connector for OpenAlex.
  • src/paperbot/infrastructure/connectors/zotero_connector.py
    • Added a new connector for Zotero.
  • src/paperbot/infrastructure/harvesters/semantic_scholar_harvester.py
    • Modified close method to await client close.
  • src/paperbot/infrastructure/llm/router.py
    • Modified ModelConfig and from_env to support model registry and API keys.
  • src/paperbot/infrastructure/queue/arq_worker.py
    • Modified daily papers job to use unified topic search.
  • src/paperbot/infrastructure/services/subscription_service.py
    • Added methods for managing scholar subscriptions.
  • src/paperbot/infrastructure/stores/author_store.py
    • Added a new store for author and paper-author data.
  • src/paperbot/infrastructure/stores/identity_store.py
    • Added a new store for paper identifiers.
  • src/paperbot/infrastructure/stores/keychain.py
    • Added a new module for Keychain-backed secret storage.
  • src/paperbot/infrastructure/stores/llm_usage_store.py
    • Added a new store for LLM usage tracking.
  • src/paperbot/infrastructure/stores/model_endpoint_store.py
    • Added a new store for model endpoints.
  • src/paperbot/infrastructure/stores/models.py
    • Added new models for workflow metrics, collections, authors, anchor scores, actions, paper authors, identifiers, model endpoints, LLM usage, and pipeline sessions.
  • src/paperbot/infrastructure/stores/paper_store.py
    • Refactored paper upsert logic, added identifier syncing, and structured card updates.
  • src/paperbot/infrastructure/stores/pipeline_session_store.py
    • Added a new store for pipeline session checkpoints.
  • src/paperbot/infrastructure/stores/research_store.py
    • Added new methods for collections, track feed, repo enrichment, and paper detail.
  • src/paperbot/infrastructure/stores/sqlalchemy_db.py
    • Modified database engine creation for PostgreSQL.
  • src/paperbot/infrastructure/stores/workflow_metric_store.py
    • Added a new store for workflow quality metrics.
  • src/paperbot/presentation/cli/main.py
    • Modified CLI commands to use unified topic search and pipeline session management.
  • src/paperbot/utils/search.py
    • Removed.
  • src/paperbot/utils/secret.py
    • Added a new module for symmetric encryption.
  • tests/test_framework.py
    • Removed search module tests.
  • tests/unit/test_agent_runtime_contract.py
    • Added new tests for agent runtime contract.
  • tests/unit/test_analyze_review_runtime_routes.py
    • Added new tests for analyze and review API routes using runtime contracts.
  • tests/unit/test_anchor_action_routes.py
    • Added new tests for anchor action routes.
  • tests/unit/test_anchor_discover_route.py
    • Added new tests for anchor discover route.
  • tests/unit/test_anchor_service.py
    • Added new tests for anchor service.
  • tests/unit/test_arq_daily_papers.py
    • Modified daily papers job test to use unified topic search.
  • tests/unit/test_author_backfill_service.py
    • Added new tests for author backfill service.
  • tests/unit/test_author_store.py
    • Added new tests for author store.
  • tests/unit/test_connection_test_endpoint.py
    • Added new tests for connection test endpoint.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/ci.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

这是一个重大的拉取请求,引入了显著的架构改进和一系列新功能。这些变更标志着系统向更健壮、可配置和功能丰富的方向迈出了重要一步。主要改进包括:

  • 重大的数据库模式重构,通过一系列结构良好的 Alembic 迁移增加了作者、论文标识符、模型端点和用量跟踪等新表。
  • 通过集成 keyring 增强了密钥管理的安全性。
  • 通过实现带指数退避的重试逻辑,提高了 API 客户端的稳健性。
  • 通过标准化的 SSE 信封,改善了流式响应的可观察性和客户端处理能力。
  • 重构了核心工作流,如搜索和日报生成流程,使其更加模块化和可扩展。

总体方向非常出色。我有一些建议可以进一步提高代码的可维护性和稳健性。

Comment on lines +22 to +50
def _is_offline() -> bool:
try:
return bool(context.is_offline_mode())
except Exception:
return False


def _insp():
return sa.inspect(op.get_bind())


def _has_table(name: str) -> bool:
return _insp().has_table(name)


def _get_indexes(table: str) -> set[str]:
idx = set()
for i in _insp().get_indexes(table):
idx.add(str(i.get("name") or ""))
return idx


def _create_index(name: str, table: str, cols: list[str]) -> None:
if _is_offline():
op.create_index(name, table, cols)
return
if name in _get_indexes(table):
return
op.create_index(name, table, cols)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

这些辅助函数(如 _is_offline, _insp, _has_table 等)在多个新的迁移文件中被重复定义(例如 0009_*, 0010_* 等)。为了提高代码的可维护性并遵循 DRY (Don't Repeat Yourself) 原则,建议将这些通用的辅助函数提取到一个共享的工具模块中,例如 alembic/utils.py,然后由各个迁移文件导入使用。

Comment on lines +67 to +124
_DEADLINE_RADAR_DATA: List[Dict[str, Any]] = [
{
"name": "KDD 2026",
"ccf_level": "A",
"field": "Data Mining",
"deadline": "2026-03-05T23:59:59+00:00",
"url": "https://kdd.org/kdd2026/",
"keywords": ["data mining", "recommendation", "graph mining"],
},
{
"name": "ACL 2026",
"ccf_level": "A",
"field": "NLP",
"deadline": "2026-03-15T23:59:59+00:00",
"url": "https://2026.aclweb.org/",
"keywords": ["nlp", "llm", "language model", "retrieval"],
},
{
"name": "CVPR 2026",
"ccf_level": "A",
"field": "Computer Vision",
"deadline": "2026-03-20T23:59:59+00:00",
"url": "https://cvpr.thecvf.com/",
"keywords": ["computer vision", "diffusion", "multimodal"],
},
{
"name": "USENIX Security 2026",
"ccf_level": "A",
"field": "Security",
"deadline": "2026-03-28T23:59:59+00:00",
"url": "https://www.usenix.org/conference/usenixsecurity26",
"keywords": ["security", "privacy", "llm safety"],
},
{
"name": "EMNLP 2026",
"ccf_level": "B",
"field": "NLP",
"deadline": "2026-05-10T23:59:59+00:00",
"url": "https://2026.emnlp.org/",
"keywords": ["nlp", "alignment", "reasoning"],
},
{
"name": "NeurIPS 2026",
"ccf_level": "A",
"field": "Machine Learning",
"deadline": "2026-05-15T23:59:59+00:00",
"url": "https://neurips.cc/",
"keywords": ["machine learning", "llm", "optimization"],
},
{
"name": "AAAI 2027",
"ccf_level": "A",
"field": "Artificial Intelligence",
"deadline": "2026-08-10T23:59:59+00:00",
"url": "https://aaai.org/conference/aaai/",
"keywords": ["ai", "agent", "reasoning"],
},
]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

会议截止日期数据 _DEADLINE_RADAR_DATA 被硬编码在代码中。这种方式使得更新和维护数据变得困难,每次变更都需要修改代码并重新部署。为了提高灵活性和可维护性,建议将这些数据迁移到配置文件(如 YAML 或 JSON)或数据库表中。这样可以更方便地更新会议信息,而无需改动代码。

Comment on lines +390 to +395
paper_query_map: Dict[int, str] = {}
for query in report.get("queries") or []:
query_name = query.get("normalized_query") or query.get("raw_query") or ""
for item in query.get("top_items") or []:
query_items.append(item)
paper_query_map[id(item)] = query_name

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

在这里使用 id(item) 作为字典 paper_query_map 的键存在潜在风险。id() 返回的是对象的内存地址,它只在对象的生命周期内是唯一的。如果 item 字典在其他地方被复制或重新创建,它的 ID 将会改变,这可能导致映射关系失效。虽然在当前函数作用域内可能安全,但这是一种脆弱的实现方式。建议使用一个从论文数据本身派生的、稳定且唯一的标识符作为键,例如论文的 URL 或由 (source, paper_id) 组成的复合键。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants