Skip to content

refactor: update process_pending_tasks to accept database type and ad… - #1

Open
Rjiegit wants to merge 1 commit into
masterfrom
feature/20250907-select-database
Open

refactor: update process_pending_tasks to accept database type and ad…#1
Rjiegit wants to merge 1 commit into
masterfrom
feature/20250907-select-database

Conversation

@Rjiegit

@Rjiegit Rjiegit commented Sep 7, 2025

Copy link
Copy Markdown
Owner

…just streamlit_app to use selected database

@Rjiegit
Rjiegit requested a review from Copilot September 7, 2025 09:43

Copilot AI 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.

Pull Request Overview

该 PR 重构了 process_pending_tasks 函数,使其能够接受数据库类型参数,并调整了 streamlit 应用使用选定的数据库。

  • 更新 process_pending_tasks 函数以接受可选的数据库类型参数
  • 修改 streamlit 应用以传递用户选择的数据库类型到处理函数
  • 简化 UI,移除重复的数据库选择器,统一使用顶部选择器

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
processing.py 重构 process_pending_tasks 函数以接受可选的数据库类型参数
streamlit_app.py 修改应用以使用统一的数据库选择器并传递选择到处理函数

Comment thread processing.py
If db_type is provided, it will be used to select the database; otherwise,
the environment variable DB_TYPE (default sqlite) is used.
"""
db = DBFactory.get_db(db_type) if db_type else get_db_client()

Copilot AI Sep 7, 2025

Copy link

Choose a reason for hiding this comment

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

建议导入 DBFactory。从上下文看,这里直接使用了 DBFactory.get_db(),但在文件顶部应该确保正确导入了 DBFactory 模块。

Copilot generated this review using guidance from repository custom instructions.
Comment thread streamlit_app.py
# This block will execute when the state is True after a rerun
if st.session_state.processing_tasks:
# Use the top selector's current choice from session state
selected_db = st.session_state.get("add_db", "SQLite")

Copilot AI Sep 7, 2025

Copy link

Choose a reason for hiding this comment

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

硬编码的默认值 'SQLite' 在多处使用。建议将其定义为常量,例如 DEFAULT_DB_TYPE = 'SQLite',以提高代码的可维护性。

Copilot uses AI. Check for mistakes.
Comment thread streamlit_app.py
"Select Database to View", ["SQLite", "Notion"], key="view_db"
)
# Use the top selectbox choice for viewing as well to avoid duplicate selectors
db_choice_view = st.session_state.get("add_db", "SQLite")

Copilot AI Sep 7, 2025

Copy link

Choose a reason for hiding this comment

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

与上面的评论相同,这里也使用了硬编码的 'SQLite' 默认值。应该使用统一的常量。

Copilot uses AI. Check for mistakes.
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