Skip to content

fix: 修复测试并应用代码格式化#2

Merged
HalfAnElephant merged 20 commits into
mainfrom
feat/p1-search-engine
Mar 31, 2026
Merged

fix: 修复测试并应用代码格式化#2
HalfAnElephant merged 20 commits into
mainfrom
feat/p1-search-engine

Conversation

@HalfAnElephant
Copy link
Copy Markdown
Owner

Summary

  • 修复 3 个测试失败(mock lambda 参数签名不匹配)
  • 应用代码格式化(ruff line-length=100)
  • 添加 uv.lock 确保依赖可复现

修复详情

问题test_writer.pytest_report_review_agent.py 中 mock _resolve_provider 的 lambda 无参数,但实际方法签名需要 provider 参数。

修复

# 之前
lambda: ("https://example.org", "key", "model")

# 之后
lambda provider=None: ("https://example.org", "key", "model")

Test plan

  • uv run pytest tests/ -v 全部通过(95 passed)
  • uv run ruff check backend/app/ 无错误
  • 前端 npm run build 成功

🤖 Generated with Claude Code

HalfAnElephant and others added 20 commits March 29, 2026 15:05
1. 全局改进:
   - 创建会话时新增AI确认消息
   - 新增设置模态框,支持选择LLM提供商
   - 新增 /api/v1/settings/llm 接口

2. DAG编辑器优化:
   - 节点视觉升级为玻璃拟态风格
   - 修复中文文字换行问题
   - 使用LLM生成结构化研究问题树,解决层级关系错乱问题

3. 新增服务:
   - ResearchPlanGenerator: 用LLM生成结构化研究问题
   - 重构MasterPlanner使用新生成器

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The _resolve_provider method accepts an optional provider parameter,
but the test mocks used lambda without parameters, causing TypeError.

Changed from:
  lambda: ("https://example.org", "key", "model")
To:
  lambda provider=None: ("https://example.org", "key", "model")

Fixes 3 failing tests in test_writer.py and test_report_review_agent.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Format long lines to comply with ruff line-length=100
- Add uv.lock for reproducible dependency resolution

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add complete styling for the settings modal including:
- Modal overlay with backdrop blur
- Slide-up animation on open
- LLM provider selection cards with hover/selected states
- Responsive layout and proper spacing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Backend:
- Add LLMConfigRepository for persistent API key storage
- Support task-type to provider mapping (draft/chat/article)
- Add API endpoints: GET/PUT /settings/llm/providers/{provider}
- Add API endpoints: GET/PUT /settings/llm/task-mapping
- API keys stored with base64 encoding, returned masked for display

Frontend:
- Redesign SettingsModal with modern tab-based UI
- Provider cards with edit form for API key configuration
- Task mapping section to assign providers per task type
- 348 lines of new CSS for polished UI

Features:
- Free API key configuration per provider
- Task-specific provider selection (draft/chat/article)
- Modern, responsive settings interface

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@HalfAnElephant HalfAnElephant merged commit 3cd6026 into main Mar 31, 2026
1 check passed
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.

1 participant